Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajuste #634

Open
wants to merge 6 commits into
base: source
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions README.md

This file was deleted.

Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion protected/commands/SipProxyAccountsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 2 additions & 9 deletions protected/components/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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");
}
}
Expand Down Expand Up @@ -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')) {
Expand Down
10 changes: 7 additions & 3 deletions protected/components/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ class Controller extends BaseController
'invoices',
'statusSystem',
'firewall',
'trunkGroup',
'callSummaryPerDay',
);

//Allowed controllers to no admin users use updateall
Expand All @@ -41,8 +39,9 @@ class Controller extends BaseController
'sendCreditRates',
);

public function authorizedNoSession()
public function authorizedNoSession($value = false)
{

$allow = array(
'site',
'authentication',
Expand All @@ -68,6 +67,11 @@ public function authorizedNoSession()
'molPay',
'sms',
);

if ($value) {

$allow[] = $value;
}
return in_array($this->controllerName, $allow);
}

Expand Down
39 changes: 24 additions & 15 deletions protected/controllers/RefillController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 0 additions & 2 deletions protected/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ class UserController extends Controller
'credit',
'id_user',
'id_group_agent',
'typepaid',
'creditlimit',
'calllimit',
'restriction',
'restriction_use',
Expand Down
2 changes: 1 addition & 1 deletion resources/asterisk/AGI.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1990,4 +1990,4 @@ function iferrorexec($result, $callback)
//$result['code']=='500' &&
$callback();
}
}
}
35 changes: 30 additions & 5 deletions resources/asterisk/DidAgi.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,37 @@ public function call_did(&$agi, &$MAGNUS, &$CalcAgi, $destinationIvr = false)
return 1;
} else {

$fields = "uniqueid,id_user,calledstation,id_plan,id_trunk,callerid,src,
starttime, terminatecauseid,sipiax,id_prefix,hangupcause";
$fields = "
uniqueid,
id_user,
calledstation,
id_plan,
id_trunk,
callerid,
src,
starttime,
terminatecauseid,
sipiax,
id_prefix,
hangupcause,
id_server";

$id_trunk = $MAGNUS->id_trunk > 0 ? $MAGNUS->id_trunk : null;
$values = "'$MAGNUS->uniqueid', '$MAGNUS->id_user','$this->did','$MAGNUS->id_plan',
'$id_trunk','$MAGNUS->CallerID', 'DID Call',
'" . date('Y-m-d H:i:s') . "', '0','3','$CalcAgi->id_prefix','0'";

$values = "
'$MAGNUS->uniqueid',
'$MAGNUS->id_user',
'$this->did',
'$MAGNUS->id_plan',
'$id_trunk',
'$MAGNUS->CallerID',
'DID Call',
'" . date('Y-m-d H:i:s') . "',
'0',
'3',
'$CalcAgi->id_prefix',
'0',
'$MAGNUS->id_server'";
$sql = "INSERT INTO pkg_cdr_failed ($fields) VALUES ($values) ";
$agi->exec($sql);
return 1;
Expand Down