diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d54a477aeee..50b481f4b14 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2613,6 +2613,18 @@ elseif (! empty($object->id)) } } + if ($object->statut == 2) + { + if ($user->rights->fournisseur->commande->commander) + { + print '
'.$langs->trans("MakeOrder").'
'; + } + else + { + print '
'.$langs->trans("MakeOrder").'
'; + } + } + // Create bill if (! empty($conf->facture->enabled)) { @@ -2664,103 +2676,102 @@ elseif (! empty($object->id)) } - print '
'; - - /* - * Documents generes - */ - $comfournref = dol_sanitizeFileName($object->ref); - $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf'; - $relativepath = $comfournref.'/'.$comfournref.'.pdf'; - $filedir = $conf->fournisseur->dir_output . '/commande/' . $comfournref; - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$user->rights->fournisseur->commande->creer; - $delallowed=$user->rights->fournisseur->commande->supprimer; - - print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang); - $somethingshown=$formfile->numoffiles; - - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_order','order_supplier')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - print '
'; - - - if ($user->rights->fournisseur->commande->commander && $object->statut == 2) + if ($user->rights->fournisseur->commande->commander && $object->statut == 2 && $action == 'makeorder') { - // Set status to ordered (action=commande) - print ''."\n"; - print '
'; - print ''; - print ''; - print load_fiche_titre($langs->trans("ToOrder"),'',''); - print ''; - //print ''; - print ''; - - print ''; - - print ''; - print ''; - print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; - $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); - print $form->select_date($date_com,'',1,1,'',"commande",1,0,1); - print '
'.$langs->trans("OrderMode").''; - $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1); - print '
'.$langs->trans("Comment").'
'; - print '
'; - print "
"; + // Set status to ordered (action=commande) + print ''."\n"; + print '
'; + print ''; + print ''; + print load_fiche_titre($langs->trans("ToOrder"),'',''); + print ''; + //print ''; + print ''; + + print ''; + + print ''; + print ''; + print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; + $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + print $form->select_date($date_com,'',1,1,'',"commande",1,0,1); + print '
'.$langs->trans("OrderMode").''; + $formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1); + print '
'.$langs->trans("Comment").'
'; + print ''; + print '     '; + print ''; + print '
'; + print '
'; + print "
"; } - - if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) + + + if ($action != 'makeorder') { - // Set status to received (action=livraison) - print ''."\n"; - print '
'; - print ''; - print ''; - print load_fiche_titre($langs->trans("Receive"),'',''); - - print ''; - //print ''; - print '\n"; - - print "'; - print ''; - print ''; - print "
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; - print $form->select_date('','',1,1,'',"commande",1,0,1); - print "
".$langs->trans("Delivery")."\n"; - $liv = array(); - $liv[''] = ' '; - $liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected"); - $liv['par'] = $langs->trans("PartialWoman"); - $liv['nev'] = $langs->trans("NeverReceived"); - $liv['can'] = $langs->trans("Canceled"); - - print $form->selectarray("type",$liv); - - print '
'.$langs->trans("Comment").'
\n"; - print "
\n"; - print "
"; + print '
'; + + /* + * Documents generes + */ + $comfournref = dol_sanitizeFileName($object->ref); + $file = $conf->fournisseur->dir_output . '/commande/' . $comfournref . '/' . $comfournref . '.pdf'; + $relativepath = $comfournref.'/'.$comfournref.'.pdf'; + $filedir = $conf->fournisseur->dir_output . '/commande/' . $comfournref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed=$user->rights->fournisseur->commande->creer; + $delallowed=$user->rights->fournisseur->commande->supprimer; + + print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang); + $somethingshown=$formfile->numoffiles; + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_order','order_supplier')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + print '
'; + + + if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4)) + { + // Set status to received (action=livraison) + print ''."\n"; + print '
'; + print ''; + print ''; + print load_fiche_titre($langs->trans("Receive"),'',''); + + print ''; + //print ''; + print '\n"; + + print "'; + print ''; + print ''; + print "
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; + print $form->select_date('','',1,1,'',"commande",1,0,1); + print "
".$langs->trans("Delivery")."\n"; + $liv = array(); + $liv[''] = ' '; + $liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected"); + $liv['par'] = $langs->trans("PartialWoman"); + $liv['nev'] = $langs->trans("NeverReceived"); + $liv['can'] = $langs->trans("Canceled"); + + print $form->selectarray("type",$liv); + + print '
'.$langs->trans("Comment").'
\n"; + print "
\n"; + print "
"; + } + + // List of actions on element + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + $formactions=new FormActions($db); + $somethingshown=$formactions->showactions($object,'order_supplier',$socid,0,'listaction'.($genallowed?'largetitle':'')); + + print '
'; } - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'order_supplier',$socid,0,'listaction'.($genallowed?'largetitle':'')); - - - // List of actions on element - /* Hidden because" available into "Log" tab - print '
'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions=new FormActions($db); - $somethingshown=$formactions->showactions($object,'order_supplier',$socid); - */ - - print '
'; } print '';