diff --git a/build/MagnusBilling-current.tar.gz b/build/MagnusBilling-current.tar.gz index 313451faa..5c8149cbf 100644 Binary files a/build/MagnusBilling-current.tar.gz and b/build/MagnusBilling-current.tar.gz differ diff --git a/protected/commands/SipProxyAccountsCommand.php b/protected/commands/SipProxyAccountsCommand.php index e4d5ce3b5..e7211a57e 100755 --- a/protected/commands/SipProxyAccountsCommand.php +++ b/protected/commands/SipProxyAccountsCommand.php @@ -80,7 +80,9 @@ public function run($args) // } foreach ($modelSip as $key => $sip) { - + if ($sip->idUser->active == 0) { + continue; + } if ($sip->host == 'dynamic') { $sqlproxy .= " ('" . $sip->defaultuser . "', '$remoteProxyIP','" . $sip->secret . "','" . md5($sip->defaultuser . ':' . $remoteProxyIP . ':' . $sip->secret) . "', '" . $sip->idUser->username . "', '" . $sip->trace . "','" . $sip->idUser->cpslimit . "'),"; } else { diff --git a/protected/components/BaseController.php b/protected/components/BaseController.php index 9e0aa8e9e..e75bc164e 100755 --- a/protected/components/BaseController.php +++ b/protected/components/BaseController.php @@ -38,6 +38,7 @@ class BaseController extends CController public $extraFieldsRelated = array(); public $titleReport; public $subTitleReport; + public $addAuthorizedNoSession; public $attributes = array(); public $extraValues = array(); public $mapErrorsMySql = array( @@ -95,7 +96,7 @@ public function init() } if (!Yii::app()->session['id_user']) { - if (!$this->authorizedNoSession()) { + if (!$this->authorizedNoSession($this->addAuthorizedNoSession)) { exit("Access denied to All action in All modules"); } } @@ -221,14 +222,6 @@ public function getActions($modules) return $actions; } - public function authorizedNoSession() - { - $allow = array( - 'site', - 'authentication', - ); - return in_array($this->controllerName, $allow); - } private function getOverride() { if (!file_exists('protected/config/overrides.php')) { diff --git a/protected/components/Controller.php b/protected/components/Controller.php index ac764b372..a62d1f93d 100755 --- a/protected/components/Controller.php +++ b/protected/components/Controller.php @@ -31,8 +31,6 @@ class Controller extends BaseController 'invoices', 'statusSystem', 'firewall', - 'trunkGroup', - 'callSummaryPerDay', ); //Allowed controllers to no admin users use updateall @@ -41,8 +39,9 @@ class Controller extends BaseController 'sendCreditRates', ); - public function authorizedNoSession() + public function authorizedNoSession($value = false) { + $allow = array( 'site', 'authentication', @@ -68,6 +67,11 @@ public function authorizedNoSession() 'molPay', 'sms', ); + + if ($value) { + + $allow[] = $value; + } return in_array($this->controllerName, $allow); } diff --git a/protected/controllers/RefillController.php b/protected/controllers/RefillController.php index 0bfc65d00..797ce6474 100755 --- a/protected/controllers/RefillController.php +++ b/protected/controllers/RefillController.php @@ -202,22 +202,31 @@ public function recordsExtraSum($records) public function setAttributesModels($attributes, $models) { - $modelRefill = $this->abstractModel->find(array( - 'select' => 'SUM(t.credit) AS credit', - 'join' => $this->join, - 'condition' => $this->filter == '' ? 1 : $this->filter, - 'params' => $this->paramsFilter, - 'with' => $this->relationFilter, - )); + $criteria = new CDbCriteria(); + $criteria->addCondition($this->filter); + + $criteria->select = 'SUM(t.credit) AS credit'; + $criteria->join = $this->join; + $criteria->params = $this->paramsFilter; + $criteria->with = $this->relationFilter; + $criteria->order = $this->order; + $criteria->limit = $this->limit; + $criteria->offset = $this->start; + + if (count($this->addInCondition)) { + $criteria->addInCondition($this->addInCondition[0], $this->addInCondition[1]); + } - $modelRefillSumm2 = $this->abstractModel->findAll(array( - 'select' => 'EXTRACT(YEAR_MONTH FROM date) AS CreditMonth , SUM(t.credit) AS sumCreditMonth', - 'join' => $this->join, - 'condition' => $this->filter == '' ? 1 : $this->filter, - 'params' => $this->paramsFilter, - 'with' => $this->relationFilter, - 'group' => 'CreditMonth', - )); + $modelRefill = $this->abstractModel->find($criteria); + + $criteria->select = 'EXTRACT(YEAR_MONTH FROM date) AS CreditMonth , SUM(t.credit) AS sumCreditMonth'; + + $criteria->group = 'CreditMonth'; + + if (count($this->addInCondition)) { + $criteria->addInCondition($this->addInCondition[0], $this->addInCondition[1]); + } + $modelRefillSumm2 = $this->abstractModel->findAll($criteria); $pkCount = is_array($attributes) || is_object($attributes) ? $attributes : []; for ($i = 0; $i < count($pkCount); $i++) { diff --git a/protected/controllers/UserController.php b/protected/controllers/UserController.php index 13ade7ba1..4675beda8 100755 --- a/protected/controllers/UserController.php +++ b/protected/controllers/UserController.php @@ -86,8 +86,6 @@ class UserController extends Controller 'credit', 'id_user', 'id_group_agent', - 'typepaid', - 'creditlimit', 'calllimit', 'restriction', 'restriction_use',