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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateLogin"),"confirm_create_user",$formquestion); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$adh->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion); + if ($ret == 'html') print '
'; } // Confirm remove member if ($action == 'delete') { - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete"); - print '
'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete"); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion); + if ($ret == 'html') print '
'; } // Confirm send card by mail if ($action == 'sendinfo') { - $html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo"); - print '
'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail"),"confirm_sendinfo"); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm("fiche.php?rowid=$rowid",$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $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 '
'; } /* @@ -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 '
'; + $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 '
'; } 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']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); - $form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion); - print '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion); + if ($ret == 'html') print '
'; } print '
'; 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"]]); + $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]).'
'; - } - } - // Autres verif - if (isset($_POST["code"]) && $_POST["code"]=='0') { - $ok=0; - $msg.="Le Code ne peut avoir la valeur 0
"; - } - if (isset($_POST["pays"]) && $_POST["pays"]=='0') { - $ok=0; - $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'
'; - } - - // 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 + // 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]).'
'; + } + } + // Autres verif + if (isset($_POST["code"]) && $_POST["code"]=='0') { + $ok=0; + $msg.="Le Code ne peut avoir la valeur 0
"; + } + if (isset($_POST["pays"]) && $_POST["pays"]=='0') { + $ok=0; + $msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'
'; + } + + // 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.= $newid.","; - $i=0; - foreach ($listfieldinsert as $f => $value) + ! 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) { - 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)"; + } + $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").'
'; - } - 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 + dol_syslog("dict actionadd sql=".$sql); + $result = $db->query($sql); + if (!$result) + { + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + $msg=$langs->trans("ErrorRecordAlreadyExists").'
'; + } + 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(); - } - } + $resql = $db->query($sql); + if (! $resql) + { + $msg=$db->error(); + } + } - if ($msg) $msg='
'.$msg.'
'; - $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition + if ($msg) $msg='
'.$msg.'
'; + $_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='
'.$langs->trans("ErrorRecordIsUsedByChild").'
'; - } - else - { - dol_print_error($db); - } - } + $result = $db->query($sql); + if (! $result) + { + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') + { + $msg='
'.$langs->trans("ErrorRecordIsUsedByChild").'
'; + } + else + { + dol_print_error($db); + } + } } if ($_GET["action"] == $acts[0]) // activate { - if ($tabrowid[$_GET["id"]]) { $rowidcol=$tabrowid[$_GET["id"]]; } - else { $rowidcol="rowid"; } + 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"]."'"; - } + 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); - } + $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 ($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"]."'"; - } + 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); - } + $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")."
\n"; } - print "
\n"; +print "
\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 '
'; - } + +/* + * 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 '
'; +} /* * Affichage d'un dictionnaire particulier */ if ($_GET["id"]) { - if ($msg) + if ($msg) { - print $msg.'
'; - } + print $msg.'
'; + } - // 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.=", "; + // 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 ''; - print ''; + $fieldlist=split(',',$tabfield[$_GET["id"]]); - // Ligne d'ajout - if ($tabname[$_GET["id"]]) - { - $alabelisused=0; - $var=false; - - $fieldlist=split(',',$tabfield[$_GET["id"]]); -// print '
'; + print ''; + print '
'; - // Ligne de titre d'ajout - print ''; - 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=''; } + // Ligne d'ajout + if ($tabname[$_GET["id"]]) + { + $alabelisused=0; + $var=false; - if ($valuetoshow != '') - { - print ''; - } + $fieldlist=split(',',$tabfield[$_GET["id"]]); + // print '
'; - print $valuetoshow; - print '
'; - if ($fieldlist[$field]=='libelle') $alabelisused=1; - } - print ''; - print ''; - print ''; + // Ligne de titre d'ajout + print ''; + 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=''; } - // Ligne d'ajout - print ""; - - fieldList($fieldlist); - - print ''; - print ""; - - if ($alabelisused) // Si un des champs est un libelle - { - print ''; - } - print ''; - } - - // Affiche table des valeurs - dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG); - $resql=$db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - $var=true; - if ($num) - { - // Ligne de titre - print ''; - foreach ($fieldlist as $field => $value) + if ($valuetoshow != '') { - // 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 ''; - print ''; + print ''; + } - // Lignes de valeurs - while ($i < $num) - { - $obj = $db->fetch_object($resql); - $var=!$var; + if ($fieldlist[$field]=='libelle') $alabelisused=1; + } + print ''; + print ''; + + // Ligne d'ajout + print ""; + + fieldList($fieldlist); + + print ''; + print ""; + + if ($alabelisused) // Si un des champs est un libelle + { + print ''; + } + print ''; + } + + // Affiche table des valeurs + dol_syslog("htdocs/admin/dict sql=".$sql, LOG_DEBUG); + $resql=$db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + $var=true; + if ($num) + { + // Ligne de titre + print ''; + foreach ($fieldlist as $field => $value) + { + // 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 ''; + print ''; + + // Lignes de valeurs + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $var=!$var; //print_r($obj); - print ""; - if ($_GET["action"] == 'modify' && ($_GET["rowid"] == ($obj->rowid?$obj->rowid:$obj->code))) - { - print ''; - print ''; - print ''; - fieldList($fieldlist,$obj); - print ''; - } - else - { + print ""; + if ($_GET["action"] == 'modify' && ($_GET["rowid"] == ($obj->rowid?$obj->rowid:$obj->code))) + { + print ''; + print ''; + print ''; + fieldList($fieldlist,$obj); + print ''; + } + else + { foreach ($fieldlist as $field => $value) { $showfield=1; @@ -646,68 +646,68 @@ if ($_GET["id"]) print $langs->trans("AlwaysActive"); } print ""; - + if ($iserasable) { print ''; } else { - print ''; + print ''; } if ($iserasable) { print ''; } else { - print ''; + print ''; } print "\n"; } - $i++; - } - } - } - else { - dol_print_error($db); - } + $i++; + } + } + } + else { + dol_print_error($db); + } - print '
 
* '.$langs->trans("LabelUsedByDefault").'.
 
 
'; + print $valuetoshow; + print ''; + print ''; + print ' 
* '.$langs->trans("LabelUsedByDefault").'.
 
 
 '; - print ' 
 '; + print ' rowid?$obj->rowid:$obj->code).'">'.img_edit().'  '.img_delete().'  
'; + print ''; - print '
'; + print ''; } else { - /* - * Affichage de la liste des dictionnaires - */ + /* + * Affichage de la liste des dictionnaires + */ - $var=true; + $var=true; $lastlineisempty=false; - print ''; - print ''; + print '
'; + print ''; //print ''; print ''; print ''; print ''; - 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 ''; + print ''; $lastlineisempty=false; - } - else - { + } + else + { if (! $lastlineisempty) { $var=!$var; print ''; $lastlineisempty=true; } - } - } - print '
'.$langs->trans("Module").''.$langs->trans("Dictionnary").''.$langs->trans("Table").'
'.$tablib[$i].''.$tabname[$i].'
'.$tablib[$i].''.$tabname[$i].'
  
'; + } + } + print ''; } print '
'; @@ -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 "
\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 '
'; } 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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"], $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'), 'confirm_purge'); + if ($ret == 'html') print '
'; } print ''; 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); + if ($ret == 'html') print '
'; } print '
'; 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 '
'; + $ret=$html->form_confirm("fiche.php?id=".$_GET["id"],$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete"); + if ($ret == 'html') print '
'; } 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 "
\n"; - + if ($livraison->error) { print '
'; print nl2br($livraison->error); print '
'; } - + print ''; print ''; print ''; print ''; print ''; - + print '
'; print ''; @@ -238,21 +238,21 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') print ''; - + print ''; - + print ''; - + print ''; print ''."\n"; - + print '
'.$langs->trans('DeliveryAddressLabel').'
'.$langs->trans('Country').''; $form->select_pays($livraison->pays_id,'pays_id'); print '
'.$langs->trans('Phone').'
'.$langs->trans('Fax').'
'.$langs->trans('Note').'
'; print '
'."\n"; print ''."\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 ''.$langs->trans('Country').''; $form->select_pays($livraison->pays_id,'pays_id'); print ''; - + print ''.$langs->trans('Phone').''; - + print ''.$langs->trans('Fax').''; - + print ''.$langs->trans('Note').''; @@ -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 "
\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 '
'; } if ($livraison->error) @@ -399,53 +399,53 @@ else { for ($i = 0 ; $i < $nblignes ; $i++) { - + print ''; - + print ''; print ''; print ''; - + print ""; - + print '"; print '"; - + print ''; - + print ''; - + print ''; - + print ''; - + print '
'.$langs->trans('DeliveryAddressLabel').''.$livraison->lignes[$i]->label.''.$langs->trans('Note').' :
'.nl2br($livraison->lignes[$i]->note).'
'.$langs->trans('Name').''.$livraison->lignes[$i]->nom.'
".$langs->trans('Address')."".nl2br($livraison->lignes[$i]->adresse)."
'.$langs->trans('Zip').''.$livraison->lignes[$i]->cp."
'.$langs->trans('Town').''.$livraison->lignes[$i]->ville."
'.$langs->trans('Country').''.$livraison->lignes[$i]->pays.'
'.$langs->trans('Phone').''.dol_print_phone($livraison->lignes[$i]->tel,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_TEL').'
'.$langs->trans('Fax').''.dol_print_phone($livraison->lignes[$i]->fax,$livraison->lignes[$i]->pays_code,0,$livraison->socid,'AC_FAX').'
'; - - + + /* * */ - + print '
'; - + if ($user->rights->societe->creer) { print ''.$langs->trans("Modify").''; } - + if ($user->rights->societe->supprimer) { print ''.$langs->trans("Delete").''; } - - + + print '
'; print '
'; } } else { - print $langs->trans("None"); + print $langs->trans("None"); } print ''; @@ -453,7 +453,7 @@ else /* * Bouton actions */ - + if ($_GET["action"] == '') { print '
'; 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='
'.$langs->trans("MailingNeedCommand").'
'; - $message.='
'; - $message.='

'.$langs->trans("MailingNeedCommand2").'
'; - $_GET["action"]=''; + // on affiche donc juste un message + $message='
'.$langs->trans("MailingNeedCommand").'
'; + $message.='
'; + $message.='

'.$langs->trans("MailingNeedCommand2").'
'; + $_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++; + $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); + dol_syslog("mailing-send: error 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); - } - } + $resql2=$db->query($sql); + if (! $resql2) + { + dol_print_error($db); + } + } - $i++; - } - } + $i++; + } + } - // Loop finished, set global statut of mail + // 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) } - 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); - } + $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='
'.$langs->trans("ErrorFieldRequired",$langs->trans("MailTo")).'
'; } - 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]*',$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='
'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'
'; - } - else - { - $message='
'.$langs->trans("ResultKo").'
'.$mailfile->error.' '.$result.'
'; - } + $result=$mailfile->sendfile(); + if ($result) + { + $message='
'.$langs->trans("MailSuccessfulySent",$mil->email_from,$mil->sendto).'
'; + } + else + { + $message='
'.$langs->trans("ResultKo").'
'.$mailfile->error.' '.$result.'
'; + } - $_GET["action"]=''; - $_GET["id"]=$mil->id; - } + $_GET["action"]=''; + $_GET["id"]=$mil->id; + } } // Action ajout mailing if ($_POST["action"] == 'add') { - $message=''; + $message=''; - $mil = new Mailing($db); + $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"]); + $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?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); - if (! $mil->sujet) $message.=($message?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); + if (! $mil->titre) $message.=($message?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); + if (! $mil->sujet) $message.=($message?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic")); - if (! $message) - { - if ($mil->create($user) >= 0) - { - Header("Location: fiche.php?id=".$mil->id); - exit; - } - $message=$mil->error; - } + if (! $message) + { + if ($mil->create($user) >= 0) + { + Header("Location: fiche.php?id=".$mil->id); + exit; + } + $message=$mil->error; + } - $message='
'.$message.'
'; - $_GET["action"]="create"; + $message='
'.$message.'
'; + $_GET["action"]="create"; } // Action mise a jour mailing if ($_POST["action"] == 'update') { - $mil = new Mailing($db); + $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"]; + $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); - } + 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 ($_POST["confirm"] == 'yes') + { + $mil = new Mailing($db); + $mil->id = $_GET["id"]; - if ($mil->delete($mil->id)) - { - Header("Location: index.php"); - } - } + 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 '
'."\n"; - print ''; + print ''; - print_fiche_titre($langs->trans("NewMailing")); + print_fiche_titre($langs->trans("NewMailing")); - if ($message) print "$message
"; + if ($message) print "$message
"; - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print ''; + print ''; - print ''; - print '
'.$langs->trans("MailTitle").'
 
'.$langs->trans("MailFrom").'
'.$langs->trans("MailTopic").'
'.$langs->trans("MailMessage").'
'; - print '
'.$langs->trans("CommonSubstitutions").':
'; - foreach($substitutionarray as $key => $val) + print '
'.$langs->trans("MailTitle").'
 
'.$langs->trans("MailFrom").'
'.$langs->trans("MailTopic").'
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("CommonSubstitutions").':
'; + foreach($substitutionarray as $key => $val) { print $key.' = '.$langs->trans($val).'
'; } - print '
'; - // Editeur wysiwyg + print ''; + // 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 ''; - } - print '
'; - print '
'; + } + else + { + print ''; + } + print ''; + print ''; + print ''; + print ''; } 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++; + 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/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")); + /* + $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 '
'; - } + // 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 '
'; + } - // 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 '
'; - } + // 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 '
'; + } - // Confirm delete - if ($_GET["action"] == 'delete') - { - $html->form_confirm("fiche.php?id=".$mil->id,$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete"); - print '
'; - } + // 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 '
'; + } - if ($_GET["action"] != 'edit') - { - /* - * Mailing en mode visu - * - */ + 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='
'.$langs->trans("MailingNeedCommand").'
'; - $message.='
'; - $message.='

'.$langs->trans("MailingNeedCommand2").'
'; - $_GET["action"]=''; + // on affiche donc juste un message + $message='
'.$langs->trans("MailingNeedCommand").'
'; + $message.='
'; + $message.='

'.$langs->trans("MailingNeedCommand2").'
'; + $_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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$_REQUEST['id'],$langs->trans('SendMailing'),$text,'sendallconfirmed'); + if ($ret == 'html') print '
'; } } - print ''; + print '
'; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - $uc = new User($db, $mil->user_creat); - $uc->fetch(); - print ''; - print ''; - print ''; + $uc = new User($db, $mil->user_creat); + $uc->fetch(); + print ''; + print ''; + print ''; - if ($mil->statut > 0) - { - $uv = new User($db, $mil->user_valid); - $uv->fetch(); - print ''; - print ''; - print ''; - } + if ($mil->statut > 0) + { + $uv = new User($db, $mil->user_valid); + $uv->fetch(); + print ''; + print ''; + print ''; + } - if ($mil->statut > 1) - { - print ''; - print ''; - print ''; - } + if ($mil->statut > 1) + { + print ''; + print ''; + print ''; + } - // Sujet - print ''; + // Sujet + print ''; // Message - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; print $html->showrefnav($mil,'id'); - print '
'.$langs->trans("MailTitle").''.$mil->titre.'
'.$langs->trans("MailFrom").''.htmlentities($mil->email_from).'
'.$langs->trans("Status").''.$mil->getLibStatut(4).'
'.$langs->trans("TotalNbOfDistinctRecipients").''.($mil->nbemail?$mil->nbemail:''.$langs->trans("NoTargetYet").'').'
'.$langs->trans("MailTitle").''.$mil->titre.'
'.$langs->trans("MailFrom").''.htmlentities($mil->email_from).'
'.$langs->trans("Status").''.$mil->getLibStatut(4).'
'.$langs->trans("TotalNbOfDistinctRecipients").''.($mil->nbemail?$mil->nbemail:''.$langs->trans("NoTargetYet").'').'
'.$langs->trans("CreatedBy").''.$uc->getNomUrl(1).''.$langs->trans("Date").''.dol_print_date($mil->date_creat,"dayhour").'
'.$langs->trans("CreatedBy").''.$uc->getNomUrl(1).''.$langs->trans("Date").''.dol_print_date($mil->date_creat,"dayhour").'
'.$langs->trans("ValidatedBy").''.$uv->getNomUrl(1).''.$langs->trans("Date").''.dol_print_date($mil->date_valid,"dayhour").'
'.$langs->trans("ValidatedBy").''.$uv->getNomUrl(1).''.$langs->trans("Date").''.dol_print_date($mil->date_valid,"dayhour").'
'.$langs->trans("SentBy").''.$langs->trans("Unknown").''.$langs->trans("Date").''.dol_print_date($mil->date_envoi,"dayhour").'
'.$langs->trans("SentBy").''.$langs->trans("Unknown").''.$langs->trans("Date").''.dol_print_date($mil->date_envoi,"dayhour").'
'.$langs->trans("MailTopic").''.$mil->sujet.'
'.$langs->trans("MailTopic").''.$mil->sujet.'
'.$langs->trans("MailMessage").''; - print dol_htmlentitiesbr($mil->body); - print '
'.$langs->trans("MailMessage").''; + print dol_htmlentitiesbr($mil->body); + print '
'; + print ''; - print "
"; + print ""; - // 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.='
'; } - if ($message) print "$message
"; + if ($message) print "$message
"; - /* - * Boutons d'action - */ - if ($_GET["action"] == '') - { - print "\n\n
\n"; + /* + * Boutons d'action + */ + if ($_GET["action"] == '') + { + print "\n\n
\n"; - if ($mil->statut == 0 && $user->rights->mailing->creer) - { - print ''.$langs->trans("EditMailing").''; - } + if ($mil->statut == 0 && $user->rights->mailing->creer) + { + print ''.$langs->trans("EditMailing").''; + } - //print ''.$langs->trans("PreviewMailing").''; + //print ''.$langs->trans("PreviewMailing").''; - print ''.$langs->trans("TestMailing").''; + print ''.$langs->trans("TestMailing").''; - if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider) - { - print ''.$langs->trans("ValidMailing").''; - } + if ($mil->statut == 0 && $mil->nbemail > 0 && $user->rights->mailing->valider) + { + print ''.$langs->trans("ValidMailing").''; + } - if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider) - { - print ''.$langs->trans("SendMailing").''; - } + if (($mil->statut == 1 || $mil->statut == 2) && $mil->nbemail > 0 && $user->rights->mailing->valider) + { + print ''.$langs->trans("SendMailing").''; + } - if ($user->rights->mailing->creer) - { - print ''.$langs->trans("ToClone").''; - } + if ($user->rights->mailing->creer) + { + print ''.$langs->trans("ToClone").''; + } - if (($mil->statut == 2 || $mil->statut == 3) && $user->rights->mailing->valider) - { - print ''.$langs->trans("ResetMailing").''; - } + if (($mil->statut == 2 || $mil->statut == 3) && $user->rights->mailing->valider) + { + print ''.$langs->trans("ResetMailing").''; + } - if (($mil->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) - { - print ''.$langs->trans("DeleteMailing").''; - } + if (($mil->statut <= 1 && $user->rights->mailing->creer) || $user->rights->mailing->supprimer) + { + print ''.$langs->trans("DeleteMailing").''; + } - print '

'; - } + print '

'; + } // Affichage formulaire de TEST - if ($_GET["action"] == 'test') - { - print_titre($langs->trans("TestMailing")); + 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; + // 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(); - } + // Init list of files + if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init') + { + $formmail->clear_attached_files(); + } - $formmail->show_form(); + $formmail->show_form(); - print '
'; - } + print '
'; + } - } - else - { - /* - * Mailing en mode edition - */ - print '
'."\n"; - print ''; - print ''; - print ''; + } + else + { + /* + * Mailing en mode edition + */ + print ''."\n"; + print ''; + print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + else + { + print ''; + } + print ''; - print ''; - print '
'.$langs->trans("Ref").''.$mil->id.'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailTopic").'
'.$langs->trans("MailMessage").'
'; - print '
'.$langs->trans("CommonSubstitutions").':
'; - print '__ID__ = '.$langs->trans("IdRecord").'
'; - print '__EMAIL__ = '.$langs->trans("EMail").'
'; - print '__LASTNAME__ = '.$langs->trans("Lastname").'
'; - print '__FIRSTNAME__ = '.$langs->trans("Firstname").'
'; - print '__OTHER1__ = '.$langs->trans("Other").'1
'; - print '__OTHER2__ = '.$langs->trans("Other").'2
'; - print '__OTHER3__ = '.$langs->trans("Other").'3
'; - print '__OTHER4__ = '.$langs->trans("Other").'4
'; - print '__OTHER5__ = '.$langs->trans("Other").'5
'; - print '
'; - // Editeur wysiwyg - if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING) - { - require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); + print '
'.$langs->trans("Ref").''.$mil->id.'
'.$langs->trans("MailTitle").'
'.$langs->trans("MailFrom").'
'.$langs->trans("MailTopic").'
'.$langs->trans("MailMessage").'
'; + print '
'.$langs->trans("CommonSubstitutions").':
'; + print '__ID__ = '.$langs->trans("IdRecord").'
'; + print '__EMAIL__ = '.$langs->trans("EMail").'
'; + print '__LASTNAME__ = '.$langs->trans("Lastname").'
'; + print '__FIRSTNAME__ = '.$langs->trans("Firstname").'
'; + print '__OTHER1__ = '.$langs->trans("Other").'1
'; + print '__OTHER2__ = '.$langs->trans("Other").'2
'; + print '__OTHER3__ = '.$langs->trans("Other").'3
'; + print '__OTHER4__ = '.$langs->trans("Other").'4
'; + print '__OTHER5__ = '.$langs->trans("Other").'5
'; + print '
'; + // 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 ''; - } - print '
'; - print '
'; + print ''; + print ''; + print ''; - print ""; - } - } + print ""; + } + } } 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 '
'; + $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 '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp'), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $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 '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?propalid='.$propal->id, $langs->trans('ValidateProp'), $langs->trans('ConfirmValidateProp'), 'confirm_validate'); + if ($ret == 'html') print '
'; } @@ -1460,15 +1460,7 @@ if ($id > 0 || ! empty($ref)) print ''; 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 'trans("No").'\',\'deleteline'.$i.'\')">'; - } - else - { - print 'rowid.'">'; - } + print 'rowid.'">'; } else { @@ -1763,16 +1755,7 @@ if ($id > 0 || ! empty($ref)) // Valid if ($propal->statut == 0 && $user->rights->propale->valider) { - print '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 ''.$langs->trans('Validate').''; } @@ -1821,16 +1804,7 @@ if ($id > 0 || ! empty($ref)) // Delete if ($user->rights->propale->supprimer) { - print '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 ''.$langs->trans('Delete').''; } 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('Cancel'), $langs->trans('ConfirmCancelOrder'), 'confirm_cancel'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline'); + if ($ret == 'html') print '
'; } // 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 '
'; + $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 '
'; } /* @@ -1638,15 +1638,7 @@ else print ''; 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 'trans("No")).'\',\'deleteline'.$i.'\')">'; - } - else - { - print 'rowid.'">'; - } + print 'rowid.'">'; } else { @@ -1929,26 +1921,7 @@ else // Valid if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider) { - print '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 ''.$langs->trans('Validate').''; } @@ -2004,16 +1977,7 @@ else { if ($user->rights->commande->cloturer) { - print '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 ''.$langs->trans('Close').''; } } @@ -2024,16 +1988,7 @@ else $nb_expedition = $commande->nb_expedition(); if ($user->rights->commande->annuler && $nb_expedition == 0) { - print '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 ''.$langs->trans('CancelOrder').''; } } @@ -2047,16 +2002,7 @@ else // Delete order if ($user->rights->commande->supprimer) { - print '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 ''.$langs->trans('Delete').''; } 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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?account='.$acct->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); + if ($ret == 'html') print '
'; } 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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + if ($ret == 'html') print '
'; } // Check BBAN - if (! checkBanForAccount($account)) + if (! checkBanForAccount($account)) { print '
'.$langs->trans("RIBControlError").'

'; } - - + + print ''; // Ref @@ -165,23 +165,23 @@ if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') print ''; print ''; print ''; - + print ''; print ''; print ''; } - + print ''; print ''; print ''; - + if ($account->useDetailedBBAN()) { print ''; print ''; print ''; } - + print ''; print ''; @@ -273,12 +273,12 @@ if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configure print ''; print ''; print ''; - + print ''; print ''; print ''; } - + print ''; print ''; print ''; 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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + if ($ret == 'html') print '
'; } print '
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("DeskCode").''.$account->code_guichet.'
'.$langs->trans("BankAccountNumber").''.$account->number.'
'.$langs->trans("BankAccountNumberKey").''.$account->cle_rib.'
'.$langs->trans("IBAN").''.$account->iban_prefix.'
'.$langs->trans("BankCode").'
'.$langs->trans("DeskCode").'
'.$langs->trans("BankAccountNumber").'
'; 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 '
'; + $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 '
'; } print '
'; @@ -238,7 +238,7 @@ if ($result) print '"; print ''; print ''; - + // Author print '"; 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 '
'; + $ret=$html->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); + if ($ret == 'html') print '
'; } $soc = new Societe($db); @@ -253,9 +250,9 @@ else print ''; - + print ''; - + print ''; print ''; - + print ''; - + print ''; - + print "
'.$langs->trans("Ref")."'.$objp->rowid.'
'.$langs->trans("Author")."'.$langs->trans("Ref").''; print $deplacement->ref; print '
'.$langs->trans("Type").''.$langs->trans($deplacement->type).'
'.$langs->trans("CompanyVisited").''; if ($soc->id) print $soc->getNomUrl(1); @@ -266,13 +263,13 @@ else $userfee->fetch(); print $userfee->getNomUrl(1); print '
'.$langs->trans("Date").''; print dol_print_date($deplacement->date); print '
'.$langs->trans("FeesKilometersOrAmout").''.$deplacement->km.'
"; print ''; 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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('ConvertToReduc'),$text,'confirm_converttoreduc'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ClassifyPayed'),$langs->trans('ConfirmClassifyPayedBill',$fac->ref),'confirm_payed'); + if ($ret == 'html') print '
'; } 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 '
'; + $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 '
'; } // 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 '
'; + $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 '
'; } } // 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 '
'; + $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 '
'; } // 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 '
'; + $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 '
'; } @@ -3182,19 +3182,7 @@ else { if ($user->rights->facture->valider) { - print '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 ''.$langs->trans('Validate').''; } } 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 ''; - print '
'; + print '
'; $text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie)); $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion); - // print ''; } print "\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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$remisecheque->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide'); + if ($ret == 'html') print '
'; } } 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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + if ($ret == 'html') print '
'; } 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 '
'; + $ret=$html->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite"); + if ($ret == 'html') print '
'; } print ''; 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=$cha->id&action=confirm_payed",$langs->trans('PaySocialContribution'),$text,"confirm_payed"); + if ($ret == 'html') print '
'; } if ($_GET['action'] == 'delete') { $text=$langs->trans('ConfirmDeleteSocialContribution'); - $html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete'); - print '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$cha->id,$langs->trans('DeleteSocialContribution'),$text,'confirm_delete'); + if ($ret == 'html') print '
'; } if ($_GET['action'] == 'edit') print "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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete"); + if ($ret == 'html') print '
'; } } @@ -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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$contact->id,$langs->trans("CreateDolibarrLogin"),$langs->trans("ConfirmCreateContact"),"confirm_create_user",$formquestion); + if ($ret == 'html') print '
'; } print '
'; 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 '
'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("ValidateAContract"),$langs->trans("ConfirmValidateContract"),"confirm_valid"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$form->form_confirm("fiche.php?id=$id",$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close"); + if ($ret == 'html') print '
'; } /* @@ -991,7 +991,11 @@ else //print '
'; $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 '
'; } 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='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'
'; $_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 ' -> '.$ecmdir->getNomUrl(1).'
'; print "

"; */ - + // 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 '
'; + $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 '
'; } if ($mesg) { print $mesg."
"; } - + // 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 ''; - print ''; - print ''; + print ''; + print ''; } print ''; @@ -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 '
'; + $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 '
'; } if ($mesg) { print $mesg."
"; } - + // 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 = '
'.$langs->trans("FileWasRemoved").'
'; $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 ''; - print ''; - print ''; + print ''; + print ''; } print '
'; @@ -310,12 +310,12 @@ print ''; if ($_GET["action"] != 'edit' && $_GET['action'] != 'delete_dir' && $_GET['action'] != 'delete') { print '
'; - + if ($user->rights->ecm->setup) { print ''.$langs->trans('Edit').''; } - + if (sizeof($filearray) == 0) { if ($user->rights->ecm->setup) @@ -340,15 +340,15 @@ if ($mesg) { print '
'.$mesg.'
'; } // 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 '
'; + $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 '
'; } // 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 '
'; + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection'), 'confirm_deletedir'); + if ($ret == 'html') print '
'; } $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 = '
'.$langs->trans("FileTransferComplete").'
'; - //print_r($_FILES); - } - else if ($result < 0) - { - // Echec transfert (fichier d?passant la limite ?) - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; - // print_r($_FILES); - } - else - { - // Fichier infect? par un virus - $mesg = '
'.$langs->trans("ErrorFileIsInfectedWith",$result).'
'; - } - } + 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 = '
'.$langs->trans("FileTransferComplete").'
'; + //print_r($_FILES); + } + else if ($result < 0) + { + // Echec transfert (fichier d?passant la limite ?) + $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + // print_r($_FILES); + } + else + { + // Fichier infect? par un virus + $mesg = '
'.$langs->trans("ErrorFileIsInfectedWith",$result).'
'; + } + } } // Suppression fichier if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { - $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); - dol_delete_file($file); - $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); + dol_delete_file($file); + $mesg = '
'.$langs->trans("FileWasRemoved").'
'; } @@ -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 '
'; + $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 '
'; } // 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 "
\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 '
'; + $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 '
'; } if ($mesg) { print $mesg."
"; } @@ -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 '
'; + $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 '
'; } // 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 "
"; + $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 '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$expedition->ref),'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('ValidateSending'),$langs->trans("ConfirmValidateSending",$expedition->ref),'confirm_valid'); + if ($ret == 'html') print '
'; } /* * 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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$expedition->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$expedition->ref),'confirm_cancel'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify'); + if ($ret == 'html') print '
'; } // 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 '
'; + $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 '
'; } print '
'; @@ -676,17 +676,8 @@ elseif ($_GET["id"] > 0) print ''; if ($nbbyrow) print ''; if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; } - + // Ferme tableau while ($nbphoto % $nbbyrow) { print ''; $nbphoto++; } - + if ($nbphoto < 1) { print '"; - + // Date print ''; @@ -179,7 +179,7 @@ if ($_GET["id"] > 0) $minutes = round((($task_time->task_duration - $heure) * 60),0); $minutes = substr("00"."$minutes", -2); print '\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 "
\n"; + $ret=$html->form_confirm("soc.php?socid=".$soc->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,1); + if ($ret == 'html') print '
'; } if ($mesg) @@ -1244,17 +1244,7 @@ else if ($user->rights->societe->supprimer) { - print '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').''; + print ''.$langs->trans('Delete').''; } print ''; 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)) 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 = '
'.$langs->trans("FileTransferComplete").'
'; - //print_r($_FILES); - } - else if ($result < 0) - { - // Echec transfert (fichier depassant la limite ?) - $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; - // print_r($_FILES); - } - else - { - // Fichier infecte par un virus - $mesg = '
'.$langs->trans("ErrorFileIsInfectedWith",$result).'
'; - } - } + if (is_dir($upload_dir)) + { + $result = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0); + if ($result > 0) + { + $mesg = '
'.$langs->trans("FileTransferComplete").'
'; + //print_r($_FILES); + } + else if ($result < 0) + { + // Echec transfert (fichier depassant la limite ?) + $mesg = '
'.$langs->trans("ErrorFileNotUploaded").'
'; + // print_r($_FILES); + } + else + { + // Fichier infecte par un virus + $mesg = '
'.$langs->trans("ErrorFileIsInfectedWith",$result).'
'; + } + } } // Suppression fichier if ($_POST['action'] == 'confirm_deletefile' && $_POST['confirm'] == 'yes') { - $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); - dol_delete_file($file); - $mesg = '
'.$langs->trans("FileWasRemoved").'
'; + $file = $upload_dir . "/" . urldecode($_GET["urlfile"]); + dol_delete_file($file); + $mesg = '
'.$langs->trans("FileWasRemoved").'
'; } /* -* 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
"; } - /* - * 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 '
'; - } + /* + * 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 '
'; + } // 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 '
'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$fuser->login),"confirm_password"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$fuser->login),"confirm_passwordsend"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$fuser->login),"confirm_disable"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$fuser->login),"confirm_enable"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm("fiche.php?id=$fuser->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$fuser->login),"confirm_delete"); + if ($ret == 'html') print '
'; } 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 '
'; } - /* * Fiche en mode visu */
'; 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 'trans("No").'\',\'deleteline'.$i.'\')">'; - print img_delete(); - } - else - { - print 'rowid.'">'; - print img_delete(); - } + print 'rowid.'">'; + print img_delete(); } else { @@ -849,48 +840,21 @@ elseif ($_GET["id"] > 0) // Validate if ($fichinter->statut == 0 && $user->rights->ficheinter->creer) { - print '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 ''.$langs->trans("Valid").''; } // Modify if ($fichinter->statut == 1 && $user->rights->ficheinter->creer) { - print '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 ''.$langs->trans("Modify").''; } // Delete if (($fichinter->statut == 0 && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print '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 ''.$langs->trans('Delete').''; } } 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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('ValidateOrder'), $text, 'confirm_valid'); + if ($ret == 'html') print '
'; } /* * 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 '
'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder"),"confirm_approve"); + if ($ret == 'html') print '
'; } /* * 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 '
'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder"),"confirm_refuse"); + if ($ret == 'html') print '
'; } /* * 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 '
'; + $ret=$html->form_confirm("fiche.php?id=$commande->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder"),"confirm_cancel"); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $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 '
'; } /* @@ -939,19 +939,7 @@ if ($id > 0 || ! empty($ref)) { if ($user->rights->fournisseur->commande->valider) { - print '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 ''.$langs->trans('Validate').''; } } 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 '
'; + $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 '
'; } // 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 '
'; + $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 '
'; } // 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 '
'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ValidateBill'), $langs->trans('ConfirmValidateBill', $fac->ref), 'confirm_valid'); + if ($ret == 'html') print '
'; } // 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 '
'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('ClassifyPayed'), $langs->trans('ConfirmClassifyPayedBill', $fac->ref), 'confirm_payed'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete'); + if ($ret == 'html') print '
'; } print ''; @@ -1059,17 +1059,7 @@ else if ($_GET['action'] != 'edit' && $fac->statut == 1 && $fac->paye == 0 && $user->societe_id == 0) { - print '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 ''.$langs->trans('ClassifyPayed').''; //print ''.$langs->trans('ClassifyPayed').''; @@ -1079,19 +1069,7 @@ else { if (sizeof($fac->lignes)) { - print '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 ''.$langs->trans('Validate').''; } } 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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); + if ($ret == 'html') print '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + if ($ret == 'html') print '
'; } 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\n"; - print ''; - print ''; - print '
'; - - // Ligne titre - print ''; - - // Ligne formulaire - if ($formquestion) + if ($allowajax && $conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX) { - print ''; - //print ''; - } - - // Ligne message - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'.img_picto('','recent').' '.$title.'
'; - print ''; - print ''; - foreach ($formquestion as $key => $input) + $pageyes=$page.'&action='.$action.'&confirm=yes'; + $pageno=$page.'&confirm=no'; + print ''; + print "\n"; + $ret='ajax'; + } + else + { + print ''; + print ''; + + print '
'.$formquestion['text'].'
'; + + // Ligne titre + print ''; + + // Ligne formulaire + if ($formquestion) { - if ($input['type'] == 'text') + print ''; + + //print ''; } + + // Ligne message + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.img_picto('','recent').' '.$title.'
'; + print ''; + print ''; + foreach ($formquestion as $key => $input) { - print ''; - } - if ($input['type'] == 'select') - { - print ''; - } - if ($input['type'] == 'checkbox') - { - print ''; - print ''; - print ''; - print ''; - print ''; - } - if ($input['type'] == 'radio') - { - $i=0; - foreach($input['values'] as $selkey => $selval) + if ($input['type'] == 'text') + { + print ''; + } + if ($input['type'] == 'select') + { + print ''; + } + if ($input['type'] == 'checkbox') { print ''; - if ($i==0) print ''; - else print ''; - print ''; - print ''; - $i++; + print ''; + print ''; + print ''; + } + if ($input['type'] == 'radio') + { + $i=0; + foreach($input['values'] as $selkey => $selval) + { + print ''; + if ($i==0) print ''; + else print ''; + print ''; + print ''; + $i++; + } } } + print '
'.$formquestion['text'].'
'.$input['label'].'
'; - print $this->select_array($input['name'],$input['values'],'',1); - print '
'.$input['label'].'  '; - print '  
'.$input['label'].'
'; + print $this->select_array($input['name'],$input['values'],'',1); + print '
'.$input['label'].' '.$input['label'].'  '; + print ''; - print $selval; - print '
  
'.$input['label'].' '; + print $selval; + print '
'; + print '

'.$question.''; + $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; + print $this->selectyesno("confirm",$newselectedchoice); + print '
'; - print '

'.$question.''; - $newselectedchoice=empty($selectedchoice)?"no":$selectedchoice; - print $this->selectyesno("confirm",$newselectedchoice); - print '
'; - - if (is_array($formquestion)) - { - foreach ($formquestion as $key => $input) + if (is_array($formquestion)) { - if ($input['type'] == 'hidden') print ''; + foreach ($formquestion as $key => $input) + { + if ($input['type'] == 'hidden') print ''; + } } + + print "\n"; + $ret='html'; } - print "\n"; - - print "\n\n"; + print "\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 '
'; + $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 '
'; } /* @@ -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 '
'; + $ret=$html->form_confirm($_SERVER['PHP_SELF'].'?id='.$livraison->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm"),'confirm_valid'); + if ($ret == 'html') print '
'; } 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 "
\n"; + $ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete"); + if ($ret == 'html') print '
'; } 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 '
'; + $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 '
'; } 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 '
'; - + print ''; // 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 'trans("No").'\',\'delete\')">'; - } - else - { - print ''; - } + print ''; print img_delete().''; } if ($nbbyrow) print '
 
'; 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 "
"; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteAProject"),$langs->trans("ConfirmDeleteAProject"),"confirm_delete"); + if ($ret == 'html') print '
'; } 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 "
"; + $ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); + if ($ret == 'html') print '
'; } print '
'; @@ -170,7 +170,7 @@ if ($_GET["id"] > 0) { $var=!$var; print "
'.dol_print_date($db->jdate($task_time->task_date),'day').' '.dol_print_date($db->jdate($task_time->task_date),'%A').''.$heure." h ".$minutes."