From c7537732d2bccc690527f1514b4134048eb113d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 9 Sep 2017 10:03:09 +0200 Subject: [PATCH] NEW Can set a dedicated message on payment forms --- htdocs/core/lib/payments.lib.php | 29 ++++++++++++++++++---------- htdocs/public/paybox/newpayment.php | 2 +- htdocs/public/paybox/paymentko.php | 3 ++- htdocs/public/paybox/paymentok.php | 3 ++- htdocs/public/payment/newpayment.php | 3 ++- htdocs/public/payment/paymentko.php | 4 +++- htdocs/public/payment/paymentok.php | 4 +++- htdocs/public/paypal/newpayment.php | 2 +- htdocs/public/paypal/paymentko.php | 4 +++- htdocs/public/paypal/paymentok.php | 4 +++- htdocs/public/stripe/newpayment.php | 2 +- htdocs/public/stripe/paymentko.php | 4 +++- htdocs/public/stripe/paymentok.php | 4 +++- 13 files changed, 46 insertions(+), 22 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 3a4d6b684f5..84d66f3f1e4 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -1,5 +1,5 @@ * @@ -21,14 +21,14 @@ /** * Returns an array with the tabs for the "Payment" section * It loads tabs from modules looking for the entity payment - * + * * @param Paiement $object Current payment object * @return array Tabs for the payment section */ function payment_prepare_head(Paiement $object) { - + global $langs, $conf; - + $h = 0; $head = array(); @@ -56,14 +56,14 @@ function payment_prepare_head(Paiement $object) { /** * Returns an array with the tabs for the "Supplier payment" section * It loads tabs from modules looking for the entity payment_supplier - * + * * @param Paiement $object Current payment object * @return array Tabs for the payment section */ function payment_supplier_prepare_head(Paiement $object) { - + global $langs, $conf; - + $h = 0; $head = array(); @@ -77,7 +77,7 @@ function payment_supplier_prepare_head(Paiement $object) { // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_supplier'); - + $head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id; $head[$h][1] = $langs->trans('Info'); $head[$h][2] = 'info'; @@ -95,9 +95,10 @@ function payment_supplier_prepare_head(Paiement $object) { * * @param Societe $fromcompany Third party * @param Translate $langs Output language + * @param int $addformmessage Add the payment form message * @return void */ -function htmlPrintOnlinePaymentFooter($fromcompany,$langs) +function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0) { global $conf; @@ -149,8 +150,16 @@ function htmlPrintOnlinePaymentFooter($fromcompany,$langs) $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra; } - print '


'."\n"; + print '
'; + print '
'."\n"; + if ($addformmessage) + { + $key='ONLINE_PAYMENT_MESSAGE_FORM'; + if (! empty($conf->global->$key)) print '
'.$conf->global->$key; + } + + print '

'."\n"; print $fromcompany->name.'
'; print $line1.'
'; print $line2; diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index f29a342929e..bcf9a8a1b36 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -802,7 +802,7 @@ print '
'."\n"; print '
'; -htmlPrintOnlinePaymentFooter($mysoc,$langs); +htmlPrintOnlinePaymentFooter($mysoc,$langs,1); llxFooter('', 'public'); diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index 992fe8ae0e2..15828f7d53b 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -156,7 +156,8 @@ print '
'."\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."

\n"; -if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; +$key='ONLINE_PAYMENT_MESSAGE_KO'; +if (! empty($conf->global->$key)) print $conf->global->$key; print "\n
\n"; diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index cddc30ef4eb..7c0a9048ae8 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -115,7 +115,8 @@ dol_syslog("Call newpaymentok with token=".$onlinetoken." paymentType=".$payment print $langs->trans("YourPaymentHasBeenRecorded")."

\n"; -if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK; +$key='ONLINE_PAYMENT_MESSAGE_OK'; +if (! empty($conf->global->$key)) print $conf->global->$key; // Appel des triggers diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index faf0b5ea165..05589b9da9c 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1264,6 +1264,7 @@ else print ''."\n"; print ''."\n"; + print ''."\n"; print ''."\n"; print '
'; @@ -1446,7 +1447,7 @@ if (preg_match('/^dopayment/',$action)) -htmlPrintOnlinePaymentFooter($mysoc,$langs); +htmlPrintOnlinePaymentFooter($mysoc,$langs,1); llxFooter('', 'public'); diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index c5eb9f7e698..1ab3ecba9b1 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -238,7 +238,9 @@ if ($urllogo) print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; -if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; +$key='ONLINE_PAYMENT_MESSAGE_KO'; +if (! empty($conf->global->$key)) print $conf->global->$key; + print "\n\n"; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ceda6a8c5a7..bda39223673 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -285,7 +285,9 @@ if ($ispaymentok) print $langs->trans("YourPaymentHasBeenRecorded")."
\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."

\n"; - if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK; + + $key='ONLINE_PAYMENT_MESSAGE_OK'; + if (! empty($conf->global->$key)) print $conf->global->$key; $sendemail = ''; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL; diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 8616d434e38..eeb738f6e8a 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -1015,7 +1015,7 @@ print '
'; -htmlPrintOnlinePaymentFooter($mysoc,$langs); +htmlPrintOnlinePaymentFooter($mysoc,$langs,1); llxFooter('', 'public'); diff --git a/htdocs/public/paypal/paymentko.php b/htdocs/public/paypal/paymentko.php index aff6509e390..f9eb9984ce3 100644 --- a/htdocs/public/paypal/paymentko.php +++ b/htdocs/public/paypal/paymentko.php @@ -166,7 +166,9 @@ print ''."\n"; print '
'."\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; -if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; +$key='ONLINE_PAYMENT_MESSAGE_KO'; +if (! empty($conf->global->$key)) print $conf->global->$key; + print "\n
\n"; diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index ec0ba7df46e..5e896b6f38a 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -170,7 +170,9 @@ if ($PAYPALTOKEN) print $langs->trans("YourPaymentHasBeenRecorded")."
\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."

\n"; - if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK; + + $key='ONLINE_PAYMENT_MESSAGE_OK'; + if (! empty($conf->global->$key)) print $conf->global->$key; // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 442e24aa52b..36eb3cc2968 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -1229,7 +1229,7 @@ if (preg_match('/^dopayment/',$action)) -htmlPrintOnlinePaymentFooter($mysoc,$langs); +htmlPrintOnlinePaymentFooter($mysoc,$langs,1); llxFooter('', 'public'); diff --git a/htdocs/public/stripe/paymentko.php b/htdocs/public/stripe/paymentko.php index c3c8672eb84..0be9f5e53ec 100644 --- a/htdocs/public/stripe/paymentko.php +++ b/htdocs/public/stripe/paymentko.php @@ -153,7 +153,9 @@ print ''."\n"; print '
'."\n"; print $langs->trans("YourPaymentHasNotBeenRecorded")."

"; -if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_KO)) print $conf->global->ONLINE_PAYMENT_MESSAGE_KO; +$key='ONLINE_PAYMENT_MESSAGE_KO'; +if (! empty($conf->global->$key)) print $conf->global->$key; + print "\n
\n"; diff --git a/htdocs/public/stripe/paymentok.php b/htdocs/public/stripe/paymentok.php index 1b8854c2de1..f67f3c1a794 100644 --- a/htdocs/public/stripe/paymentok.php +++ b/htdocs/public/stripe/paymentok.php @@ -120,7 +120,9 @@ if ($ispaymentok) print $langs->trans("YourPaymentHasBeenRecorded")."
\n"; print $langs->trans("ThisIsTransactionId",$TRANSACTIONID)."

\n"; - if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_OK)) print $conf->global->ONLINE_PAYMENT_MESSAGE_OK; + + $key='ONLINE_PAYMENT_MESSAGE_OK'; + if (! empty($conf->global->$key)) print $conf->global->$key; $sendemail = ''; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL;