public function execute() { $request = $this->getRequest(); $aid = $request->get("aid"); $stamp = Billrun_Util::getBillrunKey(time()); $subscribers = $request->get("subscribers"); if (!is_numeric($aid)) { die; } if (is_string($subscribers)) { $subscribers = explode(",", $subscribers); } else { $subscribers = array(); } $options = array('type' => 'balance', 'aid' => $aid, 'subscribers' => $subscribers, 'stamp' => $stamp); $generator = Billrun_Generator::getInstance($options); if ($generator) { $generator->load(); header('Content-type: text/xml'); $generator->generate(); $this->getController()->setOutput(array(false, true)); // hack } else { $this->_controller->addOutput("Generator cannot be loaded"); } }
protected function fetchData($params) { $options = array('type' => 'balance', 'aid' => $params['aid'], 'subscribers' => $params['subscribers'], 'stamp' => $params['stamp'], 'buffer' => true); $generator = Billrun_Generator::getInstance($options); $generator->load(); $output = $generator->generate(); return $output; }
/** * method to execute the generate process * it's called automatically by the cli main controller */ public function execute() { $possibleOptions = array('type' => false, 'stamp' => false, 'page' => true, 'size' => true); if (($options = $this->_controller->getInstanceOptions($possibleOptions)) === FALSE) { return; } $this->_controller->addOutput("Loading generator"); $generator = Billrun_Generator::getInstance($options); $this->_controller->addOutput("Generator loaded"); if ($generator) { $this->_controller->addOutput("Loading data to Generate..."); $generator->load(); $this->_controller->addOutput("Starting to Generate. This action can take a while..."); $generator->generate(); $this->_controller->addOutput("Finished generating."); } else { $this->_controller->addOutput("Generator cannot be loaded"); } }
protected function makeXml($account_billrun, $lines) { $options = array('type' => 'golanxml', 'stamp' => $account_billrun->getBillrunKey()); $generator = Billrun_Generator::getInstance($options); $generator->createXmlInvoice($account_billrun->getRawData(), $lines); }