public function __construct($options = array())
 {
     if (isset($options['autoload'])) {
         $autoload = $options['autoload'];
     } else {
         $autoload = true;
     }
     $options['autoload'] = false;
     parent::__construct($options);
     if (isset($options['calculator']['limit'])) {
         $this->limit = $options['calculator']['limit'];
     }
     if (isset($options['calculator']['vatable'])) {
         $this->vatable = $options['calculator']['vatable'];
     }
     if (isset($options['calculator']['months_limit'])) {
         $this->months_limit = $options['calculator']['months_limit'];
     }
     if (isset($options['calculator']['unlimited_to_balances'])) {
         $this->unlimited_to_balances = (bool) $options['calculator']['unlimited_to_balances'];
     }
     $this->billrun_lower_bound_timestamp = is_null($this->months_limit) ? 0 : strtotime($this->months_limit . " months ago");
     // set months limit
     if ($autoload) {
         $this->load();
     }
     $this->loadRates();
     $this->loadPlans();
     $this->balances = Billrun_Factory::db(array('name' => 'balances'))->balancesCollection();
 }
Example #2
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['calculator']['rate_mapping'])) {
         $this->rateMapping = $options['calculator']['rate_mapping'];
         //Billrun_Factory::log()->log("receive options : ".print_r($this->rateMapping,1),  Zend_Log::DEBUG);
     }
 }
Example #3
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['lines_query'])) {
         $this->linesQuery = $options['lines_query'];
     }
     $this->setCarriers();
 }
Example #4
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['peak_times'])) {
         $this->peakTimes = $options['peak_times'];
     }
     if (isset($options['wholesale_records'])) {
         $this->wholesaleRecords = $options['wholesale_records'];
     }
 }
Example #5
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['calculator']['customer_identification_translation'])) {
         $this->translateCustomerIdentToAPI = $options['calculator']['customer_identification_translation'];
     }
     if (isset($options['calculator']['bulk'])) {
         $this->bulk = $options['calculator']['bulk'];
     }
     $this->subscriber = Billrun_Factory::subscriber();
     $this->plans = Billrun_Factory::db()->plansCollection();
     $this->lines_coll = Billrun_Factory::db()->linesCollection();
 }
Example #6
0
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->init();
     if (isset($options['date_seperation'])) {
         $this->dateSeperation = $options['date_seperation'];
     }
     if (isset($options['unification_fields'])) {
         $this->unificationFields = $options['unification_fields'];
     } else {
         // TODO: put in seperate config dedicate to unify
         $this->unificationFields = array('ggsn' => array('required' => array('fields' => array('sid', 'aid', 'ggsn_address', 'arate', 'urt'), 'match' => array('sgsn_address' => '/^(?=62\\.90\\.|37\\.26\\.)/')), 'date_seperation' => 'Ymd', 'stamp' => array('value' => array('sgsn_address', 'ggsn_address', 'sid', 'aid', 'arate', 'imsi', 'plan', 'rating_group', 'billrun', 'rat_type'), 'field' => array('in_plan', 'out_plan', 'over_plan', 'aprice')), 'fields' => array('$set' => array('process_time'), '$setOnInsert' => array('urt', 'imsi', 'usagesb', 'usaget', 'aid', 'sid', 'ggsn_address', 'sgsn_address', 'rating_group', 'arate', 'plan', 'billrun', 'rat_type'), '$inc' => array('usagev', 'aprice', 'apr', 'fbc_downlink_volume', 'fbc_uplink_volume', 'duration', 'in_plan', 'out_plan', 'over_plan'))), 'nsn' => array('required' => array('fields' => array('urt', 'record_type', 'in_circuit_group', 'in_circuit_group_name', 'out_circuit_group', 'out_circuit_group_name'), 'match' => array('classMethod' => 'isNsnLineLegitimate')), 'date_seperation' => 'Ymd', 'stamp' => array('value' => array('record_type', 'in_circuit_group', 'in_circuit_group_name', 'out_circuit_group', 'out_circuit_group_name', 'arate', 'usaget', 'calling_subs_last_ex_id', 'called_subs_last_ex_id'), 'field' => array()), 'fields' => array('$set' => array('process_time'), '$setOnInsert' => array('urt', 'record_type', 'in_circuit_group', 'in_circuit_group_name', 'out_circuit_group', 'out_circuit_group_name', 'calling_subs_last_ex_id', 'called_subs_last_ex_id', 'arate', 'usaget'), '$inc' => array('usagev', 'duration'))));
     }
     if (isset($options['accept_archived_lines'])) {
         $this->acceptArchivedLines = $options['accept_archived_lines'];
     }
     if (isset($options['protect_concurrent_files'])) {
         $this->protectedConcurrentFiles = $options['protect_concurrent_files'];
     }
     $this->dbReadPref = Billrun_Factory::config()->getConfigValue('read_only_db_pref', $this->dbReadPref);
     $this->dbConcurrentPref = Billrun_Factory::config()->getConfigValue('concurrent_db_pref', $this->dbConcurrentPref);
     // archive connection setting
     $this->archiveDb = Billrun_Factory::db(Billrun_Factory::config()->getConfigValue('archive.db'));
 }
Example #7
0
 public function __construct($options = array())
 {
     if (isset($options['autoload'])) {
         $autoload = $options['autoload'];
     } else {
         $autoload = true;
     }
     $options['autoload'] = false;
     parent::__construct($options);
     if (isset($options['calculator']['limit'])) {
         $this->limit = $options['calculator']['limit'];
     }
     if (isset($options['calculator']['vatable'])) {
         $this->vatable = $options['calculator']['vatable'];
     }
     if (isset($options['calculator']['months_limit'])) {
         $this->months_limit = $options['calculator']['months_limit'];
     }
     if (isset($options['calculator']['unlimited_to_balances'])) {
         $this->unlimited_to_balances = (bool) $options['calculator']['unlimited_to_balances'];
     }
     $this->billrun_lower_bound_timestamp = is_null($this->months_limit) ? 0 : strtotime($this->months_limit . " months ago");
     // set months limit
     if ($autoload) {
         $this->load();
     }
     $this->loadRates();
     $this->loadPlans();
     $this->balances = Billrun_Factory::db(array('name' => 'balances'))->balancesCollection()->setReadPreference('RP_PRIMARY');
     $this->active_billrun = Billrun_Billrun::getActiveBillrun();
     $this->active_billrun_end_time = Billrun_Util::getEndTime($this->active_billrun);
     $this->next_active_billrun = Billrun_Util::getFollowingBillrunKey($this->active_billrun);
     // max recursive retrues for value=oldValue tactic
     $this->concurrentMaxRetries = (int) Billrun_Factory::config()->getConfigValue('updateValueEqualOldValueMaxRetries', 8);
     $this->sidsQueuedForRebalance = array_flip(Billrun_Factory::db()->rebalance_queueCollection()->distinct('sid'));
 }
Example #8
0
 public function __construct($options = array())
 {
     parent::__construct($options);
 }