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

This commit is contained in:
Laurent Destailleur 2009-05-06 15:45:50 +00:00
parent a477c5cab7
commit 6335fe2b55
17 changed files with 144 additions and 130 deletions

View File

@ -117,7 +117,7 @@ if ($_POST["action"] == 'confirm_create_thirdparty' && $_POST["confirm"] == 'yes
}
}
if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
if ($_REQUEST["action"] == 'confirm_sendinfo' && $_REQUEST["confirm"] == 'yes')
{
$adh->id = $rowid;
$adh->fetch($rowid);
@ -125,6 +125,7 @@ if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
if ($adh->email)
{
$result=$adh->send_an_email("Voici le contenu de votre fiche\n\n%INFOS%\n\n","Contenu de votre fiche adherent");
$mesg=$langs->trans("CardSent");
}
}
@ -392,7 +393,7 @@ if ($user->rights->adherent->creer && $_POST["action"] == 'add')
}
}
if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
if ($user->rights->adherent->supprimer && $_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
{
$result=$adh->fetch($rowid);
$result=$adh->delete($rowid);
@ -542,6 +543,7 @@ if ($errmsg)
print '<div class="error">'.$errmsg.'</div>';
print "\n";
}
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
// fetch optionals attributes and labels
$adho->fetch_name_optionals_label();
@ -878,13 +880,6 @@ if ($rowid && $action != 'edit')
if ($ret == 'html') print '<br>';
}
// Confirm remove member
if ($action == 'delete')
{
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete");
if ($ret == 'html') print '<br>';
}
// Confirm validate member
if ($action == 'valid')
{
@ -899,7 +894,7 @@ if ($rowid && $action != 'edit')
// Confirm send card by mail
if ($action == 'sendinfo')
{
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo");
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo",'',0,1);
if ($ret == 'html') print '<br>';
}
@ -919,6 +914,13 @@ if ($rowid && $action != 'edit')
if ($ret == 'html') print '<br>';
}
// Confirm remove member
if ($action == 'delete')
{
$ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",'',0,1);
if ($ret == 'html') print '<br>';
}
/*
* Confirm add in spip
*/

View File

@ -17,11 +17,11 @@
*/
/**
\file htdocs/adherents/fiche_subscription.php
\ingroup adherent
\brief Page d'ajout, edition, suppression d'une fiche adhésion
\version $Id$
*/
* \file htdocs/adherents/fiche_subscription.php
* \ingroup adherent
* \brief Page d'ajout, edition, suppression d'une fiche adhésion
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/member.lib.php");
@ -126,7 +126,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
}
}
if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
{
$result=$subscription->fetch($rowid);
$result=$subscription->delete();
@ -297,7 +297,7 @@ if ($rowid && $action != 'edit')
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
$text=$langs->trans("ConfirmDeleteSubscription");
if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) $text.='<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1);
if ($ret == 'html') print '<br>';
}

View File

@ -356,7 +356,7 @@ if ($_POST["actioncancel"])
$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition
}
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') // delete
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') // delete
{
if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; }
else { $rowidcol="rowid"; }
@ -448,7 +448,7 @@ print "<br>\n";
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$_GET["rowid"].'&amp;code='.$_GET["code"].'&amp;id='.$_GET["id"], $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$_GET["rowid"].'&code='.$_GET["code"].'&id='.$_GET["id"], $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
if ($ret == 'html') print '<br>';
}

View File

@ -22,10 +22,10 @@
*/
/**
\file htdocs/admin/fichinter.php
\ingroup fichinter
\brief Page d'administration/configuration du module FicheInter
\version $Id$
* \file htdocs/admin/fichinter.php
* \ingroup fichinter
* \brief Page d'administration/configuration du module FicheInter
* \version $Id$
*/
require("./pre.inc.php");
@ -108,7 +108,7 @@ if ($_GET["action"] == 'del')
$sql.= " WHERE nom = '".$_GET["value"];
$sql.= " AND type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
if ($db->query($sql))
{
@ -129,11 +129,14 @@ if ($_GET["action"] == 'setdoc')
// On active le modele
$type='ficheinter';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del.= " WHERE nom = '".$_GET["value"];
$sql_del.= " WHERE nom = '".$_GET["value"]."'";
$sql_del.= " AND type = '".$type."'";
$sql_del.= " AND entity = ".$conf->entity;
dol_syslog("fichinter: sql_del=".$sql_del);
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
dol_syslog("fichinter: sql_del=".$sql_del);
$result2=$db->query($sql);
if ($result1 && $result2)
{

View File

@ -116,7 +116,7 @@ if ($_GET['action'] == 'reopen' && $user->rights->facture->creer)
}
// Suppression de la facture
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->supprimer)
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->supprimer)
{
if ($user->rights->facture->supprimer)
{
@ -138,7 +138,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user-
/*
* Supprime une ligne produit AVEC ou SANS confirmation
*/
if (($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
if (($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
{
if ($user->rights->facture->creer)
@ -369,14 +369,14 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
}
// Classe à "payée"
if ($_POST['action'] == 'confirm_payed' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
if ($_REQUEST['action'] == 'confirm_payed' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$fac = new Facture($db);
$fac->fetch($_GET['facid']);
$result = $fac->set_payed($user);
}
// Classe à "payée partiellement"
if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
if ($_REQUEST['action'] == 'confirm_payed_partially' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$fac = new Facture($db);
$fac->fetch($_GET['facid']);
@ -2004,7 +2004,7 @@ else
if ($_GET['action'] == 'converttoreduc')
{
$text=$langs->trans('ConfirmConvertToReduc');
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc');
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc','',0,2);
if ($ret == 'html') print '<br>';
}
@ -2012,7 +2012,7 @@ else
if ($_GET['action'] == 'delete')
{
$text=$langs->trans('ConfirmDeleteBill');
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete');
$ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete','',0,2);
if ($ret == 'html') print '<br>';
}
@ -2046,14 +2046,14 @@ else
$text.=$notify->confirmMessage(2,$fac->socid);
}
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid','',0,($conf->notification->enabled?0:2));
if ($ret == 'html') print '<br>';
}
// Confirmation du classement payé
if ($_GET['action'] == 'payed' && $resteapayer <= 0)
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed','',0,1);
if ($ret == 'html') print '<br>';
}
if ($_GET['action'] == 'payed' && $resteapayer > 0)
@ -2132,7 +2132,7 @@ else
// Confirmation de la suppression d'une ligne produit
if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no', 1);
if ($ret == 'html') print '<br>';
}
@ -2145,7 +2145,7 @@ else
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1)
);
// 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>';
}

View File

@ -19,10 +19,10 @@
*/
/**
\file htdocs/compta/facture/fiche-rec.php
\ingroup facture
\brief Page d'affichage d'une facture récurrent
\version $Id$
* \file htdocs/compta/facture/fiche-rec.php
* \ingroup facture
* \brief Page d'affichage d'une facture récurrent
* \version $Id$
*/
require("./pre.inc.php");
@ -101,7 +101,7 @@ $html = new Form($db);
************************************************************************/
if ($_GET["action"] == 'create')
{
print_titre($langs->trans("CreateRepeatableInvoice"));
print_fiche_titre($langs->trans("CreateRepeatableInvoice"));
if ($mesg) print $mesg.'<br>';

View File

@ -256,7 +256,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
exit;
}
// Initialise donnees pour page de confirmation
// Initialize data for confirmation (this is used because data can be change during confirmation)
if ($_POST["action"] == 'add_paiement')
{
$i=0;
@ -264,8 +264,6 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
$formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
$formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
$formquestion[$i++]=array('type' => 'hidden','name' => 'type', 'value' => $facture->type);
}
print '<form name="add_paiement" action="paiement.php" method="post">';
@ -469,7 +467,6 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
// Formulaire confirmation
if ($_POST["action"] == 'add_paiement')
{
// print '<tr><td colspan="3">';
print '<br>';
$text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie));
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion);

View File

@ -51,7 +51,7 @@ $mesg='';
* Actions
*/
if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$db->begin();
@ -71,7 +71,7 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user-
}
}
if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->facture->paiement)
if ($_REQUEST['action'] == 'confirm_valide' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->paiement)
{
$db->begin();
@ -143,7 +143,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"));
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete');
$ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
if ($ret == 'html') print '<br>';
}
@ -153,7 +153,7 @@ if ($_GET['action'] == 'delete')
if ($_GET['action'] == 'valide')
{
$facid = $_GET['facid'];
$ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide');
$ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&amp;facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
if ($ret == 'html') print '<br>';
}

View File

@ -610,6 +610,8 @@ class Contact extends CommonObject
$result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if ($error) $this->error=join(',',$this->errors);
}
if (! $error)

View File

@ -121,7 +121,7 @@ if ($_POST["action"] == 'add' && $user->rights->societe->contact->creer)
}
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->societe->contact->supprimer)
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes' && $user->rights->societe->contact->supprimer)
{
$contact = new Contact($db);
$result=$contact->fetch($_GET["id"]);
@ -130,9 +130,15 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user-
$contact->old_firstname = $_POST["old_firstname"];
$result = $contact->delete();
Header("Location: index.php");
exit;
if ($result > 0)
{
Header("Location: index.php");
exit;
}
else
{
$mesg=$contact->error;
}
}
if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact->creer)
@ -223,7 +229,7 @@ if ($user->rights->societe->contact->supprimer)
{
if ($_GET["action"] == 'delete')
{
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete");
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
if ($ret == 'html') print '<br>';
}
}

View File

@ -51,7 +51,7 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
* Actions
*/
if ($_POST["action"] == 'confirm_active' && $_POST["confirm"] == 'yes' && $user->rights->contrat->activer)
if ($_REQUEST["action"] == 'confirm_active' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
@ -361,21 +361,21 @@ if ($_GET["action"] == 'deleteline' && $user->rights->contrat->creer)
}
}
if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == 'yes' && $user->rights->contrat->creer)
if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
$result = $contrat->validate($user,$langs,$conf);
}
if ($_POST["action"] == 'confirm_close' && $_POST["confirm"] == 'yes' && $user->rights->contrat->creer)
if ($_REQUEST["action"] == 'confirm_close' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
{
$contrat = new Contrat($db);
$contrat->fetch($_GET["id"]);
$result = $contrat->cloture($user,$langs,$conf);
}
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes')
{
if ($user->rights->contrat->supprimer)
{
@ -394,7 +394,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
}
}
if ($_POST["action"] == 'confirm_move' && $_POST["confirm"] == 'yes')
if ($_REQUEST["action"] == 'confirm_move' && $_REQUEST["confirm"] == 'yes')
{
if ($user->rights->contrat->creer)
{
@ -654,7 +654,7 @@ else
*/
if ($_GET["action"] == 'delete')
{
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete");
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1);
if ($ret == 'html') print '<br>';
}
@ -664,7 +664,7 @@ else
if ($_GET["action"] == 'valid')
{
//$numfa = contrat_get_num($soc);
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid");
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid",'',0,1);
if ($ret == 'html') print '<br>';
}
@ -673,7 +673,7 @@ else
*/
if ($_GET["action"] == 'close')
{
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close");
$ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1);
if ($ret == 'html') print '<br>';
}
@ -995,7 +995,7 @@ else
$title=$langs->trans("CloseService");
$question=$langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y"));
$action="confirm_closeline";
$html->form_confirm($page,$title,$question,$action,'','');
$html->form_confirm($page,$title,$question,$action,'',0,1);
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
}

View File

@ -107,7 +107,7 @@ if ($_REQUEST['action'] == 'confirm_modify' && $_REQUEST['confirm'] == 'yes')
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
}
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
$result=fichinter_create($db, $fichinter, (empty($_REQUEST['model'])?$fichinter->model:$_REQUEST['model']), $outputlangs);
}
else
{
@ -291,7 +291,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
/*
* Supprime une ligne d'intervention SANS confirmation
*/
if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
if ($_REQUEST['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
$fichinterline = new FichinterLigne($db);
if ($fichinterline->fetch($_GET['ligne']) <= 0)
@ -522,28 +522,28 @@ elseif ($_GET["id"] > 0)
// Confirmation de la suppression de la fiche d'intervention
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1);
if ($ret == 'html') print '<br>';
}
// Confirmation de la validation de la fiche d'intervention
if ($_GET['action'] == 'validate')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate','',0,1);
if ($ret == 'html') print '<br>';
}
// Confirmation de la validation de la fiche d'intervention
if ($_GET['action'] == 'modify')
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1);
if ($ret == 'html') print '<br>';
}
// Confirmation de la suppression d'une ligne d'intervention
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
{
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&amp;ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline');
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&amp;ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1);
if ($ret == 'html') print '<br>';
}

View File

@ -1541,20 +1541,73 @@ class Form
* \param action action
* \param formquestion an array with forms complementary inputs
* \param selectedchoice "" or "no" or "yes"
* \param allowajax 0=No, 1=Yes (Yes works only if option activated)
* \param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
* \param string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
*/
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $allowajax=0)
function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0)
{
global $langs,$conf;
$more='';
if ($formquestion)
{
$more.='<tr class="valid"><td class="valid" colspan="3">';
$more.='<table class="notopnoleftnoright" width="100%">';
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>';
foreach ($formquestion as $key => $input)
{
if ($input['type'] == 'text')
{
$more.='<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>';
}
if ($input['type'] == 'select')
{
$more.='<tr><td valign="top">';
$more.=$this->select_array($input['name'],$input['values'],'',1);
$more.='</td></tr>';
}
if ($input['type'] == 'checkbox')
{
$more.='<tr>';
$more.='<td valign="top">'.$input['label'].' &nbsp;';
$more.='<input type="checkbox" class="flat" name="'.$input['name'].'"';
if ($input['value'] != 'false') $more.=' checked="true"';
if ($input['disabled']) $more.=' disabled="true"';
$more.='></td>';
$more.='<td valign="top" align="left">&nbsp;</td>';
$more.='<td valign="top" align="left">&nbsp;</td>';
$more.='</tr>';
}
if ($input['type'] == 'radio')
{
$i=0;
foreach($input['values'] as $selkey => $selval)
{
$more.='<tr>';
if ($i==0) $more.='<td valign="top">'.$input['label'].'</td>';
else $more.='<td>&nbsp;</td>';
$more.='<td valign="top" width="20"><input type="radio" class="flat" name="'.$input['name'].'" value="'.$selkey.'"';
if ($input['disabled']) $more.=' disabled="true"';
$more.='></td>';
$more.='<td valign="top" align="left">';
$more.=$selval;
$more.='</td></tr>';
$i++;
}
}
}
$more.='</table>';
$more.='</td></tr>';
}
print "\n<!-- begin form_confirm -->\n";
if ($allowajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
if ($useajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
{
$pageyes=$page.'&action='.$action.'&confirm=yes';
$pageno=$page.'&confirm=no';
print '<script type="text/javascript">dialogConfirm(\''.$pageyes.'\',\''.$pageno.'\',\''.dol_escape_js($question).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')</script>';
$pageno=($useajax == 2?$page.'&confirm=no':'');
// Note: Title is not used by dialogConfirm function
print '<script type="text/javascript">dialogConfirm(\''.$title.'\',\''.$pageyes.'\',\''.$pageno.'\',\''.dol_escape_js('<b>'.$title.'</b><br>'.$more.$question).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')</script>';
print "\n";
$ret='ajax';
}
@ -1569,58 +1622,7 @@ class Form
print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>';
// Ligne formulaire
if ($formquestion)
{
print '<tr class="valid"><td class="valid" colspan="3">';
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>';
foreach ($formquestion as $key => $input)
{
if ($input['type'] == 'text')
{
print '<tr><td valign="top">'.$input['label'].'</td><td colspan="2"><input type="text" class="flat" name="'.$input['name'].'" size="'.$input['size'].'" value="'.$input['value'].'"></td></tr>';
}
if ($input['type'] == 'select')
{
print '<tr><td valign="top">';
print $this->select_array($input['name'],$input['values'],'',1);
print '</td></tr>';
}
if ($input['type'] == 'checkbox')
{
print '<tr>';
print '<td valign="top">'.$input['label'].' &nbsp;';
print '<input type="checkbox" class="flat" name="'.$input['name'].'"';
if ($input['value'] != 'false') print ' checked="true"';
if ($input['disabled']) print ' disabled="true"';
print '></td>';
print '<td valign="top" align="left">&nbsp;</td>';
print '<td valign="top" align="left">&nbsp;</td>';
print '</tr>';
}
if ($input['type'] == 'radio')
{
$i=0;
foreach($input['values'] as $selkey => $selval)
{
print '<tr>';
if ($i==0) print '<td valign="top">'.$input['label'].'</td>';
else print '<td>&nbsp;</td>';
print '<td valign="top" width="20"><input type="radio" class="flat" name="'.$input['name'].'" value="'.$selkey.'"';
if ($input['disabled']) print ' disabled="true"';
print '></td>';
print '<td valign="top" align="left">';
print $selval;
print '</td></tr>';
$i++;
}
}
}
print '</table>';
print '</td></tr>';
//print '<tr class="valid"><td class="valid" colspan="3"><hr></td></tr>';
}
print $more;
// Ligne message
print '<tr class="valid">';

View File

@ -14,6 +14,7 @@ CustomerDoesNotHavePrefix=Customer does not have a prefix
InterventionContact=Intervention contact
DeleteIntervention=Delete intervention
ValidateIntervention=Validate intervention
ModifyIntervention=Modify intervention
DeleteInterventionLine=Delete intervention line
ConfirmDeleteIntervention=Are you sure you want to delete this intervention ?
ConfirmValidateIntervention=Are you sure you want to validate this intervention ?

View File

@ -14,6 +14,7 @@ CustomerDoesNotHavePrefix=Le client n'a pas de préfixe de défini
InterventionContact=Contact intervention
DeleteIntervention=Supprimer intervention
ValidateIntervention=Valider intervention
ModifyIntervention=Modifier intervention
DeleteInterventionLine=Supprimer ligne d'intervention
ConfirmDeleteIntervention=Êtes-vous sûr de vouloir effacer cette intervention ?
ConfirmValidateIntervention=Êtes-vous sûr de vouloir valider cette intervention ?

View File

@ -672,12 +672,12 @@ function cleanSerialize(expr) {
}
/*=================================================================
Purpose: Affiche un message de confirmation
Input: linkurl,message,ok,cancel,objectID
Author: Regis Houssin
Purpose: Show a confim popup
Input: title,linkurlyes,linkurlno,message,ok,cancel,objectID
Author: Regis Houssin, Laurent Destailleur
Licence: GPL
==================================================================*/
function dialogConfirm(linkurlyes,linkurlno,message,ok,cancel,objectID) {
function dialogConfirm(title,linkurlyes,linkurlno,message,ok,cancel,objectID) {
Dialog.confirm(message, {
width:560,
okLabel: ok,

View File

@ -959,7 +959,7 @@ else
if ($_GET["action"] == 'delete')
{
$html = new Form($db);
$ret=$html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,1);
$ret=$html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,2);
if ($ret == 'html') print '<br>';
}