30 if ($massaction ==
'predeletedraft')
32 print $form->formconfirm(
$_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete", null,
'', 0, 200, 500, 1);
35 if ($massaction ==
'predelete')
37 print $form->formconfirm(
$_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete", null,
'', 0, 200, 500, 1);
40 if ($massaction ==
'presend')
42 $langs->load(
"mails");
44 $listofselectedid = array();
45 $listofselectedthirdparties = array();
46 $listofselectedref = array();
48 if (!
GETPOST(
'cancel',
'alpha'))
50 foreach ($arrayofselected as $toselectid)
52 $result = $objecttmp->fetch($toselectid);
55 $listofselectedid[$toselectid] = $toselectid;
56 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
57 if ($objecttmp->element ==
'societe')
58 $thirdpartyid = $objecttmp->id;
59 if ($objecttmp->element ==
'expensereport')
60 $thirdpartyid = $objecttmp->fk_user_author;
61 $listofselectedthirdparties[$thirdpartyid] = $thirdpartyid;
62 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
67 print '<input type="hidden" name="massaction" value="confirm_presend">';
69 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
75 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
77 $formmail->withform = -1;
78 $formmail->fromtype = (
GETPOST(
'fromtype') ?
GETPOST(
'fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE :
'user'));
80 if ($formmail->fromtype ===
'user')
82 $formmail->fromid = $user->id;
84 $formmail->trackid = $trackid;
85 if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2))
87 include DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
90 $formmail->withfrom = 1;
91 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
92 if (count($listofselectedthirdparties) == 1)
95 $thirdpartyid = array_shift($listofselectedthirdparties);
96 if ($objecttmp->element ==
'expensereport')
98 $fuser =
new User($db);
99 $fuser->fetch($thirdpartyid);
100 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
103 $soc->fetch($thirdpartyid);
104 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
105 $liste[$key] = $value;
108 $formmail->withtoreadonly = 0;
110 $formmail->withtoreadonly = 1;
113 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : ((
GETPOST(
'oneemailperrecipient') ==
'on') ? 1 : -1);
115 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
116 $formmail->withtofree = empty($liste) ? 1 : 0;
117 $formmail->withtocc = 1;
118 $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
119 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REFCLIENT__');
120 $formmail->withfile = 1;
122 $formmail->withmaindocfile = 1;
123 if ($objecttmp->element !=
'societe') {
124 $formmail->withfile =
'<span class="hideonsmartphone">'.$langs->trans(
"OnlyPDFattachmentSupported").
'</span>';
125 $formmail->withmaindocfile = - 1;
127 $formmail->withbody = 1;
128 $formmail->withdeliveryreceipt = 1;
129 $formmail->withcancel = 1;
134 $substitutionarray[
'__EMAIL__'] = $sendto;
135 $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"/>' :
'';
136 $substitutionarray[
'__PERSONALIZED__'] =
'';
137 $substitutionarray[
'__CONTACTCIVNAME__'] =
'';
140 'mode' =>
'formemail'
145 $formmail->substit = $substitutionarray;
148 $formmail->param[
'action'] = $action;
149 $formmail->param[
'models'] = $modelmail;
150 $formmail->param[
'models_id'] =
GETPOST(
'modelmailselected',
'int');
151 $formmail->param[
'id'] = join(
',', $arrayofselected);
153 if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedthirdparties) > $conf->global->MAILING_LIMIT_SENDBYWEB)
155 $langs->load(
"errors");
156 print img_warning().
' '.$langs->trans(
'WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
157 print ' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
158 $arrayofmassactions = array();
160 print $formmail->get_form();
167 'toselect' => $toselect,
168 'uploaddir' => $uploaddir
171 $reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters, $object, $action);
175 print $hookmanager->resPrint;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
dolAddEmailTrackId($email, $trackingid)
Return an email formatted to include a tracking id For example myemail@example.com becom myemail+trac...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage third parties objects (customers, suppliers, prospects...)
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...