Qual: Use a so much simpler way to have ajax confirmation boxes

This commit is contained in:
Laurent Destailleur 2009-05-06 16:27:45 +00:00
parent 64db204c29
commit 3ccecb4e7f
10 changed files with 233 additions and 224 deletions

View File

@ -224,7 +224,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->fournisseur->commande->c
} }
} }
if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_POST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE))) if ($_REQUEST['action'] == 'confirm_deleteproductline' && ($_REQUEST['confirm'] == 'yes' || empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)))
{ {
if ($user->rights->fournisseur->commande->creer) if ($user->rights->fournisseur->commande->creer)
{ {
@ -262,21 +262,21 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
} }
} }
if ($_POST['action'] == 'confirm_approve' && $_POST["confirm"] == 'yes' && $user->rights->fournisseur->commande->approuver) if ($_REQUEST['action'] == 'confirm_approve' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->approuver)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($id); $commande->fetch($id);
$result = $commande->approve($user); $result = $commande->approve($user);
} }
if ($_POST['action'] == 'confirm_refuse' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->approuver) if ($_REQUEST['action'] == 'confirm_refuse' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->approuver)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($id); $commande->fetch($id);
$result = $commande->refuse($user); $result = $commande->refuse($user);
} }
if ($_POST['action'] == 'confirm_commande' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->commander) if ($_REQUEST['action'] == 'confirm_commande' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->commander)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($id); $commande->fetch($id);
@ -284,7 +284,7 @@ if ($_POST['action'] == 'confirm_commande' && $_POST['confirm'] == 'yes' && $use
} }
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->commande->creer) if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->fournisseur->commande->creer)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->id = $id; $commande->id = $id;
@ -320,13 +320,20 @@ if ($_POST["action"] == 'livraison' && $user->rights->fournisseur->commande->rec
} }
} }
if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->rights->fournisseur->commande->annuler) if ($_REQUEST["action"] == 'confirm_cancel' && $_REQUEST["confirm"] == 'yes' && $user->rights->fournisseur->commande->annuler)
{ {
$commande = new CommandeFournisseur($db); $commande = new CommandeFournisseur($db);
$commande->fetch($id); $commande->fetch($id);
$result = $commande->cancel($user); $result = $commande->cancel($user);
if ($result > 0)
{
Header("Location: fiche.php?id=".$id); Header("Location: fiche.php?id=".$id);
exit; exit;
}
else
{
$mesg=$commande->error;
}
} }
/* /*
@ -501,7 +508,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -525,7 +532,7 @@ if ($id > 0 || ! empty($ref))
$text.=$notify->confirmMessage(3,$commande->socid); $text.=$notify->confirmMessage(3,$commande->socid);
} }
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, ($conf->notification->enabled?0:1));
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
/* /*
@ -534,7 +541,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'approve') if ($_GET['action'] == 'approve')
{ {
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve"); $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve", '', 1, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
/* /*
@ -543,7 +550,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'refuse') if ($_GET['action'] == 'refuse')
{ {
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse"); $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
/* /*
@ -551,7 +558,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'cancel') if ($_GET['action'] == 'cancel')
{ {
$ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel"); $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -571,7 +578,7 @@ if ($id > 0 || ! empty($ref))
*/ */
if ($_GET['action'] == 'delete_product_line' && ! empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)) if ($_GET['action'] == 'delete_product_line' && ! empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE))
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&amp;lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline','',0,2);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -55,7 +55,7 @@ $action=isset($_GET['action'])?$_GET['action']:$_POST['action'];
*/ */
// Action clone object // Action clone object
if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes') if ($_REQUEST["action"] == 'confirm_clone' && $_REQUEST['confirm'] == 'yes')
{ {
if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) if (1==0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"]))
{ {
@ -87,7 +87,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$result = $facturefourn->set_valid($user); $result = $facturefourn->set_valid($user);
} }
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
{ {
if ($user->rights->fournisseur->facture->supprimer ) if ($user->rights->fournisseur->facture->supprimer )
{ {
@ -577,7 +577,7 @@ else
// Confirmation de la suppression d'une ligne produit // Confirmation de la suppression d'une ligne produit
if ($_GET['action'] == 'confirm_delete_line') if ($_GET['action'] == 'confirm_delete_line')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 0, 0);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -590,21 +590,21 @@ else
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
); );
// Paiement incomplet. On demande si motif = escompte ou autre // Paiement incomplet. On demande si motif = escompte ou autre
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes', 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirmation de la validation // Confirmation de la validation
if ($_GET['action'] == 'valid') if ($_GET['action'] == 'valid')
{ {
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid'); $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
// Confirmation de la validation // Confirmation set payed
if ($_GET['action'] == 'payed') if ($_GET['action'] == 'payed')
{ {
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed'); $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -613,7 +613,7 @@ else
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete'); $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -191,10 +191,7 @@ llxHeader();
$html=new Form($db); $html=new Form($db);
if ($mesg) if ($mesg) print $mesg;
{
print '<tr><td colspan="3" align="center">'.$mesg.'</td></tr>';
}
if ($action == 'create' || $action == 'add_paiement') if ($action == 'create' || $action == 'add_paiement')
{ {
@ -222,6 +219,7 @@ if ($action == 'create' || $action == 'add_paiement')
$total = $obj->total; $total = $obj->total;
print_fiche_titre($langs->trans('DoPayment')); print_fiche_titre($langs->trans('DoPayment'));
print '<form name="addpaiement" action="paiement.php" method="post">'; print '<form name="addpaiement" action="paiement.php" method="post">';
print '<input type="hidden" name="action" value="add_paiement">'; print '<input type="hidden" name="action" value="add_paiement">';
print '<input type="hidden" name="facid" value="'.$facid.'">'; print '<input type="hidden" name="facid" value="'.$facid.'">';

View File

@ -322,8 +322,8 @@ class CommandeFournisseur extends Commande
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut; $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1"; $sql .= " WHERE rowid = ".$this->id;
dol_syslog("CommandeFournisseur::Cancel sql=".$sql);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$result = 0; $result = 0;
@ -350,9 +350,9 @@ class CommandeFournisseur extends Commande
} }
else else
{ {
dol_syslog("CommandeFournisseur::Cancel Error -1");
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
dol_syslog("CommandeFournisseur::Cancel ".$this->error);
return -1; return -1;
} }
} }

View File

@ -273,7 +273,7 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
/* /*
* Suppression d'un produit/service pas encore affect * Suppression d'un produit/service pas encore affect
*/ */
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->produit->supprimer) if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->produit->supprimer)
{ {
$product = new Product($db); $product = new Product($db);
$product->fetch($_GET['id']); $product->fetch($_GET['id']);
@ -806,7 +806,7 @@ if ($_GET["id"] || $_GET["ref"])
// Confirmation de la suppression de la facture // Confirmation de la suppression de la facture
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete"); $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,2);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -24,7 +24,7 @@
\ingroup product \ingroup product
\brief Onglet photos de la fiche produit \brief Onglet photos de la fiche produit
\version $Id$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
@ -65,13 +65,10 @@ if ($_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global
} }
} }
if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes') if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confirm'] == 'yes' && $user->rights->produit->creer)
{ {
if ($user->rights->produit->creer)
{
$product = new Product($db); $product = new Product($db);
$product->delete_photo($conf->produit->dir_output."/".$_GET["file"]); $product->delete_photo($conf->produit->dir_output."/".$_GET["file"]);
}
} }
if ($_GET["action"] == 'addthumb' && $_GET["file"]) if ($_GET["action"] == 'addthumb' && $_GET["file"])
@ -110,7 +107,7 @@ if ($_GET["id"] || $_GET["ref"])
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&amp;file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -205,7 +202,7 @@ if ($_GET["id"] || $_GET["ref"])
{ {
$nbphoto++; $nbphoto++;
// if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; // if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>'; if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">'; if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';

View File

@ -955,7 +955,7 @@ else
dol_fiche_head($head, 'company', $langs->trans("ThirdParty")); dol_fiche_head($head, 'company', $langs->trans("ThirdParty"));
// Confirmation de la suppression de la facture // Confirm delete third party
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$html = new Form($db); $html = new Form($db);
@ -981,7 +981,8 @@ else
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>'; print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$soc->prefix_comm.'</td></tr>';
if ($soc->client) { if ($soc->client)
{
print '<tr><td>'; print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="3">'; print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $soc->code_client; print $soc->code_client;

View File

@ -98,7 +98,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
} }
// Suppression fichier // Suppression fichier
if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes')
{ {
$file = $upload_dir . "/" . urldecode($_GET["urlfile"]); $file = $upload_dir . "/" . urldecode($_GET["urlfile"]);
dol_delete_file($file); dol_delete_file($file);
@ -157,11 +157,11 @@ if ($socid > 0)
if ($mesg) { print "$mesg<br>"; } if ($mesg) { print "$mesg<br>"; }
/* /*
* Confirmation de la suppression d'une ligne produit * Confirmation suppression fichier
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&amp;urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -80,7 +80,7 @@ if ($_GET["subaction"] == 'delrights' && $caneditperms)
$edituser->delrights($_GET["rights"]); $edituser->delrights($_GET["rights"]);
} }
if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes") if ($_REQUEST["action"] == 'confirm_disable' && $_REQUEST["confirm"] == "yes")
{ {
if ($_GET["id"] <> $user->id) if ($_GET["id"] <> $user->id)
{ {
@ -92,7 +92,7 @@ if ($_POST["action"] == 'confirm_disable' && $_POST["confirm"] == "yes")
exit; exit;
} }
} }
if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes") if ($_REQUEST["action"] == 'confirm_enable' && $_REQUEST["confirm"] == "yes")
{ {
if ($_GET["id"] <> $user->id) if ($_GET["id"] <> $user->id)
{ {
@ -105,7 +105,7 @@ if ($_POST["action"] == 'confirm_enable' && $_POST["confirm"] == "yes")
} }
} }
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
{ {
if ($_GET["id"] <> $user->id) if ($_GET["id"] <> $user->id)
{ {
@ -299,8 +299,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield)
} }
// Action modif mot de passe // Action modif mot de passe
if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes') if ((($_REQUEST["action"] == 'confirm_password' && $_REQUEST["confirm"] == 'yes')
|| $_POST["action"] == 'confirm_passwordsend') && $caneditpassword) || ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')) && $caneditpassword)
{ {
$edituser = new User($db, $_GET["id"]); $edituser = new User($db, $_GET["id"]);
$edituser->fetch(); $edituser->fetch();
@ -314,7 +314,7 @@ if ((($_POST["action"] == 'confirm_password' && $_POST["confirm"] == 'yes')
else else
{ {
// Succes // Succes
if ($_POST["action"] == 'confirm_passwordsend') if ($_REQUEST["action"] == 'confirm_passwordsend' && $_REQUEST["confirm"] == 'yes')
{ {
if ($edituser->send_password($user,$newpassword) > 0) if ($edituser->send_password($user,$newpassword) > 0)
{ {
@ -764,7 +764,7 @@ else
*/ */
if ($action == 'password') if ($action == 'password')
{ {
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password"); $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -773,7 +773,7 @@ else
*/ */
if ($action == 'passwordsend') if ($action == 'passwordsend')
{ {
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend"); $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -782,7 +782,7 @@ else
*/ */
if ($action == 'disable') if ($action == 'disable')
{ {
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -791,7 +791,7 @@ else
*/ */
if ($action == 'enable') if ($action == 'enable')
{ {
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable"); $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
@ -800,7 +800,7 @@ else
*/ */
if ($action == 'delete') if ($action == 'delete')
{ {
$ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete", '', 0, 1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }

View File

@ -45,14 +45,17 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
/** /**
* Action suppression groupe * Action suppression groupe
*/ */
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes") if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes")
{ {
if($caneditperms){ if ($caneditperms)
{
$editgroup = new Usergroup($db, $_GET["id"]); $editgroup = new Usergroup($db, $_GET["id"]);
$editgroup->fetch($_GET["id"]); $editgroup->fetch($_GET["id"]);
$editgroup->delete(); $editgroup->delete();
Header("Location: index.php"); Header("Location: index.php");
}else{ }
else
{
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
} }
} }
@ -62,14 +65,17 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
*/ */
if ($_POST["action"] == 'add') if ($_POST["action"] == 'add')
{ {
if($caneditperms){ if($caneditperms)
{
$message=""; $message="";
if (! $_POST["nom"]) { if (! $_POST["nom"])
{
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>'; $message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
if (! $message) { if (! $message)
{
$editgroup = new UserGroup($db,0); $editgroup = new UserGroup($db,0);
$editgroup->nom = trim($_POST["nom"]); $editgroup->nom = trim($_POST["nom"]);
@ -226,7 +232,7 @@ else
*/ */
if ($action == 'delete') if ($action == 'delete')
{ {
$ret=$html->form_confirm("fiche.php?id=$group->id",$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete"); $ret=$html->form_confirm("fiche.php?id=".$group->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete", '',0,1);
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }