billing now supports domain_uuid to let currect domain erasing work properly, missing support to bill extension created added
This commit is contained in:
@@ -55,6 +55,8 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.
|
|||||||
$action = "add";
|
$action = "add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$domain_uuid = $_SESSION['domain_uuid'];
|
||||||
|
|
||||||
//get http post variables and set them to php variables
|
//get http post variables and set them to php variables
|
||||||
if (count($_POST) > 0) {
|
if (count($_POST) > 0) {
|
||||||
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
|
||||||
@@ -402,7 +404,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
$settled=1;
|
$settled=1;
|
||||||
$mc_gross = $destination_sell_current_currency;
|
$mc_gross = $destination_sell_current_currency;
|
||||||
$post_payload = serialize($_POST);
|
$post_payload = serialize($_POST);
|
||||||
$db2->sql = "INSERT INTO v_billing_invoices (billing_invoice_uuid, billing_uuid, payer_uuid, billing_payment_date, settled, amount, debt, post_payload,plugin_used) VALUES ('$billing_invoice_uuid', '$billing_uuid', '$user_uuid', NOW(), $settled, $mc_gross, $balance, '$post_payload', 'DID $destination_number Assigment' )";
|
$db2->sql = "INSERT INTO v_billing_invoices (billing_invoice_uuid, billing_uuid, payer_uuid, billing_payment_date, settled, amount, debt, post_payload,plugin_used, domain_uuid) VALUES ('$billing_invoice_uuid', '$billing_uuid', '$user_uuid', NOW(), $settled, $mc_gross, $balance, '$post_payload', 'DID $destination_number Assigment', '$domain_uuid' )";
|
||||||
$db2->result = $db2->execute();
|
$db2->result = $db2->execute();
|
||||||
unset($db2->sql, $db2->result);
|
unset($db2->sql, $db2->result);
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){
|
||||||
require_once "app/billings/functions.php";
|
require_once "app/billing/resources/functions/currency.php";
|
||||||
|
require_once "app/billing/resources/functions/rating.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
@@ -53,6 +54,8 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config
|
|||||||
$action = "add";
|
$action = "add";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$domain_uuid = $_SESSION['domain_uuid'];
|
||||||
|
|
||||||
//get the http values and set them as php variables
|
//get the http values and set them as php variables
|
||||||
if (count($_POST) > 0) {
|
if (count($_POST) > 0) {
|
||||||
//get the values from the HTTP POST and save them as PHP variables
|
//get the values from the HTTP POST and save them as PHP variables
|
||||||
@@ -475,6 +478,31 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
|
|
||||||
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){
|
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){
|
||||||
// Let's bill $j has the number of extensions to bill
|
// Let's bill $j has the number of extensions to bill
|
||||||
|
$db2 = new database;
|
||||||
|
$db2->sql = "SELECT currency, billing_uuid, balance FROM v_billings WHERE type_value='$destination_accountcode'";
|
||||||
|
$db2->result = $db2->execute();
|
||||||
|
$default_currency = (strlen($_SESSION['billing']['currency']['text'])?$_SESSION['billing']['currency']['text']:'USD');
|
||||||
|
$billing_currency = (strlen($db2->result[0]['currency'])?$db2->result[0]['currency']:$default_currency);
|
||||||
|
$destination_sell_current_currency = currency_convert($destination_sell,$billing_currency,$currency);
|
||||||
|
$billing_uuid = $db2->result[0]['billing_uuid'];
|
||||||
|
$balance = $db2->result[0]['balance'];
|
||||||
|
unset($db2->sql, $db2->result);
|
||||||
|
|
||||||
|
$default_extension_pricing = (strlen($_SESSION['billing']['extension.pricing']['numeric'])?$_SESSION['billing']['extension.pricing']['numeric']:'0');
|
||||||
|
$total_price = $default_extension_pricing * $j;
|
||||||
|
$balance -= $total_price;
|
||||||
|
$db2->sql = "UPDATE v_billings SET balance = $balance, old_balance = $balance WHERE type_value='$destination_accountcode'";
|
||||||
|
$db2->result = $db2->execute();
|
||||||
|
unset($db2->sql, $db2->result);
|
||||||
|
|
||||||
|
$billing_invoice_uuid = uuid();
|
||||||
|
$user_uuid = check_str($_SESSION['user_uuid']);
|
||||||
|
$settled=1;
|
||||||
|
$mc_gross = $total_price;
|
||||||
|
$post_payload = serialize($_POST);
|
||||||
|
$db2->sql = "INSERT INTO v_billing_invoices (billing_invoice_uuid, billing_uuid, payer_uuid, billing_payment_date, settled, amount, debt, post_payload,plugin_used, domain_uuid) VALUES ('$billing_invoice_uuid', '$billing_uuid', '$user_uuid', NOW(), $settled, $mc_gross, $balance, '$post_payload', '$j extension(s) created', '$domain_uuid' )";
|
||||||
|
$db2->result = $db2->execute();
|
||||||
|
unset($db2->sql, $db2->result);
|
||||||
}
|
}
|
||||||
} //if ($action == "add")
|
} //if ($action == "add")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user