Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Fifo / ProcessGl.php
1 <?php
2
3 /**
4  * fill in any fifo basic entries that have not been processed..
5  * -- does not fill in values.. - just qty's
6  *
7  */
8 require_once 'ProcessBase.php';
9  
10 class Pman_Xtuple_Fifo_ProcessGl extends  Pman_Xtuple_Fifo_ProcessBase
11
12 {
13     static $cli_desc = "Post GL entries.";
14    
15     static $permitError = false;
16     
17     function getAuth()
18     {
19         $ff = HTML_FlexyFramework::get();
20         if (!$ff->cli) {
21             die("run form cli only");
22         }
23          
24     }
25     
26     function get()
27     {
28         // set up the failure code..
29         PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
30         
31         // we have to have a pointer to work out where we left off..
32         // this process can go by invdetail_id ASC..
33         $id = DB_DataObject::Factory('cohead');
34         
35         $locs = $id->fetchAll('cohead_id', 'cohead_number');
36         $id->free();
37         
38         $tot = count($locs);
39         $n=0;
40         foreach($locs as $cohead_id => $cohead_number) {
41         
42             $id = DB_DataObject::Factory('invdetail');
43             echo "SELECT invfifo_apply_gl_cohead($cohead_id)\n";
44             $id->query("SELECT invfifo_apply_gl_cohead($cohead_id) as result");
45             $id->fetch();
46             $res = $id->result;
47             $id->free();
48             echo "DONE $cohead_number - adjust: $res\n";
49             
50             if (!($n % 50)) {
51                 echo "$n/$tot\n";
52             }
53             $n++;
54             //if ($n > 50) { exit; }
55         }
56         
57         die("DONE");
58     
59         
60         die("DONE");
61          
62    
63     }
64      
65     
66 }