فهرست منبع

FIX page for confirmation of payments is empty

Laurent Destailleur 5 سال پیش
والد
کامیت
5d20f47473
2فایلهای تغییر یافته به همراه23 افزوده شده و 17 حذف شده
  1. 6 4
      htdocs/public/payment/paymentko.php
  2. 17 13
      htdocs/public/payment/paymentok.php

+ 6 - 4
htdocs/public/payment/paymentko.php

@@ -129,10 +129,12 @@ if (!empty($_SESSION['ipaddress']))      // To avoid to make action twice
     $ipaddress          = $_SESSION['ipaddress'];
     $errormessage       = $_SESSION['errormessage'];
 
-    // Call trigger
-    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
-    if ($result < 0) $error++;
-    // End call triggers
+    if (is_object($object) && method_exists($object, 'call_trigger')) {
+    	// Call trigger
+	    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
+	    if ($result < 0) $error++;
+	    // End call triggers
+    }
 
     // Send an email
     $sendemail = '';

+ 17 - 13
htdocs/public/payment/paymentok.php

@@ -616,8 +616,8 @@ if ($ispaymentok)
 	{
 		// Record payment
 		include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-		$invoice = new Facture($db);
-		$result = $invoice->fetch($tmptag['INV']);
+		$object = new Facture($db);
+		$result = $object->fetch($tmptag['INV']);
 		if ($result)
 		{
 			$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"];
@@ -646,11 +646,11 @@ if ($ispaymentok)
 				$paiement->datepaye = $now;
 				if ($currencyCodeType == $conf->currency)
 				{
-					$paiement->amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id
+					$paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id
 				}
 				else
 				{
-					$paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching
+					$paiement->multicurrency_amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching
 
 					$postactionmessages[] = 'Payment was done in a different currency that currency expected of company';
 					$ispostactionok = -1;
@@ -689,7 +689,7 @@ if ($ispaymentok)
 					if ($bankaccountid > 0)
 					{
 						$label = '(CustomerInvoicePayment)';
-						if ($invoice->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
+						if ($object->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
 						if ($result < 0)
 						{
@@ -748,10 +748,12 @@ if ($ispaymentok)
     $currencyCodeType   = $_SESSION['currencyCodeType'];
     $FinalPaymentAmt    = $_SESSION["FinalPaymentAmt"];
 
-    // Call trigger
-    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
-    if ($result < 0) $error++;
-    // End call triggers
+    if (is_object($object) && method_exists($object, 'call_trigger')) {
+	    // Call trigger
+	    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
+	    if ($result < 0) $error++;
+	    // End call triggers
+    }
 
     print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
     if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."<br><br>\n";
@@ -882,10 +884,12 @@ else
     $currencyCodeType   = $_SESSION['currencyCodeType'];
     $FinalPaymentAmt    = $_SESSION["FinalPaymentAmt"];
 
-    // Call trigger
-    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
-    if ($result < 0) $error++;
-    // End call triggers
+    if (is_object($object) && method_exists($object, 'call_trigger')) {
+    	// Call trigger
+	    $result = $object->call_trigger('PAYMENTONLINE_PAYMENT_KO', $user);
+	    if ($result < 0) $error++;
+	    // End call triggers
+    }
 
     print $langs->trans('DoExpressCheckoutPaymentAPICallFailed')."<br>\n";
     print $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."<br>\n";