Use ajax confirm box to validate supplier order

This commit is contained in:
Laurent Destailleur 2008-10-19 13:08:21 +00:00
parent f9e640bc18
commit 5046225bcc

View File

@ -242,7 +242,7 @@ if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] ==
exit; 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); $commande = new CommandeFournisseur($db);
@ -921,7 +921,20 @@ if ($id > 0)
{ {
if ($user->rights->fournisseur->commande->valider) if ($user->rights->fournisseur->commande->valider)
{ {
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&amp;action=valid">'.$langs->trans("Valid").'</a>'; print '<a class="butAction" ';
if ($conf->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.'&amp;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.'&amp;action=valid"';
}
print '>'.$langs->trans('Validate').'</a>';
} }
} }