Merge pull request #562 from simnandez/3.3

Fix: Supplier is mandatory into adding invoice suppliers
This commit is contained in:
Laurent Destailleur 2012-12-30 08:38:34 -08:00
commit df43d477fc
2 changed files with 188 additions and 171 deletions

View File

@ -198,6 +198,15 @@ else if ($action == 'add' && $user->rights->commande->creer)
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'),GETPOST('liv_day'),GETPOST('liv_year'));
if ($datecommande == '')
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'</div>';
$action='create';
$error++;
}
if (! $error)
{
$object->socid=$socid; $object->socid=$socid;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -393,6 +402,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>'; if (! $mesg) $mesg='<div class="error">'.$object->error.'</div>';
} }
} }
}
else if ($action == 'classifybilled' && $user->rights->commande->creer) else if ($action == 'classifybilled' && $user->rights->commande->creer)
{ {

View File

@ -230,6 +230,13 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']); $datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
if (GETPOST('socid','int')<1)
{
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Supplier')).'</div>';
$action='create';
$error++;
}
if ($datefacture == '') if ($datefacture == '')
{ {
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>'; $mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('DateInvoice')).'</div>';