Ajout popup ajax de confirmation

This commit is contained in:
Regis Houssin 2007-11-08 15:36:12 +00:00
parent 55c7787348
commit 3e6b55fdb3

View File

@ -194,7 +194,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
} }
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->supprimer) if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->supprimer)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
@ -1174,7 +1174,7 @@ else
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Edit").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Edit").'</a>';
} }
if ($conf->projet->enabled && $user->rights->projet->creer) if ($conf->projet->enabled && $user->rights->projet->creer)
@ -1190,7 +1190,17 @@ else
if ($user->rights->societe->supprimer) if ($user->rights->societe->supprimer)
{ {
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" ';
if ($conf->use_ajax && $conf->global->MAIN_CONFIRM_AJAX)
{
$url = $_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=confirm_delete&confirm=yes';
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteCompany').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
}
else
{
print 'href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&amp;action=delete"';
}
print '>'.$langs->trans('Delete').'</a>';
} }
print '</div>'; print '</div>';