Merge pull request #11744 from andreubisquerra/master
Control errors before validate invoice in TakePOS
This commit is contained in:
commit
7009f036a0
@ -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
|
||||
|
||||
@ -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"]});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user