Exemplo n.º 1
0
			}
			
			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 ($verbose_level >= 2)
						echo "\n Email sent for invoice to pay, card id :> ".$card_id;
			    } catch (A2bMailException $e) {
		            $error_msg = $e->getMessage();
		            if ($verbose_level >= 1)
		            	echo "Sent mail error : ".$error_msg;
		        }
			}
			
			if ($verbose_level >= 2)
                // block the card
                $QUERY = "UPDATE cc_card SET status = 8 WHERE id=" . $subscription['card_id'];
                $result = $instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
                if ($verbose_level >= 1) {
                    echo "==> UPDATE CARD QUERY: \t{$QUERY}\n";
                }
                $QUERY = "UPDATE cc_card_subscription SET paid_status = 3 WHERE id=" . $subscription['card_subscription_id'];
                if ($verbose_level >= 1) {
                    echo "==> UPDATE SUBSCRIPTION QUERY: \t{$QUERY}\n";
                }
                $result = $instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
                if ($verbose_level >= 1) {
                    echo "==> UPDATE CARD QUERY: \t{$QUERY}\n";
                }
                $mail = new Mail(Mail::$TYPE_SUBSCRIPTION_DISABLE_CARD, $subscription('card_id'));
                $mail->replaceInEmail(Mail::$SUBSCRIPTION_FEE, $subscription['fee']);
                $mail->replaceInEmail(Mail::$SUBSCRIPTION_ID, $subscription['id']);
                $mail->replaceInEmail(Mail::$SUBSCRIPTION_LABEL, $subscription['product_name']);
                try {
                    $mail->send();
                } catch (A2bMailException $e) {
                    if ($verbose_level >= 1) {
                        echo "[Sent mail failed : {$e}]";
                    }
                    write_log(LOGFILE_CRONT_SUBSCRIPTIONFEE, basename(__FILE__) . ' line:' . __LINE__ . "[Sent mail failed : {$e}]");
                }
                break;
        }
    }
    sleep(10);
}
Exemplo n.º 3
0
	static public function proccessing_billing_customer()
	{
		global $A2B;
		$FormHandler = FormHandler::GetInstance();
		$processed = $FormHandler->getProcessed();
		//find the last billing 
		$card_id = $processed['id_card'];
		$date_bill=$processed['date'];

		//GET VAT
		$card_table = new Table('cc_card', 'vat, typepaid, credit');
		$card_clause = "id = ".$card_id;
		$card_result = $card_table -> Get_list($FormHandler->DBHandle, $card_clause, 0);
		
		if(!is_array($card_result)||empty($card_result[0]['vat'])||!is_numeric($card_result[0]['vat']))
			$vat=0;
		else 
			$vat = $card_result[0][0];
		
		// FIND THE LAST BILLING
		$billing_table = new Table('cc_billing_customer','id,date');
		$clause_last_billing = "id_card = $card_id AND id != ".$FormHandler -> RESULT_QUERY;
		$result = $billing_table -> Get_list($FormHandler->DBHandle, $clause_last_billing,"date","desc");
		$call_table = new Table('cc_call',' COALESCE(SUM(sessionbill),0)' );
		$clause_call_billing ="card_id = $card_id AND ";
		$clause_charge = "id_cc_card = $card_id AND ";
		$desc_billing="";
		$desc_billing_postpaid="";
		$start_date =null;
		
		if (is_array($result) && !empty($result[0][0])) {
			$clause_call_billing .= "stoptime >= '" .$result[0][1]."' AND "; 
			$clause_charge .= "creationdate >= '".$result[0][1]."' AND  ";
			$desc_billing = "Calls cost between the ".$result[0][1]." and  $date_bill" ;
			$desc_billing_postpaid="Amount for period between the ".date("Y-m-d", strtotime($result[0][1]) + $oneday)." and $date_bill";
			$start_date = $result[0][1];
		} else {
			$desc_billing = "Calls cost before the $date_bill" ;
			$desc_billing_postpaid="Amount for period before the $date_bill" ;
		}
		$lastpostpaid_amount = 0;
		$query_table = "cc_billing_customer LEFT JOIN cc_invoice ON cc_billing_customer.id_invoice = cc_invoice.id ";
		$query_table .= "LEFT JOIN (SELECT st1.id_invoice, TRUNCATE(SUM(st1.price),2) as total_price FROM cc_invoice_item AS st1 WHERE st1.type_ext ='POSTPAID' GROUP BY st1.id_invoice ) as items ON items.id_invoice = cc_invoice.id";
		$invoice_table = new Table($query_table,'SUM( items.total_price) as total');
		$lastinvoice_clause = "cc_billing_customer.id_card = $card_id AND cc_invoice.paid_status=0 AND cc_billing_customer.id != ".$FormHandler -> RESULT_QUERY;
		$result_lastinvoice = $invoice_table ->Get_list($FormHandler->DBHandle, $lastinvoice_clause);
		if(is_array($result_lastinvoice)&& !empty($result_lastinvoice[0][0])){
		    $lastpostpaid_amount = $result_lastinvoice [0][0];
		}
		$clause_call_billing .= "stoptime < '$date_bill' ";
		$clause_charge .= "creationdate < '$date_bill' ";


		$result =  $call_table -> Get_list($FormHandler->DBHandle, $clause_call_billing);
		// COMMON BEHAVIOUR FOR PREPAID AND POSTPAID ... GENERATE A RECEIPT FOR THE CALLS OF THE MONTH
		if (is_array($result) && is_numeric($result[0][0])) {
			$amount_calls = $result[0][0];
			$amount_calls = ceil($amount_calls*100)/100;
			$date = date("Y-m-d h:i:s");
			/// create receipt
			$field_insert = "date, id_card, title, description,status";
			$title = gettext("SUMMARY OF CALLS");
			$description = gettext("Summary of the calls charged since the last billing");
			$value_insert = " '$date' , '$card_id', '$title','$description',1";
			$instance_table = new Table("cc_receipt", $field_insert);
			$id_receipt = $instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
			if(!empty($id_receipt)&& is_numeric($id_receipt)){
				$description = $desc_billing;
				$field_insert = "date, id_receipt,price,description,id_ext,type_ext";
				$instance_table = new Table("cc_receipt_item", $field_insert);
				$value_insert = " '$date' , '$id_receipt', '$amount_calls','$description','".$FormHandler -> RESULT_QUERY."','CALLS'";
				$instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
			}
		}
		// GENERATE RECEIPT FOR CHARGE ALREADY CHARGED 
		$table_charge = new Table("cc_charge", "*");
		$result =  $table_charge -> Get_list($FormHandler->DBHandle, $clause_charge." AND charged_status = 1");
		if (is_array($result)) {
			$field_insert = "date, id_card, title, description,status";
			$title = gettext("SUMMARY OF CHARGE");
			$date = date("Y-m-d h:i:s");
			$description = gettext("Summary of the charge charged since the last billing.");
			$value_insert = " '$date' , '$card_id', '$title','$description',1";
			$instance_table = new Table("cc_receipt", $field_insert);
			$id_receipt = $instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
			if(!empty($id_receipt)&& is_numeric($id_receipt)){
				foreach ($result as $charge) {
					$description = gettext("CHARGE :").$charge['description'];
					$amount = $charge['amount'];
					$field_insert = "date, id_receipt,price,description,id_ext,type_ext";
					$instance_table = new Table("cc_receipt_item", $field_insert);
					$value_insert = " '".$charge['creationdate']."' , '$id_receipt', '$amount','$description','".$charge['id']."','CHARGE'";
					$instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
				}
			}
		}
		$total =0;
		$total_vat =0;
		// GENERATE INVOICE FOR CHARGE NOT YET CHARGED
		$table_charge = new Table("cc_charge", "*");
		$result =  $table_charge -> Get_list($FormHandler->DBHandle, $clause_charge." AND charged_status = 0 AND invoiced_status = 0");
		$last_invoice = null;
		if (is_array($result) && sizeof($result)>0){
			$reference = generate_invoice_reference();
			$field_insert = "date, id_card, title ,reference, description,status,paid_status";
			$date = date("Y-m-d h:i:s");
			$title = gettext("BILLING CHARGES");
			$description = gettext("This invoice is for some charges unpaid since the last billing.")." ".$desc_billing_postpaid;
			$invoice_title = $title;
			$invoice_reference =$reference;
			$invoice_description = $description;
			$value_insert = " '$date' , '$card_id', '$title','$reference','$description',1,0";
			$instance_table = new Table("cc_invoice", $field_insert);
			$id_invoice = $instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
			if(!empty($id_invoice)&& is_numeric($id_invoice)){
			    $last_invoice = $id_invoice;
					    foreach ($result as $charge) {
						    $description = gettext("CHARGE :").$charge['description'];
						    $amount = $charge['amount'];
						    $total = $total + $amount;
						    $total_vat =$total_vat + round($amount *(1+($vat/100)),2);
						    $field_insert = "date, id_invoice,price,vat,description,id_ext,type_ext";
						    $instance_table = new Table("cc_invoice_item", $field_insert);
						    $value_insert = " '".$charge['creationdate']."' , '$id_invoice', '$amount','$vat','$description','".$charge['id']."','CHARGE'";
						    $instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
					    }
				    }
		}
		
		// behaviour postpaid
		if($card_result[0]['typepaid']==1 && is_numeric($card_result[0]['credit']) && ($card_result[0]['credit']+$lastpostpaid_amount)<0) {
			
			//GENERATE AN INVOICE TO COMPLETE THE BALANCE
		    if (!empty($last_invoice)) {
			$id_invoice = $last_invoice;
		    } else {
			$reference = generate_invoice_reference();
			$field_insert = "date, id_card, title ,reference, description,status,paid_status";
			$date = date("Y-m-d h:i:s");
			$title = gettext("BILLING POSTPAID");
			$description = gettext("Invoice for POSTPAID");
			$invoice_title = $title;
			$invoice_reference =$reference;
			$invoice_description = $description;
			$value_insert = " '$date' , '$card_id', '$title','$reference','$description',1,0";
			$instance_table = new Table("cc_invoice", $field_insert);
			$id_invoice = $instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
		    }
            
			if (!empty($id_invoice)&& is_numeric($id_invoice)) {
				$last_invoice = $id_invoice;
				$description = $desc_billing_postpaid;
				$amount = abs($card_result[0]['credit']+$lastpostpaid_amount);
				$total = $total + $amount;
				$total_vat =$total_vat + round($amount *(1+($vat/100)),2);
				$field_insert = "date, id_invoice,price,vat,description,id_ext,type_ext";
				$instance_table = new Table("cc_invoice_item", $field_insert);
				$value_insert = " '$date' , '$id_invoice', '$amount','$vat','$description','".$FormHandler -> RESULT_QUERY."','POSTPAID'";
				$instance_table -> Add_table ($FormHandler->DBHandle, $value_insert, null, null,"id");
			}
		}
		if (!empty($last_invoice)) {
		    $param_update_billing = "id_invoice = '".$last_invoice."'";
		    $clause_update_billing = " id= ".$FormHandler -> RESULT_QUERY;
		    $billing_table ->Update_table($FormHandler->DBHandle,$param_update_billing,$clause_update_billing);
		}
		//Send a mail for invoice to pay
		if (!empty($last_invoice)) {
		    $total = round($total,2);
		    $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();
		}

		//Update billing ...
		if (!empty($start_date)) {
				$param_update_billing = "start_date = '".$start_date."'";
				$clause_update_billing = " id= ".$FormHandler -> RESULT_QUERY;
				$billing_table ->Update_table($FormHandler->DBHandle,$param_update_billing,$clause_update_billing);
		}
	}
Exemplo n.º 4
0
        $mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
        $mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $id_ticket);
        $mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $description);
        $mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($priority));
        $mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, "NEW");
        $mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $title);
        $mail->send($result[0]['email']);
    } catch (A2bMailException $e) {
        $error_msg = $e->getMessage();
    }
    $component_table = new Table('cc_support_component LEFT JOIN cc_support ON id_support = cc_support.id', "email");
    $component_clause = "cc_support_component.id = " . $component;
    $result = $component_table->Get_list($HD_Form->DBHandle, $component_clause);
    try {
        $mail = new Mail(Mail::$TYPE_TICKET_NEW, null, $result[0]['language']);
        $mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
        $mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $id_ticket);
        $mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $description);
        $mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($priority));
        $mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, "NEW");
        $mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $title);
        $mail->send($result[0]['email']);
    } catch (A2bMailException $e) {
        $error_msg = $e->getMessage();
    }
    $update_msg = gettext("Ticket added successfully");
} elseif (strlen($description) + strlen($title) == 0) {
    $update_msg = gettext("Please complete the title and description portions of the form.");
} else {
    $update_msg = gettext("Sorry, There was a problem creating your ticket.");
}
Exemplo n.º 5
0
    $VAT = $transaction_data[0]['vat'];
}
write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "curr amount {$currAmount} {$currCurrency} BASE_CURRENCY=" . BASE_CURRENCY);
$amount_paid = convert_currency($currencies_list, $currAmount, $currCurrency, BASE_CURRENCY);
$amount_without_vat = $amount_paid / (1 + $VAT / 100);
//If security verification fails then send an email to administrator as it may be a possible attack on epayment security.
if ($security_verify == false) {
    write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "- security_verify == False | END");
    try {
        //TODO: create mail class for agent
        $mail = new Mail('epaymentverify', null);
    } catch (A2bMailException $e) {
        write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " ERROR NO EMAIL TEMPLATE FOUND");
        exit;
    }
    $mail->replaceInEmail(Mail::$TIME_KEY, date("y-m-d H:i:s"));
    $mail->replaceInEmail(Mail::$PAYMENTGATEWAY_KEY, $transaction_data[0][4]);
    $mail->replaceInEmail(Mail::$ITEM_AMOUNT_KEY, $amount_paid . $currCurrency);
    // Add Post information / useful to track down payment transaction without having to log
    $mail->AddToMessage("\n\n\n\n" . "-POST Var \n" . print_r($_POST, true));
    $mail->send(ADMIN_EMAIL);
    exit;
}
$newkey = securitykey(EPAYMENT_TRANSACTION_KEY, $transaction_data[0][8] . "^" . $transactionID . "^" . $transaction_data[0][2] . "^" . $transaction_data[0][1]);
if ($newkey == $key) {
    write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "----------- Transaction Key Verified ------------");
} else {
    write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "----NEW KEY =" . $newkey . " OLD KEY= " . $key . " ------- Transaction Key Verification Failed:" . $transaction_data[0][8] . "^" . $transactionID . "^" . $transaction_data[0][2] . "^" . $transaction_data[0][1] . " ------------\n");
    exit;
}
write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " ---------- TRANSACTION INFO ------------\n" . print_r($transaction_data, 1));
Exemplo n.º 6
0
    }
    Header("Location: {$url_forward}");
    die;
}
if ($orderStatus == 0 && $transaction_data[0][4] == 'iridium') {
    write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " EPAYMENT ORDER STATUS  = " . $statusmessage);
    die;
}
write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " EPAYMENT ORDER STATUS  = " . $statusmessage);
// CHECK IF THE EMAIL ADDRESS IS CORRECT
if (preg_match("/^[a-z]+[a-z0-9_-]*(([.]{1})|([a-z0-9_-]*))[a-z0-9_-]+[@]{1}[a-z0-9_-]+[.](([a-z]{2,3})|([a-z]{3}[.]{1}[a-z]{2}))\$/i", $customer_info["email"])) {
    // FIND THE TEMPLATE APPROPRIATE
    try {
        $mail = new Mail(Mail::$TYPE_PAYMENT, $id);
        write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-SENDING EMAIL TO CUSTOMER " . $customer_info["email"]);
        $mail->replaceInEmail(Mail::$ITEM_AMOUNT_KEY, $amount_paid);
        $mail->replaceInEmail(Mail::$ITEM_ID_KEY, $id_logrefill);
        $mail->replaceInEmail(Mail::$ITEM_NAME_KEY, 'balance');
        $mail->replaceInEmail(Mail::$PAYMENT_METHOD_KEY, $pmodule);
        $mail->replaceInEmail(Mail::$PAYMENT_STATUS_KEY, $statusmessage);
        $mail->send($customer_info["email"]);
        write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-SENDING EMAIL TO CUSTOMER " . $customer_info["email"]);
        write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . "- MAILTO:" . $customer_info["email"] . "-Sub=" . $mail->getTitle() . " , mtext=" . $mail->getMessage());
        // Add Post information / useful to track down payment transaction without having to log
        $mail->AddToMessage("\n\n\n\n" . "-POST Var \n" . print_r($_POST, true));
        $mail->setTitle("COPY FOR ADMIN : " . $mail->getTitle());
        $mail->send(ADMIN_EMAIL);
    } catch (A2bMailException $e) {
        write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " ERROR NO EMAIL TEMPLATE FOUND");
    }
} else {
         if ($verbose_level >= 1) {
             echo "==> UPDATE DID USE QUERY: \t{$QUERY}\n";
         }
         $QUERY = "INSERT INTO cc_did_use (activated, id_did) VALUES ('0','" . $mydids[0] . "')";
         $result = $instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
         if ($verbose_level >= 1) {
             echo "==> INSERT NEW DID USE QUERY: \t{$QUERY}\n";
         }
         $QUERY = "DELETE FROM cc_did_destination WHERE id_cc_did =" . $mydids[0];
         $result = $instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
         if ($verbose_level >= 1) {
             echo "==> DELETEDID did_destination QUERY: \t{$QUERY}\n";
         }
         $mail_user = true;
         $mail = new Mail(Mail::$TYPE_DID_RELEASED, $mydids[4]);
         $mail->replaceInEmail(Mail::$DID_NUMBER_KEY, $mydids[7]);
         $mail->replaceInEmail(Mail::$DID_COST_KEY, $mydids[3]);
         $mail->replaceInEmail(Mail::$BALANCE_REMAINING_KEY, $mydids[5]);
     }
 }
 $user_mail_adrr = $mydids[6];
 $user_card_id = $mydids[4];
 if (!is_null($mail) && $mail_user && strlen($user_mail_adrr) > 5) {
     try {
         $mail->send($user_mail_adrr);
     } catch (A2bMailException $e) {
         if ($verbose_level >= 1) {
             echo "[Sent mail failed : {$e}]";
         }
         write_log(LOGFILE_CRONT_BILL_DIDUSE, basename(__FILE__) . ' line:' . __LINE__ . "[Sent mail failed : {$e}]");
     }
Exemplo n.º 8
0
if ( ($OrderStatus == 0) && ($transaction_data[0][4]=='iridium')) {
	write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__." - transactionID=$transactionID"." EPAYMENT ORDER STATUS  = ".$statusmessage);
    die();
}

write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__." - transactionID=$transactionID"." EPAYMENT ORDER STATUS  = ".$statusmessage);

// CHECK IF THE EMAIL ADDRESS IS CORRECT
if (preg_match("/^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$/i", $customer_info["email"])) {

	// FIND THE TEMPLATE APPROPRIATE

    try {
        $mail = new Mail(Mail::$TYPE_PAYMENT,$id);
        write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__." - SENDING EMAIL TO CUSTOMER ".$customer_info["email"]);
        $mail->replaceInEmail(Mail::$ITEM_AMOUNT_KEY,$amount_paid);
        $mail->replaceInEmail(Mail::$ITEM_ID_KEY,$id_logrefill);
        $mail->replaceInEmail(Mail::$ITEM_NAME_KEY,$item_name);
        $mail->replaceInEmail(Mail::$PAYMENT_METHOD_KEY,$pmodule);
        $mail->replaceInEmail(Mail::$PAYMENT_STATUS_KEY,gettext($statusmessage));
        $mail->send($customer_info["email"]);

        write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__." - transactionID=$transactionID"."- MAILTO:".$customer_info["email"]."-Sub=".$mail->getTitle()." , mtext=".$mail->getMessage());

        // Add Post information / useful to track down payment transaction without having to log
		$mail->AddToMessage("\n\n\n\n"."-POST Var \n".print_r($_POST, true));
        $mail->setTitle("COPY FOR ADMIN : ".$mail->getTitle());
        $mail->send(ADMIN_EMAIL);
        
    } catch (A2bMailException $e) {
        write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__." - transactionID=$transactionID"." ERROR NO EMAIL TEMPLATE FOUND");
Exemplo n.º 9
0
 public function insertComment($desc, $creator, $creator_type)
 {
     $DBHandle = DbConnect();
     $instance_sub_table = new Table("cc_ticket_comment", "*");
     $QUERY_FIELDS = 'id_ticket, description,creator, creator_type';
     $QUERY_VALUES = "'{$this->id}', '{$desc}','{$creator}', '{$creator_type}'";
     switch ($creator_type) {
         case 0:
             $QUERY_FIELDS .= " ,viewed_cust ";
             $QUERY_VALUES .= " ,'0'";
             break;
         case 1:
             $QUERY_FIELDS .= " ,viewed_admin ";
             $QUERY_VALUES .= " ,'0'";
             break;
         case 2:
             $QUERY_FIELDS .= " ,viewed_agent ";
             $QUERY_VALUES .= " ,'0'";
             break;
     }
     $return = $instance_sub_table->Add_table($DBHandle, $QUERY_VALUES, $QUERY_FIELDS, 'cc_ticket_comment', 'id');
     switch ($creator_type) {
         case 0:
             $instance_sub_table = new Table("cc_card", "lastname, firstname");
             $QUERY = " id = " . $creator;
             $subreturn = null;
             $subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
             $subvalue = $subreturn[0];
             if (!is_null($subvalue)) {
                 $owner_comment = $subvalue["lastname"] . " " . $subvalue["firstname"];
             }
             break;
         case 1:
             $instance_sub_table = new Table("cc_ui_authen", "*");
             $QUERY = " userid = " . $creator;
             $subreturn = null;
             $subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
             $subvalue = $subreturn[0];
             if (!is_null($subvalue)) {
                 $owner_comment = "(ADMINISTRATOR) " . $subvalue["login"];
             }
             break;
         case 2:
             $instance_sub_table = new Table("cc_agent", "lastname, firstname,login");
             $QUERY = " id = " . $creator;
             $subreturn = null;
             $subreturn = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
             $subvalue = $subreturn[0];
             if (!is_null($subvalue)) {
                 $owner_comment = "(AGENT) " . $subvalue["login"] . " - " . $subvalue["firstname"] . " " . $subvalue["lastname"];
             }
             break;
     }
     $owner = $this->creator_login . " (" . $this->creator_firstname . " " . $this->creator_lastname . ")";
     try {
         $mail = new Mail(Mail::$TYPE_TICKET_MODIFY, null, $this->creator_language);
         $mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
         $mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $this->id);
         $mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $this->description);
         $mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($this->priority));
         $mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, Ticket::getStatusDisplay($this->status));
         $mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $this->title);
         $mail->replaceInEmail(Mail::$TICKET_COMMENT_DESCRIPTION_KEY, $desc);
         $mail->replaceInEmail(Mail::$TICKET_COMMENT_CREATOR_KEY, $owner_comment);
         $mail->send($this->creator_email);
     } catch (A2bMailException $e) {
         $error_msg = $e->getMessage();
     }
     try {
         $mail = new Mail(Mail::$TYPE_TICKET_MODIFY, null, $this->supportbox_language);
         $mail->replaceInEmail(Mail::$TICKET_OWNER_KEY, $owner);
         $mail->replaceInEmail(Mail::$TICKET_NUMBER_KEY, $this->id);
         $mail->replaceInEmail(Mail::$TICKET_DESCRIPTION_KEY, $this->description);
         $mail->replaceInEmail(Mail::$TICKET_PRIORITY_KEY, Ticket::DisplayPriority($this->priority));
         $mail->replaceInEmail(Mail::$TICKET_STATUS_KEY, Ticket::getStatusDisplay($this->status));
         $mail->replaceInEmail(Mail::$TICKET_TITLE_KEY, $this->title);
         $mail->replaceInEmail(Mail::$TICKET_COMMENT_DESCRIPTION_KEY, $desc);
         $mail->replaceInEmail(Mail::$TICKET_COMMENT_CREATOR_KEY, $owner_comment);
         $mail->send($this->supportbox_email);
     } catch (A2bMailException $e) {
         $error_msg = $e->getMessage();
     }
 }