VoidSalesAndPurchaseOrders.php
[Pman.Xtuple] / VoidSalesAndPurchaseOrders.php
1 <?php
2 require_once 'Pman/Roo.php';
3
4 class Pman_Xtuple_VoidSalesAndPurchaseOrders extends Pman_Roo
5 {   
6     static $cli_desc = "Void ALL the Sales Order / Voucher / Purchase Order";
7     
8     static $cli_opts = array(
9         'confirm' => array(
10             'desc' => 'Confirm',
11             'default' => '',
12             'short' => 'f',
13             'min' => 0,
14             'max' => 1,
15         )
16     );
17     
18     function getAuth()
19     {
20         if (HTML_FlexyFramework::get()->cli) {
21             return true;
22         }
23         
24         return false;
25     }
26    
27     function get($v = '', $opts)
28     {
29         print_r($opts);exit;
30         $this->jerr('die');exit;
31         $this->transObj = DB_DataObject::Factory('cohead');
32         
33         $this->transObj->query('BEGIN');
34         
35         PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
36         
37         DB_DataObject::factory('cohead')->lockTables();
38         
39         $cohead = DB_DataObject::factory('cohead');
40         $cohead->whereAdd("
41             cohead_status != 'X'
42         ");
43         $cohead->find();
44         
45         while ($cohead->fetch()){
46             $cohead->clear($this);
47         }
48         
49         
50         $pohead = DB_DataObject::factory('pohead');
51         $pohead->find();
52         
53         while ($pohead->fetch()){
54             $pohead->clear($this);
55         }
56         
57         
58         $this->jerr('DONE');
59         exit;
60     }
61     
62         
63 }