From f77545bf40d329f1abdb6b0df37fe9820f87462e Mon Sep 17 00:00:00 2001 From: luis daniel lucio quiroz Date: Wed, 25 Jun 2014 17:45:48 +0000 Subject: [PATCH] extension app is getting ready for billing --- app/extensions/app_languages.php | 5 +++++ app/extensions/extension_edit.php | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index 6d96c1d632..09da6428c7 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -612,4 +612,9 @@ $text['message-required']['pt-pt'] = "Por favor forneça: "; $text['message-required']['fr-fr'] = "Merci d'indiquer: "; + $text['label-billing_warning']['en-us'] = "Billing is installed, please take note you need to have enough balance to create extensions."; + $text['label-billing_warning']['es-cl'] = "La cobranza está instalada, por favor note que necesita suficiente balance para crear extensiones."; + $text['label-billing_warning']['pt-pt'] = "A coleção é instalado, por favor, note que você precisa saldo suficiente para criar extensões."; + $text['label-billing_warning']['fr-fr'] = "La collection est installée, s'il vous plaît noter que vous devez assez d'équilibre pour créer des extensions."; + ?> diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index aa9d7efb56..7ef26e6804 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -21,6 +21,7 @@ Contributor(s): Mark J Crane + Luis Daniel Lucio Quiroz */ include "root.php"; require_once "resources/require.php"; @@ -33,6 +34,10 @@ else { exit; } +if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){ + require_once "app/billings/functions.php"; +} + //add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { @@ -320,6 +325,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } } + $j = 0; for ($i=1; $i<=$range; $i++) { if (extension_exists($extension)) { //extension exists @@ -435,6 +441,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); + $j++; } //add or update voicemail @@ -461,6 +468,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //increment the extension number $extension++; } + + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){ + // Let's bill $j has the number of extensions to bill + } } //if ($action == "add") //update the database @@ -803,6 +814,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + // Billing + if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billings/app_config.php")){ + if ($action == "add" && permission_exists('extension_add')) { // only when adding + echo "\n"; + echo "\n"; + echo "
".$text['label-billing_warning']."
\n"; + echo "\n"; + echo "\n"; + } + } echo "\n"; echo "\n"; echo " ".$text['label-extension'].":\n";