diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 628de17efcc..856cf1de0d2 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -72,3 +72,5 @@ BasicPhoneLayout=Use basic layout for phones SetupOfTerminalNotComplete=Setup of terminal %s is not complete DirectPayment=Direct payment DirectPaymentButton=Direct cash payment button +InvoiceIsAlreadyValidated=Invoice is already validated +NoLinesToBill=No lines to bill diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index b8161da749c..60f942caccf 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -161,7 +161,17 @@ if ($action == 'valid' && $user->rights->facture->creer) $invoice->update($user); } - if (! empty($conf->stock->enabled) && $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]} != "1") + if ($invoice->statut != Facture::STATUS_DRAFT) + { + dol_syslog("Sale already validated"); + dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1); + } + elseif (count($invoice->lines)==0) + { + dol_syslog("Sale without lines"); + dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), null, 1); + } + elseif (! empty($conf->stock->enabled) && $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]} != "1") { $invoice->validate($user, '', $conf->global->{'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]}); }