33if (!empty($sall) || !empty($search_all)) {
34 $search_all = empty($sall) ? $search_all : $sall;
36 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
39if ($massaction ==
'predeletedraft') {
40 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
43if ($massaction ==
'predelete') {
44 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
47if ($massaction ==
'preclonetasks') {
49 foreach (
GETPOST(
'toselect') as $tmpselected) {
50 $selected .=
'&selected[]=' . $tmpselected;
53 $formquestion = array(
54 array(
'type' =>
'other',
'name' =>
'projectid',
'label' => $langs->trans(
'Project') .
': ',
'value' => $form->selectProjects(
'',
'projectid',
'',
'',
'',
'',
'',
'',
'', 1, 1)),
56 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
59if ($massaction ==
'preaffecttag' && isModEnabled(
'category')) {
60 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
62 $categ_types = array();
63 $categ_type_array = $categ->getMapList();
64 foreach ($categ_type_array as $categdef) {
66 if (isset($object) && $categdef[
'obj_table'] == $object->table_element) {
67 if (!array_key_exists($categdef[
'code'], $categ_types)) {
68 $categ_types[$categdef[
'code']] = array(
'code'=>$categdef[
'code'],
'label'=>$langs->trans($categdef[
'obj_class']));
71 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
72 if (!array_key_exists($categdef[
'code'], $categ_types)) {
73 $categ_types[$categdef[
'code']] = array(
'code'=>$categdef[
'code'],
'label'=>$langs->trans($categdef[
'obj_class']));
78 $formquestion = array();
79 if (!empty($categ_types)) {
80 foreach ($categ_types as $categ_type) {
81 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
82 $formquestion[] = array(
84 'name' =>
'affecttag_'.$categ_type[
'code'],
86 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'),
null,
null,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
89 $formquestion[] = array(
91 'name' =>
'affecttag_type',
93 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
95 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
101if ($massaction ==
'preupdateprice') {
102 $formquestion = array();
104 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
105 $valuefield .=
'<input type="number" name="pricerate" id="pricerate" min="-100" value="0" style="width: 100px; text-align: right; margin-right: 10px" />%';
106 $valuefield .=
'</div>';
108 $formquestion[] = array(
110 'name' =>
'pricerate',
111 'label' => $langs->trans(
"Rate"),
112 'value' => $valuefield
115 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect)),
"updateprice", $formquestion, 1, 0, 200, 500, 1);
118if ($massaction ==
'presetsupervisor') {
119 $formquestion = array();
121 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
122 $valuefield .=
img_picto(
'',
'user').
' ';
123 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
124 $valuefield .=
'</div>';
126 $formquestion[] = array(
128 'name' =>
'supervisortoset',
129 'label' => $langs->trans(
"Supervisor"),
130 'value' => $valuefield
133 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
136if ($massaction ==
'preaffectuser') {
137 $formquestion = array();
139 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
140 $valuefielduser .=
img_picto(
'',
'user').
' ';
141 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
142 $valuefielduser .=
'</div>';
144 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
145 $valuefieldprojrole .= $formcompany->selectTypeContact($object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
146 $valuefieldprojrole .=
'</div>';
148 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
149 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
150 $valuefieldtasksrole .=
'</div>';
152 $formquestion[] = array(
154 'name' =>
'usertoaffect',
155 'label' => $langs->trans(
"User"),
156 'value' => $valuefielduser
158 $formquestion[] = array(
160 'name' =>
'projectrole',
161 'label' => $langs->trans(
"ProjectRole"),
162 'value' => $valuefieldprojrole
165 $formquestion[] = array(
167 'name' =>
'tasksrole',
168 'label' => $langs->trans(
"TasksRole"),
169 'value' => $valuefieldtasksrole
172 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
175if ($massaction ==
'presend') {
176 $langs->load(
"mails");
178 $listofselectedid = array();
179 $listofselectedrecipientobjid = array();
180 $listofselectedref = array();
182 if (!
GETPOST(
'cancel',
'alpha')) {
183 foreach ($arrayofselected as $toselectid) {
184 $result = $objecttmp->fetch($toselectid);
186 $listofselectedid[$toselectid] = $toselectid;
187 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
188 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
189 $thirdpartyid = $objecttmp->id;
190 } elseif ($objecttmp->element ==
'contact') {
191 $thirdpartyid = $objecttmp->id;
192 } elseif ($objecttmp->element ==
'expensereport') {
193 $thirdpartyid = $objecttmp->fk_user_author;
195 if (empty($thirdpartyid)) {
199 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
201 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
206 print
'<input type="hidden" name="massaction" value="confirm_presend">';
211 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
213 $formmail->withform = -1;
214 $formmail->fromtype = (
GETPOST(
'fromtype') ?
GETPOST(
'fromtype') : (
getDolGlobalString(
'MAIN_MAIL_DEFAULT_FROMTYPE') ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE :
'user'));
216 if ($formmail->fromtype ===
'user') {
217 $formmail->fromid = $user->id;
219 $formmail->trackid = $trackid;
220 $formmail->withfrom = 1;
221 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
222 if (count($listofselectedrecipientobjid) == 1) {
224 $thirdpartyid = array_shift($listofselectedrecipientobjid);
225 if ($objecttmp->element ==
'expensereport') {
226 $fuser =
new User($db);
227 $fuser->fetch($thirdpartyid);
228 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
229 } elseif ($objecttmp->element ==
'contact') {
231 $fcontact->fetch($thirdpartyid);
232 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
233 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
235 $fadherent->fetch($objecttmp->fk_member);
236 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
239 $soc->fetch($thirdpartyid);
240 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
241 $liste[$key] = $value;
244 $formmail->withtoreadonly = 0;
246 $formmail->withtoreadonly = 1;
250 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOST(
'oneemailperrecipient',
'int') ? 1 : -1);
251 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
252 $formmail->withoptiononeemailperrecipient = 0;
255 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
256 $formmail->withtofree = empty($liste) ? 1 : 0;
257 $formmail->withtocc = 1;
258 $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
259 if (!empty($topicmail)) {
260 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
262 $formmail->withtopic = 1;
264 if ($objecttmp->element ==
'contact') {
265 $formmail->withfile = 0;
266 $formmail->withmaindocfile = 0;
268 $formmail->withfile = 1;
270 if (isset($withmaindocfilemail)) {
271 $formmail->withmaindocfile = $withmaindocfilemail;
273 $formmail->withmaindocfile = 1;
274 if ($objecttmp->element !=
'societe') {
275 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
276 $formmail->withmaindocfile = -1;
281 $formmail->withbody = 1;
282 $formmail->withdeliveryreceipt = 1;
283 $formmail->withcancel = 1;
288 $substitutionarray[
'__EMAIL__'] = $sendto;
289 $substitutionarray[
'__CHECK_READ__'] =
'<img src="'.DOL_MAIN_URL_ROOT.
'/public/emailing/mailing-read.php?tag=undefined&securitykey='.
dol_hash(
getDolGlobalString(
'MAILING_EMAIL_UNSUBSCRIBE_KEY').
"-undefined",
'md5').
'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
290 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
291 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
292 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
293 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
296 'mode' =>
'formemail'
301 $formmail->substit = $substitutionarray;
304 $formmail->param[
'action'] = $action;
305 $formmail->param[
'models'] = $modelmail;
306 $formmail->param[
'models_id'] =
GETPOST(
'modelmailselected',
'int') ?
GETPOST(
'modelmailselected',
'int') :
'-1';
307 $formmail->param[
'id'] = join(
',', $arrayofselected);
309 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) > $conf->global->MAILING_LIMIT_SENDBYWEB) {
311 $langs->load(
"errors");
312 print
img_warning().
' '.$langs->trans(
'WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
313 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
314 $arrayofmassactions = array();
316 print $formmail->get_form();
322if ($massaction ==
'edit_extrafields') {
323 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
324 $elementtype = $objecttmp->element;
328 $extrafields->fetch_name_optionals_label($elementtype);
329 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
331 $formquestion = array();
332 if (!empty($extrafields_list)) {
333 $myParamExtra = $object->showOptionals($extrafields,
'create');
335 foreach ($extrafields_list as $extraKey => $extraLabel) {
336 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
339 $formquestion[] = array(
341 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
345 $outputShowOutputFields =
'<div class="extrafields-inputs">';
347 foreach ($extrafields_list as $extraKey => $extraLabel) {
348 $outputShowOutputFields.=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
349 $outputShowOutputFields.=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
350 $outputShowOutputFields.= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'', 0, $objecttmp->id, $objecttmp->table_element);
351 $outputShowOutputFields.=
'</div>';
353 $outputShowOutputFields.=
'<script>
355 $("#extrafield-key-to-update").on(\'change\',function(){
356 let selectedExtrtafield = $(this).val();
357 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
358 $(".mass-action-extrafield").hide();
359 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
364 $outputShowOutputFields.=
'</div>';
368 $formquestion[] = array(
370 'value' => $outputShowOutputFields
373 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
379if ($massaction ==
'preenable') {
380 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
382if ($massaction ==
'predisable') {
383 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
385if ($massaction ==
'presetcommercial') {
386 $formquestion = array();
387 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
388 $formquestion[] = array(
'type' =>
'other',
389 'name' =>
'affectedcommercial',
390 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0),
391 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
392 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"affectcommercial", $formquestion, 1, 0, 200, 500, 1);
394if ($massaction ==
'preapproveleave') {
395 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
400 'toselect' => isset($toselect) ? $toselect : array(),
401 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
402 'massaction' => $massaction
405$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters, $object, $action);
409 print $hookmanager->resPrint;
Class to manage members of a foundation.
Class to manage categories.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.