Merge pull request #11424 from OPEN-DSI/issue-fourn-commande-card-makeorder

NEW The order method in purchase order is now mandatory when registering the order
This commit is contained in:
Laurent Destailleur 2019-07-04 15:52:51 +02:00 committed by GitHub
commit d405a58999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -902,6 +902,16 @@ $result = $object->updateline(
}
}
// Force mandatory order method
if ($action == 'commande') {
$methodecommande = GETPOST('methodecommande');
if ($methodecommande <= 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors');
$action = 'makeorder';
}
}
if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander)
{
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
@ -2537,13 +2547,14 @@ elseif (! empty($object->id))
print load_fiche_titre($langs->trans("ToOrder"), '', '');
print '<table class="noborder centpercent">';
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
print '<tr><td class="fieldrequired">'.$langs->trans("OrderDate").'</td><td>';
$date_com = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
if (empty($date_com)) $date_com=dol_now();
print $form->selectDate($date_com, '', 1, 1, '', "commande", 1, 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
// Force mandatory order method
print '<tr><td class="fieldrequired">'.$langs->trans("OrderMode").'</td><td>';
$formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1);
print '</td></tr>';