Skip to content

Commit

Permalink
0.7.4 rev 4951
Browse files Browse the repository at this point in the history
  • Loading branch information
nightflyza committed Jan 28, 2016
1 parent 15fbdfe commit bf8d88b
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 76 deletions.
2 changes: 1 addition & 1 deletion RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.4 rev 4946
0.7.4 rev 4951
1 change: 0 additions & 1 deletion api/apiloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
include('api/libs/api.percity.php');
include('api/libs/api.dealwithit.php');
include('api/libs/api.megogo.php');
include('api/libs/api.olltv.php');
include('api/libs/api.userside.php');


Expand Down
2 changes: 1 addition & 1 deletion api/libs/api.custmaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ protected function kmlExtractPlacemarks($data) {
if (!empty($data)) {
foreach ($data as $io => $each) {
if (isset($each['Point'])) {
$result[$i]['name'] = trim($each['name']);
@$result[$i]['name'] = trim($each['name']);
$coordsRaw = trim($each['Point']['coordinates']);
$coordsRaw = explode(',', $coordsRaw);
$result[$i]['geo'] = $coordsRaw[1] . ', ' . $coordsRaw[0];
Expand Down
40 changes: 40 additions & 0 deletions api/libs/api.dealwithit.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ protected function setActionNames() {
$this->actionNames = array(
'noaction' => '-',
'addcash' => __('Add cash'),
'corrcash' => __('Correct saldo'),
'setcash' => __('Set cash'),
'credit' => __('Change') . ' ' . __('credit'),
'creditexpire' => __('Change') . ' ' . __('credit expire date'),
'tariffchange' => __('Change') . ' ' . __('tariff'),
Expand All @@ -103,6 +105,8 @@ protected function setActionsURL() {
$this->actions = array(
self::URL_ME . '&ajinput=noaction' => $this->actionNames['noaction'],
self::URL_ME . '&ajinput=addcash' => $this->actionNames['addcash'],
self::URL_ME . '&ajinput=corrcash' => $this->actionNames['corrcash'],
self::URL_ME . '&ajinput=setcash' => $this->actionNames['setcash'],
self::URL_ME . '&ajinput=credit' => $this->actionNames['credit'],
self::URL_ME . '&ajinput=creditexpire' => $this->actionNames['creditexpire'],
self::URL_ME . '&ajinput=tariffchange' => $this->actionNames['tariffchange'],
Expand Down Expand Up @@ -191,6 +195,14 @@ public function catchAjRequest() {
$result.= wf_HiddenInput('newschedaction', 'addcash');
$result.= wf_TextInput('newschedparam', __('Sum'), '', true, 5);
break;
case 'corrcash':
$result.= wf_HiddenInput('newschedaction', 'corrcash');
$result.= wf_TextInput('newschedparam', __('Sum'), '', true, 5);
break;
case 'setcash':
$result.= wf_HiddenInput('newschedaction', 'setcash');
$result.= wf_TextInput('newschedparam', __('Sum'), '', true, 5);
break;
case 'credit':
$result.= wf_HiddenInput('newschedaction', 'credit');
$result.= wf_TextInput('newschedparam', __('New credit'), '', true, 5);
Expand Down Expand Up @@ -296,6 +308,28 @@ public function catchCreateRequest() {
$result = __('No all of required fields is filled');
}
break;
case 'corrcash':
if ($param) {
if (zb_checkMoney($param)) {
$this->createTask($date, $login, $action, $param, $note);
} else {
$result = __('Wrong format of a sum of money to pay');
}
} else {
$result = __('No all of required fields is filled');
}
break;
case 'setcash':
if ($param) {
if (zb_checkMoney($param)) {
$this->createTask($date, $login, $action, $param, $note);
} else {
$result = __('Wrong format of a sum of money to pay');
}
} else {
$result = __('No all of required fields is filled');
}
break;
case 'credit':
if ($param >= 0) {
if (zb_checkMoney($param)) {
Expand Down Expand Up @@ -470,6 +504,12 @@ public function tasksProcessing() {
case 'addcash':
zb_CashAdd($login, $param, 'add', 1, 'SCHEDULED');
break;
case 'corrcash':
zb_CashAdd($login, $param, 'correct', 1, 'SCHEDULED');
break;
case 'setcash':
zb_CashAdd($login, $param, 'set', 1, 'SCHEDULED');
break;
case 'credit':
$billing->setcredit($login, $param);
log_register('CHANGE Credit (' . $login . ') ON ' . $param);
Expand Down
10 changes: 6 additions & 4 deletions api/libs/api.warehouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2688,13 +2688,15 @@ public function reportDateRemains() {
$fourthColumnCount = $lowerRemains[$itemtypeId]['count'] + $secondColumnCount - $thirdColumnCount;
$fourthColumnPrice = $lowerRemains[$itemtypeId]['price'] + $secondColumnPrice - $thirdColumnPrice;

$result.=$this->reportDateRemainsAddRow($itemtypeId, array($firstColumnCount, $firstColumnPrice,
$result.=$this->reportDateRemainsAddRow($itemtypeId, array(
$firstColumnCount,
round($firstColumnPrice,2),
$secondColumnCount,
$secondColumnPrice,
round($secondColumnPrice,2),
$thirdColumnCount,
$thirdColumnPrice,
round($thirdColumnPrice,2),
$fourthColumnCount,
$fourthColumnPrice));
round($fourthColumnPrice,2)));

$firstColumnTotal+=$firstColumnPrice;
$secondColumnTotal+=$secondColumnPrice;
Expand Down
14 changes: 14 additions & 0 deletions config/snmptemplates/Eltex-LTE8x
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[define]
DEVICE="Eltex LTE-8X"
;Software, Version 10.1.0B Build 18099

[signal]
SIGNALMODE="BDCOM"
SIGINDEX=".1.3.6.1.4.1.35265.1.21.6.1.1.15.6"
MACINDEX=".1.3.6.1.4.1.35265.1.21.6.1.1.1.6"
SIGVALUE="INTEGER:"
MACVALUE="Hex-STRING:"
OFFSET="10"
OFFSETMODE="div"
DOWNVALUE="-400"

2 changes: 1 addition & 1 deletion userstats/config/modules.d/adservice
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME="Additional services"
ADSERVICE_ENABLED
NEED="ADSERVICE_ENABLED"
170 changes: 102 additions & 68 deletions userstats/modules/general/adservice/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@

$applyDateType = $us_config['ADSERVICE_DATE'];
$serviceNameData = $us_config['ADSERVICE_NAMES'];
$availableServices = explode(",", $serviceNameData);
if (strpos($serviceNameData, ',') === false) {
$availableServices = $serviceNameData;
} else {
$availableServices = explode(",", $serviceNameData);
}
$serviceCostData = $us_config['ADSERVICE_COST'];
$serviceCost = explode(",", $serviceCostData);
if (strpos($serviceCostData, ',') === false) {
$serviceCost = $serviceCostData;
} else {
$serviceCost = explode(",", $serviceCostData);
}

/**
* Find in DB matches with login, note, action and param and returns it if some services is sheduled to activate
Expand All @@ -23,21 +31,27 @@ function GetAllSheduled($availableServices, $login) {
$type = 'tagadd';
$note = 'Order from userstats';
$query = "SELECT `param` FROM `dealwithit` WHERE ";
foreach ($availableServices as $eachService) {
$eachData = explode(":", $eachService);
$serviceTagID[] = $eachData[1];
}
foreach ($serviceTagID as $eachTagID) {
reset($serviceTagID);
if (current($serviceTagID) === $eachTagID) {
$query.= "(`login`='" . $login . "' AND `action`='" . $type . "' AND `note`='" . $note . "' AND `param`='" . $eachTagID . "')";
} else {
$query.= " OR (`login`='" . $login . "' AND `action`='" . $type . "' AND `note`='" . $note . "' AND `param`='" . $eachTagID . "')";
if (!empty($availableServices)) {
foreach ($availableServices as $eachService) {
$eachData = explode(":", $eachService);
$serviceTagID[] = $eachData[1];
}


foreach ($serviceTagID as $eachTagID) {
reset($serviceTagID);
if (current($serviceTagID) === $eachTagID) {
$query.= "(`login`='" . $login . "' AND `action`='" . $type . "' AND `note`='" . $note . "' AND `param`='" . $eachTagID . "')";
} else {
$query.= " OR (`login`='" . $login . "' AND `action`='" . $type . "' AND `note`='" . $note . "' AND `param`='" . $eachTagID . "')";
}
}
$query.= ';';
$result = simple_queryall($query);
return ($result);
} else {
return ('');
}
$query.= ';';
$result = simple_queryall($query);
return ($result);
}

/**
Expand All @@ -49,21 +63,25 @@ function GetAllSheduled($availableServices, $login) {
*/
function GetAllActivated($availableServices, $login) {
$query = "SELECT `tagid` FROM `tags` WHERE ";
foreach ($availableServices as $eachService) {
$eachData = explode(":", $eachService);
$serviceTagID[] = $eachData[1];
}
foreach ($serviceTagID as $eachTagID) {
reset($serviceTagID);
if (current($serviceTagID) === $eachTagID) {
$query.= "(`login`='" . $login . "' AND `tagid`='" . $eachTagID . "')";
} else {
$query.= " OR (`login`='" . $login . "' AND `tagid`='" . $eachTagID . "')";
if (!empty($availableServices)) {
foreach ($availableServices as $eachService) {
$eachData = explode(":", $eachService);
$serviceTagID[] = $eachData[1];
}
foreach ($serviceTagID as $eachTagID) {
reset($serviceTagID);
if (current($serviceTagID) === $eachTagID) {
$query.= "(`login`='" . $login . "' AND `tagid`='" . $eachTagID . "')";
} else {
$query.= " OR (`login`='" . $login . "' AND `tagid`='" . $eachTagID . "')";
}
}
$query.= ';';
$result = simple_queryall($query);
return($result);
} else {
return ('');
}
$query.= ';';
$result = simple_queryall($query);
return($result);
}

if ($applyDateType == 'nextday') {
Expand Down Expand Up @@ -107,25 +125,31 @@ function GetFullApplyDate() {
*/
function AdServicesSelector($availableServices, $login) {
$selectData['-'] = '-';
$allSheduled = GetAllSheduled($availableServices, $login);
$allActivated = GetAllActivated($availableServices, $login);
foreach ($availableServices as $eachService) {
$eq = true;
$eachData = explode(":", $eachService);
$serviceName = $eachData[0];
$serviceTagID = $eachData[1];
foreach ($allSheduled as $eachShedule) {
if ($eachShedule['param'] === $serviceTagID) {
$eq = false;
if (!empty($availableServices)) {
$allSheduled = GetAllSheduled($availableServices, $login);
$allActivated = GetAllActivated($availableServices, $login);
foreach ($availableServices as $eachService) {
$eq = false;
$eachData = explode(":", $eachService);
$serviceName = $eachData[0];
$serviceTagID = $eachData[1];
if (!empty($allSheduledl)) {
foreach ($allSheduled as $eachShedule) {
if ($eachShedule['param'] === $serviceTagID) {
$eq = true;
}
}
}
}
foreach ($allActivated as $eachActivated) {
if ($eachActivated['tagid'] === $serviceTagID) {
$eq = false;
if (!empty($allActivated)) {
foreach ($allActivated as $eachActivated) {
if ($eachActivated['tagid'] === $serviceTagID) {
$eq = true;
}
}
}
if (!$eq) {
$selectData[$serviceTagID] = $serviceName;
}
}
if ($eq) {
$selectData[$serviceTagID] = $serviceName;
}
}
$selector = la_Selector('tagid', $selectData, '', '', false);
Expand All @@ -148,13 +172,15 @@ function AdServicesList($serviceCost, $currency) {
$cell = la_TableCell(__('Aditional service name'));
$cell.= la_TableCell(__('Cost'));
$rows = la_TableRow($cell, 'row1');
foreach ($serviceCost as $allCost) {
$data = explode(":", $allCost);
$name = trim($data[0]);
$cost = trim($data[1]);
$cell = la_TableCell($name);
$cell.= la_TableCell($cost . " " . $currency);
$rows.= la_TableRow($cell, 'row3');
if (!empty($serviceCost)) {
foreach ($serviceCost as $allCost) {
$data = explode(":", $allCost);
$name = trim($data[0]);
$cost = trim($data[1]);
$cell = la_TableCell($name);
$cell.= la_TableCell($cost . " " . $currency);
$rows.= la_TableRow($cell, 'row3');
}
}
$result = la_TableBody($rows, '100%', 0, '');
return($result);
Expand Down Expand Up @@ -188,22 +214,30 @@ function ShowAllOrderedServices($availableServices, $login) {
$cells = la_TableCell(__('Service name'));
$cells.= la_TableCell(__('Status'));
$rows = la_TableRow($cells, 'row1');
foreach ($availableServices as $eachService) {
$each = explode(":", $eachService);
$name = $each[0];
$tagid = $each[1];
foreach ($allSheduled as $eachSheduled) {
if ($eachSheduled['param'] == $tagid) {
$cells = la_TableCell($name);
$cells.= la_TableCell(__('Sheduled'));
$rows.= la_TableRow($cells, 'row3');
if (!empty($availableServices)) {
foreach ($availableServices as $eachService) {
$each = explode(":", $eachService);
$name = $each[0];
$tagid = $each[1];
if (!empty($allSheduled)) {
foreach ($allSheduled as $eachSheduled) {
if ($eachSheduled['param'] == $tagid) {
$cells = la_TableCell($name);
$cells.= la_TableCell(__('Sheduled'));
$rows.= la_TableRow($cells, 'row3');
}
}
}
}
foreach ($allActivated as $eachActivated) {
if ($eachActivated['tagid'] == $tagid) {
$cells = la_TableCell($name);
$cells.= la_TableCell(__('Active'));
$rows.=la_TableRow($cells, 'row3');
if (!empty($allActivated)) {
if (!empty($allActivated)) {
foreach ($allActivated as $eachActivated) {
if ($eachActivated['tagid'] == $tagid) {
$cells = la_TableCell($name);
$cells.= la_TableCell(__('Active'));
$rows.=la_TableRow($cells, 'row3');
}
}
}
}
}
Expand All @@ -226,7 +260,7 @@ function ShowAllOrderedServices($availableServices, $login) {
show_window(__('Aditional services'), __('You can order aditional services. Available services - listed below.'));
show_window(__('Aditional services cost'), AdServicesList($serviceCost, $us_config['currency']));
show_window(__('Order aditional service'), AdServicesSelector($availableServices, $user_login));
show_window(__('Activated services'), ShowAllOrderedServices($availableServices, $user_login));
show_window(__('Activated services'), ShowAllOrderedServices($availableServices, $user_login));
} else {
show_window(__('Sorry'), __('This module is disabled'));
}
}

0 comments on commit bf8d88b

Please sign in to comment.