Fix error management in POS.

This commit is contained in:
Laurent Destailleur 2017-06-13 19:46:27 +02:00
parent c088ccea32
commit fc5dfcda65
4 changed files with 30 additions and 18 deletions

View File

@ -27,6 +27,8 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php';
require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/keypad.php';
$error=GETPOST('error');
// Test if already logged // Test if already logged
if ( $_SESSION['uid'] <= 0 ) if ( $_SESSION['uid'] <= 0 )
{ {
@ -54,9 +56,7 @@ print '<body>'."\n";
if (!empty($error)) if (!empty($error))
{ {
print $error; dol_htmloutput_events();
print '</body></html>';
exit;
} }
print '<div class="conteneur">'."\n"; print '<div class="conteneur">'."\n";

View File

@ -106,6 +106,14 @@ p {
padding-right: 5px; padding-right: 5px;
} }
/* Force values for small screen 570 */
@media only screen and (max-width: 570px)
{
.menu_choix0 {
max-width: 180px;
}
}
.menu_choix0 a { .menu_choix0 a {
font-weight: normal; font-weight: normal;
text-decoration: none; text-decoration: none;

View File

@ -79,10 +79,11 @@ print '</form>';
/*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>'; /*print $langs->trans("CashDeskBankCash").': '.$bankcashLink.'<br>';
print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>'; print $langs->trans("CashDeskBankCB").': '.$bankcbLink.'<br>';
print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/ print $langs->trans("CashDeskBankCheque").': '.$bankchequeLink.'<br>';*/
print '<div class="clearboth">';
if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_STOCK))
{ {
print $langs->trans("CashDeskWarehouse").': '.$warehouseLink; print $langs->trans("CashDeskWarehouse").': '.$warehouseLink;
} }
print '</li></ul>'; print '</div></li></ul>';
print '</div>'; print '</div>';
print "\n".'<!-- menu.tpl.php end -->'."\n"; print "\n".'<!-- menu.tpl.php end -->'."\n";

View File

@ -32,7 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$obj_facturation = unserialize($_SESSION['serObjFacturation']); $obj_facturation = unserialize($_SESSION['serObjFacturation']);
unset ($_SESSION['serObjFacturation']);
$action =GETPOST('action','aZ09'); $action =GETPOST('action','aZ09');
$bankaccountid=GETPOST('cashdeskbank'); $bankaccountid=GETPOST('cashdeskbank');
@ -159,7 +158,6 @@ switch ($action)
$note .= $_POST['txtaNotes']; $note .= $_POST['txtaNotes'];
dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id); dol_syslog("obj_facturation->getSetPaymentMode()=".$obj_facturation->getSetPaymentMode()." mode_reglement_id=".$mode_reglement_id." cond_reglement_id=".$cond_reglement_id);
$error=0; $error=0;
@ -255,6 +253,7 @@ switch ($action)
} }
else else
{ {
setEventMessage($invoice->error, $invoice->errors, 'errors');
$error++; $error++;
} }
@ -287,6 +286,7 @@ switch ($action)
if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); if ($invoice->type == $invoice::TYPE_CREDIT_NOTE) $result=$mouvP->reception($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref));
else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref)); else $result=$mouvP->livraison($user, $invoice->lines[$i]->fk_product, $warehouseidtodecrease, $invoice->lines[$i]->qty, $invoice->lines[$i]->subprice, $langs->trans("InvoiceValidatedInDolibarrFromPos",$invoice->newref));
if ($result < 0) { if ($result < 0) {
setEventMessages($mouvP->error, $mouvP->errors, 'errors');
$error++; $error++;
} }
} }
@ -331,15 +331,18 @@ switch ($action)
} }
else else
{ {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++; $error++;
} }
} }
else else
{ {
setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++; $error++;
} }
} }
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
@ -348,14 +351,14 @@ switch ($action)
else else
{ {
$db->rollback(); $db->rollback();
$redirection = 'affIndex.php?facid='.$id.'&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr $redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr
} }
break; break;
// End of case: valide_facture // End of case: valide_facture
} }
unset ($_SESSION['serObjFacturation']);
$_SESSION['serObjFacturation'] = serialize($obj_facturation); $_SESSION['serObjFacturation'] = serialize($obj_facturation);