NEW Add a confirmation for all mass action 'delete'

This commit is contained in:
Laurent Destailleur 2017-11-11 16:03:22 +01:00
parent 01a41237bf
commit d1860b87f8
37 changed files with 262 additions and 276 deletions

View File

@ -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 '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";

View File

@ -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);

View File

@ -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 '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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)
{

View File

@ -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')
{

View File

@ -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

View File

@ -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='';

View File

@ -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)
{

View File

@ -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 '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
@ -435,6 +435,12 @@ print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
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);

View File

@ -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 '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
@ -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)
{

View File

@ -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 '<form method="POST" action="'. $_SERVER["PHP_SELF"] .'">';

View File

@ -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();

View File

@ -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 <form> 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<!-- begin form_confirm page=".$page." -->\n";
$formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
if (empty($disableformtag)) $formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">'."\n";
$formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
if (empty($disableformtag)) $formconfirm.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
$formconfirm.= '<table width="100%" class="valid">'."\n";
@ -3811,7 +3813,7 @@ class Form
$formconfirm.= '</table>'."\n";
$formconfirm.= "</form>\n";
if (empty($disableformtag)) $formconfirm.= "</form>\n";
$formconfirm.= '<br>';
$formconfirm.= "<!-- end form_confirm -->\n";

View File

@ -1,151 +0,0 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* 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 '<input type="hidden" name="massaction" value="confirm_presend">';
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)." &lt;".$fuser->email."&gt;";
}
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)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
$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 ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
$arrayofmassactions = array();
}
else
{
print $formmail->get_form();
}
dol_fiche_end();

View File

@ -0,0 +1,160 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* 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 '<input type="hidden" name="massaction" value="confirm_presend">';
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)." &lt;".$fuser->email."&gt;";
}
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)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
$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 ' - <a href="javascript: window.history.go(-1)">' . $langs->trans("GoBack") . '</a>';
$arrayofmassactions = array();
}
else
{
print $formmail->get_form();
}
dol_fiche_end();
}

View File

@ -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)
{

View File

@ -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

View File

@ -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')
{

View File

@ -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')
{

View File

@ -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);

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -344,6 +344,13 @@ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
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);

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';

View File

@ -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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$id.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -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 '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
@ -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)
{

View File

@ -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 '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -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)
{

View File

@ -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);
*/