From e16fd45972a4ba717ca867ab126c07c8b5f7328c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Aug 2020 14:44:52 +0200 Subject: [PATCH 1/2] FIX Label of opportunities in graph with special chars badly encoded --- htdocs/projet/graph_opportunities.inc.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 8d0e7bb1e02..2bb9332c2ae 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -1,4 +1,22 @@ + * + * 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 . + */ + +// 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]).')'; From 5d20f47473b879c3c63361b1e7eafe140f088012 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Aug 2020 15:00:03 +0200 Subject: [PATCH 2/2] FIX page for confirmation of payments is empty --- htdocs/public/payment/paymentko.php | 10 ++++++---- htdocs/public/payment/paymentok.php | 30 ++++++++++++++++------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index a3f6d733fcb..f84a014d5e5 100644 --- a/htdocs/public/payment/paymentko.php +++ b/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 = ''; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b1d6c149a51..5203da2284f 100644 --- a/htdocs/public/payment/paymentok.php +++ b/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")."
\n"; if ($TRANSACTIONID) print $langs->trans("ThisIsTransactionId", $TRANSACTIONID)."

\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')."
\n"; print $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."
\n";