Skip to content

Commit

Permalink
fix buld did destination
Browse files Browse the repository at this point in the history
  • Loading branch information
callcenter-magnus committed Dec 28, 2023
1 parent ac71249 commit 236e037
Show file tree
Hide file tree
Showing 26 changed files with 219 additions and 208 deletions.
Binary file modified build/MagnusBilling-current.tar.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion classic/src/view/did/Bulk.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Ext.define('MBilling.view.did.Bulk', {
if (!me.down('form').isValid()) {
return;
}
me.down('form').setLoading(true);
Ext.Ajax.setTimeout(1000000);
me.down('form').submit({
url: 'index.php/diddestination/bulkdestinatintion',
Expand All @@ -156,13 +157,14 @@ Ext.define('MBilling.view.did.Bulk', {
Ext.ux.Alert.alert(t('Error'), obj.errors, 'error');
}
btn.enable();
me.list.setLoading(false);
me.down('form').setLoading(false);
store.load();
me.close();
},
failure: function(form, action) {
var obj = Ext.decode(action.response.responseText),
errors = Helper.Util.convertErrorsJsonToString(obj.errors);
me.down('form').setLoading(false);
if (!Ext.isObject(obj.errors)) {
Ext.ux.Alert.alert(me.titleError, t(errors), 'error');
} else {
Expand Down
2 changes: 1 addition & 1 deletion classic/src/view/did/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Ext.define('MBilling.view.did.List', {
disabled: false
}, {
text: t('Bulk DID'),
iconCls: 'icon-delete',
iconCls: '',
handler: 'onBulk',
hidden: !App.user.isAdmin || window.isTablet
}];
Expand Down
18 changes: 9 additions & 9 deletions protected/components/AccessManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static function getInstance($module)

private function getResult($canDoIt)
{
if (in_array($this->module, self::$config['only_admin']) && !Yii::app()->session['isAdmin']) {
if (in_array($this->module, self::$config['only_admin']) && ! Yii::app()->session['isAdmin']) {
return false;
}

Expand Down Expand Up @@ -86,14 +86,14 @@ public function checkAccess($user, $pass)
$filterUser = '((s.username COLLATE utf8_bin = :key OR s.email COLLATE utf8_bin LIKE :key) AND UPPER(MD5(s.password)) = :key1)';
$filterSip = '(t.name COLLATE utf8_bin = :key AND UPPER(MD5(t.secret)) = :key1 )';
$modelSip = Sip::model()->find(
array(
[
'condition' => $filterUser . ' OR ' . $filterSip,
'join' => 'LEFT JOIN pkg_user s ON t.id_user = s.id',
'params' => array(
'params' => [
':key' => trim($user),
':key1' => trim(strtoupper($pass)),
),
));
],
]);
return $modelSip;
}

Expand All @@ -102,14 +102,14 @@ public function checkAccessLogin($user, $pass)
$filterUser = '((s.username COLLATE utf8_bin = :key OR s.email COLLATE utf8_bin LIKE :key) AND UPPER(SHA1(s.password)) = :key1)';
$filterSip = '(t.name COLLATE utf8_bin = :key AND UPPER(SHA1(t.secret)) = :key1 )';
$modelSip = Sip::model()->find(
array(
[
'condition' => $filterUser . ' OR ' . $filterSip,
'join' => 'LEFT JOIN pkg_user s ON t.id_user = s.id',
'params' => array(
'params' => [
':key' => trim($user),
':key1' => trim(strtoupper($pass)),
),
));
],
]);
return $modelSip;
}
}
12 changes: 6 additions & 6 deletions protected/components/CCJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public static function encode($var)
case $ord_var_c == 0x2F:
case $ord_var_c == 0x5C:
// double quote, slash, slosh
$ascii .= '\\' . $var{$c};
$ascii .= '\\' . $var{$c}
break;

case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
// characters U-00000000 - U-0000007F (same as ASCII)
$ascii .= $var{$c};
$ascii .= $var{$c}
break;

case (($ord_var_c & 0xE0) == 0xC0):
Expand Down Expand Up @@ -152,19 +152,19 @@ public static function encode($var)
// treat as a JSON object
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
return '{' .
join(',', array_map(array('CJSON', 'nameValue'),
join(',', array_map(['CJSON', 'nameValue'],
array_keys($var),
array_values($var)))
. '}';
}

// treat it like a regular array
return '[' . join(',', array_map(array('CJSON', 'encode'), $var)) . ']';
return '[' . join(',', array_map(['CJSON', 'encode'], $var)) . ']';

case 'object':
if ($var instanceof Traversable) {
$var = get_parent_class($var) === 'Model' ? $var->getAttributes() : $var;
$vars = array();
$vars = [];
foreach ($var as $k => $v) {
$vars[$k] = $v;
}
Expand All @@ -174,7 +174,7 @@ public static function encode($var)
}

return '{' .
join(',', array_map(array('CJSON', 'nameValue'),
join(',', array_map(['CJSON', 'nameValue'],
array_keys($vars),
array_values($vars)))
. '}';
Expand Down
6 changes: 3 additions & 3 deletions protected/components/CSVActiveRecorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class CSVActiveRecorder
private $translations;
private $data;
private $model;
private $errors = array();
private $errors = [];
private $aditionalParams;

public function __construct(array $data, $model, $additionalParams = array())
public function __construct(array $data, $model, $additionalParams = [])
{

$this->model = $model;
Expand Down Expand Up @@ -101,7 +101,7 @@ public function translateColumns()
$foundTranslation = true;
}
}
if (!$foundTranslation) {
if ( ! $foundTranslation) {
$resultColumns[$csvColumn] = $csvColumn;
}

Expand Down
2 changes: 1 addition & 1 deletion protected/components/CSVInterpreter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class CSVInterpreter
{
private $filename;
private $errors = array();
private $errors = [];
private $delimiter;
private $enclosure;
private $escape;
Expand Down
2 changes: 1 addition & 1 deletion protected/components/ConsoleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function init()

define('LOGFILE', 'protected/runtime/' . $this->getName() . '.log');

if (!defined('PID')) {
if ( ! defined('PID')) {
define("PID", '/var/run/magnus/' . $this->getName() . 'Pid.php');
}

Expand Down
12 changes: 6 additions & 6 deletions protected/components/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
class Controller extends BaseController
{
public $nofilterPerAdminGroup = array(
public $nofilterPerAdminGroup = [
'offer',
'module',
'methodpay',
Expand All @@ -31,18 +31,18 @@ class Controller extends BaseController
'invoices',
'statusSystem',
'firewall',
);
];

//Allowed controllers to no admin users use updateall
public $controllerAllowUpdateAll = array(
public $controllerAllowUpdateAll = [
'rateCallshop',
'sendCreditRates',
);
];

public function authorizedNoSession($value = false)
{

$allow = array(
$allow = [
'site',
'authentication',
'overrides/authenticationOR',
Expand All @@ -66,7 +66,7 @@ public function authorizedNoSession($value = false)
'mercadoPago',
'molPay',
'sms',
);
];

if ($value) {

Expand Down
5 changes: 3 additions & 2 deletions protected/components/LinuxAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class LinuxAccess

public static function exec($command)
{
Yii::log($command, 'error');
return exec($command, $output);
Yii::log('LinuxAccess::exec -> ' . $command, 'error');
exec($command, $output);
return $output;
}

public static function getDirectoryDiskSpaceUsed($filter = '*', $directory = '/var/spool/asterisk/monitor/')
Expand Down
2 changes: 1 addition & 1 deletion protected/components/LoadConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function getConfig()
{
$modelConfiguration = Configuration::model()->findAll();

$config = array();
$config = [];
foreach ($modelConfiguration as $conf) {
$config[$conf->config_group_title][$conf->config_key] = $conf->config_value;
}
Expand Down
26 changes: 13 additions & 13 deletions protected/components/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ class Mail
public function __construct($type, $id_user = null, $id_agent = null, $msg = null, $title = null)
{

if (!empty($type)) {
if ( ! empty($type)) {
$this->type = $type;
$modelUser = User::model()->findByPk((int) $id_user);
$modelConfig = Configuration::model()->find('config_key = "ip_servers"');

$modelTemplate = TemplateMail::model()->find('mailtype = :key AND language = :key1 AND id_user = :key2',
array(
[
':key' => $type,
':key1' => $modelUser->language,
':key2' => $modelUser->id_user,
));
]);

if (!isset($modelTemplate->id)) {
if ( ! isset($modelTemplate->id)) {
return;
}

Expand Down Expand Up @@ -202,7 +202,7 @@ public function __construct($type, $id_user = null, $id_agent = null, $msg = nul
return true;
}

} elseif (!empty($msg) || !empty($title)) {
} elseif ( ! empty($msg) || ! empty($title)) {
$this->message = $msg;
$this->title = $title;
} else {
Expand All @@ -222,7 +222,7 @@ public function __construct($type, $id_user = null, $id_agent = null, $msg = nul
$modelUser->credit_notification = '';
$modelUser->language = $modelAgent->language;
}
if (!empty($this->message) || !empty($this->title)) {
if ( ! empty($this->message) || ! empty($this->title)) {
$credit = round($real_credit, 3);
$currency = isset($modelUser->currency) ? $modelUser->currency : null;

Expand Down Expand Up @@ -254,7 +254,7 @@ public function __construct($type, $id_user = null, $id_agent = null, $msg = nul
$this->replaceInEmail(self::$CUSTOMER_CREDIT_NOTIFICATION, $modelUser->credit_notification);
$this->replaceInEmail(self::$CANCEL_CREDIT_NOTIFICATION_URL, 'http://' . $modelConfig->config_value . '/mbilling/index.php/authentication/cancelCreditNotification?id=' . $modelUser->id . '&key=' . sha1($modelUser->id . $modelUser->username . $modelUser->password));
$this->replaceInEmail(self::$TIME_KEY, date('Y-m-d H:i:s'));
$OBS = !isset($OBS) ? $this->replaceInEmail(self::$OBS, '') : $OBS;
$OBS = ! isset($OBS) ? $this->replaceInEmail(self::$OBS, '') : $OBS;

$this->replaceInEmail(self::$SYSTEM_CURRENCY, $currency);
}
Expand Down Expand Up @@ -329,8 +329,8 @@ public function setFromName($from_name)
public function send($to_email = null)
{

$this->from_email = !empty($this->from_email) ? $this->from_email : $to_email;
$this->to_email = !empty($to_email) ? $to_email : $this->to_email;
$this->from_email = ! empty($this->from_email) ? $this->from_email : $to_email;
$this->to_email = ! empty($to_email) ? $to_email : $this->to_email;

if (strlen($this->to_email) < 5) {
return;
Expand All @@ -345,9 +345,9 @@ public function send($to_email = null)
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
curl_setopt($curl, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
));
]);
curl_setopt($curl, CURLOPT_URL,
"$result->url"
);
Expand All @@ -357,9 +357,9 @@ public function send($to_email = null)
}
}

$modelSmtps = Smtps::model()->find('id_user = :key', array(':key' => $this->id_agent));
$modelSmtps = Smtps::model()->find('id_user = :key', [':key' => $this->id_agent]);

if (!isset($modelSmtps->id)) {
if ( ! isset($modelSmtps->id)) {
return;
}
$smtp_host = $modelSmtps->host;
Expand Down
30 changes: 15 additions & 15 deletions protected/components/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function uniquePeerName($attribute, $params)
{

if (isset($this->name)) {
$modelTrunk = Trunk::model()->find('trunkcode = :key', array(':key' => $this->name));
$modelTrunk = Trunk::model()->find('trunkcode = :key', [':key' => $this->name]);
if (isset($modelTrunk->id)) {
$this->addError($attribute, Yii::t('zii', 'This username is in use by a trunk'));
}
} else if (isset($this->trunkcode)) {

$modelSip = Sip::model()->find('name = :key', array(':key' => $this->trunkcode));
$modelSip = Sip::model()->find('name = :key', [':key' => $this->trunkcode]);
if (isset($modelSip->id)) {
$this->addError($attribute, Yii::t('zii', 'This trunk name is in use by a SIP user'));
}
Expand All @@ -57,21 +57,21 @@ public function uniquePeerName($attribute, $params)

public function generateRules($rules = [])
{
$table = array($this->getTableSchema($this->tableName()));
$table = [$this->getTableSchema($this->tableName())];

$required = array();
$integers = array();
$numerical = array();
$length = array();
$safe = array();
$required = [];
$integers = [];
$numerical = [];
$length = [];
$safe = [];

foreach ($table[0]->columns as $column) {

if ($column->autoIncrement) {
continue;
}

$r = !$column->allowNull && $column->defaultValue === null;
$r = ! $column->allowNull && $column->defaultValue === null;
if ($r) {
$required[] = $column->name;
}
Expand All @@ -82,31 +82,31 @@ public function generateRules($rules = [])
$numerical[] = $column->name;
} elseif ($column->type === 'string' && $column->size > 0) {
$length[$column->size][] = $column->name;
} elseif (!$column->isPrimaryKey && !$r) {
} elseif ( ! $column->isPrimaryKey && ! $r) {
$safe[] = $column->name;
}

}
if ($required !== array()) {
if ($required !== []) {

$rules[] = [implode(', ', $required), 'required'];
}

if ($integers !== array()) {
if ($integers !== []) {
$rules[] = [implode(', ', $integers), 'numerical', 'integerOnly' => true];
}

if ($numerical !== array()) {
if ($numerical !== []) {
$rules[] = [implode(', ', $numerical), 'numerical'];
}

if ($length !== array()) {
if ($length !== []) {
foreach ($length as $len => $cols) {
$rules[] = [implode(', ', $cols), 'length', 'max' => $len];
}

}
if ($safe !== array()) {
if ($safe !== []) {
$rules[] = [implode(', ', $safe), 'safe'];
}

Expand Down
Loading

0 comments on commit 236e037

Please sign in to comment.