4 require_once 'Pman/Roo.php';
6 class Pman_Xtuple_Import_Report extends Pman_Roo
10 * get .. same as roo...
16 if (HTML_FlexyFramework::get()->cli) {
19 return parent::getAuth();
25 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
27 //DB_DataObject::DebugLevel(1);
29 $this->jerr('not suppoprted');
35 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
36 // DB_DAtaObject::debugLevel(1);
37 $this->sessionState(0); // turn off the session..
39 $img = DB_DataObject::Factory('images');
44 $img->onUpload(false);
46 $fc = file_get_contents($img->getStoreName());
47 $rep = DB_DataObject::Factory('report');
48 $rep->get($_REQUEST['onid']);
50 $mrep = DB_DataObject::Factory('report');
51 $mrep->report_name = $rep->report_name;
52 $mrep->orderBy('report_grade DESC');
56 $nrep= DB_DataObject::Factory('report');
57 $nrep->setFrom($mrep->toArray());
58 $nrep->report_source = $fc;
59 $nrep->report_grade = $mrep->report_grade + 1;
60 $nrep->report_loaddate = $nrep->sqlValue('NOW()');
61 $id = $nrep->insert();
62 $this->addEvent('REPORTUP', $nrep, $nrep->report_name . ' uploaded');