fix : move check if invoice module is enabled into paymentok.php
This commit is contained in:
parent
4e1fe23b7e
commit
9b71f1e16b
@ -2633,7 +2633,7 @@ if ($action == 'create' && $usercancreate)
|
|||||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
||||||
|
|
||||||
// Show online payment link
|
// Show online payment link
|
||||||
$useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->facture->enabled));
|
$useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled));
|
||||||
if (!empty($conf->global->ORDER_HIDE_ONLINE_PAYMENT_ON_ORDER)) $useonlinepayment = 0;
|
if (!empty($conf->global->ORDER_HIDE_ONLINE_PAYMENT_ON_ORDER)) $useonlinepayment = 0;
|
||||||
if ($object->statut != Commande::STATUS_DRAFT && $useonlinepayment)
|
if ($object->statut != Commande::STATUS_DRAFT && $useonlinepayment)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -742,6 +742,7 @@ if ($ispaymentok)
|
|||||||
$currencyCodeType = $_SESSION['currencyCodeType'];
|
$currencyCodeType = $_SESSION['currencyCodeType'];
|
||||||
|
|
||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
|
if (!empty($conf->banque->enabled)) {
|
||||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0 ) {
|
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0 ) {
|
||||||
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||||
$invoice = new Facture($db);
|
$invoice = new Facture($db);
|
||||||
@ -766,7 +767,7 @@ if ($ispaymentok)
|
|||||||
$paiement->num_payment = '';
|
$paiement->num_payment = '';
|
||||||
$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
|
$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress;
|
||||||
$paiement->ext_payment_id = $TRANSACTIONID;
|
$paiement->ext_payment_id = $TRANSACTIONID;
|
||||||
$paiement->ext_payment_site = $service;
|
$paiement->ext_payment_site = '';
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
|
$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents
|
||||||
@ -818,6 +819,10 @@ if ($ispaymentok)
|
|||||||
$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type" (' . $paymentType . ') to record the payment of order ' . $tmptag['ORD'] . '. May be payment was already recorded.';
|
$postactionmessages[] = 'Failed to get a valid value for "amount paid" (' . $FinalPaymentAmt . ') or "payment type" (' . $paymentType . ') to record the payment of order ' . $tmptag['ORD'] . '. May be payment was already recorded.';
|
||||||
$ispostactionok = -1;
|
$ispostactionok = -1;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$postactionmessages[] = 'Invoice module is not enable';
|
||||||
|
$ispostactionok = -1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
|
$postactionmessages[] = 'Order paid ' . $tmptag['ORD'] . ' was not found';
|
||||||
$ispostactionok = -1;
|
$ispostactionok = -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user