cli) { die("run form cli only"); } } function get() { // set up the failure code.. PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError')); // we have to have a pointer to work out where we left off.. // this process can go by invdetail_id ASC.. $id = DB_DataObject::Factory('cohead'); $locs = $id->fetchAll('cohead_id', 'cohead_number'); $id->free(); $tot = count($locs); $n=0; foreach($locs as $cohead_id => $cohead_number) { $id = DB_DataObject::Factory('invdetail'); echo "SELECT invfifo_apply_gl_cohead($cohead_id)\n"; $id->query("SELECT invfifo_apply_gl_cohead($cohead_id) as result"); $id->fetch(); $res = $id->result; $id->free(); echo "DONE $cohead_number - adjust: $res\n"; if (!($n % 50)) { echo "$n/$tot\n"; } $n++; //if ($n > 50) { exit; } } die("DONE"); die("DONE"); } }