The changes that should be applied are incomplete in the git version Joe referenced. If you want to fix it, you need to apply the patch or do it manually. The second patch actually fixes an error in the first patch, so both patches must be executed in the order given.
Note: This patch addresses more than just the issue in question. The parts of the code pertaining to this specific issue are not fully implemented on git.
diff -B -u -r Star2Billing194orig/admin/Public/A2B_entity_friend.php Star2Billing194mod/admin/Public/A2B_entity_friend.php
--- Star2Billing194orig/admin/Public/A2B_entity_friend.php 2011-05-31 15:39:39.000000000 -0400
+++ Star2Billing194mod/admin/Public/A2B_entity_friend.php 2011-11-12 09:03:16.299767341 -0500
@@ -273,7 +273,7 @@
<b> <?php echo $HD_Form -> FG_NB_RECORD ?> <?php echo gettext("cards selected!"); ?> <?php echo gettext("Use the options below to batch update the selected cards.");?></b>
<table align="center" border="0" width="65%" cellspacing="1" cellpadding="2">
<tbody>
- <form name="updateForm" action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
+ <form name="updateForm" action="<?php echo $_SERVER['PHP_SELF'].'?atmenu='.$atmenu?>" method="post">
<INPUT type="hidden" name="batchupdate" value="1">
<tr>
<td align="left" class="bgcolor_001" >
diff -B -u -r Star2Billing194orig/common/lib/Class.A2Billing.php Star2Billing194mod/common/lib/Class.A2Billing.php
--- Star2Billing194orig/common/lib/Class.A2Billing.php 2011-05-31 15:39:39.000000000 -0400
+++ Star2Billing194mod/common/lib/Class.A2Billing.php 2011-11-12 09:38:50.161765887 -0500
@@ -772,7 +772,7 @@
return true;
}
} else {
- if ($this->credit <= -$this->creditlimit) {
+ if (!($this->credit <= $this->creditlimit)) {
$QUERY = "SELECT id_cc_package_offer FROM cc_tariffgroup WHERE id= ".$this->tariff ;
$result = $this -> instance_table -> SQLExec ($this->DBHandle, $QUERY);
if (!empty($result[0][0])) {
@@ -1163,7 +1163,7 @@
if ($this->agiconfig['busy_timeout'] > 0)
$res_busy = $agi->exec("Busy ".$this->agiconfig['busy_timeout']);
$agi-> stream_file('prepaid-isbusy', '#');
- } elseif ($this->dialstatus == "NOANSWER") {
+ } elseif ($dialstatus == "NOANSWER") {
$answeredtime = 0;
$agi-> stream_file('prepaid-noanswer', '#');
} elseif ($dialstatus == "CANCEL") {
@@ -1318,7 +1318,7 @@
continue;
} elseif ($dialstatus == "CANCEL") {
// Call cancelled, no need to follow-me
- return 1;
+ $answeredtime = 0;
} elseif ($dialstatus == "ANSWER") {
$this -> debug( DEBUG, $agi, __FILE__, __LINE__,
"[A2Billing] DID call friend: dialstatus : $dialstatus, answered time is ".$answeredtime." \n");
@@ -1459,10 +1459,10 @@
}
}
} else {
- if ($this->credit <= -$this->creditlimit) {
+ if (!($this->credit <= $this->creditlimit)) {
$time2call =0;
} else {
- $credit_without_charge = $this->credit + abs($this->creditlimit) - abs($connection_charge);
+ $credit_without_charge = $this->credit - abs($connection_charge);
if ($credit_without_charge>0 && $selling_rate!=0 ) {
$time2call = intval($credit_without_charge / abs($selling_rate))*60;
} else {
@@ -1523,7 +1523,7 @@
// Dial(IAX2/
[email protected]/s@default)
$myres = $this -> run_dial($agi, $dialstr);
$this -> debug( INFO, $agi, __FILE__, __LINE__, "DIAL $dialstr");
- } else {
+ } elseif ( $time2call > 0) { // prevent 0 time to call on follow me
$this -> debug( INFO, $agi, __FILE__, __LINE__, "TIME TO CALL : $time2call");
$this -> fct_say_time_2_call($agi,$time2call,$selling_rate);
@@ -1543,6 +1543,8 @@
$myres = $agi->exec("StopMixMonitor");
$this -> debug( INFO, $agi, __FILE__, __LINE__, "EXEC StopMixMonitor (".$this->uniqueid.")");
}
+ } else {
+ continue;
}
$answeredtime = $agi->get_variable("ANSWEREDTIME");
@@ -1565,14 +1567,14 @@
$agi-> stream_file('prepaid-isbusy', '#');
if (count($listdestination)>$callcount)
continue;
- } elseif ($this->dialstatus == "NOANSWER") {
+ } elseif ($dialstatus == "NOANSWER") {
$answeredtime = 0;
$agi-> stream_file('prepaid-callfollowme', '#');
if (count($listdestination) > $callcount)
continue;
} elseif ($dialstatus == "CANCEL") {
// Call cancelled, no need to follow-me
- return 1;
+ $answeredtime = 0;
} elseif ($dialstatus == "ANSWER") {
$this -> debug( DEBUG, $agi, __FILE__, __LINE__,
"[A2Billing] DID call friend: dialstatus : $dialstatus, answered time is ".$answeredtime." \n");
diff -B -u -r Star2Billing194orig/customer/form_data/FG_var_signup.inc Star2Billing194mod/customer/form_data/FG_var_signup.inc
--- Star2Billing194orig/customer/form_data/FG_var_signup.inc 2011-05-31 15:39:39.000000000 -0400
+++ Star2Billing194mod/customer/form_data/FG_var_signup.inc 2011-11-12 08:46:27.354704491 -0500
@@ -152,16 +152,32 @@
$language_list = Constants::getLanguagesList();
if (LANGUAGE_ENABLE) {
-$HD_Form->AddEditElement(gettext("LANGUAGE"), "language", "", "SELECT", "", "", "", "list", "", "", "", $language_list, "%1", "", "");
-$language_editFG = "language,";
+
+ $languageSelect = '';
+ if (!empty($_POST['language'])) {
+ $languageSelect = $_POST['language'];
+ }
+ $HD_Form->AddEditElement(gettext("LANGUAGE"), "language", "$languageSelect", "SELECT", "", "", "", "list", "", "", "", $language_list, "%1", "", "");
+ $language_editFG = "language,";
}
if (CURRENCY_ENABLE) {
-$HD_Form->AddEditElement("CURRENCY", "currency", "", "SELECT", "", "", "", "list", "", "", "", $currency_list, "%1", "", "");
-$currency_editFG = "currency,";
+
+ $currencySelect = '';
+ if (!empty($_POST['currency'])) {
+ $currencySelect = $_POST['currency'];
+ }
+
+ $HD_Form->AddEditElement("CURRENCY", "currency", "$currencySelect", "SELECT", "", "", "", "list", "", "", "", $currency_list, "%1", "", "");
+ $currency_editFG = "currency,";
}
if (!$agent_conf && strpos($callPlan_idlist, ',') !== false && !($subscriber_signup>0)) {
- $HD_Form->AddEditElement(gettext("CALL PLAN"), "tariff", "", "SELECT", "", "", "", "list", "", "", "", $callPlan_list, "%1", "", "");
+ $callPlanSelect = '';
+ if (!empty($_POST['tariff'])) {
+ $callPlanSelect = $_POST['tariff'];
+ }
+ $HD_Form->AddEditElement(gettext("CALL PLAN"), "tariff", "$callPlanSelect", "SELECT", "", "", "", "list", "", "", "", $callPlan_list, "%1", "", "");
}
+
$comp_zero = $comp_date_plus = '';
if (isset ($form_action) && $form_action == "ask-add") {
$begin_date = date("Y");
@@ -226,6 +242,9 @@
$country_default_val = 'USA';
}
if (COUNTRY_ENABLE) {
+ if (!empty($_POST['country'])) {
+ $country_default_val = $_POST['country'];
+ }
$HD_Form->AddEditElement(gettext("COUNTRY"),
"country",
"$country_default_val",
@@ -254,6 +273,9 @@
}
}
if (TIMEZONE_ENABLE) {
+ if (is_numeric($_POST['id_timezone'])) {
+ $timezone_default_val = $_POST['id_timezone'];
+ }
$HD_Form->AddEditElement(gettext("TIMEZONE"),
"id_timezone",
"$timezone_default_val",
diff -B -u -r Star2Billing194mod/common/lib/Class.A2Billing.php Star2Billing194mod2/common/lib/Class.A2Billing.php
--- Star2Billing194mod/common/lib/Class.A2Billing.php 2011-11-12 09:38:50.161765887 -0500
+++ Star2Billing194mod2/common/lib/Class.A2Billing.php 2012-01-24 01:21:17.095488158 -0500
@@ -766,13 +766,13 @@
function enough_credit_to_call()
{
if ($this->typepaid == 0) {
- if ($this->credit < $this->agiconfig['min_credit_2call'] || $this->credit < 0 ) {
+ if ($this->credit < $this->agiconfig['min_credit_2call'] || $this->credit <= 0 ) {
return false;
} else {
return true;
}
} else {
- if (!($this->credit <= $this->creditlimit)) {
+ if ($this->credit <= 0) {
$QUERY = "SELECT id_cc_package_offer FROM cc_tariffgroup WHERE id= ".$this->tariff ;
$result = $this -> instance_table -> SQLExec ($this->DBHandle, $QUERY);
if (!empty($result[0][0])) {
@@ -1459,7 +1459,7 @@
}
}
} else {
- if (!($this->credit <= $this->creditlimit)) {
+ if ($this->credit <= 0) {
$time2call =0;
} else {
$credit_without_charge = $this->credit - abs($connection_charge);