diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 03d8c0af29a..6fb80b92103 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -242,7 +242,7 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] == exit; } -if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->valider) +if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->valider) { $commande = new CommandeFournisseur($db); @@ -622,7 +622,7 @@ if ($id > 0) print ''; if ($commande->methode_commande) { - print $langs->trans("Method")." : " .$commande->methode_commande; + print $langs->trans("Method")." : " .$commande->methode_commande; } print ""; } @@ -919,42 +919,55 @@ if ($id > 0) if ($commande->statut == 0 && $num > 0) { - if ($user->rights->fournisseur->commande->valider) - { - print ''.$langs->trans("Valid").''; - } + if ($user->rights->fournisseur->commande->valider) + { + print 'use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) + { + // We check if number is temporary number + if (eregi('^\(PROV',$commande->ref)) $num = $commande->getNextNumRef($soc); + else $num = $commande->ref; + $url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_valid&confirm=yes'; + print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateBill',$num)).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'validate\')"'; + } + else + { + print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=valid"'; + } + print '>'.$langs->trans('Validate').''; + } } if ($commande->statut == 1) { - if ($user->rights->fournisseur->commande->approuver) - { - print ''.$langs->trans("ApproveOrder").''; + if ($user->rights->fournisseur->commande->approuver) + { + print ''.$langs->trans("ApproveOrder").''; - print ''.$langs->trans("RefuseOrder").''; - } + print ''.$langs->trans("RefuseOrder").''; + } - if ($user->rights->fournisseur->commande->annuler) - { - print ''.$langs->trans("CancelOrder").''; - } + if ($user->rights->fournisseur->commande->annuler) + { + print ''.$langs->trans("CancelOrder").''; + } } if ($commande->statut == 2) { - if ($user->rights->fournisseur->commande->annuler) - { - print ''.$langs->trans("CancelOrder").''; - } + if ($user->rights->fournisseur->commande->annuler) + { + print ''.$langs->trans("CancelOrder").''; + } } if ($commande->statut == 0) { - if ($user->rights->fournisseur->commande->creer) - { - print ''.$langs->trans("Delete").''; - } + if ($user->rights->fournisseur->commande->creer) + { + print ''.$langs->trans("Delete").''; + } } print "";