From 7c6016b35541da1a24ac57d228b713533fdcf663 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Wed, 6 May 2009 13:39:43 +0000 Subject: [PATCH] Qual: Use a so much simpler way to have ajax confirmation boxes --- htdocs/adherents/fiche.php | 32 +- htdocs/adherents/fiche_subscription.php | 4 +- htdocs/admin/dict.php | 678 ++++++++++---------- htdocs/admin/menus/index.php | 5 +- htdocs/admin/tools/listevents.php | 4 +- htdocs/categories/viewcat.php | 4 +- htdocs/comm/action/fiche.php | 4 +- htdocs/comm/adresse_livraison.php | 84 +-- htdocs/comm/mailing/fiche.php | 786 ++++++++++++------------ htdocs/comm/propal.php | 48 +- htdocs/commande/fiche.php | 86 +-- htdocs/compta/bank/account.php | 8 +- htdocs/compta/bank/bankid_fr.php | 24 +- htdocs/compta/bank/fiche.php | 4 +- htdocs/compta/bank/ligne.php | 6 +- htdocs/compta/deplacement/fiche.php | 17 +- htdocs/compta/facture.php | 46 +- htdocs/compta/paiement.php | 3 +- htdocs/compta/paiement/cheque/fiche.php | 10 +- htdocs/compta/paiement/fiche.php | 8 +- htdocs/compta/prelevement/fiche.php | 4 +- htdocs/compta/sociales/charges.php | 8 +- htdocs/contact/fiche.php | 8 +- htdocs/contrat/fiche.php | 20 +- htdocs/ecm/docdir.php | 14 +- htdocs/ecm/docfile.php | 10 +- htdocs/ecm/docmine.php | 36 +- htdocs/ecm/docother.php | 90 +-- htdocs/ecm/index.php | 8 +- htdocs/expedition/commande.php | 4 +- htdocs/expedition/fiche.php | 12 +- htdocs/fichinter/fiche.php | 62 +- htdocs/fourn/commande/fiche.php | 42 +- htdocs/fourn/facture/fiche.php | 46 +- htdocs/fourn/paiement/fiche.php | 10 +- htdocs/html.form.class.php | 156 ++--- htdocs/lib/lib_head.js | 6 +- htdocs/livraison/fiche.php | 8 +- htdocs/product/fiche.php | 5 +- htdocs/product/photos.php | 34 +- htdocs/projet/fiche.php | 4 +- htdocs/projet/tasks/task.php | 8 +- htdocs/soc.php | 16 +- htdocs/societe/document.php | 78 +-- htdocs/user/fiche.php | 20 +- htdocs/user/group/fiche.php | 6 +- 46 files changed, 1204 insertions(+), 1372 deletions(-) diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 42b75bc0d4f..08d10629eff 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -851,8 +851,8 @@ if ($rowid && $action != 'edit') $formquestion=array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); - $html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion); + if ($ret == 'html') print '<br>'; } // Confirm create third party @@ -874,15 +874,15 @@ if ($rowid && $action != 'edit') $formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); - $html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion); + if ($ret == 'html') print '<br>'; } // Confirm remove member if ($action == 'delete') { - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } // Confirm validate member @@ -892,15 +892,15 @@ if ($rowid && $action != 'edit') $formquestion=array(); if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $langs->trans("SendAnEMailToMember",$adh->email), 'value' => 'true'); - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion); + if ($ret == 'html') print '<br>'; } // Confirm send card by mail if ($action == 'sendinfo') { - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo"); + if ($ret == 'html') print '<br>'; } // Confirm resiliate @@ -915,8 +915,8 @@ if ($rowid && $action != 'edit') $label.=')'; if ($adh->email) $formquestion[0]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?'true':'false')); - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); + if ($ret == 'html') print '<br>'; } /* @@ -924,8 +924,8 @@ if ($rowid && $action != 'edit') */ if ($action == 'add_spip') { - $html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid","Ajouter dans spip","Etes-vous sur de vouloir ajouter cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_add_spip"); + if ($ret == 'html') print '<br>'; } /* @@ -933,8 +933,8 @@ if ($rowid && $action != 'edit') */ if ($action == 'del_spip') { - $html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid","Supprimer dans spip","Etes-vous sur de vouloir effacer cet adherent dans spip ? (serveur : ".ADHERENT_SPIP_SERVEUR.")","confirm_del_spip"); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 3175a53d2c0..dd83b4fff2b 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -297,8 +297,8 @@ 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"); - $form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion); + if ($ret == 'html') print '<br>'; } print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 12823318489..e159f90f5ac 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -35,7 +35,7 @@ $langs->load("admin"); $langs->load("companies"); if (!$user->admin) - accessforbidden(); +accessforbidden(); $acts[0] = "activate"; $acts[1] = "disable"; @@ -241,114 +241,114 @@ $sortorder=$_GET["sortorder"]; */ if ($_POST["actionadd"] || $_POST["actionmodify"]) { - $listfield=split(',',$tabfield[$_POST["id"]]); - $listfieldinsert=split(',',$tabfieldinsert[$_POST["id"]]); - $listfieldmodify=split(',',$tabfieldinsert[$_POST["id"]]); - $listfieldvalue=split(',',$tabfieldvalue[$_POST["id"]]); - - // Verifie que tous les champs sont renseign�s - $ok=1; - foreach ($listfield as $f => $value) { - if (! isset($_POST[$value]) || $_POST[$value]=='') { - $ok=0; - $msg.=$langs->trans("ErrorFieldRequired",$listfield[$f]).'<br>'; - } - } - // Autres verif - if (isset($_POST["code"]) && $_POST["code"]=='0') { - $ok=0; - $msg.="Le Code ne peut avoir la valeur 0<br>"; - } - if (isset($_POST["pays"]) && $_POST["pays"]=='0') { - $ok=0; - $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'<br>'; - } - - // Si verif ok et action add, on ajoute la ligne - if ($ok && $_POST["actionadd"]) { - if ($tabrowid[$_POST["id"]]) { - // Recupere id libre pour insertion - $newid=0; - $sql = "SELECT max(".$tabrowid[$_POST["id"]].") newid from ".$tabname[$_POST["id"]]; - $result = $db->query($sql); - if ($result) - { - $obj = $db->fetch_object($result); - $newid=($obj->newid + 1); - - } else { - dol_print_error($db); - } - } - - // Add new entry - $sql = "INSERT INTO ".$tabname[$_POST["id"]]." ("; - // List of fields + $listfield=split(',',$tabfield[$_POST["id"]]); + $listfieldinsert=split(',',$tabfieldinsert[$_POST["id"]]); + $listfieldmodify=split(',',$tabfieldinsert[$_POST["id"]]); + $listfieldvalue=split(',',$tabfieldvalue[$_POST["id"]]); + + // Verifie que tous les champs sont renseign�s + $ok=1; + foreach ($listfield as $f => $value) { + if (! isset($_POST[$value]) || $_POST[$value]=='') { + $ok=0; + $msg.=$langs->trans("ErrorFieldRequired",$listfield[$f]).'<br>'; + } + } + // Autres verif + if (isset($_POST["code"]) && $_POST["code"]=='0') { + $ok=0; + $msg.="Le Code ne peut avoir la valeur 0<br>"; + } + if (isset($_POST["pays"]) && $_POST["pays"]=='0') { + $ok=0; + $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'<br>'; + } + + // Si verif ok et action add, on ajoute la ligne + if ($ok && $_POST["actionadd"]) { + if ($tabrowid[$_POST["id"]]) { + // Recupere id libre pour insertion + $newid=0; + $sql = "SELECT max(".$tabrowid[$_POST["id"]].") newid from ".$tabname[$_POST["id"]]; + $result = $db->query($sql); + if ($result) + { + $obj = $db->fetch_object($result); + $newid=($obj->newid + 1); + + } else { + dol_print_error($db); + } + } + + // Add new entry + $sql = "INSERT INTO ".$tabname[$_POST["id"]]." ("; + // List of fields + if ($tabrowid[$_POST["id"]] && + ! in_array($tabrowid[$_POST["id"]],$listfieldinsert)) $sql.= $tabrowid[$_POST["id"]].","; + $sql.= $tabfieldinsert[$_POST["id"]]; + $sql.=",active)"; + $sql.= " VALUES("; + // List of values if ($tabrowid[$_POST["id"]] && - ! in_array($tabrowid[$_POST["id"]],$listfieldinsert)) $sql.= $tabrowid[$_POST["id"]].","; - $sql.= $tabfieldinsert[$_POST["id"]]; - $sql.=",active)"; - $sql.= " VALUES("; - // List of values - if ($tabrowid[$_POST["id"]] && - ! in_array($tabrowid[$_POST["id"]],$listfieldinsert)) $sql.= $newid.","; - $i=0; - foreach ($listfieldinsert as $f => $value) + ! in_array($tabrowid[$_POST["id"]],$listfieldinsert)) $sql.= $newid.","; + $i=0; + foreach ($listfieldinsert as $f => $value) { - if ($value == 'price') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } + if ($value == 'price') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } if ($i) $sql.=","; $sql.="'".addslashes($_POST[$listfieldvalue[$i]])."'"; $i++; - } - $sql.=",1)"; - - dol_syslog("dict actionadd sql=".$sql); - $result = $db->query($sql); - if (!$result) - { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $msg=$langs->trans("ErrorRecordAlreadyExists").'<br>'; - } - else { - dol_print_error($db); - } - } - } - - // Si verif ok et action modify, on modifie la ligne - if ($ok && $_POST["actionmodify"]) { - if ($tabrowid[$_POST["id"]]) { $rowidcol=$tabrowid[$_POST["id"]]; } - else { $rowidcol="rowid"; } - - // Modify entry - $sql = "UPDATE ".$tabname[$_POST["id"]]." SET "; - // Modifie valeur des champs + } + $sql.=",1)"; + + dol_syslog("dict actionadd sql=".$sql); + $result = $db->query($sql); + if (!$result) + { + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $msg=$langs->trans("ErrorRecordAlreadyExists").'<br>'; + } + else { + dol_print_error($db); + } + } + } + + // Si verif ok et action modify, on modifie la ligne + if ($ok && $_POST["actionmodify"]) { + if ($tabrowid[$_POST["id"]]) { $rowidcol=$tabrowid[$_POST["id"]]; } + else { $rowidcol="rowid"; } + + // Modify entry + $sql = "UPDATE ".$tabname[$_POST["id"]]." SET "; + // Modifie valeur des champs if ($tabrowid[$_POST["id"]] && !in_array($tabrowid[$_POST["id"]],$listfieldmodify)) - { - $sql.= $tabrowid[$_POST["id"]]."="; - $sql.= "'".addslashes($_POST["rowid"])."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) { - if ($field == 'price') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - if ($i) $sql.=","; - $sql.= $field."="; - $sql.= "'".addslashes($_POST[$listfieldvalue[$i]])."'"; - $i++; - } - $sql.= " WHERE ".$rowidcol." = '".$_POST["rowid"]."'"; + { + $sql.= $tabrowid[$_POST["id"]]."="; + $sql.= "'".addslashes($_POST["rowid"])."', "; + } + $i = 0; + foreach ($listfieldmodify as $field) { + if ($field == 'price') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } + if ($i) $sql.=","; + $sql.= $field."="; + $sql.= "'".addslashes($_POST[$listfieldvalue[$i]])."'"; + $i++; + } + $sql.= " WHERE ".$rowidcol." = '".$_POST["rowid"]."'"; dol_syslog("dict actionmodify sql=".$sql); //print $sql; - $resql = $db->query($sql); - if (! $resql) - { - $msg=$db->error(); - } - } - - if ($msg) $msg='<div class="error">'.$msg.'</div>'; - $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition + $resql = $db->query($sql); + if (! $resql) + { + $msg=$db->error(); + } + } + + if ($msg) $msg='<div class="error">'.$msg.'</div>'; + $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition } if ($_POST["actioncancel"]) @@ -358,62 +358,62 @@ if ($_POST["actioncancel"]) if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes') // delete { - if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } - else { $rowidcol="rowid"; } + if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } + else { $rowidcol="rowid"; } - $sql = "DELETE from ".$tabname[$_GET["id"]]." WHERE ".$rowidcol."='".$_GET["rowid"]."'"; + $sql = "DELETE from ".$tabname[$_GET["id"]]." WHERE ".$rowidcol."='".$_GET["rowid"]."'"; dol_syslog("dict delete sql=".$sql); - $result = $db->query($sql); - if (! $result) - { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') - { - $msg='<div class="error">'.$langs->trans("ErrorRecordIsUsedByChild").'</div>'; - } - else - { - dol_print_error($db); - } - } + $result = $db->query($sql); + if (! $result) + { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') + { + $msg='<div class="error">'.$langs->trans("ErrorRecordIsUsedByChild").'</div>'; + } + else + { + dol_print_error($db); + } + } } if ($_GET["action"] == $acts[0]) // activate { - if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } - else { $rowidcol="rowid"; } - - if ($_GET["rowid"]) { - $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE ".$rowidcol."='".$_GET["rowid"]."'"; - } - elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE code='".$_GET["code"]."'"; - } - - $result = $db->query($sql); - if (!$result) - { - dol_print_error($db); - } + if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } + else { $rowidcol="rowid"; } + + if ($_GET["rowid"]) { + $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE ".$rowidcol."='".$_GET["rowid"]."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 1 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } } if ($_GET["action"] == $acts[1]) // disable { - if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } - else { $rowidcol="rowid"; } - - if ($_GET["rowid"]) { - $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE ".$rowidcol."='".$_GET["rowid"]."'"; - } - elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE code='".$_GET["code"]."'"; - } - - $result = $db->query($sql); - if (!$result) - { - dol_print_error($db); - } + if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } + else { $rowidcol="rowid"; } + + if ($_GET["rowid"]) { + $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE ".$rowidcol."='".$_GET["rowid"]."'"; + } + elseif ($_GET["code"]) { + $sql = "UPDATE ".$tabname[$_GET["id"]]." SET active = 0 WHERE code='".$_GET["code"]."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } } @@ -440,180 +440,180 @@ if (empty($_GET["id"])) print $langs->trans("DictionnaryDesc"); print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; } - print "<br>\n"; - - - /* - * Confirmation de la suppression de la ligne - */ - if ($_GET['action'] == 'delete') - { - $html = new Form($db); - $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'); - print '<br>'; - } +print "<br>\n"; + + +/* + * Confirmation de la suppression de la ligne + */ +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'); + if ($ret == 'html') print '<br>'; +} /* * Affichage d'un dictionnaire particulier */ if ($_GET["id"]) { - if ($msg) + if ($msg) { - print $msg.'<br>'; - } - - // Complete requete recherche valeurs avec critere de tri - $sql=$tabsql[$_GET["id"]]; - if ($_GET["sortfield"]) - { - $sql.= " ORDER BY ".$_GET["sortfield"]; - if ($_GET["sortorder"]) - { - $sql.=" ".strtoupper($_GET["sortorder"]); - } - $sql.=", "; + print $msg.'<br>'; + } + + // Complete requete recherche valeurs avec critere de tri + $sql=$tabsql[$_GET["id"]]; + if ($_GET["sortfield"]) + { + $sql.= " ORDER BY ".$_GET["sortfield"]; + if ($_GET["sortorder"]) + { + $sql.=" ".strtoupper($_GET["sortorder"]); + } + $sql.=", "; // Remove from default sort order the choosed order - $tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].' '.$_GET["sortorder"].',','',$tabsqlsort[$_GET["id"]]); - $tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].',','',$tabsqlsort[$_GET["id"]]); - } - else { - $sql.=" ORDER BY "; - } - $sql.=$tabsqlsort[$_GET["id"]]; + $tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].' '.$_GET["sortorder"].',','',$tabsqlsort[$_GET["id"]]); + $tabsqlsort[$_GET["id"]]=eregi_replace($_GET["sortfield"].',','',$tabsqlsort[$_GET["id"]]); + } + else { + $sql.=" ORDER BY "; + } + $sql.=$tabsqlsort[$_GET["id"]]; //print $sql; - - $fieldlist=split(',',$tabfield[$_GET["id"]]); - - print '<form action="dict.php" method="post">'; - print '<table class="noborder" width="100%">'; - - // Ligne d'ajout - if ($tabname[$_GET["id"]]) - { - $alabelisused=0; - $var=false; - - $fieldlist=split(',',$tabfield[$_GET["id"]]); -// print '<table class="noborder" width="100%">'; - - // Ligne de titre d'ajout - print '<tr class="liste_titre">'; - foreach ($fieldlist as $field => $value) - { - // Determine le nom du champ par rapport aux noms possibles - // dans les dictionnaires de donnees - $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } - if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } - if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } - if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $valuetoshow=''; } - - if ($valuetoshow != '') - { - print '<td>'; - print $valuetoshow; - print '</td>'; - } - - if ($fieldlist[$field]=='libelle') $alabelisused=1; - } - print '<td colspan="3"> </td>'; - print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; - print '</tr>'; - - // Ligne d'ajout - print "<tr ".$bc[$var].">"; - - fieldList($fieldlist); - - print '<td colspan="3"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>'; - print "</tr>"; - - if ($alabelisused) // Si un des champs est un libelle - { - print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>'; - } - print '<tr><td colspan="'.(count($fieldlist)+2).'"> </td></tr>'; - } - - // Affiche table des valeurs + + $fieldlist=split(',',$tabfield[$_GET["id"]]); + + print '<form action="dict.php" method="post">'; + print '<table class="noborder" width="100%">'; + + // Ligne d'ajout + if ($tabname[$_GET["id"]]) + { + $alabelisused=0; + $var=false; + + $fieldlist=split(',',$tabfield[$_GET["id"]]); + // print '<table class="noborder" width="100%">'; + + // Ligne de titre d'ajout + print '<tr class="liste_titre">'; + foreach ($fieldlist as $field => $value) + { + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut + if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } + if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } + if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } + if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } + if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } + if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } + if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } + if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } + if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } + if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $valuetoshow=''; } + + if ($valuetoshow != '') + { + print '<td>'; + print $valuetoshow; + print '</td>'; + } + + if ($fieldlist[$field]=='libelle') $alabelisused=1; + } + print '<td colspan="3">'; + print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; + print ' </td>'; + print '</tr>'; + + // Ligne d'ajout + print "<tr ".$bc[$var].">"; + + fieldList($fieldlist); + + print '<td colspan="3"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>'; + print "</tr>"; + + if ($alabelisused) // Si un des champs est un libelle + { + print '<tr><td colspan="'.(count($fieldlist)+2).'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>'; + } + print '<tr><td colspan="'.(count($fieldlist)+2).'"> </td></tr>'; + } + + // Affiche table des valeurs dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG); - $resql=$db->query($sql); + $resql=$db->query($sql); if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $var=true; - if ($num) - { - // Ligne de titre - print '<tr class="liste_titre">'; - foreach ($fieldlist as $field => $value) + { + $num = $db->num_rows($resql); + $i = 0; + $var=true; + if ($num) + { + // Ligne de titre + print '<tr class="liste_titre">'; + foreach ($fieldlist as $field => $value) { - // Determine le nom du champ par rapport aux noms possibles - // dans les dictionnaires de donnees - $showfield=1; // Par defaut + // Determine le nom du champ par rapport aux noms possibles + // dans les dictionnaires de donnees + $showfield=1; // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } - if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } - if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } - if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } - if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $showfield=0; } - - // Affiche nom du champ - if ($showfield) - { - print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield,$sortorder); - } - } - print_liste_field_titre($langs->trans("Action"),"dict.php","active","&id=".$_GET["id"],"",'align="center"',$sortfield,$sortorder); - print '<td colspan="2"> </td>'; - print '</tr>'; - - // Lignes de valeurs - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; + if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } + if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } + if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } + if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } + if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label")."*"; } + if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } + if ($fieldlist[$field]=='pays') { $valuetoshow=$langs->trans("Country"); } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=MAIN_LABEL_MENTION_NPR; } + if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } + if ($fieldlist[$field]=='fdm') { $valuetoshow=$langs->trans("AtEndOfMonth"); } + if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } + if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } + if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') { $showfield=0; } + + // Affiche nom du champ + if ($showfield) + { + print_liste_field_titre($valuetoshow,"dict.php",$fieldlist[$field],"&id=".$_GET["id"],"","",$sortfield,$sortorder); + } + } + print_liste_field_titre($langs->trans("Action"),"dict.php","active","&id=".$_GET["id"],"",'align="center"',$sortfield,$sortorder); + print '<td colspan="2"> </td>'; + print '</tr>'; + + // Lignes de valeurs + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; //print_r($obj); - print "<tr $bc[$var]>"; - if ($_GET["action"] == 'modify' && ($_GET["rowid"] == ($obj->rowid?$obj->rowid:$obj->code))) - { - print '<form action="dict.php" method="post">'; - print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; - print '<input type="hidden" name="rowid" value="'.$_GET["rowid"].'">'; - fieldList($fieldlist,$obj); - print '<td colspan="3" align="right"><a name="'.($obj->rowid?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; - print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; - } - else - { + print "<tr $bc[$var]>"; + if ($_GET["action"] == 'modify' && ($_GET["rowid"] == ($obj->rowid?$obj->rowid:$obj->code))) + { + print '<form action="dict.php" method="post">'; + print '<input type="hidden" name="id" value="'.$_GET["id"].'">'; + print '<input type="hidden" name="rowid" value="'.$_GET["rowid"].'">'; + fieldList($fieldlist,$obj); + print '<td colspan="3" align="right"><a name="'.($obj->rowid?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; + print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; + } + else + { foreach ($fieldlist as $field => $value) { $showfield=1; @@ -646,68 +646,68 @@ if ($_GET["id"]) print $langs->trans("AlwaysActive"); } print "</td>"; - + if ($iserasable) { print '<td align="center"><a href="dict.php?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&code='.$obj->code.'&id='.$_GET["id"].'&action=modify#'.($obj->rowid?$obj->rowid:$obj->code).'">'.img_edit().'</a></td>'; } else { - print '<td> </td>'; + print '<td> </td>'; } if ($iserasable) { print '<td align="center"><a href="dict.php?sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.($obj->rowid?$obj->rowid:$obj->code).'&code='.$obj->code.'&id='.$_GET["id"].'&action=delete">'.img_delete().'</a></td>'; } else { - print '<td> </td>'; + print '<td> </td>'; } print "</tr>\n"; } - $i++; - } - } - } - else { - dol_print_error($db); - } + $i++; + } + } + } + else { + dol_print_error($db); + } - print '</table>'; + print '</table>'; - print '</form>'; + print '</form>'; } else { - /* - * Affichage de la liste des dictionnaires - */ + /* + * Affichage de la liste des dictionnaires + */ - $var=true; + $var=true; $lastlineisempty=false; - print '<table class="noborder" width="100%">'; - print '<tr class="liste_titre">'; + print '<table class="noborder" width="100%">'; + print '<tr class="liste_titre">'; //print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Dictionnary").'</td>'; print '<td>'.$langs->trans("Table").'</td>'; print '</tr>'; - foreach ($taborder as $i) - { - if ($tabname[$i] && ! $tabcond[$i]) continue; // If dictionnary and condition not true - - if ($i) - { + foreach ($taborder as $i) + { + if ($tabname[$i] && ! $tabcond[$i]) continue; // If dictionnary and condition not true + + if ($i) + { $var=!$var; $value=$tabname[$i]; - print '<tr '.$bc[$var].'><td width="30%"><a href="dict.php?id='.$i.'">'.$tablib[$i].'</a></td><td>'.$tabname[$i].'</td></tr>'; + print '<tr '.$bc[$var].'><td width="30%"><a href="dict.php?id='.$i.'">'.$tablib[$i].'</a></td><td>'.$tabname[$i].'</td></tr>'; $lastlineisempty=false; - } - else - { + } + else + { if (! $lastlineisempty) { $var=!$var; print '<tr '.$bc[$var].'><td width="30%"> </td><td> </td></tr>'; $lastlineisempty=true; } - } - } - print '</table>'; + } + } + print '</table>'; } print '<br>'; @@ -717,8 +717,8 @@ $db->close(); llxFooter('$Date$ - $Revision$'); /** - \brief Affiche les champs -*/ + \brief Affiche les champs + */ function fieldList($fieldlist,$obj='') { global $conf,$langs,$db; @@ -727,7 +727,7 @@ function fieldList($fieldlist,$obj='') $html = new Form($db); $formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); - + foreach ($fieldlist as $field => $value) { if ($fieldlist[$field] == 'pays') { diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index d0a381a675e..9ec0ffeeb85 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -242,9 +242,8 @@ if ($_GET["action"] == 'delete') $result = $db->query($sql); $obj = $db->fetch_object($result); - $html = new Form($db); - $html->form_confirm("index.php?menu_handler=".$menu_handler."&menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete"); - print "<br>\n"; + $ret=$html->form_confirm("index.php?menu_handler=".$menu_handler."&menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete"); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 15db5aef633..d6ca4ca6a04 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -102,8 +102,8 @@ if ($result) if ($_GET["action"] == 'purge') { - $form->form_confirm($_SERVER["PHP_SELF"], $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"], $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge'); + if ($ret == 'html') print '<br>'; } print '<table class="liste" width="100%">'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a5fd3a72f0c..0a5f1749b9e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -100,8 +100,8 @@ dol_fiche_head($head, 'card', $title); */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); + if ($ret == 'html') print '<br>'; } print '<table border="0" width="100%" class="border">'; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 70a19fc2954..c67aabac974 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -643,8 +643,8 @@ if ($_GET["id"]) // Confirmation suppression action if ($_GET["action"] == 'delete') { - $html->form_confirm("fiche.php?id=".$_GET["id"],$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=".$_GET["id"],$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } if ($_REQUEST["action"] == 'edit') diff --git a/htdocs/comm/adresse_livraison.php b/htdocs/comm/adresse_livraison.php index 48e45fedbdd..633dca01925 100644 --- a/htdocs/comm/adresse_livraison.php +++ b/htdocs/comm/adresse_livraison.php @@ -60,14 +60,14 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') $livraison->tel = $_POST["tel"]; $livraison->fax = $_POST["fax"]; $livraison->note = $_POST["note"]; - + if ($_POST["action"] == 'add') { $socid = $_POST["socid"]; $origin = $_POST["origin"]; $originid = $_POST["originid"]; $result = $livraison->create($socid, $user); - + if ($result >= 0) { if ($origin == commande) @@ -92,14 +92,14 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') $_GET["action"]='create'; } } - + if ($_POST["action"] == 'update') { $socid = $_POST["socid"]; $origin = $_POST["origin"]; $originid = $_POST["originid"]; $result = $livraison->update($_POST["idl"], $socid, $user); - + if ($result >= 0) { if ($origin == commande) @@ -132,7 +132,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user- { $livraison = new AdresseLivraison($db); $result = $livraison->delete($_GET["idl"], $socid); - + if ($result == 0) { Header("Location: adresse_livraison.php?socid=".$socid); @@ -165,11 +165,11 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') */ $livraison = new AdresseLivraison($db); - + $societe=new Societe($db); $societe->fetch($_GET["socid"]); $head = societe_prepare_head($societe); - + dol_fiche_head($head, 'customer', $societe->nom); if ($_POST["label"] && $_POST["nom"]) @@ -202,23 +202,23 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') $livraison->pays_code=$obj->code; $livraison->pays=$obj->libelle; } - + print_titre($langs->trans("NewDeliveryAddress")); print "<br>\n"; - + if ($livraison->error) { print '<div class="error">'; print nl2br($livraison->error); print '</div>'; } - + print '<form action="adresse_livraison.php" method="post" name="formsoc">'; print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="origin" value="'.$origin.'">'; print '<input type="hidden" name="originid" value="'.$originid.'">'; print '<input type="hidden" name="action" value="add">'; - + print '<table class="border" width="100%">'; print '<tr><td>'.$langs->trans('DeliveryAddressLabel').'</td><td><input type="text" size="30" name="label" value="'.$livraison->label.'"></td></tr>'; @@ -238,21 +238,21 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">'; $form->select_pays($livraison->pays_id,'pays_id'); print '</td></tr>'; - + print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$livraison->tel.'"></td></tr>'; - + print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$livraison->fax.'"></td></tr>'; - + print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">'; print $livraison->note; print '</textarea></td></tr>'; print '<tr><td colspan="4" align="center">'; print '<input type="submit" class="button" value="'.$langs->trans('AddDeliveryAddress').'"></td></tr>'."\n"; - + print '</table>'."\n"; print '</form>'."\n"; - + } } elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') @@ -261,11 +261,11 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') * Fiche societe en mode edition */ $livraison = new AdresseLivraison($db); - + $societe=new Societe($db); $societe->fetch($_GET["socid"]); $head = societe_prepare_head($societe); - + dol_fiche_head($head, 'customer', $societe->nom); print_titre($langs->trans("EditDeliveryAddress")); @@ -344,11 +344,11 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit') print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'; $form->select_pays($livraison->pays_id,'pays_id'); print '</td></tr>'; - + print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$livraison->tel.'"></td></tr>'; - + print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$livraison->fax.'"></td></tr>'; - + print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">'; print $livraison->note; print '</textarea></td></tr>'; @@ -375,7 +375,7 @@ else $societe=new Societe($db); $societe->fetch($livraison->socid); $head = societe_prepare_head($societe); - + dol_fiche_head($head, 'customer', $societe->nom); @@ -383,8 +383,8 @@ else if ($_GET["action"] == 'delete') { $html = new Form($db); - $html->form_confirm("adresse_livraison.php?socid=".$livraison->socid."&idl=".$_GET["idl"],$langs->trans("DeleteDeliveryAddress"),$langs->trans("ConfirmDeleteDeliveryAdress"),"confirm_delete"); - print "<br />\n"; + $ret=$html->form_confirm("adresse_livraison.php?socid=".$livraison->socid."&idl=".$_GET["idl"],$langs->trans("DeleteDeliveryAddress"),$langs->trans("ConfirmDeleteDeliveryAdress"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } if ($livraison->error) @@ -399,53 +399,53 @@ else { for ($i = 0 ; $i < $nblignes ; $i++) { - + print '<table class="border" width="100%">'; - + print '<tr><td width="20%">'.$langs->trans('DeliveryAddressLabel').'</td><td colspan="3">'.$livraison->lignes[$i]->label.'</td>'; print '<td valign="top" colspan="2" width="50%" rowspan="6">'.$langs->trans('Note').' :<br>'.nl2br($livraison->lignes[$i]->note).'</td></tr>'; print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$livraison->lignes[$i]->nom.'</td></tr>'; - + print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($livraison->lignes[$i]->adresse)."</td></tr>"; - + print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$livraison->lignes[$i]->cp."</td></tr>"; print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$livraison->lignes[$i]->ville."</td></tr>"; - + print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$livraison->lignes[$i]->pays.'</td>'; - + print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($livraison->lignes[$i]->tel,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_TEL').'</td></tr>'; - + print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($livraison->lignes[$i]->fax,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_FAX').'</td></tr>'; - + print '</td></tr>'; - + print '</table>'; - - + + /* * */ - + print '<div class="tabsAction">'; - + if ($user->rights->societe->creer) { print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/adresse_livraison.php?socid='.$livraison->socid.'&idl='.$livraison->lignes[$i]->idl.'&action=edit">'.$langs->trans("Modify").'</a>'; } - + if ($user->rights->societe->supprimer) { print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/comm/adresse_livraison.php?socid='.$livraison->socid.'&idl='.$livraison->lignes[$i]->idl.'&action=delete">'.$langs->trans("Delete").'</a>'; } - - + + print '</div>'; print '<br>'; } } else { - print $langs->trans("None"); + print $langs->trans("None"); } print '</div>'; @@ -453,7 +453,7 @@ else /* * Bouton actions */ - + if ($_GET["action"] == '') { print '<div class="tabsAction">'; diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 6c1a741c11f..38c7926d1b0 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/mailing.class.php'; $langs->load("mails"); if (! $user->rights->mailing->lire || $user->societe_id > 0) - accessforbidden(); +accessforbidden(); $message = ''; @@ -89,14 +89,14 @@ if ($_POST["action"] == 'confirm_clone' && $_POST['confirm'] == 'yes') // Action envoi mailing pour tous if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') { - if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message - $message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; - $message.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/mailing/mailing-send.php '.$_GET["id"].'</textarea>'; - $message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; - $_GET["action"]=''; + // on affiche donc juste un message + $message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; + $message.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/mailing/mailing-send.php '.$_GET["id"].'</textarea>'; + $message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; + $_GET["action"]=''; } else { @@ -133,32 +133,32 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); // nb of possible recipients + $num = $db->num_rows($resql); // nb of possible recipients - if ($num) - { - dol_syslog("fiche.php: nb of targets = ".$num, LOG_DEBUG); + if ($num) + { + dol_syslog("fiche.php: nb of targets = ".$num, LOG_DEBUG); - // Positionne date debut envoi - $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$id; - $resql2=$db->query($sql); - if (! $resql2) - { - dol_print_error($db); - } + // Positionne date debut envoi + $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$id; + $resql2=$db->query($sql); + if (! $resql2) + { + dol_print_error($db); + } - // Boucle sur chaque adresse et envoie le mail - $i = 0; + // Boucle sur chaque adresse et envoie le mail + $i = 0; - while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB) - { + while ($i < $num && $i < $conf->global->MAILING_LIMIT_SENDBYWEB) + { - $res=1; + $res=1; - $obj = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); - // sendto en RFC2822 - $sendto = eregi_replace(',',' ',$obj->prenom." ".$obj->nom)." <".$obj->email.">"; + // sendto en RFC2822 + $sendto = eregi_replace(',',' ',$obj->prenom." ".$obj->nom)." <".$obj->email.">"; // Make subtsitutions on topic and body $other=split(';',$obj->other); @@ -183,11 +183,11 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') $newsubject=make_substitutions($subject,$substitutionarray); $newmessage=make_substitutions($message,$substitutionarray); - // Fabrication du mail - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, - array(), array(), array(), + // Fabrication du mail + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, + array(), array(), array(), '', '', 0, $msgishtml); - $mail->errors_to = $errorsto; + $mail->errors_to = $errorsto; if ($mail->error) @@ -200,70 +200,70 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') $res=0; } - // Envoi du mail + // Envoi du mail if ($res) { - $res=$mail->sendfile(); + $res=$mail->sendfile(); } - if ($res) - { - // Mail envoye avec succes - $nbok++; + if ($res) + { + // Mail envoye avec succes + $nbok++; - dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); + dol_syslog("mailing-send: ok for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); - $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; + $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql.=" SET statut=1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid; - $resql2=$db->query($sql); - if (! $resql2) - { - dol_print_error($db); - } - } - else - { - // Mail en echec - $nbko++; - - dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); - - $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; + $resql2=$db->query($sql); + if (! $resql2) + { + dol_print_error($db); + } + } + else + { + // Mail en echec + $nbko++; + + dol_syslog("mailing-send: error for #".$i.($mail->error?' - '.$mail->error:''), LOG_DEBUG); + + $sql="UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql.=" SET statut=-1, date_envoi=".$db->idate(gmmktime())." WHERE rowid=".$obj->rowid; - $resql2=$db->query($sql); - if (! $resql2) - { - dol_print_error($db); - } - } - - $i++; - } - } - - // Loop finished, set global statut of mail + $resql2=$db->query($sql); + if (! $resql2) + { + dol_print_error($db); + } + } + + $i++; + } + } + + // Loop finished, set global statut of mail if ($nbko > 0) { - $statut=2; // Status 'sent partially' (because at least one error) + $statut=2; // Status 'sent partially' (because at least one error) + } + else + { + if ($nbok >= $num) $statut=3; // Send to everybody + else $statut=2; // Status 'sent partially' (because not send to everybody) + } + + $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$id; + dol_syslog("mailing-send: update global status sql=".$sql, LOG_DEBUG); + $resql2=$db->query($sql); + if (! $resql2) + { + dol_print_error($db); } - else - { - if ($nbok >= $num) $statut=3; // Send to everybody - else $statut=2; // Status 'sent partially' (because not send to everybody) - } - - $sql="UPDATE ".MAIN_DB_PREFIX."mailing SET statut=".$statut." WHERE rowid=".$id; - dol_syslog("mailing-send: update global status sql=".$sql, LOG_DEBUG); - $resql2=$db->query($sql); - if (! $resql2) - { - dol_print_error($db); - } } else { - dol_syslog($db->error()); - dol_print_error($db); + dol_syslog($db->error()); + dol_print_error($db); } $message=''; $_GET["action"] = ''; @@ -274,91 +274,91 @@ if ($_POST["action"] == 'sendallconfirmed' && $_POST['confirm'] == 'yes') // Action envoi test mailing if ($_POST["action"] == 'send' && ! $_POST["cancel"]) { - $mil = new Mailing($db); - $result=$mil->fetch($_POST["mailid"]); + $mil = new Mailing($db); + $result=$mil->fetch($_POST["mailid"]); - $mil->sendto = $_POST["sendto"]; + $mil->sendto = $_POST["sendto"]; if (! $mil->sendto) { $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'</div>'; } - if ($mil->sendto) - { - $arr_file = array(); - $arr_mime = array(); - $arr_name = array(); + if ($mil->sendto) + { + $arr_file = array(); + $arr_mime = array(); + $arr_name = array(); // Le message est-il en html $msgishtml=-1; // Inconnu par defaut if (eregi('[ \t]*<html>',$message)) $msgishtml=1; - // Pratique les substitutions sur le sujet et message + // Pratique les substitutions sur le sujet et message $mil->sujet=make_substitutions($mil->sujet,$substitutionarrayfortest); $mil->body=make_substitutions($mil->body,$substitutionarrayfortest); $mailfile = new CMailFile($mil->sujet,$mil->sendto,$mil->email_from,$mil->body, - $arr_file,$arr_mime,$arr_name, + $arr_file,$arr_mime,$arr_name, '', '', 0, $msgishtml); - $result=$mailfile->sendfile(); - if ($result) - { - $message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'</div>'; - } - else - { - $message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>'; - } - - $_GET["action"]=''; - $_GET["id"]=$mil->id; - } + $result=$mailfile->sendfile(); + if ($result) + { + $message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'</div>'; + } + else + { + $message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>'; + } + + $_GET["action"]=''; + $_GET["id"]=$mil->id; + } } // Action ajout mailing if ($_POST["action"] == 'add') { - $message=''; - - $mil = new Mailing($db); - - $mil->email_from = trim($_POST["from"]); - $mil->titre = trim($_POST["titre"]); - $mil->sujet = trim($_POST["sujet"]); - $mil->body = trim($_POST["body"]); - - if (! $mil->titre) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); - if (! $mil->sujet) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); - - if (! $message) - { - if ($mil->create($user) >= 0) - { - Header("Location: fiche.php?id=".$mil->id); - exit; - } - $message=$mil->error; - } - - $message='<div class="error">'.$message.'</div>'; - $_GET["action"]="create"; + $message=''; + + $mil = new Mailing($db); + + $mil->email_from = trim($_POST["from"]); + $mil->titre = trim($_POST["titre"]); + $mil->sujet = trim($_POST["sujet"]); + $mil->body = trim($_POST["body"]); + + if (! $mil->titre) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); + if (! $mil->sujet) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); + + if (! $message) + { + if ($mil->create($user) >= 0) + { + Header("Location: fiche.php?id=".$mil->id); + exit; + } + $message=$mil->error; + } + + $message='<div class="error">'.$message.'</div>'; + $_GET["action"]="create"; } // Action mise a jour mailing if ($_POST["action"] == 'update') { - $mil = new Mailing($db); - - $mil->id = $_POST["id"]; - $mil->email_from = $_POST["from"]; - $mil->titre = $_POST["titre"]; - $mil->sujet = $_POST["sujet"]; - $mil->body = $_POST["body"]; - - if ($mil->update()) - { - Header("Location: fiche.php?id=".$mil->id); - } + $mil = new Mailing($db); + + $mil->id = $_POST["id"]; + $mil->email_from = $_POST["from"]; + $mil->titre = $_POST["titre"]; + $mil->sujet = $_POST["sujet"]; + $mil->body = $_POST["body"]; + + if ($mil->update()) + { + Header("Location: fiche.php?id=".$mil->id); + } } // Action confirmation validation @@ -432,21 +432,21 @@ if ($_POST["action"] == 'confirm_reset') // Action confirmation suppression if ($_POST["action"] == 'confirm_delete') { - if ($_POST["confirm"] == 'yes') - { - $mil = new Mailing($db); - $mil->id = $_GET["id"]; - - if ($mil->delete($mil->id)) - { - Header("Location: index.php"); - } - } + if ($_POST["confirm"] == 'yes') + { + $mil = new Mailing($db); + $mil->id = $_GET["id"]; + + if ($mil->delete($mil->id)) + { + Header("Location: index.php"); + } + } } if ($_POST["cancel"] == $langs->trans("Cancel")) { - $action = ''; + $action = ''; } @@ -466,167 +466,167 @@ if ($_GET["action"] == 'create') { // EMailing in creation mode print '<form action="fiche.php" method="post">'."\n"; - print '<input type="hidden" name="action" value="add">'; + print '<input type="hidden" name="action" value="add">'; - print_fiche_titre($langs->trans("NewMailing")); + print_fiche_titre($langs->trans("NewMailing")); - if ($message) print "$message<br>"; + if ($message) print "$message<br>"; - print '<table class="border" width="100%">'; + print '<table class="border" width="100%">'; - print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value=""></td></tr>'; - print '<tr><td colspan="2"> </td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value=""></td></tr>'; - print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; - print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; - foreach($substitutionarray as $key => $val) + print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value=""></td></tr>'; + print '<tr><td colspan="2"> </td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value=""></td></tr>'; + print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; + print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; + foreach($substitutionarray as $key => $val) { print $key.' = '.$langs->trans($val).'<br>'; } - print '</i></td>'; - print '<td>'; - // Editeur wysiwyg + print '</i></td>'; + print '<td>'; + // Editeur wysiwyg if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) - { + { require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('body','',320,'dolibarr_mailings','',true,false); $doleditor->Create(); - } - else - { - print '<textarea cols="70" rows="20" name="body"></textarea>'; - } - print '</td></tr>'; - print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></td></tr>'; - print '</table>'; - print '</form>'; + } + else + { + print '<textarea cols="70" rows="20" name="body"></textarea>'; + } + print '</td></tr>'; + print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></td></tr>'; + print '</table>'; + print '</form>'; } else { - if ($mil->fetch($_GET["id"]) >= 0) - { - $h=0; - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailCard"); - $hselected = $h; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id; - $head[$h][1] = $langs->trans('MailRecipients'); - $h++; + if ($mil->fetch($_GET["id"]) >= 0) + { + $h=0; + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; + $head[$h][1] = $langs->trans("MailCard"); + $hselected = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$mil->id; + $head[$h][1] = $langs->trans('MailRecipients'); + $h++; + + /* + $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$mil->id; + $head[$h][1] = $langs->trans("MailHistory"); + $h++; + */ + dol_fiche_head($head, $hselected, $langs->trans("Mailing")); + + // Confirmation de la validation du mailing + if ($_GET["action"] == 'valide') + { + $ret=$html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valide"); + if ($ret == 'html') print '<br>'; + } -/* - $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$mil->id; - $head[$h][1] = $langs->trans("MailHistory"); - $h++; -*/ - dol_fiche_head($head, $hselected, $langs->trans("Mailing")); - - // Confirmation de la validation du mailing - if ($_GET["action"] == 'valide') - { - $html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valide"); - print '<br>'; - } - - // Confirm reset - if ($_GET["action"] == 'reset') - { - $html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$mil->ref),"confirm_reset"); - print '<br>'; - } - - // Confirm delete - if ($_GET["action"] == 'delete') - { - $html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete"); - print '<br>'; - } - - - if ($_GET["action"] != 'edit') - { - /* - * Mailing en mode visu - * - */ + // Confirm reset + if ($_GET["action"] == 'reset') + { + $ret=$html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$mil->ref),"confirm_reset"); + if ($ret == 'html') print '<br>'; + } + + // Confirm delete + if ($_GET["action"] == 'delete') + { + $ret=$html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete"); + if ($ret == 'html') print '<br>'; + } + + + if ($_GET["action"] != 'edit') + { + /* + * Mailing en mode visu + * + */ if ($_GET["action"] == 'sendall') { - if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) + if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, - // on affiche donc juste un message - $message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; - $message.='<br><textarea cols="50" rows="'.ROWS_2.'" wrap="soft">php ./scripts/mailing/mailing-send.php '.$_GET["id"].'</textarea>'; - $message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; - $_GET["action"]=''; + // on affiche donc juste un message + $message='<div class="warning">'.$langs->trans("MailingNeedCommand").'</div>'; + $message.='<br><textarea cols="50" rows="'.ROWS_2.'" wrap="soft">php ./scripts/mailing/mailing-send.php '.$_GET["id"].'</textarea>'; + $message.='<br><br><div class="warning">'.$langs->trans("MailingNeedCommand2").'</div>'; + $_GET["action"]=''; } else { $text=$langs->trans('ConfirmSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed'); - print '<br />'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed'); + if ($ret == 'html') print '<br>'; } } - print '<table class="border" width="100%">'; + print '<table class="border" width="100%">'; - print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; - print '<td colspan="3">'; + print '<tr><td width="25%">'.$langs->trans("Ref").'</td>'; + print '<td colspan="3">'; print $html->showrefnav($mil,'id'); - print '</td></tr>'; - - print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$mil->titre.'</td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.htmlentities($mil->email_from).'</td></tr>'; - print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$mil->getLibStatut(4).'</td></tr>'; - print '<tr><td width="25%">'.$langs->trans("TotalNbOfDistinctRecipients").'</td><td colspan="3">'.($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>').'</td></tr>'; - - $uc = new User($db, $mil->user_creat); - $uc->fetch(); - print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>'.$uc->getNomUrl(1).'</td>'; - print '<td>'.$langs->trans("Date").'</td>'; - print '<td>'.dol_print_date($mil->date_creat,"dayhour").'</td></tr>'; - - if ($mil->statut > 0) - { - $uv = new User($db, $mil->user_valid); - $uv->fetch(); - print '<tr><td>'.$langs->trans("ValidatedBy").'</td><td>'.$uv->getNomUrl(1).'</td>'; - print '<td>'.$langs->trans("Date").'</td>'; - print '<td>'.dol_print_date($mil->date_valid,"dayhour").'</td></tr>'; - } - - if ($mil->statut > 1) - { - print '<tr><td>'.$langs->trans("SentBy").'</td><td>'.$langs->trans("Unknown").'</td>'; - print '<td>'.$langs->trans("Date").'</td>'; - print '<td>'.dol_print_date($mil->date_envoi,"dayhour").'</td></tr>'; - } - - // Sujet - print '<tr><td>'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>'; + print '</td></tr>'; + + print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$mil->titre.'</td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3">'.htmlentities($mil->email_from).'</td></tr>'; + print '<tr><td width="25%">'.$langs->trans("Status").'</td><td colspan="3">'.$mil->getLibStatut(4).'</td></tr>'; + print '<tr><td width="25%">'.$langs->trans("TotalNbOfDistinctRecipients").'</td><td colspan="3">'.($mil->nbemail?$mil->nbemail:'<font class="error">'.$langs->trans("NoTargetYet").'</font>').'</td></tr>'; + + $uc = new User($db, $mil->user_creat); + $uc->fetch(); + print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>'.$uc->getNomUrl(1).'</td>'; + print '<td>'.$langs->trans("Date").'</td>'; + print '<td>'.dol_print_date($mil->date_creat,"dayhour").'</td></tr>'; + + if ($mil->statut > 0) + { + $uv = new User($db, $mil->user_valid); + $uv->fetch(); + print '<tr><td>'.$langs->trans("ValidatedBy").'</td><td>'.$uv->getNomUrl(1).'</td>'; + print '<td>'.$langs->trans("Date").'</td>'; + print '<td>'.dol_print_date($mil->date_valid,"dayhour").'</td></tr>'; + } + + if ($mil->statut > 1) + { + print '<tr><td>'.$langs->trans("SentBy").'</td><td>'.$langs->trans("Unknown").'</td>'; + print '<td>'.$langs->trans("Date").'</td>'; + print '<td>'.dol_print_date($mil->date_envoi,"dayhour").'</td></tr>'; + } + + // Sujet + print '<tr><td>'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>'; // Message - print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>'; - print '<td colspan="3">'; - print dol_htmlentitiesbr($mil->body); - print '</td>'; - print '</tr>'; + print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>'; + print '<td colspan="3">'; + print dol_htmlentitiesbr($mil->body); + print '</td>'; + print '</tr>'; - print '</table>'; + print '</table>'; - print "</div>"; + print "</div>"; - // Clone confirmation + // Clone confirmation if ($_GET["action"] == 'clone') { // Create an array for form $formquestion=array( 'text' => $langs->trans("ConfirmClone"), - array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), - array('type' => 'checkbox', 'name' => 'clone_receviers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) + array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContent"), 'value' => 1), + array('type' => 'checkbox', 'name' => 'clone_receviers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) ); // Paiement incomplet. On demande si motif = escompte ou autre $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$mil->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$mil->ref),'confirm_clone',$formquestion,'yes'); @@ -636,7 +636,7 @@ else if ($mesg) print $mesg; - if ($_GET["action"] == 'sendall') + if ($_GET["action"] == 'sendall') { // Pour des raisons de securite, on ne permet pas cette fonction via l'IHM, // on affiche donc juste un message @@ -644,141 +644,141 @@ else $message.='<br><textarea cols="70" rows="'.ROWS_2.'" wrap="soft">php ./scripts/mailing/mailing-send.php '.$_GET["id"].'</textarea>'; } - if ($message) print "$message<br>"; + if ($message) print "$message<br>"; - /* - * Boutons d'action - */ - if ($_GET["action"] == '') - { - print "\n\n<div class=\"tabsAction\">\n"; + /* + * Boutons d'action + */ + if ($_GET["action"] == '') + { + print "\n\n<div class=\"tabsAction\">\n"; - if ($mil->statut == 0 && $user->rights->mailing->creer) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$mil->id.'">'.$langs->trans("EditMailing").'</a>'; - } + if ($mil->statut == 0 && $user->rights->mailing->creer) + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$mil->id.'">'.$langs->trans("EditMailing").'</a>'; + } - //print '<a class="butAction" href="fiche.php?action=test&id='.$mil->id.'">'.$langs->trans("PreviewMailing").'</a>'; + //print '<a class="butAction" href="fiche.php?action=test&id='.$mil->id.'">'.$langs->trans("PreviewMailing").'</a>'; - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=test&id='.$mil->id.'">'.$langs->trans("TestMailing").'</a>'; + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=test&id='.$mil->id.'">'.$langs->trans("TestMailing").'</a>'; - if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valide&id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>'; - } + if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider) + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=valide&id='.$mil->id.'">'.$langs->trans("ValidMailing").'</a>'; + } - if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>'; - } + if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider) + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=sendall&id='.$mil->id.'">'.$langs->trans("SendMailing").'</a>'; + } - if ($user->rights->mailing->creer) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&object=emailing&id='.$mil->id.'">'.$langs->trans("ToClone").'</a>'; - } + if ($user->rights->mailing->creer) + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=clone&object=emailing&id='.$mil->id.'">'.$langs->trans("ToClone").'</a>'; + } - if (($mil->statut == 2 || $mil->statut == 3) && $user->rights->mailing->valider) - { - print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=reset&id='.$mil->id.'">'.$langs->trans("ResetMailing").'</a>'; - } + if (($mil->statut == 2 || $mil->statut == 3) && $user->rights->mailing->valider) + { + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=reset&id='.$mil->id.'">'.$langs->trans("ResetMailing").'</a>'; + } - if (($mil->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) - { - print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$mil->id.'">'.$langs->trans("DeleteMailing").'</a>'; - } + if (($mil->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) + { + print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$mil->id.'">'.$langs->trans("DeleteMailing").'</a>'; + } - print '<br /><br /></div>'; - } + print '<br /><br /></div>'; + } // Affichage formulaire de TEST - if ($_GET["action"] == 'test') - { - print_titre($langs->trans("TestMailing")); - - // Create l'objet formulaire mail - include_once("../../html.formmail.class.php"); - $formmail = new FormMail($db); - $formmail->fromname = $mil->email_from; - $formmail->frommail = $mil->email_from; - $formmail->withsubstit=1; - $formmail->withfrom=0; - $formmail->withto=$user->email?$user->email:1; - $formmail->withtocc=0; - $formmail->withtopic=0; - $formmail->withtopicreadonly=1; - $formmail->withfile=0; - $formmail->withbody=0; - $formmail->withbodyreadonly=1; - $formmail->withcancel=1; - $formmail->withdeliveryreceipt=0; - // Tableau des substitutions - $formmail->substit=$substitutionarrayfortest; - // Tableau des parametres complementaires du post - $formmail->param["action"]="send"; - $formmail->param["models"]="body"; - $formmail->param["mailid"]=$mil->id; - $formmail->param["returnurl"]=DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; - - // Init list of files - if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') - { - $formmail->clear_attached_files(); - } + if ($_GET["action"] == 'test') + { + print_titre($langs->trans("TestMailing")); + + // Create l'objet formulaire mail + include_once("../../html.formmail.class.php"); + $formmail = new FormMail($db); + $formmail->fromname = $mil->email_from; + $formmail->frommail = $mil->email_from; + $formmail->withsubstit=1; + $formmail->withfrom=0; + $formmail->withto=$user->email?$user->email:1; + $formmail->withtocc=0; + $formmail->withtopic=0; + $formmail->withtopicreadonly=1; + $formmail->withfile=0; + $formmail->withbody=0; + $formmail->withbodyreadonly=1; + $formmail->withcancel=1; + $formmail->withdeliveryreceipt=0; + // Tableau des substitutions + $formmail->substit=$substitutionarrayfortest; + // Tableau des parametres complementaires du post + $formmail->param["action"]="send"; + $formmail->param["models"]="body"; + $formmail->param["mailid"]=$mil->id; + $formmail->param["returnurl"]=DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id; + + // Init list of files + if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') + { + $formmail->clear_attached_files(); + } + + $formmail->show_form(); - $formmail->show_form(); - - print '<br>'; - } - - } - else - { - /* - * Mailing en mode edition - */ - print '<form action="fiche.php" method="post">'."\n"; - print '<input type="hidden" name="action" value="update">'; - print '<input type="hidden" name="id" value="'.$mil->id.'">'; - print '<table class="border" width="100%">'; - - print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$mil->id.'</td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3"><input class="flat" type="text" size=40 name="titre" value="'.$mil->titre.'"></td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3"><input class="flat" type="text" size=40 name="from" value="'.$mil->email_from.'"></td></tr>'; - print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>'; - print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; - print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; - print '__ID__ = '.$langs->trans("IdRecord").'<br>'; - print '__EMAIL__ = '.$langs->trans("EMail").'<br>'; - print '__LASTNAME__ = '.$langs->trans("Lastname").'<br>'; - print '__FIRSTNAME__ = '.$langs->trans("Firstname").'<br>'; - print '__OTHER1__ = '.$langs->trans("Other").'1<br>'; - print '__OTHER2__ = '.$langs->trans("Other").'2<br>'; - print '__OTHER3__ = '.$langs->trans("Other").'3<br>'; - print '__OTHER4__ = '.$langs->trans("Other").'4<br>'; - print '__OTHER5__ = '.$langs->trans("Other").'5<br>'; - print '</i></td>'; - print '<td colspan="3">'; - // Editeur wysiwyg - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + print '<br>'; + } + + } + else + { + /* + * Mailing en mode edition + */ + print '<form action="fiche.php" method="post">'."\n"; + print '<input type="hidden" name="action" value="update">'; + print '<input type="hidden" name="id" value="'.$mil->id.'">'; + print '<table class="border" width="100%">'; + + print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">'.$mil->id.'</td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3"><input class="flat" type="text" size=40 name="titre" value="'.$mil->titre.'"></td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3"><input class="flat" type="text" size=40 name="from" value="'.$mil->email_from.'"></td></tr>'; + print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>'; + print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>'; + print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>'; + print '__ID__ = '.$langs->trans("IdRecord").'<br>'; + print '__EMAIL__ = '.$langs->trans("EMail").'<br>'; + print '__LASTNAME__ = '.$langs->trans("Lastname").'<br>'; + print '__FIRSTNAME__ = '.$langs->trans("Firstname").'<br>'; + print '__OTHER1__ = '.$langs->trans("Other").'1<br>'; + print '__OTHER2__ = '.$langs->trans("Other").'2<br>'; + print '__OTHER3__ = '.$langs->trans("Other").'3<br>'; + print '__OTHER4__ = '.$langs->trans("Other").'4<br>'; + print '__OTHER5__ = '.$langs->trans("Other").'5<br>'; + print '</i></td>'; + print '<td colspan="3">'; + // Editeur wysiwyg + if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) + { + require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); $doleditor=new DolEditor('body',$mil->body,320,'dolibarr_mailings','',true,false); $doleditor->Create(); - } - else - { - print '<textarea class="flat" name="body" cols="70" rows="20">'; - print dol_htmlentitiesbr_decode($mil->body).'</textarea>'; - } - print '</td></tr>'; - - print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>'; - print '</table>'; - print '</form>'; - - print "</div>"; - } - } + } + else + { + print '<textarea class="flat" name="body" cols="70" rows="20">'; + print dol_htmlentitiesbr_decode($mil->body).'</textarea>'; + } + print '</td></tr>'; + + print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>'; + print '</table>'; + print '</form>'; + + print "</div>"; + } + } } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 0454e59ff0c..f8cdacc5114 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -916,8 +916,8 @@ if ($id > 0 || ! empty($ref)) //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$propal->ref),'confirm_clone',$formquestion,'yes'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id,$langs->trans('ClonePropal'),$langs->trans('ConfirmClonePropal',$propal->ref),'confirm_clone',$formquestion,'yes'); + if ($ret == 'html') print '<br>'; } /* @@ -925,8 +925,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -934,8 +934,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); + if ($ret == 'html') print '<br>'; } /* @@ -943,8 +943,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'validate') { - $html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); + if ($ret == 'html') print '<br>'; } @@ -1460,15 +1460,7 @@ if ($id > 0 || ! empty($ref)) print '<td align="center">'; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&lineid='.$objp->rowid.'&action=confirm_deleteline&confirm=yes'; - print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteProductLine').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'deleteline'.$i.'\')">'; - } - else - { - print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=ask_deleteline&lineid='.$objp->rowid.'">'; - } + print '<a href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=ask_deleteline&lineid='.$objp->rowid.'">'; } else { @@ -1763,16 +1755,7 @@ if ($id > 0 || ! empty($ref)) // Valid if ($propal->statut == 0 && $user->rights->propale->valider) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_validate&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateProp')).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=validate"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=validate"'; print '>'.$langs->trans('Validate').'</a>'; } @@ -1821,16 +1804,7 @@ if ($id > 0 || ! empty($ref)) // Delete if ($user->rights->propale->supprimer) { - print '<a class="butActionDelete" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_delete&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=delete"'; - } + print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=delete"'; print '>'.$langs->trans('Delete').'</a>'; } diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 4eca815dc28..cab7c300ba9 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1203,8 +1203,8 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -1225,7 +1225,7 @@ else $text=$langs->trans('ConfirmValidateOrder',$num); $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_validate'); - print '<br />'; + if ($ret == 'html') print '<br>'; } /* @@ -1233,8 +1233,8 @@ else */ if ($_GET['action'] == 'close') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); + if ($ret == 'html') print '<br>'; } /* @@ -1242,8 +1242,8 @@ else */ if ($_GET['action'] == 'cancel') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); + if ($ret == 'html') print '<br>'; } /* @@ -1251,8 +1251,8 @@ else */ if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); + if ($ret == 'html') print '<br>'; } // Clone confirmation @@ -1264,8 +1264,8 @@ else //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$commande->ref),'confirm_clone',$formquestion,'yes'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$commande->ref),'confirm_clone',$formquestion,'yes'); + if ($ret == 'html') print '<br>'; } /* @@ -1638,15 +1638,7 @@ else print '<td align="center">'; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$objp->rowid.'&action=confirm_deleteline&confirm=yes'; - print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmDeleteProductLine')).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'deleteline'.$i.'\')">'; - } - else - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=ask_deleteline&lineid='.$objp->rowid.'">'; - } + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=ask_deleteline&lineid='.$objp->rowid.'">'; } else { @@ -1929,26 +1921,7 @@ else // Valid if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - // on verifie si la commande est en numerotation provisoire - $ref = substr($commande->ref, 1, 4); - if ($ref == 'PROV') - { - $num = $commande->getNextNumRef($soc); - } - else - { - $num = $commande->ref; - } - $url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_validate&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateOrder',$num)).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'validate\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=validate"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=validate"'; print '>'.$langs->trans('Validate').'</a>'; } @@ -2004,16 +1977,7 @@ else { if ($user->rights->commande->cloturer) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_close&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmCloseOrder')).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'close\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=close"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=close"'; print '>'.$langs->trans('Close').'</a>'; } } @@ -2024,16 +1988,7 @@ else $nb_expedition = $commande->nb_expedition(); if ($user->rights->commande->annuler && $nb_expedition == 0) { - print '<a class="butActionDelete" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_cancel&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmCancelOrder')).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'cancel\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=cancel"'; - } + print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=cancel"'; print '>'.$langs->trans('CancelOrder').'</a>'; } } @@ -2047,16 +2002,7 @@ else // Delete order if ($user->rights->commande->supprimer) { - print '<a class="butActionDelete" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_delete&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmDeleteOrder')).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'delete\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=delete"'; - } + print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=delete"'; print '>'.$langs->trans('Delete').'</a>'; } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 9fdc9dc0b9b..8aab077fada 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -154,12 +154,12 @@ if ($account || $_GET["ref"]) // Chargement des categories bancaires dans $options $nbcategories=0; - + $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE entity = ".$conf->entity; $sql.= " ORDER BY label"; - + $result = $db->query($sql); if ($result) { @@ -313,8 +313,8 @@ if ($account || $_GET["ref"]) if ($_GET["action"]=='delete') { $text=$langs->trans('ConfirmDeleteTransaction'); - $html->form_confirm($_SERVER['PHP_SELF'].'?account='.$acct->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?account='.$acct->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index e9adb08036c..5ad9ec80254 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -56,7 +56,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"]) $account->number = trim($_POST["number"]); $account->cle_rib = trim($_POST["cle_rib"]); $account->bic = trim($_POST["bic"]); - $account->iban = trim($_POST["iban_prefix"]); + $account->iban = trim($_POST["iban_prefix"]); $account->iban_prefix = trim($_POST["iban_prefix"]); // deprecated $account->domiciliation = trim($_POST["domiciliation"]); $account->proprio = trim($_POST["proprio"]); @@ -127,17 +127,17 @@ if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') */ if ($_GET["action"] == 'delete') { - $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - print '<br />'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } // Check BBAN - if (! checkBanForAccount($account)) + if (! checkBanForAccount($account)) { print '<div class="warning">'.$langs->trans("RIBControlError").'</div><br>'; } - - + + print '<table class="border" width="100%">'; // Ref @@ -165,23 +165,23 @@ if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') print '<tr><td>'.$langs->trans("BankCode").'</td>'; print '<td colspan="3">'.$account->code_banque.'</td>'; print '</tr>'; - + print '<tr><td>'.$langs->trans("DeskCode").'</td>'; print '<td colspan="3">'.$account->code_guichet.'</td>'; print '</tr>'; } - + print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>'; print '<td colspan="3">'.$account->number.'</td>'; print '</tr>'; - + if ($account->useDetailedBBAN()) { print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>'; print '<td colspan="3">'.$account->cle_rib.'</td>'; print '</tr>'; } - + print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>'; print '<td colspan="3">'.$account->iban_prefix.'</td></tr>'; @@ -273,12 +273,12 @@ if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configure print '<tr><td>'.$langs->trans("BankCode").'</td>'; print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>'; print '</tr>'; - + print '<tr><td>'.$langs->trans("DeskCode").'</td>'; print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>'; print '</tr>'; } - + print '<td>'.$langs->trans("BankAccountNumber").'</td>'; print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>'; print '</tr>'; diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 1ed227ee49e..f8eb0f57659 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -289,8 +289,8 @@ else */ if ($_GET["action"] == 'delete') { - $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - print '<br />'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } print '<table class="border" width="100%">'; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 0f682cd6f18..6eafbd96430 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -219,8 +219,8 @@ if ($result) // Confirmations if ($_GET["action"] == 'delete_categ') { - $html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,$langs->trans("RemoveFromRubrique"),$langs->trans("RemoveFromRubriqueConfirm"),"confirm_delete_categ"); - print '<br>'; + $ret=$html->form_confirm("ligne.php?rowid=".$_GET["rowid"]."&cat1=".$_GET["fk_categ"]."&orig_account=".$orig_account,$langs->trans("RemoveFromRubrique"),$langs->trans("RemoveFromRubriqueConfirm"),"confirm_delete_categ"); + if ($ret == 'html') print '<br>'; } print '<table class="border" width="100%">'; @@ -238,7 +238,7 @@ if ($result) print '<tr><td width="20%">'.$langs->trans("Ref")."</td>"; print '<td colspan="4">'.$objp->rowid.'</td>'; print '</tr>'; - + // Author print '<tr><td width="20%">'.$langs->trans("Author")."</td>"; if ($objp->fk_user_author) diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index 9cb129e313c..f69b89d1994 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -237,11 +237,8 @@ else */ if ($_GET["action"] == 'delete') { - - $html = new Form($db); - $html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); - - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } $soc = new Societe($db); @@ -253,9 +250,9 @@ else print '<td width="20%">'.$langs->trans("Ref").'</td><td>'; print $deplacement->ref; print '</td></tr>'; - + print '<tr><td>'.$langs->trans("Type").'</td><td>'.$langs->trans($deplacement->type).'</td></tr>'; - + print '<tr><td width="20%">'.$langs->trans("CompanyVisited").'</td>'; print '<td>'; if ($soc->id) print $soc->getNomUrl(1); @@ -266,13 +263,13 @@ else $userfee->fetch(); print $userfee->getNomUrl(1); print '</td></tr>'; - + print '<tr><td>'.$langs->trans("Date").'</td><td>'; print dol_print_date($deplacement->date); print '</td></tr>'; - + print '<tr><td>'.$langs->trans("FeesKilometersOrAmout").'</td><td>'.$deplacement->km.'</td></tr>'; - + print "</table>"; print '</div>'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index c06d69e1e6b..cead2d72e12 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2004,16 +2004,16 @@ else if ($_GET['action'] == 'converttoreduc') { $text=$langs->trans('ConfirmConvertToReduc'); - $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc'); - print '<br />'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc'); + if ($ret == 'html') print '<br>'; } // Confirmation de la suppression de la facture if ($_GET['action'] == 'delete') { $text=$langs->trans('ConfirmDeleteBill'); - $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete'); + if ($ret == 'html') print '<br>'; } // Confirmation de la validation @@ -2046,15 +2046,15 @@ else $text.=$notify->confirmMessage(2,$fac->socid); } - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid'); + if ($ret == 'html') print '<br>'; } // Confirmation du classement pay� if ($_GET['action'] == 'payed' && $resteapayer <= 0) { - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); + if ($ret == 'html') print '<br>'; } if ($_GET['action'] == 'payed' && $resteapayer > 0) { @@ -2083,8 +2083,8 @@ else array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100') ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedPartially',$fac->ref),'confirm_payed_partially',$formquestion); + if ($ret == 'html') print '<br>'; } // Confirmation du classement abandonne @@ -2124,16 +2124,16 @@ else array('type' => 'text', 'name' => 'close_note', 'label' => $langs->trans("Comment"), 'value' => '', 'size' => '100') ); - $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled',$formquestion); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('CancelBill'),$langs->trans('ConfirmCancelBill',$fac->ref),'confirm_canceled',$formquestion); + if ($ret == 'html') print '<br>'; } } // Confirmation de la suppression d'une ligne produit if ($_GET['action'] == 'delete_product_line' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&rowid='.$_GET["rowid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 'no'); + if ($ret == 'html') print '<br>'; } // Clone confirmation @@ -2145,8 +2145,8 @@ else //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); + if ($ret == 'html') print '<br>'; } @@ -3182,19 +3182,7 @@ else { if ($user->rights->facture->valider) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - // We check if number is temporary number - if (eregi('^\(PROV',$fac->ref)) $num = $fac->getNextNumRef($soc); - else $num = $fac->ref; - $url = $_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=confirm_valid&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateBill',$num)).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=valid"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=valid"'; print '>'.$langs->trans('Validate').'</a>'; } } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index d6c418bca9e..b79ddc8a35e 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -470,10 +470,9 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P if ($_POST["action"] == 'add_paiement') { // print '<tr><td colspan="3">'; - print '<br />'; + 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); - // print '</td></tr>'; } print "</form>\n"; diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index b290ca56e77..4a5fb831671 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -133,7 +133,7 @@ if ($_POST['action'] == 'builddoc' && $user->rights->banque) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } - + $result = $remisecheque->GeneratePdf($_POST["model"], $outputlangs); if ($result <= 0) { @@ -197,8 +197,8 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -207,8 +207,8 @@ else if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide'); + if ($ret == 'html') print '<br>'; } } diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index cc97fe3c89c..0ab3bca493f 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -143,8 +143,8 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice")); */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -153,8 +153,8 @@ if ($_GET['action'] == 'delete') if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index 5ea922c4c15..c983e1b049e 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -150,8 +150,8 @@ if ($_GET["id"]) if ($_GET["action"] == 'credite') { - $html->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite"); - print '<br />'; + $ret=$html->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite"); + if ($ret == 'html') print '<br>'; } print '<table class="border" width="100%">'; diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index 36a7ea90034..c286fb36b46 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -262,15 +262,15 @@ if ($chid > 0) if ($_GET["action"] == 'payed') { $text=$langs->trans('ConfirmPaySocialContribution'); - $html->form_confirm($_SERVER["PHP_SELF"]."?id=$cha->id&action=confirm_payed",$langs->trans('PaySocialContribution'),$text,"confirm_payed"); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=$cha->id&action=confirm_payed",$langs->trans('PaySocialContribution'),$text,"confirm_payed"); + if ($ret == 'html') print '<br>'; } if ($_GET['action'] == 'delete') { $text=$langs->trans('ConfirmDeleteSocialContribution'); - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete'); + if ($ret == 'html') print '<br>'; } if ($_GET['action'] == 'edit') print "<form name=\"charge\" action=\"charges.php?id=$cha->id&action=update\" method=\"post\">"; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index ed969396ef2..39ec23d2d6f 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -223,8 +223,8 @@ if ($user->rights->societe->contact->supprimer) { if ($_GET["action"] == 'delete') { - $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete"); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } } @@ -487,8 +487,8 @@ if ($_GET["id"] && $_GET["action"] != 'edit') $formquestion=array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login)); - $form->form_confirm($_SERVER["PHP_SELF"]."?id=".$contact->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$contact->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); + if ($ret == 'html') print '<br>'; } print '<table class="border" width="100%">'; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 17e48b72284..28ebba078f8 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -68,7 +68,7 @@ if ($_POST["action"] == 'confirm_active' && $_POST["confirm"] == 'yes' && $user- } } -if ($_POST["action"] == 'confirm_closeline' && $_POST["confirm"] == 'yes' && $user->rights->contrat->activer) +if ($_REQUEST["action"] == 'confirm_closeline' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->activer) { $contrat = new Contrat($db); $contrat->fetch($_GET["id"]); @@ -654,8 +654,8 @@ else */ if ($_GET["action"] == 'delete') { - $form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete"); - print '<br>'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } /* @@ -664,8 +664,8 @@ else if ($_GET["action"] == 'valid') { //$numfa = contrat_get_num($soc); - $form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid"); - print '<br>'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid"); + if ($ret == 'html') print '<br>'; } /* @@ -673,8 +673,8 @@ else */ if ($_GET["action"] == 'close') { - $form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close"); - print '<br>'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close"); + if ($ret == 'html') print '<br>'; } /* @@ -991,7 +991,11 @@ else //print '<br />'; $dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); $dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]); - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend,$langs->trans("CloseService"),$langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")),"confirm_closeline"); + $page=$_SERVER["PHP_SELF"]."?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend; + $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,'',''); print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>'; } diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 3593d98f4f0..d186f0e8e7b 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -94,18 +94,18 @@ if ($_POST["action"] == 'add' && $user->rights->ecm->setup) $ecmdir->fk_parent = $_POST["catParent"]; $ok=true; - + if (! $ecmdir->label) { $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>'; $_GET["action"] = "create"; $ok=false; } - + if ($ok) { $id = $ecmdir->create($user); - + if ($id > 0) { Header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); @@ -196,17 +196,17 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section') //print ' -> <b>'.$ecmdir->getNomUrl(1).'</b><br>'; print "<br><br>"; */ - + // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); + if ($ret == 'html') print '<br>'; } if ($mesg) { print $mesg."<br>"; } - + // Construit fiche rubrique diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index 3ee773750a1..419a0de1f11 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -119,8 +119,8 @@ dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual")); if ($_GET["action"] == 'edit') { print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; - print '<input type="hidden" name="fileid" value="'.$fileid.'">'; - print '<input type="hidden" name="action" value="update">'; + print '<input type="hidden" name="fileid" value="'.$fileid.'">'; + print '<input type="hidden" name="action" value="update">'; } print '<table class="border" width="100%">'; @@ -202,13 +202,13 @@ if (! $_GET["action"] || $_GET["action"] == 'delete_section') // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); + if ($ret == 'html') print '<br>'; } if ($mesg) { print $mesg."<br>"; } - + // Construit fiche rubrique diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index c535904003a..0cb263f661a 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -66,7 +66,7 @@ if (! $section) // Load ecm object $ecmdir = new ECMDirectory($db); -if (empty($_REQUEST["section"])) +if (empty($_REQUEST["section"])) { dol_print_error('','Error, section parameter missing'); exit; @@ -91,11 +91,11 @@ $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; // Envoie fichier if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if (! is_dir($upload_dir)) + if (! is_dir($upload_dir)) { $result=create_exdir($upload_dir); } - + if (is_dir($upload_dir)) { $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); @@ -132,7 +132,7 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); $result=dol_delete_file($file); - + $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; $result=$ecmdir->changeNbOfFiles('-'); @@ -152,11 +152,11 @@ if ($_POST['action'] == 'confirm_deletedir' && $_POST['confirm'] == 'yes') if ($_POST['action'] == 'update' && ! $_POST['cancel']) { $db->begin(); - + $oldlabel=$ecmdir->label; $olddir=$ecmdir->getRelativePath(0); $olddir=$conf->ecm->dir_output.'/'.$olddir; - + // Fetch was already done $ecmdir->label = $_POST["label"]; $ecmdir->description = $_POST["description"]; @@ -164,7 +164,7 @@ if ($_POST['action'] == 'update' && ! $_POST['cancel']) if ($result > 0) { $error=0; - + // Try to rename file if changed if ($oldlabel != $ecmdir->label && file_exists($olddir)) @@ -180,18 +180,18 @@ if ($_POST['action'] == 'update' && ! $_POST['cancel']) $error++; } } - + if (! $error) { $db->commit(); - + $relativepath=$ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } else { $db->rollback(); - } + } } else { @@ -228,8 +228,8 @@ dol_fiche_head($head, 'card', $langs->trans("ECMSectionManual")); if ($_GET["action"] == 'edit') { print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; - print '<input type="hidden" name="section" value="'.$section.'">'; - print '<input type="hidden" name="action" value="update">'; + print '<input type="hidden" name="section" value="'.$section.'">'; + print '<input type="hidden" name="action" value="update">'; } print '<table class="border" width="100%">'; @@ -310,12 +310,12 @@ print '</div>'; if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete_dir' && $_GET['action'] != 'delete') { print '<div class="tabsAction">'; - + if ($user->rights->ecm->setup) { print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'">'.$langs->trans('Edit').'</a>'; } - + if (sizeof($filearray) == 0) { if ($user->rights->ecm->setup) @@ -340,15 +340,15 @@ if ($mesg) { print '<br>'.$mesg.'<br>'; } // Confirm remove file if ($_GET['action'] == 'delete') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + if ($ret == 'html') print '<br>'; } // Confirm remove file if ($_GET['action'] == 'delete_dir') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection'), 'confirm_deletedir'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection'), 'confirm_deletedir'); + if ($ret == 'html') print '<br>'; } $formfile=new FormFile($db); diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index 37ca1ed953d..b1b3af01782 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -3,12 +3,12 @@ */ /** - \file htdocs/ecm/docother.php - \ingroup ecm - \brief Main ecm page - \version $Id$ - \author Laurent Destailleur -*/ + \file htdocs/ecm/docother.php + \ingroup ecm + \brief Main ecm page + \version $Id$ + \author Laurent Destailleur + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); @@ -27,8 +27,8 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:''; // Permissions if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } $section=$_GET["section"]; @@ -38,44 +38,44 @@ $upload_dir = $conf->ecm->dir_output.'/'.$section; /******************************************************************* -* ACTIONS -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ + * ACTIONS + * + * Put here all code to do according to value of "action" parameter + ********************************************************************/ // Envoie fichier if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if (! is_dir($upload_dir)) create_exdir($upload_dir); - - if (is_dir($upload_dir)) - { - $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); - if ($result > 0) - { - $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; - //print_r($_FILES); - } - else if ($result < 0) - { - // Echec transfert (fichier d?passant la limite ?) - $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; - // print_r($_FILES); - } - else - { - // Fichier infect? par un virus - $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>'; - } - } + if (! is_dir($upload_dir)) create_exdir($upload_dir); + + if (is_dir($upload_dir)) + { + $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); + if ($result > 0) + { + $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; + //print_r($_FILES); + } + else if ($result < 0) + { + // Echec transfert (fichier d?passant la limite ?) + $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; + // print_r($_FILES); + } + else + { + // Fichier infect? par un virus + $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>'; + } + } } // Suppression fichier if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { - $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); - dol_delete_file($file); - $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; + $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); + dol_delete_file($file); + $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; } @@ -83,10 +83,10 @@ if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') /******************************************************************* -* PAGE -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ + * PAGE + * + * Put here all code to do according to value of "action" parameter + ********************************************************************/ llxHeader(); @@ -101,12 +101,12 @@ print_fiche_titre($langs->trans("ECMAutoOrg")); /* -* Confirmation de la suppression d'une ligne produit -*/ + * Confirmation de la suppression d'une ligne produit + */ if ($_GET['action'] == 'delete_file') { -$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); -print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + if ($ret == 'html') print '<br>'; } // Construit liste des fichiers diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index f005b61522f..528b0c57643 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -221,8 +221,8 @@ print "<br>\n"; // Confirm remove file if ($_GET['action'] == 'delete') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + if ($ret == 'html') print '<br>'; } if ($mesg) { print $mesg."<br>"; } @@ -246,8 +246,8 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $ // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') { - $form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - print '<br>'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urldecode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); + if ($ret == 'html') print '<br>'; } // Construit liste des repertoires diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index 6b7c86d5eaf..bea7721118a 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -150,8 +150,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET["action"] == 'cloture') { - $html->form_confirm("commande.php?id=".$_GET["id"],"Cl�turer la commande","Etes-vous s�r de vouloir cl�turer cette commande ?","confirm_cloture"); - print "<br />"; + $ret=$html->form_confirm("commande.php?id=".$_GET["id"],"Cl�turer la commande","Etes-vous s�r de vouloir cl�turer cette commande ?","confirm_cloture"); + if ($ret == 'html') print '<br>'; } // Onglet commande diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index dcf988f56b7..79b3dfbbe6e 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -554,8 +554,8 @@ else */ if ($_GET["action"] == 'delete') { - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$expedition->ref),'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$expedition->ref),'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -564,8 +564,8 @@ else */ if ($_GET["action"] == 'valid') { - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$expedition->ref),'confirm_valid'); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$expedition->ref),'confirm_valid'); + if ($ret == 'html') print '<br>'; } /* * Confirmation de l'annulation @@ -573,8 +573,8 @@ else */ if ($_GET["action"] == 'annuler') { - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$expedition->ref),'confirm_cancel'); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$expedition->ref),'confirm_cancel'); + if ($ret == 'html') print '<br>'; } // Calcul du poids total et du volume total des produits diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 564dd5aea7a..4426abc096c 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -522,29 +522,29 @@ elseif ($_GET["id"] > 0) // Confirmation de la suppression de la fiche d'intervention if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } // Confirmation de la validation de la fiche d'intervention if ($_GET['action'] == 'validate') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate'); + if ($ret == 'html') print '<br>'; } // Confirmation de la validation de la fiche d'intervention if ($_GET['action'] == 'modify') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify'); + 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) { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline'); + if ($ret == 'html') print '<br>'; } print '<table class="border" width="100%">'; @@ -676,17 +676,8 @@ elseif ($_GET["id"] > 0) print '<td align="center">'; if ($conf->global->PRODUIT_CONFIRM_DELETE_LINE) { - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$objp->rowid.'&action=confirm_deleteline&confirm=yes'; - print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteInterventionLine').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'deleteline'.$i.'\')">'; - print img_delete(); - } - else - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=ask_deleteline&ligne='.$objp->rowid.'">'; - print img_delete(); - } + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=ask_deleteline&ligne='.$objp->rowid.'">'; + print img_delete(); } else { @@ -849,48 +840,21 @@ elseif ($_GET["id"] > 0) // Validate if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=confirm_validate&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateIntervention')).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"'; - } - else - { - print 'href="fiche.php?id='.$_GET["id"].'&action=validate"'; - } + print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=validate"'; print '>'.$langs->trans("Valid").'</a>'; } // Modify if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=confirm_modify&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmModifyIntervention')).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"'; - } - else - { - print 'href="fiche.php?id='.$_GET["id"].'&action=modify"'; - } + print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=modify"'; print '>'.$langs->trans("Modify").'</a>'; } // Delete if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print '<a class="butActionDelete" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=confirm_delete&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans("ConfirmDeleteIntervention",$fichinter->ref)).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=delete"'; - } + print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&action=delete"'; print '>'.$langs->trans('Delete').'</a>'; } } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index fccce16b904..ebfade40d1a 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -501,8 +501,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -525,8 +525,8 @@ if ($id > 0 || ! empty($ref)) $text.=$notify->confirmMessage(3,$commande->socid); } - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid'); - print '<br />'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid'); + if ($ret == 'html') print '<br>'; } /* * Confirmation de l'approbation @@ -534,8 +534,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'approve') { - $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve"); - print '<br />'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve"); + if ($ret == 'html') print '<br>'; } /* * Confirmation de la desapprobation @@ -543,16 +543,16 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'refuse') { - $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse"); - print '<br />'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse"); + if ($ret == 'html') print '<br>'; } /* * Confirmation de l'annulation */ if ($_GET['action'] == 'cancel') { - $html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel"); - print '<br />'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel"); + if ($ret == 'html') print '<br>'; } /* @@ -561,9 +561,9 @@ if ($id > 0 || ! empty($ref)) if ($_GET["action"] == 'commande') { $date_com = dol_mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); - $html->form_confirm("fiche.php?id=".$commande->id."&datecommande=".$date_com."&methode=".$_POST["methodecommande"]."&comment=".urlencode($_POST["comment"]), + $ret=$html->form_confirm("fiche.php?id=".$commande->id."&datecommande=".$date_com."&methode=".$_POST["methodecommande"]."&comment=".urlencode($_POST["comment"]), $langs->trans("MakeOrder"),$langs->trans("ConfirmMakeOrder",dol_print_date($date_com,'day')),"confirm_commande"); - print '<br />'; + if ($ret == 'html') print '<br>'; } /* @@ -571,8 +571,8 @@ if ($id > 0 || ! empty($ref)) */ if ($_GET['action'] == 'delete_product_line' && ! empty($conf->global->PRODUIT_CONFIRM_DELETE_LINE)) { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$commande->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + if ($ret == 'html') print '<br>'; } /* @@ -939,19 +939,7 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->fournisseur->commande->valider) { - 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.'&action=confirm_valid&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmValidateOrder',$num)).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'validate\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=valid"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=valid"'; print '>'.$langs->trans('Validate').'</a>'; } } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 9e1b92880cd..0ae4bda7cdf 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -577,8 +577,8 @@ else // Confirmation de la suppression d'une ligne produit if ($_GET['action'] == 'confirm_delete_line') { - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id.'&ligne_id='.$_GET["ligne_id"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline'); + if ($ret == 'html') print '<br>'; } // Clone confirmation @@ -590,22 +590,22 @@ else //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$fac->ref),'confirm_clone',$formquestion,'yes'); + if ($ret == 'html') print '<br>'; } // Confirmation de la validation if ($_GET['action'] == 'valid') { - $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid'); - print '<br />'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid'); + if ($ret == 'html') print '<br>'; } // Confirmation de la validation if ($_GET['action'] == 'payed') { - $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed'); - print '<br />'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed'); + if ($ret == 'html') print '<br>'; } /* @@ -613,8 +613,8 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete'); - print '<br />'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } print '<table width="100%" class="notopnoleftnoright">'; @@ -1059,17 +1059,7 @@ else if ($_GET['action'] != 'edit' && $fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $num = $fac->ref; - $url = $_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=confirm_payed&confirm=yes'; - print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.dol_escape_js($langs->trans('ConfirmClassifPayed',$num)).'\',\''.dol_escape_js($langs->trans("Yes")).'\',\''.dol_escape_js($langs->trans("No")).'\',\'validate\')"'; - } - else - { - print 'href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=payed"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=payed"'; print '>'.$langs->trans('ClassifyPayed').'</a>'; //print '<a class="butAction" href="fiche.php?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayed').'</a>'; @@ -1079,19 +1069,7 @@ else { if (sizeof($fac->lignes)) { - print '<a class="butAction" '; - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - // We check if number is temporary number - if (eregi('^\(PROV',$fac->ref)) $num = $fac->getNextNumRef($soc); - else $num = $fac->ref; - $url = $_SERVER["PHP_SELF"].'?facid='.$fac->id.'&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"].'?facid='.$fac->id.'&action=valid"'; - } + print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=valid"'; print '>'.$langs->trans('Validate').'</a>'; } } diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index eb9ab54315c..4c84b6629dd 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -114,8 +114,8 @@ dol_fiche_head($head, $hselected, $langs->trans('SupplierPayment')); */ if ($_GET['action'] == 'delete') { - $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -123,8 +123,8 @@ if ($_GET['action'] == 'delete') */ if ($_GET['action'] == 'valide') { - $html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); - print '<br>'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + if ($ret == 'html') print '<br>'; } if (!empty($_POST['action']) && $_POST['action'] == 'update_num' && !empty($_POST['new_num'])) @@ -278,7 +278,7 @@ if ($resql) $var=True; $facturestatic=new FactureFournisseur($db); - + while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index fe05e7147e4..b386ca1b78f 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1534,104 +1534,120 @@ class Form /** - * \brief Affiche formulaire de demande de confirmation - * \param page page + * \brief Show a confirmation HTML form or AJAX popup + * \param page page Url of page to call if confirmation is OK * \param title title * \param question question * \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 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="") + function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $allowajax=0) { - global $langs; + global $langs,$conf; print "\n<!-- begin form_confirm -->\n"; - print '<form method="post" action="'.$page.'" class="notoptoleftroright">'; - print '<input type="hidden" name="action" value="'.$action.'">'; - print '<table width="100%" class="valid">'; + if ($allowajax && $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>'; + print "\n"; + $ret='ajax'; + } + else + { + print '<form method="post" action="'.$page.'" class="notoptoleftroright">'; + print '<input type="hidden" name="action" value="'.$action.'">'; - // Ligne titre - print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'; + print '<table width="100%" class="valid">'; - // 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) + // Ligne titre + print '<tr class="validtitre"><td class="validtitre" colspan="3">'.img_picto('','recent').' '.$title.'</td></tr>'; + + // Ligne formulaire + if ($formquestion) { - if ($input['type'] == 'text') + 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) { - 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'].' '; - 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"> </td>'; - print '<td valign="top" align="left"> </td>'; - print '</tr>'; - } - if ($input['type'] == 'radio') - { - $i=0; - foreach($input['values'] as $selkey => $selval) + 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>'; - if ($i==0) print '<td valign="top">'.$input['label'].'</td>'; - else print '<td> </td>'; - print '<td valign="top" width="20"><input type="radio" class="flat" name="'.$input['name'].'" value="'.$selkey.'"'; + print '<td valign="top">'.$input['label'].' '; + 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">'; - print $selval; - print '</td></tr>'; - $i++; + print '<td valign="top" align="left"> </td>'; + print '<td valign="top" align="left"> </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> </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 '</table>'; + print '</td></tr>'; - //print '<tr class="valid"><td class="valid" colspan="3"><hr></td></tr>'; - } + //print '<tr class="valid"><td class="valid" colspan="3"><hr></td></tr>'; + } - // Ligne message - print '<tr class="valid">'; - print '<td class="valid">'.$question.'</td>'; - print '<td class="valid">'; - $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; - print $this->selectyesno("confirm",$newselectedchoice); - print '</td>'; - print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>'; - print '</tr>'; + // Ligne message + print '<tr class="valid">'; + print '<td class="valid">'.$question.'</td>'; + print '<td class="valid">'; + $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; + print $this->selectyesno("confirm",$newselectedchoice); + print '</td>'; + print '<td class="valid" align="center"><input class="button" type="submit" value="'.$langs->trans("Validate").'"></td>'; + print '</tr>'; - print '</table>'; + print '</table>'; - if (is_array($formquestion)) - { - foreach ($formquestion as $key => $input) + if (is_array($formquestion)) { - if ($input['type'] == 'hidden') print '<input type="hidden" name="'.$input['name'].'" value="'.$input['value'].'">'; + foreach ($formquestion as $key => $input) + { + if ($input['type'] == 'hidden') print '<input type="hidden" name="'.$input['name'].'" value="'.$input['value'].'">'; + } } - } - print "</form>\n"; + print "</form>\n"; + $ret='html'; + } - print "\n<!-- end form_confirm -->\n"; + print "<!-- end form_confirm -->\n"; + return $ret; } diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index d997939b6c8..f1c2cf55236 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -677,7 +677,7 @@ function cleanSerialize(expr) { Author: Regis Houssin Licence: GPL ==================================================================*/ -function dialogConfirm(linkurl,message,ok,cancel,objectID) { +function dialogConfirm(linkurlyes,linkurlno,message,ok,cancel,objectID) { Dialog.confirm(message, { width:560, okLabel: ok, @@ -685,8 +685,8 @@ function dialogConfirm(linkurl,message,ok,cancel,objectID) { buttonClass: "buttonajax", id: objectID, destroyOnClose: true, - cancel:function(win){}, - ok:function(win) {window.location.href=linkurl; return true;} + ok:function(win) {window.location.href=linkurlyes; return true;}, + cancel:function(win) { if (linkurlno!='') { window.location.href=linkurlno; return true; } } }); } diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index b6613d389ca..1e68bb656db 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -395,8 +395,8 @@ else if ($_GET["action"] == 'delete') { $expedition_id = $_GET["expid"]; - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm"),'confirm_delete'); + if ($ret == 'html') print '<br>'; } /* @@ -405,8 +405,8 @@ else */ if ($_GET["action"] == 'valid') { - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid'); - print '<br>'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid'); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index cfb2278005f..ff1ba4a36a1 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -806,9 +806,8 @@ if ($_GET["id"] || $_GET["ref"]) // Confirmation de la suppression de la facture if ($_GET["action"] == 'delete') { - $html = new Form($db); - $html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete"); - print "<br />\n"; + $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } print($mesg); diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index cc402e5f8d3..5ac565f4844 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -74,7 +74,7 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_GET["file"] && $_REQUEST['confi } } -if ($_GET["action"] == 'addthumb' && $_GET["file"]) +if ($_GET["action"] == 'addthumb' && $_GET["file"]) { $product = new Product($db); $product->add_thumb($conf->produit->dir_output."/".$_GET["file"]); @@ -93,7 +93,7 @@ if ($_GET["id"] || $_GET["ref"]) $product = new Product($db); if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]); if ($_GET["id"]) $result = $product->fetch($_GET["id"]); - + llxHeader("","",$langs->trans("CardProduct".$product->type)); if ($result) @@ -104,14 +104,14 @@ if ($_GET["id"] || $_GET["ref"]) $head=product_prepare_head($product, $user); $titre=$langs->trans("CardProduct".$product->type); dol_fiche_head($head, 'photos', $titre); - + /* * Confirmation de la suppression de photo */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete'); - print '<br>'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete'); + if ($ret == 'html') print '<br>'; } print($mesg); @@ -191,10 +191,10 @@ if ($_GET["id"] || $_GET["ref"]) { $nbphoto=0; $nbbyrow=5; - + $maxWidth = 160; $maxHeight = 120; - + $pdir = get_exdir($product->id,2) . $product->id ."/photos/"; $dir = $conf->produit->dir_output . '/'. $pdir; @@ -209,7 +209,7 @@ if ($_GET["id"] || $_GET["ref"]) if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>'; if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">'; - + print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">'; // Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine @@ -221,10 +221,10 @@ if ($_GET["id"] || $_GET["ref"]) { $filename=$obj['photo']; } - + // Nom affich� $viewfilename=$obj['photo']; - + // Taille de l'image $product->get_image_size($dir.$filename); $imgWidth = ($product->imgWidth < $maxWidth) ? $product->imgWidth : $maxWidth; @@ -243,28 +243,20 @@ if ($_GET["id"] || $_GET["ref"]) } if ($user->rights->produit->creer) { - if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) - { - $url = $_SERVER["PHP_SELF"].'?id='.$product->id.'&file='.urlencode($pdir.$viewfilename).'&action=confirm_delete&confirm=yes'; - print '<a href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeletePicture').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')">'; - } - else - { - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">'; - } + print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">'; print img_delete().'</a>'; } if ($nbbyrow) print '</td>'; if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>'; } - + // Ferme tableau while ($nbphoto % $nbbyrow) { print '<td width="'.ceil(100/$nbbyrow).'%"> </td>'; $nbphoto++; } - + if ($nbphoto < 1) { print '<tr align=center valign=middle border=1><td class="photo">'; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index eb7e526d125..91fc8108c5f 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -200,8 +200,8 @@ else if ($_GET["action"] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete"); - print "<br>"; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } if ($_GET["action"] == 'edit') diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index cde131b79b1..433744099e4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -92,8 +92,8 @@ if ($_GET["id"] > 0) if ($_GET["action"] == 'delete') { - $html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); - print "<br>"; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); + if ($ret == 'html') print '<br>'; } print '<form method="POST" action="fiche.php?id='.$projet->id.'">'; @@ -170,7 +170,7 @@ if ($_GET["id"] > 0) { $var=!$var; print "<tr ".$bc[$var].">"; - + // Date print '<td>'.dol_print_date($db->jdate($task_time->task_date),'day').' '.dol_print_date($db->jdate($task_time->task_date),'%A').'</td>'; @@ -179,7 +179,7 @@ if ($_GET["id"] > 0) $minutes = round((($task_time->task_duration - $heure) * 60),0); $minutes = substr("00"."$minutes", -2); print '<td align="right">'.$heure." h ".$minutes."</td>\n"; - + // User $user->id=$task_time->rowid; $user->nom=$task_time->login; diff --git a/htdocs/soc.php b/htdocs/soc.php index 5951b8162ad..4f09cffc785 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -959,8 +959,8 @@ else if ($_GET["action"] == 'delete') { $html = new Form($db); - $html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete"); - print "<br />\n"; + $ret=$html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,1); + if ($ret == 'html') print '<br>'; } if ($mesg) @@ -1244,17 +1244,7 @@ else if ($user->rights->societe->supprimer) { - print '<a class="butActionDelete" '; - if ($conf->use_javascript_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.'&action=delete"'; - } - print '>'.$langs->trans('Delete').'</a>'; + print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&action=delete">'.$langs->trans('Delete').'</a>'; } print '</div>'; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 1f04b5063c7..7b275b383f3 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -23,7 +23,7 @@ * \brief Tab for documents linked to third party * \ingroup societe * \version $Id$ -*/ + */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); @@ -73,42 +73,42 @@ $courrier_dir = $conf->societe->dir_output . "/courrier/" . get_exdir($socid) ; // Envoie fichier if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if (! is_dir($upload_dir)) create_exdir($upload_dir); - - if (is_dir($upload_dir)) - { - $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); - if ($result > 0) - { - $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; - //print_r($_FILES); - } - else if ($result < 0) - { - // Echec transfert (fichier depassant la limite ?) - $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; - // print_r($_FILES); - } - else - { - // Fichier infecte par un virus - $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>'; - } - } + if (! is_dir($upload_dir)) create_exdir($upload_dir); + + if (is_dir($upload_dir)) + { + $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); + if ($result > 0) + { + $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; + //print_r($_FILES); + } + else if ($result < 0) + { + // Echec transfert (fichier depassant la limite ?) + $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; + // print_r($_FILES); + } + else + { + // Fichier infecte par un virus + $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWith",$result).'</div>'; + } + } } // Suppression fichier if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { - $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); - dol_delete_file($file); - $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; + $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); + dol_delete_file($file); + $mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>'; } /* -* View -*/ + * View + */ llxHeader(); @@ -118,8 +118,8 @@ if ($socid > 0) if ($societe->fetch($socid)) { /* - * Affichage onglets - */ + * Affichage onglets + */ $head = societe_prepare_head($societe); $html=new Form($db); @@ -156,18 +156,18 @@ if ($socid > 0) if ($mesg) { print "$mesg<br>"; } - /* - * Confirmation de la suppression d'une ligne produit - */ - if ($_GET['action'] == 'delete') - { - $html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - print '<br>'; - } + /* + * Confirmation de la suppression d'une ligne produit + */ + if ($_GET['action'] == 'delete') + { + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?socid='.$_GET["id"].'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + if ($ret == 'html') print '<br>'; + } // Affiche formulaire upload - $formfile=new FormFile($db); + $formfile=new FormFile($db); $formfile->form_attach_new_file(DOL_URL_ROOT.'/societe/document.php?socid='.$socid,'',0,0,$user->rights->societe->creer); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index e56fc7c0e59..17ae5f43db4 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -764,8 +764,8 @@ else */ if ($action == 'password') { - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password"); + if ($ret == 'html') print '<br>'; } /* @@ -773,8 +773,8 @@ else */ if ($action == 'passwordsend') { - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend"); + if ($ret == 'html') print '<br>'; } /* @@ -782,8 +782,8 @@ else */ if ($action == 'disable') { - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); + if ($ret == 'html') print '<br>'; } /* @@ -791,8 +791,8 @@ else */ if ($action == 'enable') { - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable"); + if ($ret == 'html') print '<br>'; } /* @@ -800,8 +800,8 @@ else */ if ($action == 'delete') { - $html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); - print '<br>'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); + if ($ret == 'html') print '<br>'; } diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index c98c25f0e08..4eb6e9c8e24 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -221,17 +221,15 @@ else $title = $langs->trans("Group"); dol_fiche_head($head, 'group', $title); - /* * Confirmation suppression */ if ($action == 'delete') { - $html = new Form($db); - $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"); + if ($ret == 'html') print '<br>'; } - /* * Fiche en mode visu */ -- GitLab