diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 08d10629eff..807529209f9 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -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 '
'.$errmsg.'
'; print "\n"; } +if ($mesg) print '
'.$mesg.'
'; // fetch optionals attributes and labels $adho->fetch_name_optionals_label(); @@ -878,13 +880,6 @@ if ($rowid && $action != 'edit') if ($ret == 'html') print '
'; } - // 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 '
'; - } - // 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 '
'; } @@ -919,6 +914,13 @@ if ($rowid && $action != 'edit') if ($ret == 'html') print '
'; } + // 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 '
'; + } + /* * Confirm add in spip */ diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index dd83b4fff2b..c1cbfd9bf34 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -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']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) $text.='
'.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 '
'; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e159f90f5ac..707402fbfd0 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -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 "
\n"; */ if ($_GET['action'] == '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'); + $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 '
'; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 36599421595..371d5b71fbd 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -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) { diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index cead2d72e12..efcbf6abbd5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -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 '
'; } @@ -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 '
'; } @@ -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 '
'; } // 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 '
'; } 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.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no'); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no', 1); if ($ret == 'html') print '
'; } @@ -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 '
'; } diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 761b35795fa..967216cf8e0 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -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.'
'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index b79ddc8a35e..bdb80375d88 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -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 '
'; @@ -469,7 +467,6 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P // Formulaire confirmation if ($_POST["action"] == 'add_paiement') { - // print ''; print '
'; $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); diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 0ab3bca493f..4a00c3c201c 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -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 '
'; } @@ -153,7 +153,7 @@ if ($_GET['action'] == 'delete') if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); if ($ret == 'html') print '
'; } diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index 35d6eeb03f9..32d3f59e854 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -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) diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 39ec23d2d6f..98c6feeec4a 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -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 '
'; } } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 28ebba078f8..752712e0964 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -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 '
'; } @@ -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 '
'; } @@ -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 '
'; } @@ -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 '
'; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 4426abc096c..7df42250cbc 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -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 '
'; } // 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 '
'; } // 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 '
'; } // 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.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline'); + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); if ($ret == 'html') print '
'; } diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index b386ca1b78f..322fd6cd822 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -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.=''; + $more.=''; + $more.=''; + foreach ($formquestion as $key => $input) + { + if ($input['type'] == 'text') + { + $more.=''; + } + if ($input['type'] == 'select') + { + $more.=''; + } + if ($input['type'] == 'checkbox') + { + $more.=''; + $more.=''; + if ($i==0) $more.=''; + else $more.=''; + $more.=''; // Ligne formulaire - if ($formquestion) - { - print ''; - - //print ''; - } + print $more; // Ligne message print ''; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index d22cd0647cd..366d540edc7 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -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 ? diff --git a/htdocs/langs/fr_FR/interventions.lang b/htdocs/langs/fr_FR/interventions.lang index 51958ea3988..69878dc6371 100644 --- a/htdocs/langs/fr_FR/interventions.lang +++ b/htdocs/langs/fr_FR/interventions.lang @@ -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 ? diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index f1c2cf55236..c93fc900088 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -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, diff --git a/htdocs/soc.php b/htdocs/soc.php index 4f09cffc785..e619ee79925 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -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 '
'; }
'.$formquestion['text'].'
'.$input['label'].'
'; + $more.=$this->select_array($input['name'],$input['values'],'',1); + $more.='
'.$input['label'].'  '; + $more.=' $selval) + { + $more.='
'.$input['label'].' \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 ''; + $pageno=($useajax == 2?$page.'&confirm=no':''); + // Note: Title is not used by dialogConfirm function + print ''; print "\n"; $ret='ajax'; } @@ -1569,58 +1622,7 @@ class Form print '
'.img_picto('','recent').' '.$title.'
'; - print ''; - print ''; - foreach ($formquestion as $key => $input) - { - if ($input['type'] == 'text') - { - print ''; - } - if ($input['type'] == 'select') - { - print ''; - } - if ($input['type'] == 'checkbox') - { - print ''; - print ''; - print ''; - print ''; - print ''; - } - if ($input['type'] == 'radio') - { - $i=0; - foreach($input['values'] as $selkey => $selval) - { - print ''; - if ($i==0) print ''; - else print ''; - print ''; - print ''; - $i++; - } - } - } - print '
'.$formquestion['text'].'
'.$input['label'].'
'; - print $this->select_array($input['name'],$input['values'],'',1); - print '
'.$input['label'].'  '; - print '  
'.$input['label'].' '; - print $selval; - print '
'; - print '