2 require_once 'Pman/Roo.php';
4 class Pman_Xtuple_VoidSalesAndPurchaseOrders extends Pman_Roo
6 static $cli_desc = "Void ALL the Sales Orders / Vouchers / Purchase Orders - Make Sure you know what is going to do!!!";
8 static $cli_opts = array(
20 if (HTML_FlexyFramework::get()->cli) {
27 function get($v = '', $opts)
29 if(empty($opts['confirm']) || $opts['confirm'] !== 'I am sure to void all things'){
30 $this->jerr("If you know what is going to do, try -f 'I am sure to void all things'");
33 $this->transObj = DB_DataObject::Factory('cohead');
35 $this->transObj->query('BEGIN');
37 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
39 DB_DataObject::factory('cohead')->lockTables();
41 $cohead = DB_DataObject::factory('cohead');
47 while ($cohead->fetch()){
48 $co = clone ($cohead);
50 $this->log("Voiding Sales Order : {$co->cohead_number}");
56 $pohead = DB_DataObject::factory('pohead');
59 while ($pohead->fetch()){
60 $po = clone ($pohead);
62 $this->log("Voiding Purchase Order : {$po->pohead_number}");