From d1860b87f82276e61cbeb21894cc4efb434d30e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Nov 2017 16:03:22 +0100 Subject: [PATCH] NEW Add a confirmation for all mass action 'delete' --- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/list.php | 3 +- htdocs/adherents/subscription/list.php | 3 +- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/comm/propal/list.php | 16 +- htdocs/commande/list.php | 16 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/list.php | 2 +- htdocs/compta/facture/list.php | 16 +- htdocs/contact/list.php | 10 +- htdocs/contrat/list.php | 16 +- htdocs/contrat/services_list.php | 2 +- htdocs/core/actions_massactions.inc.php | 4 +- htdocs/core/class/html.form.class.php | 10 +- htdocs/core/tpl/massactions_form.tpl.php | 151 ----------------- htdocs/core/tpl/massactions_pre.tpl.php | 160 ++++++++++++++++++ htdocs/expensereport/list.php | 16 +- htdocs/fichinter/list.php | 3 +- htdocs/fourn/commande/list.php | 16 +- htdocs/fourn/facture/list.php | 16 +- htdocs/fourn/product/list.php | 2 +- htdocs/holiday/list.php | 2 +- htdocs/langs/en_US/main.lang | 2 + .../modulebuilder/template/myobject_list.php | 9 +- htdocs/product/inventory/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/projet/tasks/time.php | 3 +- htdocs/societe/list.php | 18 +- htdocs/societe/website.php | 2 +- htdocs/supplier_proposal/list.php | 16 +- htdocs/variants/combinations.php | 2 +- 37 files changed, 262 insertions(+), 276 deletions(-) delete mode 100644 htdocs/core/tpl/massactions_form.tpl.php create mode 100644 htdocs/core/tpl/massactions_pre.tpl.php diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d20a008d4fd..880661edbf5 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -303,7 +303,7 @@ if ($result) { //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); print '
' . "\n"; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index b7fe591708e..35460f6d48f 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -267,7 +267,7 @@ if ($result) { //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 1750b90acd7..f63e0a03d4e 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -299,7 +299,7 @@ if ($result) { //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('ventil', $arrayofmassactions, 1); print '' . "\n"; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index a41d310abfe..dbded5d9a5b 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -355,9 +355,8 @@ $arrayofmassactions = array( // 'presend'=>$langs->trans("SendByMail"), // 'builddoc'=>$langs->trans("PDFMerge"), ); -//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); +//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 398039b228e..7dfad296beb 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -177,9 +177,8 @@ if ($result) //'presend'=>$langs->trans("SendByMail"), //'builddoc'=>$langs->trans("PDFMerge"), ); - //if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index e695ca122b4..5c78155f0f9 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -318,7 +318,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->monmodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index a7fe6b05201..220f50b5838 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -401,7 +401,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->propal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre @@ -417,15 +417,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendSupplierProposalRef"; - $modelmail="supplier_proposal_send"; - $objecttmp=new Propal($db); - $trackid='ord'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendSupplierProposalRef"; + $modelmail="supplier_proposal_send"; + $objecttmp=new Propal($db); + $trackid='ord'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e007953bfe3..ab151be45f3 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -652,7 +652,7 @@ if ($resql) ); if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lines of title fields @@ -669,15 +669,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendOrderRef"; - $modelmail="order_send"; - $objecttmp=new Commande($db); - $trackid='ord'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendOrderRef"; + $modelmail="order_send"; + $objecttmp=new Commande($db); + $trackid='ord'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 5e79874ae8f..001a6a23d9f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -574,7 +574,7 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->bank->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Confirmation delete diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 23df6a44285..a6dd7c75c7e 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -239,7 +239,7 @@ $arrayofmassactions = array( // 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->banque->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $newcardbutton=''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 1f45a7cec3e..8828b78bad2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -595,7 +595,7 @@ if ($resql) $arrayofmassactions['delete']=$langs->trans("Delete"); } } - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $i = 0; @@ -613,15 +613,11 @@ if ($resql) print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendBillRef"; - $modelmail="facture_send"; - $objecttmp=new Facture($db); - $trackid='inv'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendBillRef"; + $modelmail="facture_send"; + $objecttmp=new Facture($db); + $trackid='inv'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a97e6687126..ebbd0f7494b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -420,8 +420,8 @@ $arrayofmassactions = array( // 'builddoc'=>$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -435,6 +435,12 @@ print ''; print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit); +$topicmail="Information"; +$modelmail="contact"; +$objecttmp=new Contact($db); +$trackid='ctc'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 06e5a628b86..4edc6503a5b 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -366,7 +366,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -380,15 +380,11 @@ if ($resql) print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendContractRef"; - $modelmail="contract"; - $objecttmp=new Contrat($db); - $trackid='con'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendContractRef"; + $modelmail="contract"; + $objecttmp=new Contrat($db); + $trackid='con'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index c25311b84da..8bfdd27b9f1 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -324,7 +324,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->contrat->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -//if ($massaction == 'presend') $arrayofmassactions=array(); +//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index e6e9bbea604..b287b8d9737 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -726,8 +726,8 @@ if (! $error && $massaction == 'validate' && $permtocreate) } } -// Delete records -if (! $error && $massaction == 'delete' && $permtodelete) +// Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before) +if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete) { $db->begin(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2a8aa87686f..b30309cdba6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3552,9 +3552,10 @@ class Form * @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. + * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a section. * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ - function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=200, $width=500) + function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=200, $width=500, $disableformtag=0) { global $langs,$conf; global $useglobalvars; @@ -3783,9 +3784,10 @@ class Form { $formconfirm.= "\n\n"; - $formconfirm.= ''."\n"; + if (empty($disableformtag)) $formconfirm.= ''."\n"; + $formconfirm.= ''."\n"; - $formconfirm.= ''."\n"; + if (empty($disableformtag)) $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; @@ -3811,7 +3813,7 @@ class Form $formconfirm.= '
'."\n"; - $formconfirm.= "
\n"; + if (empty($disableformtag)) $formconfirm.= "\n"; $formconfirm.= '
'; $formconfirm.= "\n"; diff --git a/htdocs/core/tpl/massactions_form.tpl.php b/htdocs/core/tpl/massactions_form.tpl.php deleted file mode 100644 index 4087d988c3b..00000000000 --- a/htdocs/core/tpl/massactions_form.tpl.php +++ /dev/null @@ -1,151 +0,0 @@ - - * Copyright (C) 2013-2014 Laurent Destailleur - * Copyright (C) 2015 Marcos García - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ - */ - -// Following var must be set: -// $arrayofselected = array of id selected -// $object -// $objecttmp=new Propal($db); -// $topicmail="SendSupplierProposalRef"; -// $modelmail="supplier_proposal_send"; -// $trackid='ord'.$object->id; - -$langs->load("mails"); - -if (! GETPOST('cancel', 'alpha')) -{ - $listofselectedid = array(); - $listofselectedthirdparties = array(); - $listofselectedref = array(); - foreach ($arrayofselected as $toselectid) - { - $result = $objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofselectedid[$toselectid] = $toselectid; - $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); - if ($objecttmp->element == 'societe') - $thirdpartyid = $objecttmp->id; - if ($objecttmp->element == 'expensereport') - $thirdpartyid = $objecttmp->fk_user_author; - $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; - $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; - } - } -} - -print ''; - -include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; -$formmail = new FormMail($db); - -dol_fiche_head(null, '', ''); - -// Cree l'objet formulaire mail -include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; -$formmail = new FormMail($db); -$formmail->withform = -1; -$formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); - -if ($formmail->fromtype === 'user') -{ - $formmail->fromid = $user->id; -} -$formmail->trackid = $trackid; -if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set -{ - include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; - $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); -} -$formmail->withfrom = 1; -$liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); -if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts -{ - $liste = array(); - $thirdpartyid = array_shift($listofselectedthirdparties); - if ($objecttmp->element == 'expensereport') - { - $fuser = new User($db); - $fuser->fetch($thirdpartyid); - $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; - } - else - { - $soc = new Societe($db); - $soc->fetch($thirdpartyid); - foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { - $liste[$key] = $value; - } - } - $formmail->withtoreadonly = 0; -} else { - $formmail->withtoreadonly = 1; -} - -$formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); -$formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; -$formmail->withtofree = empty($liste)?1:0; -$formmail->withtocc = 1; -$formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; -$formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); -$formmail->withfile = 1; -// $formmail->withfile = 2; Not yet supported in mass action -$formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" -if ($objecttmp->element != 'societe') { - $formmail->withfile = $langs->trans("OnlyPDFattachmentSupported"); - $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default -} -$formmail->withbody = 1; -$formmail->withdeliveryreceipt = 1; -$formmail->withcancel = 1; - -// Make substitution in email content -$substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); -$substitutionarray['__EMAIL__'] = $sendto; -$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; -$substitutionarray['__PERSONALIZED__'] = ''; // deprecated -$substitutionarray['__CONTACTCIVNAME__'] = ''; - -$parameters = array( - 'mode' => 'formemail' -); -complete_substitutions_array($substitutionarray, $langs, $object, $parameters); - -// Tableau des substitutions -$formmail->substit = $substitutionarray; - -// Tableau des parametres complementaires du post -$formmail->param['action'] = $action; -$formmail->param['models'] = $modelmail; -$formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); -$formmail->param['id'] = join(',', $arrayofselected); -// $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; -if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) -{ - $langs->load("errors"); - print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); - print ' - ' . $langs->trans("GoBack") . ''; - $arrayofmassactions = array(); -} -else -{ - print $formmail->get_form(); -} - -dol_fiche_end(); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php new file mode 100644 index 00000000000..2095399dace --- /dev/null +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -0,0 +1,160 @@ + + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +// Following var must be set: +// $arrayofselected = array of id selected +// $object +// $objecttmp=new Propal($db); +// $topicmail="SendSupplierProposalRef"; +// $modelmail="supplier_proposal_send"; +// $trackid='ord'.$object->id; + + +if ($massaction == 'predelete') +{ + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1); +} + +if ($massaction == 'presend') +{ + $langs->load("mails"); + + if (! GETPOST('cancel', 'alpha')) + { + $listofselectedid = array(); + $listofselectedthirdparties = array(); + $listofselectedref = array(); + foreach ($arrayofselected as $toselectid) + { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofselectedid[$toselectid] = $toselectid; + $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); + if ($objecttmp->element == 'societe') + $thirdpartyid = $objecttmp->id; + if ($objecttmp->element == 'expensereport') + $thirdpartyid = $objecttmp->fk_user_author; + $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid; + $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref; + } + } + } + + print ''; + + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + + dol_fiche_head(null, '', ''); + + // Cree l'objet formulaire mail + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + $formmail->withform = -1; + $formmail->fromtype = (GETPOST('fromtype') ? GETPOST('fromtype') : (! empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE : 'user')); + + if ($formmail->fromtype === 'user') + { + $formmail->fromid = $user->id; + } + $formmail->trackid = $trackid; + if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set + { + include DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; + $formmail->frommail = dolAddEmailTrackId($formmail->frommail, $trackid); + } + $formmail->withfrom = 1; + $liste = $langs->trans("AllRecipientSelected", count($arrayofselected)); + if (count($listofselectedthirdparties) == 1) // Only 1 different recipient selected, we can suggest contacts + { + $liste = array(); + $thirdpartyid = array_shift($listofselectedthirdparties); + if ($objecttmp->element == 'expensereport') + { + $fuser = new User($db); + $fuser->fetch($thirdpartyid); + $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; + } + else + { + $soc = new Societe($db); + $soc->fetch($thirdpartyid); + foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { + $liste[$key] = $value; + } + } + $formmail->withtoreadonly = 0; + } else { + $formmail->withtoreadonly = 1; + } + + $formmail->withoptiononeemailperrecipient = empty($liste)?0:((GETPOST('oneemailperrecipient')=='on')?1:-1); + $formmail->withto = empty($liste)?(GETPOST('sendto','alpha')?GETPOST('sendto','alpha'):array()):$liste; + $formmail->withtofree = empty($liste)?1:0; + $formmail->withtocc = 1; + $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; + $formmail->withtopic = $langs->transnoentities($topicmail, '__REF__', '__REFCLIENT__'); + $formmail->withfile = 1; + // $formmail->withfile = 2; Not yet supported in mass action + $formmail->withmaindocfile = 1; // Add a checkbox "Attach also main document" + if ($objecttmp->element != 'societe') { + $formmail->withfile = $langs->trans("OnlyPDFattachmentSupported"); + $formmail->withmaindocfile = - 1; // Add a checkbox "Attach also main document" but not checked by default + } + $formmail->withbody = 1; + $formmail->withdeliveryreceipt = 1; + $formmail->withcancel = 1; + + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object); + $substitutionarray['__EMAIL__'] = $sendto; + $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '' : ''; + $substitutionarray['__PERSONALIZED__'] = ''; // deprecated + $substitutionarray['__CONTACTCIVNAME__'] = ''; + + $parameters = array( + 'mode' => 'formemail' + ); + complete_substitutions_array($substitutionarray, $langs, $object, $parameters); + + // Tableau des substitutions + $formmail->substit = $substitutionarray; + + // Tableau des parametres complementaires du post + $formmail->param['action'] = $action; + $formmail->param['models'] = $modelmail; + $formmail->param['models_id'] = GETPOST('modelmailselected', 'int'); + $formmail->param['id'] = join(',', $arrayofselected); + // $formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id; + if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB) + { + $langs->load("errors"); + print img_warning() . ' ' . $langs->trans('WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB); + print ' - ' . $langs->trans("GoBack") . ''; + $arrayofmassactions = array(); + } + else + { + print $formmail->get_form(); + } + + dol_fiche_end(); +} diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 30d5eea98d6..58ed3f50216 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -380,7 +380,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->expensereport->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lines of title fields @@ -486,15 +486,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); } - if ($massaction == 'presend') - { - $topicmail="SendExpenseReport"; - $modelmail="expensereport"; - $objecttmp=new ExpenseReport($db); - $trackid='int'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendExpenseReport"; + $modelmail="expensereport"; + $objecttmp=new ExpenseReport($db); + $trackid='int'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3b4aca20951..8f9d2fcf4bb 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -285,9 +285,8 @@ if ($resql) //'presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"), ); - //if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->ficheinter->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + //if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lines of title fields diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 5194d6296bb..9d20023abd8 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -661,7 +661,7 @@ if ($resql) ); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre @@ -678,15 +678,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendOrderRef"; - $modelmail="order_supplier_send"; - $objecttmp=new CommandeFournisseur($db); - $trackid='sord'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendOrderRef"; + $modelmail="order_supplier_send"; + $objecttmp=new CommandeFournisseur($db); + $trackid='sord'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 508a9e28117..0cf949d38de 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -472,7 +472,7 @@ if ($resql) ); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete','createbills'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $i = 0; @@ -489,15 +489,11 @@ if ($resql) print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendBillRef"; - $modelmail="supplier_invoice_send"; - $objecttmp=new FactureFournisseur($db); - $trackid='sinv'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendBillRef"; + $modelmail="supplier_invoice_send"; + $objecttmp=new FactureFournisseur($db); + $trackid='sinv'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index c6a8f24f98f..c5b39a87681 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -119,7 +119,7 @@ $arrayofmassactions = array( 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index efe1c87820e..1d89bbbdd94 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -299,7 +299,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->holiday->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -//if ($massaction == 'presend') $arrayofmassactions=array(); +//if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print '
'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 518b3ea6e04..43b8e3a6cbb 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -788,6 +788,8 @@ TooManyRecordForMassAction=Too many record selected for mass action. The action NoRecordSelected=No record selected MassFilesArea=Area for files built by mass actions ShowTempMassFilesArea=Show area of files built by mass actions +ConfirmMassDeletion=Bulk delete confirmation +ConfirmMassDeletionQuestion=Are you sure you want to delete the %s selected record ? RelatedObjects=Related Objects ClassifyBilled=Classify billed Progress=Progress diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 5716f88b4b1..70e40a4b3fb 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -329,7 +329,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -344,6 +344,13 @@ print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); +// Add code for pre mass action (confirmation or email presend form) +$topicmail="SendMyObjectRef"; +$modelmail="myobject"; +$objecttmp=new MyObject($db); +$trackid='xxx'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 39be799db47..5f99e2f365f 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -282,7 +282,7 @@ $arrayofmassactions = array( 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->inventory->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 31cf38cfe9a..a26af04fae5 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -426,7 +426,7 @@ else //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->produit->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 4b878c03260..a3fe120ceeb 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -689,7 +689,7 @@ if ($resql) // 'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 920bbac8a9b..cf0f1171a63 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -300,7 +300,7 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 08c22f30a37..d9f2a1e2e81 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -407,7 +407,7 @@ $arrayofmassactions = array( ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index d44dc3ec4b8..3342074882c 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -405,7 +405,7 @@ $arrayofmassactions = array( ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 215a7ace2d0..132c33bcf9c 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -700,11 +700,10 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) //'builddoc'=>$langs->trans("PDFMerge"), ); //if ($user->rights->projet->creer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - print ''; if ($optioncss != '') print ''; print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 23b40e48c2d..d7fe420674d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -578,8 +578,8 @@ $arrayofmassactions = array( // 'builddoc'=>$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; @@ -605,15 +605,11 @@ foreach(array(1,2,3,4,5,6) as $key) } } -if ($massaction == 'presend') -{ - $topicmail="Information"; - $modelmail="thirdparty"; - $objecttmp=new Societe($db); - $trackid='thi'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; -} +$topicmail="Information"; +$modelmail="thirdparty"; +$objecttmp=new Societe($db); +$trackid='thi'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index c268f56922c..8c2f6c9a58f 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -328,7 +328,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->delete) $arrayofmassactions['delete']=$langs->trans("Delete"); -if ($massaction == 'presend') $arrayofmassactions=array(); +if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index d3ce6ce6a27..449a5bbab60 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -401,7 +401,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->supplier_proposal->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); // Lignes des champs de filtre @@ -416,15 +416,11 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); - if ($massaction == 'presend') - { - $topicmail="SendSupplierProposalRef"; - $modelmail="supplier_proposal_send"; - $objecttmp=new SupplierProposal($db); - $trackid='spro'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_form.tpl.php'; - } + $topicmail="SendSupplierProposalRef"; + $modelmail="supplier_proposal_send"; + $objecttmp=new SupplierProposal($db); + $trackid='spro'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index f5feba2e606..2a704ae35a3 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -600,7 +600,7 @@ if (! empty($id) || ! empty($ref)) 'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->product->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); - if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); */