Skip to content

Commit 95811a4

Browse files
author
magnussolution
committed
improve dashboard
1 parent 63db46a commit 95811a4

File tree

11 files changed

+31
-29
lines changed

11 files changed

+31
-29
lines changed

build/MagnusBilling-current.tar.gz

-188 Bytes
Binary file not shown.

classic/src/view/sip/Form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Ext.define('MBilling.view.sip.Form', {
283283
}, {
284284
xtype: 'noyescombo',
285285
name: 'ringfalse',
286-
fieldLabel: t('Ring false'),
286+
fieldLabel: t('Fake Ring'),
287287
value: '0',
288288
allowBlank: !App.user.isAdmin
289289
}, {

protected/commands/StatusSystemCommand.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ class StatusSystemCommand extends ConsoleCommand
2222
public function run($args)
2323
{
2424

25-
$sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr_failed` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "'";
25+
$sql = "SELECT id FROM `pkg_cdr_failed` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "' LIMIT 1";
2626
$resultFailed = Yii::app()->db->createCommand($sql)->queryAll();
2727

28-
$sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "'";
28+
$sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr_failed` WHERE `id` > " . $resultFailed[0]['id'];
29+
$resultFailed = Yii::app()->db->createCommand($sql)->queryAll();
30+
31+
$sql = "SELECT id FROM `pkg_cdr` WHERE `starttime` > '" . date('Y-m-d H:i:s', strtotime('-1 hour')) . "' LIMIT 1";
32+
$resultAnswered = Yii::app()->db->createCommand($sql)->queryAll();
33+
34+
$sql = "SELECT SUBSTRING(uniqueid,1,10) as uniqueid, starttime FROM `pkg_cdr` WHERE `id` > " . $resultAnswered[0]['id'];
2935
$resultAnswered = Yii::app()->db->createCommand($sql)->queryAll();
3036

3137
$result = array_merge($resultFailed, $resultAnswered);

protected/components/AsteriskAccess.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function writeAsteriskFile($model, $file, $head_field = 'name')
269269
}
270270

271271
if ($head_field == 'trunkcode') {
272-
$sql = "SELECT * FROM pkg_servers WHERE type != 'mbilling' AND status = 1 AND host != 'localhost'";
272+
$sql = "SELECT * FROM pkg_servers WHERE type != 'mbilling' AND status IN (1,4) AND host != 'localhost'";
273273
$modelServers = Yii::app()->db->createCommand($sql)->queryAll();
274274

275275
foreach ($modelServers as $key => $data) {
@@ -422,7 +422,7 @@ public function groupTrunk($agi, $ipaddress, $maxuse)
422422

423423
public static function getSipShowPeers()
424424
{
425-
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'";
425+
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'";
426426
$modelServers = Yii::app()->db->createCommand($sql)->queryAll();
427427

428428
array_push($modelServers, array(
@@ -466,7 +466,7 @@ public static function getSipShowPeers()
466466
public static function getCoreShowCdrChannels()
467467
{
468468

469-
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'";
469+
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'";
470470
$modelServers = Yii::app()->db->createCommand($sql)->queryAll();
471471

472472
array_push($modelServers, array(
@@ -513,7 +513,7 @@ public static function getCoreShowCdrChannels()
513513
public static function getCoreShowChannels()
514514
{
515515

516-
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'";
516+
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'";
517517
$modelServers = Yii::app()->db->createCommand($sql)->queryAll();
518518

519519
array_push($modelServers, array(
@@ -555,7 +555,7 @@ public static function getCoreShowChannels()
555555
public static function getCoreShowChannelsVerbose()
556556
{
557557

558-
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'";
558+
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'";
559559
$modelServers = Yii::app()->db->createCommand($sql)->queryAll();
560560

561561
array_push($modelServers, array(
@@ -601,7 +601,7 @@ public static function getCoreShowChannel($channel, $agi = null, $server = null)
601601
{
602602

603603
if ($server == null) {
604-
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status = 1 AND host != 'localhost'";
604+
$sql = "SELECT * FROM pkg_servers WHERE type = 'asterisk' AND status IN (1,4) AND host != 'localhost'";
605605
if (isset($agi->engine)) {
606606
$modelServers = $agi->query($sql)->fetchAll(PDO::FETCH_ASSOC);
607607
} else {

protected/controllers/ServersController.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ public function setAttributesModels($attributes, $models)
4343
'condition' => 'type = "asterisk" AND status = 1 AND weight > 0',
4444
'order' => 'last_call DESC',
4545
]);
46-
$last_call = date("Y-m-d H:i:s", strtotime("-5 minutes", strtotime($modelServer->last_call)));
46+
if (isset($modelServer->id)) {
47+
$last_call = date("Y-m-d H:i:s", strtotime("-5 minutes", strtotime($modelServer->last_call)));
4748

48-
$pkCount = is_array($attributes) || is_object($attributes) ? $attributes : [];
49-
for ($i = 0; $i < count($pkCount); $i++) {
49+
$pkCount = is_array($attributes) || is_object($attributes) ? $attributes : [];
50+
for ($i = 0; $i < count($pkCount); $i++) {
5051

51-
if ($attributes[$i]['status'] == 4) {
52-
Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 1));
53-
}
54-
if ($attributes[$i]['type'] == 'asterisk' && $attributes[$i]['status'] > 0 && $attributes[$i]['weight'] > '0' && $attributes[$i]['last_call'] < $last_call) {
55-
Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 4));
52+
if ($attributes[$i]['status'] == 4) {
53+
Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 1));
54+
}
55+
if ($attributes[$i]['type'] == 'asterisk' && $attributes[$i]['status'] > 0 && $attributes[$i]['weight'] > '0' && $attributes[$i]['last_call'] < $last_call) {
56+
Servers::model()->updateByPk($attributes[$i]['id'], array('status' => 4));
57+
}
5658
}
5759
}
5860
return $attributes;

resources/locale/de.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ Locale.load({
840840
'Return credit after cancellation': '',
841841
'Ring': 'Klingeln',
842842
'Ring all available channels until one answers': 'Alle verfügbaren SIP-Kanäle anrufen, bis einer antwortet',
843-
'Ring false': 'Ring false',
843+
'Fake Ring': 'Fake Ring',
844844
'Ring for': 'Ring for',
845845
'Ring interface which was least recently called by this queue': 'Ringschnittstelle, die erst kürzlich von dieser Warteschlange angerufen wurde',
846846
'Ring or playing MOH': 'Rufe an oder spiele MOH ab',
@@ -1180,5 +1180,4 @@ Locale.load({
11801180
'success': 'Erfolg',
11811181
'to refill': 'zum aufladen',
11821182
'week': 'Woche',
1183-
11841183
});

resources/locale/en.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ Locale.load({
799799
'Return credit after cancellation': '',
800800
'Ring': '',
801801
'Ring all available channels until one answers': '',
802-
'Ring false': '',
802+
'Fake Ring': '',
803803
'Ring for': '',
804804
'Ring interface which was least recently called by this queue': '',
805805
'Ring or playing MOH': '',
@@ -1127,5 +1127,4 @@ Locale.load({
11271127
'name': '',
11281128
'to refill': '',
11291129
'week': '',
1130-
11311130
});

resources/locale/es.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ Locale.load({
819819
'Return credit after cancellation': 'Devolucion de crédito después de la baja',
820820
'Ring': 'Sonar',
821821
'Ring all available channels until one answers': 'Hacer sonar todas las cuentas SIP hasta que una conteste',
822-
'Ring false': 'Ring falso',
822+
'Fake Ring': 'Ring falso',
823823
'Ring for': 'Sonar por',
824824
'Ring interface which was least recently called by this queue': 'Sonar la cuenta SIP que llamó menos',
825825
'Ring or playing MOH': 'Sonar o executar MOH',
@@ -1150,5 +1150,4 @@ Locale.load({
11501150
'name': 'nombre',
11511151
'to refill': 'para recargar',
11521152
'week': 'semana',
1153-
11541153
});

resources/locale/fr.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ Locale.load({
817817
'Return credit after cancellation': '',
818818
'Ring': 'Bague',
819819
'Ring all available channels until one answers': 'à ce que des réponses',
820-
'Ring false': 'Sonner faux',
820+
'Fake Ring': 'Sonner faux',
821821
'Ring for': 'Sonnerie pour',
822822
'Ring interface which was least recently called by this queue': 'attente',
823823
'Ring or playing MOH': 'Anneau ou jouer du moh',
@@ -1158,5 +1158,4 @@ Locale.load({
11581158
'success': 'Succès',
11591159
'to refill': 'recharger',
11601160
'week': 'semaine',
1161-
11621161
});

resources/locale/it.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ Locale.load({
818818
'Return credit after cancellation': '',
819819
'Ring': 'Squillare',
820820
'Ring all available channels until one answers': 'Suonare tutti i canali disponibili fino a quando non risponde',
821-
'Ring false': 'Anello falso',
821+
'Fake Ring': 'Anello falso',
822822
'Ring for': 'Anello per',
823823
'Ring interface which was least recently called by this queue': 'Interfaccia ad anello che è stata recentemente recentemente chiamata di recente da questa coda',
824824
'Ring or playing MOH': 'Anello o giocare a moh',
@@ -1158,5 +1158,4 @@ Locale.load({
11581158
'success': 'successo',
11591159
'to refill': 'per ricaricare',
11601160
'week': 'settimana',
1161-
11621161
});

0 commit comments

Comments
 (0)