You guys will be happy to know that I saw this...and I didn't like it....so I fixed it...patch will be up later today
EDIT--
Hmm.....sorry for the delay....but i had to look through my version of A2Billing and figure out what the hell i changed that was relevant to this....since i did TONS of changes on my version....anyhoo if you have any issues post them here because i'm not sure if i'll post the
whole fix...the first time...
Here we go!
../a2billingcustomer/A2B_entity_did.php
Change Line 37
Code:
if (strlen($destination)>0 && is_numeric($choose_did) && is_numeric($voip_call)){
$FG_DID_TABLE = "cc_did";
$FG_DID_FIELDS = "did";
$instance_sub_table = new Table($FG_DID_TABLE, $FG_DID_FIELDS);
$QUERY = "INSERT INTO cc_did_destination (activated, id_cc_card, id_cc_did, destination, priority, voip_call) VALUES ('0', '".$_SESSION["card_id"]."', '".$choose_did."', '".$destination."', '1', '".$voip_call."')";
$result = $instance_sub_table -> SQLExec ($HD_Form -> DBHandle, $QUERY, 0);
$date = date("D M j G:i:s T Y", time());
$message = "\n\n".gettext("The following Destinaton-DID has been added:")."\n\n";
$message .= "$QUERY";
// email header
$em_headers = "From: A2BILLING ALERT <a2billing_alert@localhost>\n";
$em_headers .= "X-Priority: 3\n";
if (strlen($A2B->config["webcustomerui"]['error_email'])>3)
mail($A2B->config["webcustomerui"]['error_email'], "[$date] Destinaton-DID notification", $message, $em_headers);
}
TOCode:
if (strlen($destination)>0 && is_numeric($choose_did) && is_numeric($voip_call)){
$FG_DID_TABLE = "cc_did";
$FG_DID_FIELDS = "did";
$instance_sub_table = new Table($FG_DID_TABLE, $FG_DID_FIELDS);
$result = mysql_query("SELECT * FROM cc_did_destination where id_cc_did = ".$choose_did);
$row = mysql_fetch_row($result);
if($choose_did==$row[2])
{
$QUERY = "UPDATE cc_did_destination SET activated='1', id_cc_card='".$_SESSION["card_id"]."', id_cc_did='".$choose_did."', destination='".$destination."', priority='1', voip_call='".$voip_call."'";
$DID_UID_QUERY .= "UPDATE cc_did SET iduser='".$_SESSION["card_id"]."' WHERE id='".$choose_did."'";
$added = false;
}
else
{
$QUERY = "INSERT INTO cc_did_destination (activated, id_cc_card, id_cc_did, destination, priority, voip_call) VALUES ('0', '".$_SESSION["card_id"]."', '".$choose_did."', '".$destination."', '1', '".$voip_call."')";
$DID_UID_QUERY .= "UPDATE cc_did SET iduser='".$_SESSION["card_id"]."' WHERE id='".$choose_did."'";
$added = true;
}
//echo "QUERY = ".$QUERY."<br>";
//echo "DID_UID_QUERY = ".$DID_UID_QUERY."<br>";
$result = $instance_sub_table -> SQLExec ($HD_Form -> DBHandle, $QUERY, 0);
$DID_UID_result = $instance_sub_table -> SQLExec ($HD_Form -> DBHandle, $DID_UID_QUERY, 0);
if ($added)
{
$date = date("D M j G:i:s T Y", time());
$message = "\n\n".gettext("The following Destinaton-DID has been added:")."\n\n";
$message .= "$QUERY";
// email header
$em_headers = "From: A2BILLING ALERT <a2billing_alert@localhost>\n";
$em_headers .= "X-Priority: 3\n";
if (strlen($A2B->config["webcustomerui"]['error_email'])>3)
mail($A2B->config["webcustomerui"]['error_email'], "[$date] Destinaton-DID notification", $message, $em_headers);
}
}
Change Line 154Code:
$FG_TABLE_CLAUSE = " id_cc_country=$choose_country and id_cc_didgroup='".$_SESSION["id_didgroup"]."' and cc_did.activated='1'";
TOCode:
$FG_TABLE_CLAUSE = " id_cc_country=$choose_country and id_cc_didgroup='".$_SESSION["id_didgroup"]."' and cc_did.activated='1' and cc_did.iduser='0'";