コード例 #1
0
ファイル: Customer.php プロジェクト: ngchie/system
 public function __construct($options = array())
 {
     parent::__construct($options);
     ini_set('mongo.native_long', 1);
     //Set mongo  to use  long int  for  all aggregated integer data.
     if (isset($options['aggregator']['page']) && is_numeric($options['aggregator']['page'])) {
         $this->page = $options['aggregator']['page'];
     }
     if (isset($options['page']) && is_numeric($options['page'])) {
         $this->page = $options['page'];
     }
     if (isset($options['aggregator']['size']) && $options['aggregator']['size']) {
         $this->size = $options['aggregator']['size'];
     }
     if (isset($options['size']) && $options['size']) {
         $this->size = $options['size'];
     }
     if (isset($options['aggregator']['vatable'])) {
         $this->vatable = $options['aggregator']['vatable'];
     }
     if (isset($options['aggregator']['test_accounts'])) {
         $this->testAcc = $options['aggregator']['test_accounts'];
     }
     if (isset($options['aggregator']['min_invoice_id'])) {
         $this->min_invoice_id = (int) $options['aggregator']['min_invoice_id'];
     }
     if (isset($options['aggregator']['memory_limit_in_mb'])) {
         if ($options['aggregator']['memory_limit_in_mb'] > -1) {
             $this->memory_limit = $options['aggregator']['memory_limit_in_mb'] * 1048576;
         } else {
             $this->memory_limit = $options['aggregator']['memory_limit_in_mb'];
         }
     }
     if (isset($options['aggregator']['bulk_account_preload'])) {
         $this->bulkAccountPreload = (int) $options['aggregator']['bulk_account_preload'];
     }
     if (isset($options['aggregator']['override_accounts'])) {
         $this->overrideAccountIds = $options['aggregator']['override_accounts'];
     }
     $this->plans = Billrun_Factory::db()->plansCollection();
     $this->lines = Billrun_Factory::db()->linesCollection();
     $this->billrun = Billrun_Factory::db(array('name' => 'billrun'))->billrunCollection();
     $this->loadRates();
 }
コード例 #2
0
 /**
  * method to execute the aggregate 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 aggregator");
     $aggregator = Billrun_Aggregator::getInstance($options);
     $this->_controller->addOutput("Aggregator loaded");
     if ($aggregator) {
         $this->_controller->addOutput("Loading data to Aggregate...");
         $aggregator->load();
         $this->_controller->addOutput("Starting to Aggregate. This action can take a while...");
         $aggregator->aggregate();
         $this->_controller->addOutput("Finish to Aggregate.");
     } else {
         $this->_controller->addOutput("Aggregator cannot be loaded");
     }
 }
コード例 #3
0
ファイル: Customer.php プロジェクト: kalburgimanjunath/system
 public function __construct($options = array())
 {
     parent::__construct($options);
     ini_set('mongo.native_long', 1);
     //Set mongo  to use  long int  for  all aggregated integer data.
     if (isset($options['aggregator']['page']) && is_numeric($options['aggregator']['page'])) {
         $this->page = $options['aggregator']['page'];
     }
     if (isset($options['page']) && is_numeric($options['page'])) {
         $this->page = $options['page'];
     }
     if (isset($options['aggregator']['size']) && $options['aggregator']['size']) {
         $this->size = $options['aggregator']['size'];
     }
     if (isset($options['size']) && $options['size']) {
         $this->size = $options['size'];
     }
     if (isset($options['aggregator']['vatable'])) {
         $this->vatable = $options['aggregator']['vatable'];
     }
     if (isset($options['aggregator']['test_accounts'])) {
         $this->testAcc = $options['aggregator']['test_accounts'];
     }
     if (isset($options['aggregator']['min_invoice_id'])) {
         $this->min_invoice_id = (int) $options['aggregator']['min_invoice_id'];
     }
     if (isset($options['aggregator']['write_stamps_to_file']) && $options['aggregator']['write_stamps_to_file']) {
         $this->write_stamps_to_file = $options['aggregator']['write_stamps_to_file'];
         $this->stamps_dir = (isset($options['aggregator']['stamps_dir']) ? $options['aggregator']['stamps_dir'] : getcwd() . '/files/billrun_stamps') . '/' . $this->getStamp() . '/';
     }
     if (isset($options['aggregator']['memory_limit_in_mb'])) {
         if ($options['aggregator']['memory_limit_in_mb'] > -1) {
             $this->memory_limit = $options['aggregator']['memory_limit_in_mb'] * 1048576;
         } else {
             $this->memory_limit = $options['aggregator']['memory_limit_in_mb'];
         }
     }
     $this->plans = Billrun_Factory::db()->plansCollection();
     $this->lines = Billrun_Factory::db()->linesCollection();
     $this->billrun = Billrun_Factory::db()->billrunCollection();
     $this->loadRates();
 }
コード例 #4
0
ファイル: RecreateInvoices.php プロジェクト: ngchie/system
 public function execute()
 {
     Billrun_Factory::log()->log("Execute recreate invoices", Zend_Log::INFO);
     $request = $this->getRequest()->getRequest();
     // supports GET / POST requests
     if (empty($request['account_id'])) {
         return $this->setError('Please supply at least one account id', $request);
     }
     $billrun_key = Billrun_Util::getPreviousBillrunKey(Billrun_Util::getBillrunKey(time()));
     // Warning: will convert half numeric strings / floats to integers
     $account_ids = array_unique(array_diff(Billrun_Util::verify_array(explode(',', $request['account_id']), 'int'), array(0)));
     if ($account_ids) {
         $options = array('autoload' => 0, 'stamp' => $billrun_key);
         $customer_aggregator_options = array('override_accounts' => $account_ids, 'bulk_account_preload' => 0);
         $customerOptions = array('type' => 'customer', 'aggregator' => $customer_aggregator_options);
         $customerAgg = Billrun_Aggregator::getInstance(array_merge($options, $customerOptions));
         $customerAgg->load();
         $successfulAccounts = $customerAgg->aggregate();
     } else {
         return $this->setError('Illegal aids', $request);
     }
     $this->getController()->setOutput(array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'successfulAccounts' => $successfulAccounts)));
     return TRUE;
 }