diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 87412802de0..275e9323223 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -102,6 +102,8 @@ if ($action == 'unset') * View */ +$form = new Form($db); + $help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('',$langs->trans("MembersSetup"),$help_url); @@ -127,7 +129,6 @@ print ''.$langs->trans("Value").''; print ''.$langs->trans("Action").''; print "\n"; $var=true; -$form = new Form($db); // Login/Pass required for members $var=!$var; diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 0fdfec86f76..29b6ef1f1f2 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -823,8 +823,7 @@ if ($rowid) // Create a form array $formquestion=array(array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); } diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index d0615896cc6..330bedf4862 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -171,7 +171,6 @@ if ($result) { print ''; print ''; - $form = new Form($db); $form->select_comptes('','accountid',0,'',1); print '
'; $form->select_types_paiements('','paymenttypeid'); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 3df950ad187..f1a5894a78e 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -185,8 +185,7 @@ if ($id > 0) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); } diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index 66de54e804a..e3bbe5b55a9 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -653,7 +653,7 @@ if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm /* * View -*/ + */ $form = new Form($db); $formcompany = new FormCompany($db); @@ -1192,8 +1192,7 @@ else if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); } - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); } // Confirm create third party @@ -1212,8 +1211,7 @@ else // Create a form array $formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); } // Confirm validate member @@ -1286,8 +1284,7 @@ else $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion); } // Confirm remove member @@ -1295,8 +1292,7 @@ else { $formquestion=array(); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); - $ret=$form->form_confirm("fiche.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); } /* @@ -1304,8 +1300,7 @@ else */ if ($action == 'add_spip') { - $ret=$form->form_confirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); } /* @@ -1313,8 +1308,7 @@ else */ if ($action == 'del_spip') { - $ret=$form->form_confirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); } $rowspan=17; diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index ba322457eea..8f8bfbfb413 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -291,8 +291,7 @@ if ($rowid && $action != 'edit') //$formquestion['text']=''.$langs->trans("ThisWillAlsoDeleteBankRecord").''; $text=$langs->trans("ConfirmDeleteSubscription"); if (! empty($conf->banque->enabled) && ! empty($conf->global->ADHERENT_BANK_USE)) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord"); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$subscription->id,$langs->trans("DeleteSubscription"),$text,"confirm_delete",$formquestion,0,1); } print '
'; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index d221619acf4..7dd82f9a6a5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -233,7 +233,6 @@ if (! $rowid && $action != 'create' && $action != 'edit') /* ************************************************************************** */ if ($action == 'create') { - $form = new Form($db); $adht = new AdherentType($db); print_fiche_titre($langs->trans("NewMemberType")); @@ -620,8 +619,6 @@ if ($rowid > 0) if ($action == 'edit') { - $form = new Form($db); - $adht = new AdherentType($db); $adht->id = $rowid; $adht->fetch($rowid); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 66f8d3afaaf..94c660c9a3f 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -143,6 +143,8 @@ if ($action == 'delete') * View */ +$form = new Form($db); + llxHeader('',$langs->trans("OtherSetup")); // Add logic to show/hide buttons @@ -184,9 +186,6 @@ print ''.$langs->trans("Action").''; print "\n"; -$form = new Form($db); - - // Line to add new record $var=false; print "\n"; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 9397b6cd28c..7aeb6eb9f78 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -123,6 +123,8 @@ if ($action == 'update') * View */ +$form = new Form($db); + llxHeader(); print_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"),'','setup'); @@ -131,7 +133,6 @@ print $langs->transnoentities("DelaysOfToleranceDesc",img_warning()); print " ".$langs->trans("OnlyActiveElementsAreShown",DOL_URL_ROOT.'/admin/modules.php')."
\n"; print "
\n"; -$form = new Form($db); $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if ($action == 'edit') diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 507f01596c8..ec8399e0a35 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -676,8 +676,7 @@ print "
\n"; // Confirmation de la suppression de la ligne if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); } /* diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index fa30f472a5c..3b1e3a00384 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -251,8 +251,7 @@ if ($action == 'delete') $result = $db->query($sql); $obj = $db->fetch_object($result); - $ret=$form->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 '
'; + print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".$_GET['menuId'],$langs->trans("DeleteMenu"),$langs->trans("ConfirmDeleteMenu",$obj->titre),"confirm_delete"); } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 45df64a5355..cfaa0c72004 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -66,6 +66,8 @@ if ($action == 'reset' && $user->admin) * View */ +$form = new Form($db); + $_SESSION["mode"]=$mode; $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; @@ -252,7 +254,6 @@ if (! empty($categ[$categidx])) $categidx='expdev'; if (! empty($categ[$categidx])) { - $form = new Form($db); $categidx='expdev'; $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3); diff --git a/htdocs/admin/tools/index.php b/htdocs/admin/tools/index.php index 9dc1aef46b2..955d02b50f9 100644 --- a/htdocs/admin/tools/index.php +++ b/htdocs/admin/tools/index.php @@ -35,13 +35,13 @@ if (! $user->admin) * View */ +$form = new Form($db); + $title=$langs->trans("SystemToolsArea"); if (GETPOST('leftmenu') == 'modulesadmintools') $title=$langs->trans("ModulesSystemTools"); llxHeader(array(),$title); -$form = new Form($db); - print_fiche_titre($title,'','setup'); print $langs->trans("SystemToolsAreaDesc").'
'; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 5347b709410..ac5b825b421 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -150,8 +150,7 @@ if ($result) if ($action == 'purge') { $formquestion=array(); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1); } print ''; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index b4ca64c95a5..5f12b6c150f 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -116,14 +116,12 @@ print '
'; if ($action == 'purge') { $formquestion=array(); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2); } else if ($action == 'lock') { $formquestion=array(); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1); } if ($savehandler == 'files') diff --git a/htdocs/categories/fiche.php b/htdocs/categories/fiche.php index b5d23ed8740..d43c4df9a3d 100644 --- a/htdocs/categories/fiche.php +++ b/htdocs/categories/fiche.php @@ -193,9 +193,10 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr * View */ -llxHeader("","",$langs->trans("Categories")); $form = new Form($db); +llxHeader("","",$langs->trans("Categories")); + if ($user->rights->categorie->creer) { /* diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 06345dfb4cb..bbffe5865d3 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -104,8 +104,7 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); } print($mesg); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index da18c5eba76..6316436f69a 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -144,8 +144,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category'); */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); } print '
'; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 81a635e4d9f..a0daa7b79f4 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -685,8 +685,7 @@ if ($id > 0) // Confirmation suppression action if ($action == 'delete') { - $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=".$id,$langs->trans("DeleteAction"),$langs->trans("ConfirmDeleteAction"),"confirm_delete",'','',1); } if ($action == 'edit') diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index 5e0a261020f..cad05dc3166 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -416,9 +416,7 @@ else // Confirmation delete if ($action == 'delete') { - $form = new Form($db); - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?socid=".$object->socid."&id=".$id,$langs->trans("DeleteAddress"),$langs->trans("ConfirmDeleteAddress"),"confirm_delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?socid=".$object->socid."&id=".$id,$langs->trans("DeleteAddress"),$langs->trans("ConfirmDeleteAddress"),"confirm_delete"); } $nblines = count($object->lines); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index f5409681be8..9021ad0acaf 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -299,7 +299,6 @@ if ($id > 0) // Conditions de reglement par defaut $langs->load('bills'); - $form = new Form($db); print '
'; print ''; print ''; } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 1d599ee549d..61ad0aac194 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -145,8 +145,8 @@ if ($id > 0 || ! empty($ref)) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } // Affiche formulaire upload diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index edac096c8f0..6bc2d02f25e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1123,14 +1123,11 @@ else if ($action == 'builddoc') // In get or post { /* * Generate order document - * define into /core/modules/commande/modules_commande.php - */ + * define into /core/modules/commande/modules_commande.php + */ - // Sauvegarde le dernier modele choisi pour generer un document - if ($_REQUEST['model']) - { - $object->setDocModel($user, $_REQUEST['model']); - } + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; @@ -1149,11 +1146,6 @@ else if ($action == 'builddoc') // In get or post dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } // Remove file in doc form diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index d4da7ec74ac..888126a19f9 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -300,8 +300,8 @@ if ($id > 0 || ! empty($ref)) if ($action == 'delete') { $text=$langs->trans('ConfirmDeleteTransaction'); - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete'); + } // Define transaction list navigation string diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index dbe67212f37..f27cef41cb4 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -130,8 +130,8 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') // Confirmation de la suppression if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + } diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 407a5398dc5..ba6f6ea62ec 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -373,8 +373,8 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); + } print '
'; print $langs->trans('PaymentConditions'); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 88ee011bf8f..71ea4cc5d93 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -700,20 +700,17 @@ else // Confirmation de la validation du mailing if ($action == 'valid') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1); } // Confirm reset else if ($action == 'reset') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$object->ref),"confirm_reset",'','',2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$object->ref),"confirm_reset",'','',2); } // Confirm delete else if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id.(! empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''),$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(! empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''),$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete",'','',1); } @@ -749,8 +746,7 @@ else } $text.=$langs->trans('ConfirmSendingEmailing').'
'; $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,260); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index b1b91cfb89c..3d6bc97319b 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -158,8 +158,7 @@ if ($object->id > 0) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); } // Affiche formulaire upload diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index cfa83e78875..0de58ca2ed0 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -297,7 +297,7 @@ if ($socid > 0) if ($_GET['action'] == 'remove') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1); } /* @@ -394,7 +394,7 @@ if ($socid > 0) array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5') ); $langs->load("dict"); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$obj->rowid, $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($obj->amount_ttc),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); print '
'; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index dcad7cd4f22..ef57d15d355 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -266,8 +266,8 @@ if ($result) // Confirmations if ($action == 'delete_categ') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?rowid=".$rowid."&cat1=".GETPOST("fk_categ")."&orig_account=".$orig_account, $langs->trans("RemoveFromRubrique"), $langs->trans("RemoveFromRubriqueConfirm"), "confirm_delete_categ", '', 'yes', 1); + } print ''; diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 9b07bccd7ae..26cdf746f46 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -146,8 +146,8 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } // Affiche formulaire upload diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index e82d962053d..808d9163222 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -436,8 +436,8 @@ else if ($id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete"); + } $soc = new Societe($db); diff --git a/htdocs/compta/dons/fiche.php b/htdocs/compta/dons/fiche.php index 95f5985b56f..b9cf534f8a5 100644 --- a/htdocs/compta/dons/fiche.php +++ b/htdocs/compta/dons/fiche.php @@ -217,35 +217,28 @@ if ($action == 'set_encaisse') */ if ($action == 'builddoc') { - $donation = new Don($db); - $donation->fetch($id); + $object = new Don($db); + $object->fetch($id); - if ($_REQUEST['model']) - { - $donation->setDocModel($user, $_REQUEST['model']); - } + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; $newlang=''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$donation->client->default_lang; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=don_create($db, $donation->id, '', $donation->modelpdf, $outputlangs); + $result=don_create($db, $object->id, '', $object->modelpdf, $outputlangs); if ($result <= 0) { dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$donation->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 7e82e4d38d3..1251ad4fe0e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1795,7 +1795,8 @@ else if ($action == 'builddoc') // En get ou en post $object->fetch($id); $object->fetch_thirdparty(); - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model')); + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); if (GETPOST('fk_bank')) $object->fk_bank=GETPOST('fk_bank'); // Define output language @@ -1814,11 +1815,6 @@ else if ($action == 'builddoc') // En get ou en post dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } // Remove file in doc form diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 5671f4f8d9c..8aae07746e9 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -174,8 +174,8 @@ if ($id > 0 || ! empty($ref)) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?facid='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php index e93113e028c..c860e04ecd6 100644 --- a/htdocs/compta/paiement/cheque/fiche.php +++ b/htdocs/compta/paiement/cheque/fiche.php @@ -211,10 +211,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { $result = $object->fetch($id); - /*if ($_REQUEST['model']) - { - $object->setDocModel($user, $_REQUEST['model']); - }*/ + // Save last template used to generate document + //if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); $outputlangs = $langs; $newlang=''; @@ -306,8 +304,8 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteCheckReceipt"), $langs->trans("ConfirmDeleteCheckReceipt"), 'confirm_delete','','',1); + } /* @@ -315,8 +313,8 @@ else */ if ($action == 'valide') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1); + } } diff --git a/htdocs/compta/paiement/fiche.php b/htdocs/compta/paiement/fiche.php index 9f16508c590..cf7d70819fc 100644 --- a/htdocs/compta/paiement/fiche.php +++ b/htdocs/compta/paiement/fiche.php @@ -192,8 +192,8 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"), 0, 'p */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); + } /* @@ -202,8 +202,8 @@ if ($action == 'delete') if ($action == 'valide') { $facid = $_GET['facid']; - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); + } diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index ce4a3b7cb7f..b3a8939482f 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -55,10 +55,10 @@ if ($action == 'builddoc') $rap = new pdf_paiement($db); $outputlangs = $langs; - if (! empty($_REQUEST['lang_id'])) + if (! empty(GETPOST('lang_id'))) { $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $outputlangs->setDefaultLang(GETPOST('lang_id')); } // We save charset_output to restore it because write_file can change it if needed for diff --git a/htdocs/compta/payment_sc/fiche.php b/htdocs/compta/payment_sc/fiche.php index 0ad3eaf8622..d502e6e2fc0 100644 --- a/htdocs/compta/payment_sc/fiche.php +++ b/htdocs/compta/payment_sc/fiche.php @@ -146,8 +146,8 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentSocialContribution"), 0, */ if ($_GET['action'] == 'delete') { - $ret=$form->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); + } /* @@ -156,8 +156,8 @@ if ($_GET['action'] == 'delete') if ($_GET['action'] == 'valide') { $facid = $_GET['facid']; - $ret=$form->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); + } diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php index 22af3b3548d..5db8e38d912 100644 --- a/htdocs/compta/prelevement/fiche.php +++ b/htdocs/compta/prelevement/fiche.php @@ -150,8 +150,8 @@ if ($id > 0) /*if ($action == 'credite') { - $ret=$form->form_confirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=".$bon->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); + }*/ print '
'; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0a25bbf8028..cbd4cf122f4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -723,6 +723,22 @@ class Contact extends CommonObject } } + if (! $error) + { + // Remove category + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$rowid; + dol_syslog(get_class($this)."::delete sql=".$sql); + $resql=$this->db->query($sql); + if (! $resql) + { + $error++; + $this->error .= $this->db->lasterror(); + $errorflag=-1; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + + } + } + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php index 7f587500cbe..a4389294fb1 100644 --- a/htdocs/contact/fiche.php +++ b/htdocs/contact/fiche.php @@ -343,8 +343,8 @@ else { if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); + } } @@ -839,8 +839,8 @@ else if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser"); else $text.=$langs->trans("UserWillBeInternalUser"); } - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); + } print '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 19b389cc192..e12b34b78a7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -122,7 +122,7 @@ $sql.= " cp.code as country_code"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as cp ON cp.rowid = p.fk_pays"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; -if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON s.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ +if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cs ON p.rowid = cs.fk_socpeople"; // We need this table joined to the select in order to filter by categ if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= ' WHERE p.entity IN ('.getEntity('societe', 1).')'; if (!$user->rights->societe->client->voir && !$socid) //restriction diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 099befedb95..1dba64f57d7 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -145,8 +145,8 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 30aced500d7..f096cac29c7 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -947,8 +947,8 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); + } /* @@ -968,8 +968,8 @@ else $text=$langs->trans('ConfirmValidateContract',$numref); - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); + } /* @@ -977,8 +977,8 @@ else */ if ($action == 'close') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); + } /* @@ -1314,7 +1314,7 @@ else */ if ($action == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline-1]->id == GETPOST('rowid')) { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1); if ($ret == 'html') print '
'; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index be4257bd174..c81afc72ad9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2471,10 +2471,11 @@ class Form * @param string $action Action * @param array $formquestion An array with forms complementary inputs * @param string $selectedchoice "" or "no" or "yes" - * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No + * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box * @param int $width Force width of box * @return void + * @deprecated */ function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { @@ -2482,7 +2483,15 @@ class Form } /** - * Show a confirmation HTML form or AJAX popup + * Show a confirmation HTML form or AJAX popup. + * Easiest way to use this is with useajax=1. + * If you use useajax='xxx', you must also add jquery code to trigger opening of box (with correct parameters) + * just after calling this method. For example: + * print ''."\n"; * * @param string $page Url of page to call if confirmation is OK * @param string $title Title @@ -2578,7 +2587,9 @@ class Form $more.='
'."\n"; } - if (! empty($conf->dol_use_jmobile)) $useajax=0; // JQUI method dialog is broken with jmobile, we use standard HTML. We also change code for button to have get on url with action=xxx and output confirm only when action=xxx + // JQUI method dialog is broken with jmobile, we use standard HTML. + // Note: When using dol_use_jmobile, you must also check code for button use a GET url with action=xxx and output the confirm code only when action=xxx + if (! empty($conf->dol_use_jmobile)) $useajax=0; if ($useajax && $conf->use_javascript_ajax) { diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 055b4af5a60..dfe656a745e 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -585,7 +585,7 @@ function cleanSerialize(expr) { var reg = new RegExp("(&)", "g"); var reg2 = new RegExp("[^A-Z0-9,]", "g"); var liste1 = expr.replace(reg, ","); - return liste = liste1.replace(reg2, ""); + return liste1.replace(reg2, ""); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6be4eaf2a61..5d0facb4bdb 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1033,7 +1033,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl } // Add an additional description for the category products - if (! empty($conf->categorie->enabled)) + if (! empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && ! empty($conf->categorie->enabled)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categstatic=new Categorie($db); diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index f114f0c91cd..81e0ba99f26 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -209,6 +209,9 @@ if ($action=='inactive') * View */ +$form = new Form($db); +$formCron = new FormCron($db); + llxHeader('',$langs->trans("CronAdd")); if ($action=='edit' || empty($action) || $action=='delete' || $action=='execute') @@ -244,19 +247,16 @@ if ($conf->use_javascript_ajax) print ''."\n"; } -$form = new Form($db); -$formCron = new FormCron($db); - if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); + $action=''; } if ($action == 'execute'){ - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); + $action=''; } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 1591c35d26a..7c391558cb9 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -122,14 +122,14 @@ print $langs->trans('CronInfo'); if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronDelete"),$langs->trans("CronConfirmDelete"),"confirm_delete",'','',1); + } if ($action == 'execute') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&status='.$status,$langs->trans("CronExecute"),$langs->trans("CronConfirmExecute"),"confirm_execute",'','',1); + } // liste des jobs creer diff --git a/htdocs/ecm/docdir.php b/htdocs/ecm/docdir.php index 5ab21beed0d..ec16acdbc16 100644 --- a/htdocs/ecm/docdir.php +++ b/htdocs/ecm/docdir.php @@ -204,8 +204,8 @@ if (empty($action) || $action == 'delete_section') // Confirmation de la suppression d'une ligne categorie if ($action == 'delete_section') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection'); + } // Construit fiche rubrique diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index afb03ab867e..6b9dcc7d1a1 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -252,8 +252,8 @@ print ''; // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_file') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile',$urlfile), 'confirm_deletefile', '', 1, 1); + } if ($_GET["action"] != 'edit') diff --git a/htdocs/ecm/docmine.php b/htdocs/ecm/docmine.php index 8ba84f6fc76..94c5d06759d 100644 --- a/htdocs/ecm/docmine.php +++ b/htdocs/ecm/docmine.php @@ -334,16 +334,16 @@ if ($action != 'edit' && $action != 'delete') // Confirm remove file if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + } // Confirm remove file if ($action == 'delete_dir') { $relativepathwithoutslash=preg_replace('/[\/]$/','',$relativepath); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$relativepathwithoutslash), 'confirm_deletedir', '', 1, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"], $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$relativepathwithoutslash), 'confirm_deletedir', '', 1, 1); + } $formfile=new FormFile($db); diff --git a/htdocs/ecm/docother.php b/htdocs/ecm/docother.php index 4c618c79e71..b74af256bc3 100644 --- a/htdocs/ecm/docother.php +++ b/htdocs/ecm/docother.php @@ -112,8 +112,8 @@ print_fiche_titre($langs->trans("ECMAutoOrg")); */ if ($_GET['action'] == 'delete_file') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?socid='.$socid.'&urlfile='.urldecode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile'); + } // Construit liste des fichiers diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index bb8844eafc6..85eddf47624 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -405,8 +405,8 @@ print ''; // Confirm remove file (for non javascript users) if ($action == 'delete' && empty($conf->use_javascript_ajax)) { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); + } dol_htmloutput_mesg($mesg); @@ -455,8 +455,8 @@ print ''; // Confirmation de la suppression d'une ligne categorie if ($action == 'delete_section') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); + } // End confirm diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 8f466aa377f..82f3bf64867 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -294,10 +294,9 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl' // Build document else if ($action == 'builddoc') // En get ou en post { - if (GETPOST('model','alpha')) - { - $object->setDocModel($user, GETPOST('model','alpha')); - } + + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; @@ -924,8 +923,8 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); + } /* @@ -953,16 +952,16 @@ else $text.=$notify->confirmMessage('SHIPPING_VALIDATE',$object->socid); } - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('ValidateSending'),$text,'confirm_valid','',0,1); + } /* * Confirmation de l'annulation */ if ($action == 'annuler') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('CancelSending'),$langs->trans("ConfirmCancelSending",$object->ref),'confirm_cancel','',0,1); + } // Calculate true totalWeight and totalVolume for all products diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 24f4bf73b0a..1e09cd47482 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -152,8 +152,8 @@ if ($id > 0 || ! empty($ref)) */ if ($action == 'cloture') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); + } // Onglet commande diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 98397ebe6c1..c152895c0d7 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -225,7 +225,7 @@ if ($step == 1 || $action == 'cleanselect') if ($action == 'builddoc') { // Build export file - $result=$objexport->build_file($user, $_POST['model'], $datatoexport, $array_selected, $array_filtervalue); + $result=$objexport->build_file($user, GETPOST('model','alpha'), $datatoexport, $array_selected, $array_filtervalue); if ($result < 0) { setEventMessage($objexport->error, 'errors'); @@ -1025,8 +1025,8 @@ if ($step == 5 && $datatoexport) */ if ($action == 'remove_file') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport.'&file='.urlencode(GETPOST("file")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?step=5&datatoexport='.$datatoexport.'&file='.urlencode(GETPOST("file")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } print ''; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index b9d70300c80..30349e5bc09 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -146,8 +146,8 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } // Affiche formulaire upload diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index d3947958450..902db499004 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -333,10 +333,8 @@ else if ($action == 'builddoc' && $user->rights->ficheinter->creer) // En get ou $object->fetch_thirdparty(); $object->fetch_lines(); - if (GETPOST('model','alpha')) - { - $object->setDocModel($user, GETPOST('model','alpha')); - } + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; @@ -1136,8 +1134,8 @@ else if ($id > 0 || ! empty($ref)) // Confirmation de la suppression de la fiche d'intervention if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete','',0,1); + } // Confirmation validation @@ -1160,22 +1158,22 @@ else if ($id > 0 || ! empty($ref)) } $text=$langs->trans('ConfirmValidateIntervention',$numref); - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateIntervention'), $text, 'confirm_validate','',0,1); + } // Confirmation de la validation de la fiche d'intervention if ($action == 'modify') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ModifyIntervention'), $langs->trans('ConfirmModifyIntervention'), 'confirm_modify','',0,1); + } // Confirmation de la suppression d'une ligne d'intervention if ($action == 'ask_deleteline') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&line_id='.GETPOST('line_id','int'), $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline','',0,1); + } print '
'; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index d1fdaeb113e..da72a325574 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -181,8 +181,8 @@ if ($object->id > 0) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } // Affiche formulaire upload diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 77a7cce4e23..e5bc8d81926 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -628,13 +628,9 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) / { // Build document - // Sauvegarde le dernier module choisi pour generer un document - - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } - + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); + $outputlangs = $langs; if (GETPOST('lang_id')) { @@ -647,11 +643,6 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) / dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } // Delete file in doc form @@ -1069,8 +1060,8 @@ elseif (! empty($object->id)) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 2); + } // Clone confirmation @@ -1081,8 +1072,8 @@ elseif (! empty($object->id)) //array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneOrder'),$langs->trans('ConfirmCloneOrder',$object->ref),'confirm_clone',$formquestion,'yes',1); + } /* @@ -1105,8 +1096,8 @@ elseif (! empty($object->id)) $text.=$notify->confirmMessage('ORDER_SUPPLIER_APPROVE', $object->socid); } - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_valid', '', 0, 1); + } /* @@ -1128,8 +1119,8 @@ elseif (! empty($object->id)) ); } - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder",$object->ref),"confirm_approve", $formquestion, 1, 1, 240); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ApproveThisOrder"),$langs->trans("ConfirmApproveThisOrder",$object->ref),"confirm_approve", $formquestion, 1, 1, 240); + } /* @@ -1137,8 +1128,8 @@ elseif (! empty($object->id)) */ if ($action == 'refuse') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder",$object->ref),"confirm_refuse", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("DenyingThisOrder"),$langs->trans("ConfirmDenyingThisOrder",$object->ref),"confirm_refuse", '', 0, 1); + } /* @@ -1146,8 +1137,8 @@ elseif (! empty($object->id)) */ if ($action == 'cancel') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder",$object->ref),"confirm_cancel", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id",$langs->trans("Cancel"),$langs->trans("ConfirmCancelThisOrder",$object->ref),"confirm_cancel", '', 0, 1); + } /* @@ -1156,8 +1147,8 @@ elseif (! empty($object->id)) if ($action == 'commande') { $date_com = dol_mktime(0,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]); - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->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",'',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->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",'',0,2); + } /* @@ -1165,8 +1156,8 @@ elseif (! empty($object->id)) */ if ($action == 'delete_product_line') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline','',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline','',0,2); + } /* @@ -1240,7 +1231,6 @@ elseif (! empty($object->id)) // Conditions de reglement par defaut $langs->load('bills'); - $form = new Form($db); print '
'; print '
'; print $langs->trans('PaymentConditions'); @@ -1261,7 +1251,6 @@ elseif (! empty($object->id)) // Mode of payment $langs->load('bills'); - $form = new Form($db); print '
'; print '
'; print $langs->trans('PaymentMode'); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 56b8f78762f..8ba991076f1 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -121,8 +121,8 @@ if ($object->id > 0) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } print ''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 2bb1820693e..7289972c004 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -86,7 +86,7 @@ if ($id > 0 || ! empty($ref)) /* * Actions -*/ + */ // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') @@ -168,7 +168,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fourn } } -elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) +elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); $ret = $object->deleteline(GETPOST('lineid')); @@ -898,21 +898,22 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P } // Build document -elseif ($action == 'builddoc') +elseif ($action == 'builddoc') { - // Save modele used + // Save modele used $object->fetch($id); $object->fetch_thirdparty(); - if ($_REQUEST['model']) - { - $object->setDocModel($user, $_REQUEST['model']); - } + + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); $outputlangs = $langs; - if (! empty($_REQUEST['lang_id'])) + $newlang=GETPOST('lang_id','alpha'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; + if (! empty($newlang)) { $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $outputlangs->setDefaultLang($newlang); } $result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) @@ -920,11 +921,6 @@ elseif ($action == 'builddoc') dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } // Delete file in doc form @@ -1373,8 +1369,7 @@ else // Confirmation de la suppression d'une ligne produit if ($action == 'confirm_delete_line') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 1, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_delete_line', '', 1, 1); } // Clone confirmation @@ -1386,8 +1381,7 @@ else //array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1) ); // Paiement incomplet. On demande si motif = escompte ou autre - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes', 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneInvoice'),$langs->trans('ConfirmCloneInvoice',$object->ref),'confirm_clone',$formquestion,'yes', 1); } // Confirmation de la validation @@ -1433,22 +1427,22 @@ else array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))); } - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1, 240); + } // Confirmation set paid if ($action == 'paid') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', 0, 1); + } // Confirmation de la suppression de la facture fournisseur if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); + } @@ -1638,7 +1632,6 @@ else // Conditions de reglement par defaut $langs->load('bills'); - $form = new Form($db); print '
'; print '
'; print $langs->trans('PaymentConditions'); @@ -1659,7 +1652,6 @@ else // Mode of payment $langs->load('bills'); - $form = new Form($db); print '
'; print '
'; print $langs->trans('PaymentMode'); @@ -1787,7 +1779,7 @@ else /* * Lines - */ + */ print '
'; print ''; $var=1; @@ -1956,7 +1948,10 @@ else print ''; print ''; diff --git a/htdocs/fourn/paiement/fiche.php b/htdocs/fourn/paiement/fiche.php index 508aa4e1d5c..5ed2c009011 100644 --- a/htdocs/fourn/paiement/fiche.php +++ b/htdocs/fourn/paiement/fiche.php @@ -161,8 +161,8 @@ if ($result > 0) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete'); + } /* @@ -170,8 +170,8 @@ if ($result > 0) */ if ($action == 'valide') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide'); + } print '
'; - if ($object->statut == 0) print 'lines[$i]->rowid.'">'.img_delete().''; + if ($object->statut == 0) + { + print 'lines[$i]->rowid.'">'.img_delete().''; + } else print ' '; print '
'; @@ -341,4 +341,4 @@ dol_fiche_end(); llxFooter(); $db->close(); -?> \ No newline at end of file +?> diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index e8416621de6..9c4f2cfffef 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -403,15 +403,15 @@ else // Confirm remove file if ($_GET['action'] == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode($_REQUEST["section"]).'&file='.urlencode($_GET["file"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode($_REQUEST["section"]).'&file='.urlencode($_GET["file"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1); + } // Confirmation de la suppression d'une ligne categorie if ($_GET['action'] == 'delete_section') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode($_REQUEST["section"]).'&file='.urlencode($_GET["file"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?numero_ftp='.$numero_ftp.'§ion='.urlencode($_REQUEST["section"]).'&file='.urlencode($_GET["file"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); + } print $langs->trans("Server").': '.$ftp_server.'
'; diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index a65df53706d..8176a80938c 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -832,7 +832,7 @@ else if ($action == 'delete' && $cp->statut == 1) { if($user->rights->holiday->delete) { - $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); + print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1); if ($ret == 'html') print '
'; } } @@ -840,14 +840,14 @@ else // Si envoi en validation if ($action == 'sendToValidate' && $cp->statut == 1 && $user->id == $cp->fk_user) { - $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); + print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1); if ($ret == 'html') print '
'; } // Si validation de la demande if ($action == 'valid' && $cp->statut == 2 && $user->id == $cp->fk_validator) { - $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); + print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1); if ($ret == 'html') print '
'; } @@ -855,14 +855,14 @@ else if ($action == 'refuse' && $cp->statut == 2 && $user->id == $cp->fk_validator) { $array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>"")); - $ret=$form->form_confirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); + print $form->formconfirm("fiche.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0); if ($ret == 'html') print '
'; } // Si annulation de la demande if ($action == 'cancel' && $cp->statut == 2 && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) { - $ret=$form->form_confirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); + print $form->formconfirm("fiche.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1); if ($ret == 'html') print '
'; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index f2681a936f7..c6ada78322a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -135,7 +135,7 @@ if ($action=='downfield' || $action=='upfield') if ($action == 'builddoc') { // Build import file - $result=$objimport->build_file($user, $_POST['model'], $datatoimport, $array_match_file_to_database); + $result=$objimport->build_file($user, GETPOST('model','alpha'), $datatoimport, $array_match_file_to_database); if ($result < 0) { $mesg='
'.$objimport->error.'
'; @@ -481,8 +481,8 @@ if ($step == 3 && $datatoimport) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?urlfile='.urlencode(GETPOST('urlfile')).'&step=3'.$param, $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); + } print '
'; diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 5f6b45cff1e..368128e8f02 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -95,3 +95,4 @@ ReplenishmentOrders=Replenishment orders UseVirtualStock=Use virtual stock instead of physical stock RuleForStockReplenishment=Rule for stocks replenishment SelectProduct=Select at least one product +AlertOnly= Alerts only diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 98aca2b2803..d0084e82fef 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -95,3 +95,4 @@ ReplenishmentOrders=Commandes de réapprovisionnement UseVirtualStock=Utiliser le stock théorique à la place du stock physique RuleForStockReplenishment=Règle de gestion du réapprovisionnement des stocks SelectProduct=Sélectionnez au moins un produit +AlertOnly = Alertes seulement diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 6e4d8e72a7b..44c0bc91166 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -184,15 +184,13 @@ if ($action == 'builddoc') // En get ou en post $object->fetch($id); $object->fetch_thirdparty(); - if ($_REQUEST['model']) - { - $object->setDocModel($user, $_REQUEST['model']); - } + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (! empty($newlang)) { @@ -490,8 +488,8 @@ else if ($action == 'delete') { $expedition_id = $_GET["expid"]; - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id.'&expid='.$expedition_id,$langs->trans("DeleteDeliveryReceipt"),$langs->trans("DeleteDeliveryReceiptConfirm",$delivery->ref),'confirm_delete','','',1); + } /* @@ -500,8 +498,8 @@ else */ if ($action == 'valid') { - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$delivery->id,$langs->trans("ValidateDeliveryReceipt"),$langs->trans("ValidateDeliveryReceiptConfirm",$delivery->ref),'confirm_valid','','',1); + } diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php index 644c321b8bb..0cca7dee679 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/fiche.php @@ -157,7 +157,6 @@ $productstatic = new Product($db); $form = new Form($db); llxHeader("","",$langs->trans("CardProduct".$product->type)); -$form = new Form($db); dol_htmloutput_errors($mesg); diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 9680a1346b2..703177d9398 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -303,7 +303,9 @@ else print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($conf->service->enabled) && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder); - print ''; + if ($user->rights->produit->creer) { + print ''; + } if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) print ''; print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); @@ -345,9 +347,11 @@ else } // Minimum buying Price - print ''; + if ($user->rights->produit->creer) { + print ''; + } // Stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) @@ -442,21 +446,23 @@ else } // Better buy price - print ''; + print ''; + } // Show stock if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index 6710ed5b0f1..c3353866b29 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -96,8 +96,8 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1); + } print($mesg); diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index db8dbc6de1b..c98c6c23e96 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -240,9 +240,7 @@ else // Confirm delete third party if ($action == 'delete') { - $form = new Form($db); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAWarehouse"),$langs->trans("ConfirmDeleteWarehouse",$object->libelle),"confirm_delete",'',0,2); } print '
'.$langs->trans("BuyingPriceMinShort").''.$langs->trans("BuyingPriceMinShort").''.$langs->trans("DesiredStock").''.$langs->trans("PhysicalStock").''; - print ' '; - print ''; + print ' '; + print ''; - if ($objp->minsellprice != '') - { - //print price($objp->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) + if ($user->rights->produit->creer) { + print ''; + if ($objp->minsellprice != '') { - if ($product_fourn->product_fourn_price_id > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(); - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); - } + //print price($objp->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(); + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) print $form->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext); + else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } + } } - } - print '
'; diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index ef2cbb26c57..09c39e7661d 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -117,7 +117,7 @@ function ordered($product_id) } else { $error = $db->lasterror(); dol_print_error($db); - dol_syslog('replenish.php: ' . $error, LOG_ERROR); + dol_syslog('replenish.php: ' . $error, LOG_ERR); return $langs->trans('error'); } diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 6b442f763f7..fbb6edf3bae 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -47,6 +47,7 @@ $snom = GETPOST('snom', 'alpha'); $sall = GETPOST('sall', 'alpha'); $type = GETPOST('type','int'); $tobuy = GETPOST('tobuy', 'int'); +$salert = GETPOST('salert', 'alpha'); $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); @@ -66,9 +67,16 @@ $offset = $limit * $page ; * Actions */ +if (isset($_POST['button_removefilter']) || isset($_POST['valid'])) { + $sref = ''; + $snom = ''; + $sal = ''; + $salert = ''; +} + //orders creation //FIXME: could go in the lib -if ($action == 'order') { +if ($action == 'order' && isset($_POST['valid'])) { $linecount = GETPOST('linecount', 'int'); $box = 0; unset($_POST['linecount']); @@ -105,7 +113,7 @@ if ($action == 'order') { } else { $error=$db->lasterror(); dol_print_error($db); - dol_syslog('replenish.php: '.$error, LOG_ERROR); + dol_syslog('replenish.php: '.$error, LOG_ERR); } $db->free($resql); unset($_POST['fourn' . $i]); @@ -152,7 +160,7 @@ $title = $langs->trans('Status'); $sql = 'SELECT p.rowid, p.ref, p.label, p.price'; $sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type'; $sql .= ', p.tms as datem, p.duration, p.tobuy, p.seuil_stock_alerte,'; -$sql .= ' SUM(s.reel) as stock_physique'; +$sql .= ' SUM(COALESCE(s.reel, 0)) as stock_physique'; $sql .= ', p.desiredstock'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_fournisseur_price as pf'; @@ -175,10 +183,18 @@ if (dol_strlen($type)) { } } if ($sref) { - $sql .= ' AND p.ref LIKE "%' . $sref . '%"'; + //natural search + $scrit = explode(' ', $sref); + foreach ($scrit as $crit) { + $sql .= ' AND p.ref LIKE "%' . $crit . '%"'; + } } if ($snom) { - $sql .= ' AND p.label LIKE "%' . $db->escape($snom) . '%"'; + //natural search + $scrit = explode(' ', $snom); + foreach ($scrit as $crit) { + $sql .= ' AND p.label LIKE "%' . $db->escape($crit) . '%"'; + } } $sql .= ' AND p.tobuy = 1'; @@ -190,8 +206,12 @@ $sql .= ' GROUP BY p.rowid, p.ref, p.label, p.price'; $sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms'; $sql .= ', p.duration, p.tobuy, p.seuil_stock_alerte'; $sql .= ', p.desiredstock'; -$sql .= ' HAVING (p.desiredstock > SUM(s.reel) or SUM(s.reel) is NULL)'; +$sql .= ' HAVING p.desiredstock > SUM(COALESCE(s.reel, 0))'; $sql .= ' AND p.desiredstock > 0'; +if ($salert == 'on') { + $sql .= ' AND SUM(COALESCE(s.reel, 0)) < p.seuil_stock_alerte AND p.seuil_stock_alerte is not NULL'; + $alertchecked = 'checked="checked"'; +} $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -199,11 +219,6 @@ $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - if ($num == 1 && ($sall or $snom or $sref)) { - $objp = $db->fetch_object($resql); - header('Location: ../fiche.php?id=' . $objp->rowid); - exit; - } $helpurl = 'EN:Module_Stocks_En|FR:Module_Stock|'; $helpurl .= 'ES:Módulo_Stocks'; @@ -216,9 +231,10 @@ if ($resql) { $head[1][1] = $langs->trans("ReplenishmentOrders"); $head[1][2] = 'replenishorders'; dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock'); - if ($sref || $snom || $sall || GETPOST('search', 'alpha')) { + if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) { $filters = '&sref=' . $sref . '&snom=' . $snom; - $filters .= '&sall=' . $sall; + $filters .= '&sall=' . $sall; + $filters .= '&salert=' . $salert; print_barre_liste($texte, $page, 'replenish.php', @@ -231,7 +247,8 @@ if ($resql) { } else { $filters = '&sref=' . $sref . '&snom=' . $snom; $filters .= '&fourn_id=' . $fourn_id; - $filters .= (isset($type)?'&type=' . $type:''); + $filters .= (isset($type)?'&type=' . $type:''); + $filters .= '&salert=' . $salert; print_barre_liste($texte, $page, 'replenish.php', @@ -253,7 +270,7 @@ if ($resql) { '
'; $param = (isset($type)? '&type=' . $type : ''); - $param .= '&fourn_id=' . $fourn_id . '&snom='. $snom; + $param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert; $param .= '&sref=' . $sref; // Lignes des titres @@ -356,13 +373,15 @@ if ($resql) { ''; } echo '', - '', + '', '', '', '', '', ''; @@ -396,9 +415,6 @@ if ($resql) { $prod->type = $objp->fk_product_type; $ordered = ordered($prod->id); - if (!$objp->stock_physique) { - $objp->stock_physique = 0; - } if ($conf->global->USE_VIRTUAL_STOCK) { //compute virtual stock $prod->fetch($prod->id); @@ -487,14 +503,15 @@ if ($resql) { '', '
  ' . $langs->trans('AlertOnly') . '    ', '', + '', '
', '
', - '', + '', '
', ''; if ($num > $conf->liste_limit) { - if ($sref || $snom || $sall || GETPOST('search', 'alpha')) { + if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) { $filters = '&sref=' . $sref . '&snom=' . $snom; - $filters .= '&sall=' . $sall; + $filters .= '&sall=' . $sall; + $filters .= '&salert=' . $salert; print_barre_liste('', $page, 'replenish.php', @@ -509,7 +526,8 @@ if ($resql) { } else { $filters = '&sref=' . $sref . '&snom=' . $snom; $filters .= '&fourn_id=' . $fourn_id; - $filters .= (isset($type)? '&type=' . $type : ''); + $filters .= (isset($type)? '&type=' . $type : ''); + $filters .= '&salert=' . $salert; print_barre_liste('', $page, 'replenish.php', diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index ed76755cfc0..c7be26c4861 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -103,10 +103,17 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = ' . $user->id; } if ($sref) { - $sql .= ' AND cf.ref LIKE "%' . $db->escape($sref) . '%"'; + //natural search + $scrit = explode(' ', $sref); + foreach ($scrit as $crit) { + $sql .= ' AND cf.ref LIKE "%' . $db->escape($crit) . '%"'; + } } if ($snom) { - $sql .= ' AND s.nom LIKE "%' . $db->escape($snom) . '%"'; + $scrit = explode(' ', $snom); + foreach ($scrit as $crit) { + $sql .= ' AND s.nom LIKE "%' . $db->escape($crit) . '%"'; + } } if ($suser) { $sql .= ' AND u.login LIKE "%' . $db->escape($suser) . '%"'; diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 9770292e609..66ffc0443b0 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -122,8 +122,7 @@ if ($object->id > 0) if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&urlfile=".urlencode(GETPOST("urlfile")),$langs->trans("DeleteAFile"),$langs->trans("ConfirmDeleteAFile"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&urlfile=".urlencode(GETPOST("urlfile")),$langs->trans("DeleteAFile"),$langs->trans("ConfirmDeleteAFile"),"confirm_delete",'','',1); } print ''; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 17e5975a272..a07e3755fa5 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -233,10 +233,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) // Build doc if ($action == 'builddoc' && $user->rights->projet->creer) { - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); $outputlangs = $langs; if (GETPOST('lang_id')) @@ -250,11 +248,6 @@ if ($action == 'builddoc' && $user->rights->projet->creer) dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } // Delete file in doc form @@ -458,20 +451,17 @@ else // Confirmation validation if ($action == 'validate') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1); } // Confirmation close if ($action == 'close') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("CloseAProject"),$langs->trans("ConfirmCloseAProject"),"confirm_close",'','',1); } // Confirmation reopen if ($action == 'reopen') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ReOpenAProject"),$langs->trans("ConfirmReOpenAProject"),"confirm_reopen",'','',1); } // Confirmation delete if ($action == 'delete') @@ -481,8 +471,7 @@ else $taskarray=$task->getTasksArray(0,0,$object->id,0,0); $nboftask=count($taskarray); if ($nboftask) $text.='
'.img_warning().' '.$langs->trans("ThisWillAlsoRemoveTasks",$nboftask); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DeleteAProject"),$text,"confirm_delete",'','',1); } // Clone confirmation diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index f95d93d98be..7e46e1c169c 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -146,30 +146,22 @@ if (! empty($project_ref) && ! empty($withproject)) // Build doc if ($action == 'builddoc' && $user->rights->projet->creer) { - if ($object->fetch($id,$ref) >= 0 ) - { - if (GETPOST('model')) - { - $object->setDocModel($user, GETPOST('model')); - } + $object->fetch($id,$ref); + + // Save last template used to generate document + if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - $outputlangs = $langs; - if (GETPOST('lang_id')) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang(GETPOST('lang_id')); - } - $result=task_pdf_create($db, $object, $object->modelpdf, $outputlangs); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } + $outputlangs = $langs; + if (GETPOST('lang_id')) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang(GETPOST('lang_id')); + } + $result=task_pdf_create($db, $object, $object->modelpdf, $outputlangs); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; } } @@ -385,8 +377,7 @@ if ($id > 0 || ! empty($ref)) if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"].'&withproject='.$withproject,$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"].'&withproject='.$withproject,$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete"); } print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 41f19aef127..919f88135b2 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -241,8 +241,7 @@ if ($id > 0 || ! empty($ref)) if ($action == 'deleteline') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1); } print '
'; diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 96ce4976665..6d30e8e760c 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -333,24 +333,19 @@ abstract class ActionsCardCommon // Define output language $outputlangs = $langs; $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id') ) $newlang=GETPOST('lang_id'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$this->object->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=thirdparty_doc_create($this->db, $this->object->id, '', GETPOST('model'), $outputlangs); + $result=thirdparty_doc_create($this->db, $this->object->id, '', GETPOST('model','alpha'), $outputlangs); if ($result <= 0) { dol_print_error($this->db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?socid='.$this->object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } } } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index f9703044257..4a14c58dd9b 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -177,8 +177,7 @@ if ($object->id) */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1); } $formfile=new FormFile($db); diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index a0ab078e315..04210617d3d 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -130,10 +130,8 @@ $result=$object->fetch($socid); if ($result > 0) { - $form = new Form($db); $langs->load("other"); - $head = societe_prepare_head($object); dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 6ad999ebe10..8682058091d 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -475,17 +475,12 @@ if (empty($reshook)) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result=thirdparty_doc_create($db, $object, '', $_REQUEST['model'], $outputlangs); + $result=thirdparty_doc_create($db, $object, '', GETPOST('model','alpha'), $outputlangs); if ($result <= 0) { dol_print_error($db,$result); exit; } - else - { - header('Location: '.$_SERVER["PHP_SELF"].'?socid='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); - exit; - } } } @@ -871,7 +866,6 @@ else if ($j % 2 == 1) print ''; // Assujeti TVA - $form = new Form($db); print ''; print ''; // VAT payers - $form = new Form($db); print '
'.$langs->trans('VATIsUsed').''; print $form->selectyesno('assujtva_value',1,1); // Assujeti par defaut en creation @@ -1440,9 +1434,7 @@ else // Confirm delete third party if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) { - $form = new Form($db); - $ret=$form->form_confirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id,$langs->trans("DeleteACompany"),$langs->trans("ConfirmDeleteCompany"),"confirm_delete",'',0,"action-delete"); } dol_htmloutput_errors($error,$errors); @@ -1595,7 +1587,6 @@ else if ($j % 2 == 1) print '
'; print $langs->trans('VATIsUsed'); print ''; diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 7f3bd603444..a66d6108d5f 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -82,7 +82,6 @@ $langs->load("users"); $langs->load("companies"); $langs->load("ldap"); -$form = new Form($db); $object = new User($db); $extrafields = new ExtraFields($db); @@ -566,10 +565,10 @@ if ($action == 'adduserldap') * View */ -llxHeader('',$langs->trans("UserCard")); - $form = new Form($db); +llxHeader('',$langs->trans("UserCard")); + if (($action == 'create') || ($action == 'adduserldap')) { /* ************************************************************************** */ @@ -997,8 +996,7 @@ else */ if ($action == 'password') { - $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$object->login),"confirm_password", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("ReinitPassword"),$langs->trans("ConfirmReinitPassword",$object->login),"confirm_password", '', 0, 1); } /* @@ -1006,8 +1004,7 @@ else */ if ($action == 'passwordsend') { - $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$object->login),"confirm_passwordsend", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("SendNewPassword"),$langs->trans("ConfirmSendNewPassword",$object->login),"confirm_passwordsend", '', 0, 1); } /* @@ -1015,8 +1012,7 @@ else */ if ($action == 'disable') { - $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$object->login),"confirm_disable", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DisableAUser"),$langs->trans("ConfirmDisableUser",$object->login),"confirm_disable", '', 0, 1); } /* @@ -1024,8 +1020,7 @@ else */ if ($action == 'enable') { - $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$object->login),"confirm_enable", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("EnableAUser"),$langs->trans("ConfirmEnableUser",$object->login),"confirm_enable", '', 0, 1); } /* @@ -1033,8 +1028,7 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); - if ($ret == 'html') print '
'; + print $form->formconfirm("fiche.php?id=$object->id",$langs->trans("DeleteAUser"),$langs->trans("ConfirmDeleteUser",$object->login),"confirm_delete", '', 0, 1); } dol_htmloutput_mesg($message); @@ -1409,7 +1403,6 @@ else if ($caneditgroup) { - $form = new Form($db); print '
'."\n"; print ''; print ''; diff --git a/htdocs/user/group/fiche.php b/htdocs/user/group/fiche.php index 65e67b01af0..f7c0cba4a6a 100644 --- a/htdocs/user/group/fiche.php +++ b/htdocs/user/group/fiche.php @@ -278,8 +278,7 @@ else */ if ($action == 'delete') { - $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1); - if ($ret == 'html') print '
'; + print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$object->name),"confirm_delete", '',0,1); } /*