Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/public/payment/paymentok.php
This commit is contained in:
Laurent Destailleur 2020-08-04 15:03:51 +02:00
commit 07f420d58e
3 changed files with 42 additions and 18 deletions

View File

@ -1,4 +1,22 @@
<?php
/* Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// variable $listofopplabel and $listofoppstatus should be defined
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
@ -54,7 +72,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$labelStatus = '';
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelStatus = $langs->trans("OppStatus".$code);
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
//$labelStatus .= ' ('.$langs->trans("Coeff").': '.price2num($listofoppstatus[$status]).')';

View File

@ -127,10 +127,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 = '';

View File

@ -593,8 +593,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"];
@ -623,9 +623,9 @@ 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;
@ -662,7 +662,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)
{
@ -709,10 +709,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";
@ -831,10 +833,12 @@ if ($ispaymentok)
$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";