Merge branch 'master' of http://git.roojs.com/Pman.Xtuple
[Pman.Xtuple] / VoidSalesAndPurchaseOrders.php
1 <?php
2 require_once 'Pman/Roo.php';
3
4 class Pman_Xtuple_VoidSalesAndPurchaseOrders extends Pman_Roo
5 {   
6     function getAuth()
7     {
8         if (HTML_FlexyFramework::get()->cli) {
9             return false;
10         }
11         return parent::getAuth();
12     }
13    
14     function get()
15     {
16         $this->transObj = DB_DataObject::Factory('cohead');
17         
18         $this->transObj->query('BEGIN');
19         
20         PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
21         
22         DB_DataObject::factory('cohead')->lockTables();
23         
24         $cohead = DB_DataObject::factory('cohead');
25         $cohead->whereAdd("
26             cohead_status != 'X'
27         ");
28         $cohead->find();
29         
30         while ($cohead->fetch()){
31             $cohead->clear($this);
32         }
33         
34         
35         $pohead = DB_DataObject::factory('pohead');
36         $pohead->find();
37         
38         while ($pohead->fetch()){
39             $pohead->clear($this);
40         }
41         
42         
43         $this->jok('ROLL BACK');
44         exit;
45     }
46     
47         
48 }