$amount = abs($Customer['credit']+$lastpostpaid_amount);
					$total = $total + $amount;
					$total_vat =$total_vat + round($amount *(1+($vat/100)),2);
					$field_insert = " id_invoice, price, vat, description, id_ext, type_ext";
					$instance_table = new Table("cc_invoice_item", $field_insert);
					$value_insert = " '$id_invoice', '$amount','$vat','$description','" . $id_billing . "','POSTPAID'";
					$instance_table->Add_table($A2B->DBHandle, $value_insert, null, null, "id");
					if ($verbose_level >= 2)
						echo "\n Add Invoice Item :> " . $value_insert;
				}
			}
			
			if (!empty($last_invoice)) {
			    $param_update_billing = "id_invoice = '".$last_invoice."'";
			    $clause_update_billing = " id= ".$id_billing;
			    $billing_table ->Update_table($A2B->DBHandle,$param_update_billing,$clause_update_billing);
			    if ($verbose_level >= 2)
					echo "\n Update Billing :> " . $param_update_billing . " WHERE " . $clause_update_billing;
			}
			
			// Send a mail for invoice to pay
			if (!empty($last_invoice)) {
			    $total = round($total,2);
			    try {
				    $mail = new Mail(Mail::$TYPE_INVOICE_TO_PAY, $card_id);
				    $mail->replaceInEmail(Mail::$INVOICE_REFERENCE_KEY, $invoice_reference);
				    $mail->replaceInEmail(Mail::$INVOICE_TITLE_KEY, $invoice_title);
				    $mail->replaceInEmail(Mail::$INVOICE_DESCRIPTION_KEY, $invoice_description);
				    $mail->replaceInEmail(Mail::$INVOICE_TOTAL_KEY, $total);
				    $mail->replaceInEmail(Mail::$INVOICE_TOTAL_VAT_KEY, $total_vat);
				    $mail->send();
     if (!USE_REALTIME) {
         $key = "sip_changed";
     }
 } else {
     $friend_param_update = " iax_buddy='1' ";
     if (!USE_REALTIME) {
         $key = "iax_changed";
     }
 }
 if (!USE_REALTIME) {
     $who = Notification::$AGENT;
     $who_id = $_SESSION['agent_id'];
     NotificationsDAO::AddNotification($key, Notification::$HIGH, $who, $who_id);
 }
 $instance_table_friend = new Table('cc_card');
 $instance_table_friend->Update_table($HD_Form->DBHandle, $friend_param_update, "id='{$id_cc_card}'", $func_table = null);
 if ($form_action == "add_sip") {
     $TABLE_BUDDY = 'cc_sip_buddies';
 } else {
     $TABLE_BUDDY = 'cc_iax_buddies';
 }
 $instance_table_friend = new Table($TABLE_BUDDY, '*');
 $list_friend = $instance_table_friend->Get_list($HD_Form->DBHandle, "id_cc_card='{$id_cc_card}'", null, null, null, null);
 if (is_array($list_friend) && count($list_friend) > 0) {
     Header("Location: " . $HD_Form->FG_GO_LINK_AFTER_ACTION);
     exit;
 }
 $form_action = "add";
 $_POST['accountcode'] = $_POST['username'] = $_POST['name'] = $_POST['cardnumber'] = $cardnumber;
 $_POST['allow'] = FRIEND_ALLOW;
 $_POST['context'] = FRIEND_CONTEXT;
include '../lib/admin.module.access.php';
include '../lib/Form/Class.FormHandler.inc.php';
include '../lib/admin.smarty.php';
if (!has_rights(ACX_INVOICING)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
/***********************************************************************************/
$DBHandle = DbConnect();
if ($form_action == "ask-modif") {
    getpost_ifset(array('company_name', 'address', 'zipcode', 'country', 'city', 'phone', 'fax', 'email', 'vat', 'web', 'display_account'));
    $table_invoice_conf = new Table("cc_invoice_conf");
    $param_update_conf = "value ='" . $company_name . "'";
    $clause_update_conf = "key_val = 'company_name'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
    $param_update_conf = "value ='" . $address . "'";
    $clause_update_conf = "key_val = 'address'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
    $param_update_conf = "value ='" . $zipcode . "'";
    $clause_update_conf = "key_val = 'zipcode'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
    $param_update_conf = "value ='" . $country . "'";
    $clause_update_conf = "key_val = 'country'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
    $param_update_conf = "value ='" . $city . "'";
    $clause_update_conf = "key_val = 'city'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
    $param_update_conf = "value ='" . $phone . "'";
    $clause_update_conf = "key_val = 'phone'";
    $table_invoice_conf->Update_table($DBHandle, $param_update_conf, $clause_update_conf, $func_table = null);
Example #4
0
				
				if (is_array($result_agent) && is_numeric($result_agent[0]['commission']) && $result_agent[0]['commission']>0) {
					$field_insert = "id_payment, id_card, amount,description,id_agent";
					$commission = a2b_round($addcredit * ($result_agent[0]['commission']/100));
					$description_commission = gettext("GENERATED COMMISSION OF AN CUSTOMER REFILLED BY AN AGENT!");
					$description_commission.= "\nID CARD : ".$id;
					$description_commission.= "\nID REFILL : ".$id_refill;
					$description_commission.= "\REFILL AMOUNT: ".$addcredit;
					$description_commission.= "\nCOMMISSION APPLIED: ".$result_agent[0]['commission'];
					$value_insert = "'-1', '$id', '$commission','$description_commission','$id_agent'";
					$commission_table = new Table("cc_agent_commission", $field_insert);
					$id_commission = $commission_table -> Add_table ($HD_Form -> DBHandle, $value_insert, null, null,"id");
					$table_agent = new Table('cc_agent');
					$param_update_agent = "com_balance = com_balance + '".$commission."'";
					$clause_update_agent = " id='".$id_agent."'";
					$table_agent -> Update_table ($HD_Form -> DBHandle, $param_update_agent, $clause_update_agent, $func_table = null);
				}
				
				
				if (!$id_refill ) {		
					$update_msg ="<b>".$instance_sub_table -> errstr."</b>";	
				}
			
			} else {
					
				$currencies_list = get_currencies();
		
				if (!isset($currencies_list[strtoupper($agent_info [0][1])][2]) || !is_numeric($currencies_list[strtoupper($agent_info [0][1])][2])) 
					$mycur = 1;
				else 
					$mycur = $currencies_list[strtoupper($agent_info [0][1])][2];
Example #5
0
			    }
			    echo "false";
			    die();
			}
			echo "false";
			die();
			break;
		case 'down':
			if(is_numeric($id_msg)){
			    $DBHandle = DbConnect();
			    $clause = "id = $id_msg";
			    $instance_table = new Table("cc_message_agent","*");
			    $result=$instance_table -> Get_list($DBHandle, $clause);
			    if(is_array($result) && sizeof($result)>0){
				$order = $result[0]['order_display'];
				$instance_table->Update_table($DBHandle, "order_display = order_display - 1", "id_agent = '".$id."' AND order_display =".($order+1));
				$instance_table->Update_table($DBHandle, "order_display = order_display + 1", "id_agent = '".$id."' AND order_display =".($order)." AND id =$id_msg");
				echo "true";
				die();
			    }
			    echo "false";
			    die();
			}
			echo "false";
			die();
			break;

	}
}
//load home message agent
if(empty($action)) $action="add";
Example #6
0
	static public function change_card_lock()
	{
		global $A2B;
		$FormHandler = FormHandler::GetInstance();
		$processed = $FormHandler->getProcessed();
		$instance_sub_table = new Table("cc_card", "block");
		$FG_TABLE_CLAUSE_CARD = "id = ".$processed['id'];
		$card_info = $instance_sub_table -> Get_list ($FormHandler -> DBHandle, $FG_TABLE_CLAUSE_CARD, null, null, null, null, null, null);
		if (is_array($result) && !empty($result[0][0])) {
			$card_lock_info = $card_info[0][0];
		
			if ($card_lock_info != $processed['block'] && $processed['block'] == 1) {
				$param_update_card = "lock_date = NOW()";
				$clause_update_card = "id = ".$processed['id'];
				$instance_sub_table -> Update_table ($FormHandler->DBHandle, $param_update_card, $clause_update_card, $func_table = null);
			}
		}
	}
Example #7
0
function generate_invoice_reference()
{
    $handle = DbConnect();
    $year = date("Y");
    $invoice_conf_table = new Table('cc_invoice_conf', 'value');
    $conf_clause = "key_val = 'count_{$year}'";
    $result = $invoice_conf_table->Get_list($handle, $conf_clause, 0);
    if (is_array($result) && !empty($result[0][0])) {
        $count = $result[0][0];
        if (!is_numeric($count)) {
            $count = 0;
        }
        $count++;
        $param_update_conf = "value ='" . $count . "'";
        $clause_update_conf = "key_val = 'count_{$year}'";
        $invoice_conf_table->Update_table($handle, $param_update_conf, $clause_update_conf, $func_table = null);
    } else {
        //insert newcount
        $count = 1;
        $QUERY = "INSERT INTO cc_invoice_conf (key_val ,value) VALUES ( 'count_{$year}', '1');";
        $invoice_conf_table->SQLExec($handle, $QUERY);
    }
    $reference = $year . sprintf("%08d", $count);
    return $reference;
}
Example #8
0
            Header("Location: A2B_receipt_edit.php?" . "id=" . $id);
            break;
        case 'update':
            if (!empty($idc) && is_numeric($idc)) {
                if (empty($date) || strtotime($date) === FALSE) {
                    $error_msg .= gettext("Date inserted is invalid, it must respect a date format YYYY-MM-DD HH:MM:SS (time is optional).<br/>");
                }
                if (empty($price) || !is_numeric($price)) {
                    $error_msg .= gettext("Amount inserted is invalid, it must be a number. Check the format.");
                }
                if (!empty($error_msg)) {
                    break;
                }
                $DBHandle = DbConnect();
                $instance_sub_table = new Table("cc_receipt_item", "*");
                $instance_sub_table->Update_table($DBHandle, "date='{$date}',description='{$description}',price='{$price}'", "id = {$idc}");
                Header("Location: A2B_receipt_edit.php?" . "id=" . $id);
            }
            break;
    }
}
$receipt = new Receipt($id);
$items = $receipt->loadItems();
$smarty->display('main.tpl');
?>
<table class="invoice_table" >
    <tr class="form_invoice_head">
        <td width="75%" colspan="2"><font color="#FFFFFF"><?php 
echo gettext("RECEIPT: ");
?>
</font><font color="#FFFFFF"><b><?php 
Example #9
0
function update_translation($id, $languages, $subject, $mailtext)
{
    if (empty($handle)) {
        $handle = DbConnect();
    }
    $instance_table = new Table();
    $param_update = "subject = '{$subject}', messagetext = '{$mailtext}'";
    $clause = "id = {$id} and id_language = '{$languages}'";
    $func_table = 'cc_templatemail';
    $update = $instance_table->Update_table($handle, $param_update, $clause, $func_table);
    return $update;
}
					if (!$fit_expression[$i]){
						$VALID_SQL_REG_EXP = false;
						$form_action="ask-edit";						
					}
				}
				
				if ($FG_DEBUG == 1) echo "<br>$fields_name : ".$$fields_name;
				if ($i>0) $param_update .= ", ";				
				$param_update .= "$fields_name = '".addslashes(trim($$fields_name))."'";

		}
		
	}
	if ($FG_DEBUG == 1)  echo "<br><hr> $param_update";	
	
	if ($VALID_SQL_REG_EXP) $instance_table -> Update_table ($DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null);
		
	if ( ($VALID_SQL_REG_EXP) && (isset($FG_GO_LINK_AFTER_ACTION))){
		Header ("Location: $FG_GO_LINK_AFTER_ACTION".$id);
	}
	
}


if ($form_action == "delete"){
	
	
	$res_delete = $instance_table -> Delete_table ($DBHandle, $FG_EDITION_CLAUSE, $func_table = null);
	if (!$res_delete){  echo gettext("error deletion");
	}else{
		  
Example #11
0
 function Reservation_Card($security_key, $transaction_code, $card_id, $cardnumber)
 {
     // Activate the card
     $FG_TABLE = "cc_card";
     $DBHandle = DbConnect();
     $instance_sub_table = new Table($FG_TABLE);
     $status_reserved = 4;
     $param_update = "status = {$status_reserved}";
     if (is_numeric($card_id) && $card_id > 0) {
         $clause = " id = {$card_id} ";
     } else {
         $clause = " username = '******' ";
     }
     $QUERY = "SELECT count(*) FROM {$FG_TABLE} WHERE " . $clause;
     $result = $instance_sub_table->SQLExec($DBHandle, $QUERY);
     if (!is_array($result) || $result[0][0] <= 0) {
         // FAIL FOUND CARD
         write_log(LOG_WEBSERVICE, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR SELECT -> QUERY");
         sleep(2);
         return array($transaction_code, 'result=500', ' ERROR - SELECT DB NO CARD WITH THIS ID OR CARDNUMBER');
     }
     $update = $instance_sub_table->Update_table($DBHandle, $param_update, $clause);
     if (!is_array($update) && count($update) == 0) {
         // FAIL SELECT
         write_log(LOG_WEBSERVICE, basename(__FILE__) . ' line:' . __LINE__ . "[" . date("Y/m/d G:i:s", mktime()) . "] " . " ERROR SELECT -> \n QUERY=" . $update);
         sleep(2);
         return array($transaction_code, 'result=500', " ERROR - Update : card_id={$card_id} ; cardnumber={$cardnumber}");
     } else {
         if (empty($card_id) && $card_id <= 0) {
             $clause = " username = '******' ";
             $QUERY = "SELECT id FROM {$FG_TABLE} WHERE " . $clause;
             $result = $instance_sub_table->SQLExec($DBHandle, $QUERY);
             $card_id = $result[0][0];
         }
         $field_insert = "status, id_cc_card";
         $value_insert = "'{$status_reserved}', '{$card_id}'";
         $instance_status_table = new Table("cc_status_log", $field_insert);
         $result_query = $instance_status_table->Add_table($DBHandle, $value_insert, null, null);
     }
     return array($transaction_code, 'result=200', " - Card Reserved : card_id={$card_id} ; cardnumber={$cardnumber}");
 }
	/**
	* Function to save_content
	* @public     	 
	*/
	function perform_update_content($sub_action,$id,$valcon)
	{
		$processed = $this->getProcessed();
		$table_split = preg_split("/:/", $this->FG_TABLE_EDITION[$sub_action][14]);
		if(array_key_exists($table_split[1].'_hidden', $processed)){
			$value = trim($processed[$table_split[1].'_hidden']);
		} else {
			$value = trim($processed[$table_split[1]]);
		}
		$instance_sub_table = new Table($table_split[0]);
		$SPLIT_FG_UPDATE_SET = $table_split[16]."='".$valcon."'";
		$SPLIT_FG_UPDATE_CLAUSE = $table_split[1]."='".$value."' AND ".$table_split[5]."='".trim($id)."'";
		$instance_sub_table -> Update_table ($this->DBHandle, $SPLIT_FG_UPDATE_SET, $SPLIT_FG_UPDATE_CLAUSE, $func_table = null);
	}
Example #13
0
			
	   	case 'update':
			if(!empty($idc) && is_numeric($idc)){
				if(empty($date) || strtotime($date)===FALSE){
					$error_msg.= gettext("Date inserted is invalid, it must respect a date format YYYY-MM-DD HH:MM:SS (time is optional).<br/>");
				}
				if( !is_numeric($vat)){
					$error_msg.= gettext("VAT inserted is invalid, it must be a number. Check the format.<br/>");
				}
				if(empty($price) || !is_numeric($price)){
					$error_msg .= gettext("Amount inserted is invalid, it must be a number. Check the format.");
				}
				if(!empty($error_msg)) break;
				$DBHandle = DbConnect();
				$instance_sub_table = new Table("cc_invoice_item", "*");
				$instance_sub_table -> Update_table($DBHandle,"date='$date',description='$description',price='$price',vat='$vat'", "id = $idc" );
				Header ("Location: A2B_invoice_edit.php?"."id=".$id);
				
	 		}
			break;
	}
}


$invoice = new invoice($id);
$table_card = new Table("cc_card","vat");
$result_vat = $table_card->Get_list(DbConnect(),"id=".$invoice->getCard());
$card_vat =  $result_vat[0][0];
$items = $invoice->loadItems();

                }
            }
            if ($FG_DEBUG == 1) {
                echo "<br>{$fields_name} : " . ${$fields_name};
            }
            if ($i > 0) {
                $param_update .= ", ";
            }
            $param_update .= $sp . "{$fields_name}" . $sp . " = '" . addslashes(trim(${$fields_name})) . "'";
        }
    }
    if ($FG_DEBUG == 1) {
        echo "<br><hr> {$param_update}";
    }
    if ($VALID_SQL_REG_EXP) {
        $instance_table->Update_table($DBHandle, $param_update, $FG_EDITION_CLAUSE, $func_table = null);
    }
    if ($VALID_SQL_REG_EXP && isset($FG_GO_LINK_AFTER_ACTION)) {
        Header("Location: {$FG_GO_LINK_AFTER_ACTION}" . $id);
    }
}
if ($form_action == "delete") {
    $res_delete = $instance_table->Delete_table($DBHandle, $FG_EDITION_CLAUSE, $func_table = null);
    if (!$res_delete) {
        echo gettext("error deletion");
    } else {
    }
    $FG_INTRO_TEXT_DELETION = str_replace("%id", "{$id}", $FG_INTRO_TEXT_DELETION);
    $FG_INTRO_TEXT_DELETION = str_replace("%table", "{$FG_TABLE_NAME}", $FG_INTRO_TEXT_DELETION);
    if (isset($FG_GO_LINK_AFTER_ACTION)) {
        Header("Location: {$FG_GO_LINK_AFTER_ACTION_DELETE}" . $id);
$QUERY = " id = %u";
$QUERY = sprintf($QUERY, $paymentMethodID);
$DBHandle = DbConnect();
$return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
$paymentMethod = substr($return[0][0], 0, strrpos($return[0][0], '.'));
$instance_sub_table = new Table("cc_configuration", "payment_filename");
$QUERY = " active = 't'";
$return = null;
if (tep_not_null($action)) {
    switch ($action) {
        case 'save':
            while (list($key, $value) = each($configuration)) {
                if ($key == 'MODULE_PAYMENT_PLUGNPAY_ACCEPTED_CC') {
                    $value = join($value, ', ');
                }
                $instance_sub_table->Update_table($DBHandle, "configuration_value = '" . $value . "'", "configuration_key = '" . $key . "'");
            }
            tep_redirect("A2B_entity_payment_settings.php?" . 'method=' . $paymentMethod . "&id=" . $id . "&result=success");
            break;
    }
}
$payment_modules = new payment($paymentMethod);
$GLOBALS['paypal']->enabled = true;
$GLOBALS['moneybookers']->enabled = true;
$GLOBALS['authorizenet']->enabled = true;
$GLOBALS['worldpay']->enabled = true;
$GLOBALS['plugnpay']->enabled = true;
//$GLOBALS['iridium']->enabled = true;
$module_keys = $payment_modules->keys();
$keys_extra = array();
$instance_sub_table = new Table("cc_configuration", "configuration_title, configuration_value, configuration_description, use_function, set_function");
 /**
  * Function to edit the fields
  * @public
  */
 function perform_edit(&$form_action)
 {
     include_once FSROOT . "lib/Class.Table.php";
     $processed = $this->getProcessed();
     //$processed['firstname']
     $this->VALID_SQL_REG_EXP = true;
     $instance_table = new Table($this->FG_TABLE_NAME, $this->FG_QUERY_EDITION);
     if ($processed['id'] != "" || !is_null($processed['id'])) {
         $this->FG_EDITION_CLAUSE = str_replace("%id", $processed['id'], $this->FG_EDITION_CLAUSE);
     }
     for ($i = 0; $i < $this->FG_NB_TABLE_EDITION; $i++) {
         $pos = strpos($this->FG_TABLE_EDITION[$i][14], ":");
         // SQL CUSTOM QUERY
         $pos_mul = strpos($this->FG_TABLE_EDITION[$i][4], "multiple");
         if (!$pos) {
             $fields_name = $this->FG_TABLE_EDITION[$i][1];
             $regexp = $this->FG_TABLE_EDITION[$i][5];
             if ($pos_mul && is_array($processed[$fields_name])) {
                 $total_mult_select = 0;
                 foreach ($processed[$fields_name] as $value) {
                     $total_mult_select += $value;
                 }
                 if ($this->FG_DEBUG == 1) {
                     echo "<br>{$fields_name} : " . $total_mult_select;
                 }
                 if ($i > 0) {
                     $param_update .= ", ";
                 }
                 $param_update .= "{$fields_name} = '" . addslashes(trim($total_mult_select)) . "'";
             } else {
                 if (is_numeric($regexp) && !(strtoupper(substr($this->FG_TABLE_ADITION[$i][13], 0, 2)) == "NO" && $processed[$fields_name] == "")) {
                     $this->FG_fit_expression[$i] = preg_match('/' . $this->FG_regular[$regexp][0] . '/', $processed[$fields_name]);
                     if ($this->FG_DEBUG == 1) {
                         echo "<br>-> {$i})  " . $this->FG_regular[$regexp][0] . " , " . $processed[$fields_name];
                     }
                     if (!$this->FG_fit_expression[$i]) {
                         $this->VALID_SQL_REG_EXP = false;
                         if ($this->FG_DEBUG == 1) {
                             echo "<br>-> {$i}) Error Match";
                         }
                         $form_action = "ask-edit";
                     }
                 }
                 if ($this->FG_DEBUG == 1) {
                     echo "<br>{$fields_name} : " . $processed[$fields_name];
                 }
                 if ($i > 0 && $this->FG_TABLE_EDITION[$i][3] != "SPAN") {
                     $param_update .= ", ";
                 }
                 if (empty($processed[$fields_name]) && strtoupper(substr($this->FG_TABLE_ADITION[$i][13], 3, 4)) == "NULL") {
                     $param_update .= $fields_name . " = NULL ";
                 } else {
                     if ($this->FG_TABLE_EDITION[$i][3] != "SPAN") {
                         $param_update .= $fields_name . " = '" . addslashes(trim($processed[$fields_name])) . "' ";
                     }
                 }
             }
         } else {
             if (strtoupper($this->FG_TABLE_EDITION[$i][3]) == strtoupper("CHECKBOX")) {
                 $table_split = preg_split("/:/", $this->FG_TABLE_EDITION[$i][1]);
                 $checkbox_data = $table_split[0];
                 //doc_tariff
                 $instance_sub_table = new Table($table_split[0], $table_split[1] . ", " . $table_split[5]);
                 $SPLIT_FG_DELETE_CLAUSE = $table_split[5] . "='" . trim($processed['id']) . "'";
                 $instance_sub_table->Delete_table($this->DBHandle, $SPLIT_FG_DELETE_CLAUSE, $func_table = null);
                 if (!is_array($processed[$checkbox_data])) {
                     $snum = 0;
                     $this->VALID_SQL_REG_EXP = false;
                     $this->FG_fit_expression[$i] = false;
                 } else {
                     $snum = count($processed[$checkbox_data]);
                 }
                 $checkbox_data_tab = $processed[$checkbox_data];
                 for ($j = 0; $j < $snum; $j++) {
                     $this->RESULT_QUERY = $instance_sub_table->Add_table($this->DBHandle, "'" . addslashes(trim($checkbox_data_tab[$j])) . "', '" . addslashes(trim($processed['id'])) . "'", null, null);
                     if (!$this->RESULT_QUERY) {
                         $findme = 'duplicate';
                         $pos_find = strpos($instance_sub_table->errstr, $findme);
                         // Note our use of ===.  Simply == would not work as expected
                         // because the position of 'a' was the 0th (first) character.
                         if ($pos_find === false) {
                             echo $instance_sub_table->errstr;
                         } else {
                             //echo $FG_TEXT_ERROR_DUPLICATION;
                             $alarm_db_error_duplication = true;
                         }
                     }
                 }
             }
         }
     }
     if (!is_null($this->FG_QUERY_EDITION_HIDDEN_FIELDS) && $this->FG_QUERY_EDITION_HIDDEN_FIELDS != "") {
         $table_split_field = preg_split("/,/", $this->FG_QUERY_EDITION_HIDDEN_FIELDS);
         $table_split_value = preg_split("/,/", $this->FG_QUERY_EDITION_HIDDEN_VALUE);
         for ($k = 0; $k < count($table_split_field); $k++) {
             $param_update .= ", ";
             $param_update .= "{$table_split_field[$k]} = '" . addslashes(trim($table_split_value[$k])) . "'";
         }
     }
     if (strlen($this->FG_ADDITIONAL_FUNCTION_BEFORE_EDITION) > 0 && $this->VALID_SQL_REG_EXP) {
         $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_BEFORE_EDITION));
     }
     if ($this->FG_DEBUG == 1) {
         echo "<br><hr> PARAM_UPDATE: {$param_update}<br>" . $this->FG_EDITION_CLAUSE;
     }
     if ($this->VALID_SQL_REG_EXP) {
         $this->RESULT_QUERY = $instance_table->Update_table($this->DBHandle, $param_update, $this->FG_EDITION_CLAUSE, $func_table = null);
     }
     if ($this->FG_ENABLE_LOG == 1) {
         $this->logger->insertLog_Update($_SESSION["admin_id"], 3, "A " . strtoupper($this->FG_INSTANCE_NAME) . " UPDATED", "A RECORD IS UPDATED, EDITION CALUSE USED IS " . $this->FG_EDITION_CLAUSE, $this->FG_TABLE_NAME, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI'], $param_update);
     }
     if ($this->FG_DEBUG == 1) {
         echo $this->RESULT_QUERY;
     }
     // CALL DEFINED FUNCTION AFTER THE ACTION ADDITION
     if (strlen($this->FG_ADDITIONAL_FUNCTION_AFTER_EDITION) > 0 && $this->VALID_SQL_REG_EXP) {
         $res_funct = call_user_func(array('FormBO', $this->FG_ADDITIONAL_FUNCTION_AFTER_EDITION));
     }
     if ($this->VALID_SQL_REG_EXP && isset($this->FG_GO_LINK_AFTER_ACTION_EDIT)) {
         if ($this->FG_DEBUG == 1) {
             echo "<br> GOTO ; " . $this->FG_GO_LINK_AFTER_ACTION_EDIT . $processed['id'];
         }
         $ext_link = '';
         if (is_numeric($processed['current_page'])) {
             $ext_link .= "&current_page=" . $processed['current_page'];
         }
         if (!empty($processed['order']) && !empty($processed['sens'])) {
             $ext_link .= "&order=" . $processed['order'] . "&sens=" . $processed['sens'];
         }
         Header("Location: " . $this->FG_GO_LINK_AFTER_ACTION_EDIT . $processed['id'] . $ext_link);
     }
 }
	die();
}
getpost_ifset(array (
	'id',
	'action'
));

$DBHandle = DbConnect();


if ($action == "cancel") {
	if (!empty ($id) && is_numeric($id)) {
		$instance_table_remittance = new Table("cc_remittance_request");
		$param_update_remittance = "status = '3'";
		$clause_update_remittance = " id ='$id'";
		$instance_table_remittance->Update_table($DBHandle, $param_update_remittance, $clause_update_remittance, $func_table = null);
	}
	die();
}
$HD_Form->setDBHandler(DbConnect());
$HD_Form->init();

if ($id != "" || !is_null($id)) {
	$HD_Form->FG_EDITION_CLAUSE = str_replace("%id", "$id", $HD_Form->FG_EDITION_CLAUSE);
}

if (!isset ($form_action))
	$form_action = "list"; //ask-add

if (!isset ($action))
	$action = $form_action;
Example #18
0
            $ticket->insertComment($comment, $_SESSION['agent_id'], 2);
            tep_redirect("A2B_ticket_view.php?" . "id=" . $id . "&result=success");
            break;
    }
}
$ticket = new Ticket($ticketID);
$comments = $ticket->loadComments();
$DBHandle = DbConnect();
$instance_sub_table = new Table("cc_ticket", "*");
if ($ticket->getViewed(1)) {
    $instance_sub_table->Update_table($DBHandle, "viewed_agent = '0'", "id = '" . $id . "'");
}
$instance_sub_table = new Table("cc_ticket_comment", "*");
foreach ($comments as $comment) {
    if ($comment->getViewed(1)) {
        $instance_sub_table->Update_table($DBHandle, "viewed_agent = '0'", "id = '" . $comment->getId() . "'");
    }
}
$smarty->display('main.tpl');
?>
<table class="epayment_conf_table">
    <tr class="form_head">
        <td ><font color="#FFFFFF"><?php 
echo gettext("TICKET: ");
?>
</font><font color="#FFFFFF"><b><?php 
echo $ticket->getTitle();
?>
</b></font></td>
        <td align="center" ><font color="#FFFFFF">Number : </font><font color="Red"> <?php 
echo $ticket->getId();
Example #19
0
 public function changeStatus($status)
 {
     if (!is_null($this->id)) {
         $DBHandle = DbConnect();
         $instance_sub_table = new Table("cc_invoice", "*");
         $clause = "id = " . $this->id;
         $param = " paid_status = " . $status;
         $instance_sub_table->Update_table($DBHandle, $param, $clause);
         if ($this->paid_status != $status) {
             $items = $this->loadItems();
             foreach ($items as $item) {
                 if ($item->getExtType() == "DID" && is_numeric($item->getExtId())) {
                     $did_table = new Table("cc_did_use", "*");
                     if ($status == 0) {
                         $param = " reminded = 1, month_payed = month_payed-1";
                     } else {
                         $param = " reminded = 0, month_payed = month_payed+1";
                     }
                     $QUERY = "UPDATE cc_did_use set {$param} WHERE id_did = '" . $item->getExtId() . "' and activated = 1";
                     $did_table->SQLExec($DBHandle, $QUERY, 0);
                 }
             }
         }
     } else {
         return null;
     }
 }