61@phan-var-force string $string
62@phan-var-force CommonObject $objecttmp
63@phan-var-force CommonObject $object
64@phan-var-force int[] $toselect
65@phan-var-force ?string $uploaddir
66@phan-var-force int<0,1> $withmaindocfilemail
67@phan-var-force string $sendto
70if (!empty($sall) || !empty($search_all)) {
71 $search_all = empty($sall) ? $search_all : $sall;
73 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
76if ($massaction ==
'predeletedraft') {
77 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
80if ($massaction ==
'predelete') {
81 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
84if ($massaction ==
'preclonetasks') {
86 foreach (
GETPOST(
'toselect') as $tmpselected) {
87 $selected .=
'&selected[]=' . $tmpselected;
89 $formquestion = array(
92 array(
'type' =>
'other',
'name' =>
'projectid',
'label' => $langs->trans(
'Project') .
': ',
'value' => $form->selectProjects((
string)
$object->id,
'projectid',
'', 0, 1,
'', 0, array(),
$object->socid,
'1', 1,
'', array(), 1)),
94 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
97if ($massaction ==
'preaffecttag' &&
isModEnabled(
'category')) {
98 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
100 $categ_types = array();
101 $categ_type_array = $categ->getMapList();
102 foreach ($categ_type_array as $categdef) {
104 if (isset(
$object) && $categdef[
'obj_table'] ==
$object->table_element) {
105 if (!array_key_exists($categdef[
'code'], $categ_types)) {
106 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
109 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
110 if (!array_key_exists($categdef[
'code'], $categ_types)) {
111 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
116 $formquestion = array();
117 if (!empty($categ_types)) {
118 foreach ($categ_types as $categ_type) {
119 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
120 $formquestion[] = array(
122 'name' =>
'affecttag_'.$categ_type[
'code'],
124 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'), 0, 0,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
127 $formquestion[] = array(
129 'name' =>
'affecttag_type',
131 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
133 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
139if ($massaction ==
'preupdateprice'
145 $formquestion = array();
147 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
148 $valuefield .=
'<input class="width50 right" type="text" name="pricerate" id="pricerate" min="-100" placeholder="0" value="" /> %';
149 $valuefield .=
'</div>';
151 $formquestion[] = array(
153 'name' =>
'pricerate',
154 'label' => $langs->trans(
"Rate"),
155 'value' => $valuefield
158 $descConfirmPreUpdatePrice = $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect));
160 $descConfirmPreUpdatePrice = $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect) *
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT') .
' ('.$langs->transnoentities(
'PricingRule').
', '.$langs->transnoentities(
'MultiPricesNumPrices').
')');
163 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $descConfirmPreUpdatePrice,
"updateprice", $formquestion, 1, 0, 200, 500, 1);
166if ($massaction ==
'presetsupervisor') {
167 $formquestion = array();
169 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
170 $valuefield .=
img_picto(
'',
'user').
' ';
171 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
172 $valuefield .=
'</div>';
174 $formquestion[] = array(
176 'name' =>
'supervisortoset',
177 'label' => $langs->trans(
"Supervisor"),
178 'value' => $valuefield
181 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
184if ($massaction ==
'preaffectuser') {
185 $formquestion = array();
187 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
188 $valuefielduser .=
img_picto(
'',
'user').
' ';
189 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
190 $valuefielduser .=
'</div>';
192 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
193 $valuefieldprojrole .= $formcompany->selectTypeContact(
$object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
194 $valuefieldprojrole .=
'</div>';
196 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
197 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
198 $valuefieldtasksrole .=
'</div>';
200 $formquestion[] = array(
202 'name' =>
'usertoaffect',
203 'label' => $langs->trans(
"User"),
204 'value' => $valuefielduser
206 $formquestion[] = array(
208 'name' =>
'projectrole',
209 'label' => $langs->trans(
"ProjectRole"),
210 'value' => $valuefieldprojrole
213 $formquestion[] = array(
215 'name' =>
'tasksrole',
216 'label' => $langs->trans(
"TasksRole"),
217 'value' => $valuefieldtasksrole
220 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
223if ($massaction ==
'presend') {
224 $langs->load(
"mails");
226 $listofselectedid = array();
227 $listofselectedrecipientobjid = array();
228 $listofselectedref = array();
230 if (!
GETPOST(
'cancel',
'alpha')) {
231 foreach ($arrayofselected as $toselectid) {
232 $result = $objecttmp->fetch($toselectid);
234 $listofselectedid[$toselectid] = $toselectid;
235 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
236 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
237 $thirdpartyid = $objecttmp->id;
238 } elseif ($objecttmp->element ==
'contact') {
239 $thirdpartyid = $objecttmp->id;
240 } elseif ($objecttmp->element ==
'expensereport') {
241 $thirdpartyid = $objecttmp->fk_user_author;
243 if (empty($thirdpartyid)) {
247 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
249 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
254 print
'<input type="hidden" name="massaction" value="confirm_presend">';
259 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
261 $formmail->withform = -1;
264 if ($formmail->fromtype ===
'user') {
265 $formmail->fromid = $user->id;
267 $formmail->trackid = $trackid;
268 $formmail->withfrom = 1;
269 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
270 if (count($listofselectedrecipientobjid) == 1) {
272 $thirdpartyid = array_shift($listofselectedrecipientobjid);
273 if ($objecttmp->element ==
'expensereport') {
274 $fuser =
new User($db);
275 $fuser->fetch($thirdpartyid);
276 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
277 } elseif ($objecttmp->element ==
'contact') {
279 $fcontact->fetch($thirdpartyid);
280 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
281 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
283 $fadherent->fetch($objecttmp->fk_member);
284 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
287 $soc->fetch($thirdpartyid);
288 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
289 $liste[$key] = $value;
292 $formmail->withtoreadonly = 0;
294 $formmail->withtoreadonly = 1;
298 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOSTINT(
'oneemailperrecipient') ? 1 : -1);
299 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
300 $formmail->withoptiononeemailperrecipient = 0;
303 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
304 $formmail->withtofree = empty($liste) ? 1 : 0;
305 $formmail->withtocc = 1;
307 if (!empty($topicmail)) {
308 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
310 $formmail->withtopic = 1;
312 if ($objecttmp->element ==
'contact') {
313 $formmail->withfile = 0;
314 $formmail->withmaindocfile = 0;
316 $formmail->withfile = 1;
318 if (isset($withmaindocfilemail)) {
319 $formmail->withmaindocfile = $withmaindocfilemail;
321 $formmail->withmaindocfile = 1;
322 if ($objecttmp->element !=
'societe') {
323 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
324 $formmail->withmaindocfile = -1;
329 $formmail->withbody = 1;
330 $formmail->withdeliveryreceipt = 1;
331 $formmail->withcancel = 1;
334 $substitutionarray = getCommonSubstitutionArray($langs, 0,
null,
$object);
336 $substitutionarray[
'__EMAIL__'] = empty($sendto) ?
'__EMAIL__' : $sendto;
337 $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"/>';
338 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
339 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
340 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
341 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
344 'mode' =>
'formemail'
349 $formmail->substit = $substitutionarray;
352 $formmail->param[
'action'] = $action;
353 $formmail->param[
'models'] = $modelmail;
354 $formmail->param[
'models_id'] =
GETPOSTINT(
'modelmailselected') ?
GETPOSTINT(
'modelmailselected') :
'';
355 $formmail->param[
'id'] = implode(
',', $arrayofselected);
357 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) > $conf->global->MAILING_LIMIT_SENDBYWEB) {
359 $langs->load(
"errors");
361 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
362 $arrayofmassactions = array();
364 print $formmail->get_form();
370if ($massaction ==
'edit_extrafields') {
371 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
372 $elementtype = $objecttmp->element;
376 $extrafields->fetch_name_optionals_label($elementtype);
377 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
379 $formquestion = array();
380 if (!empty($extrafields_list)) {
381 $myParamExtra =
$object->showOptionals($extrafields,
'create');
383 foreach ($extrafields_list as $extraKey => $extraLabel) {
384 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
387 $formquestion[] = array(
389 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
393 $outputShowOutputFields =
'<div class="extrafields-inputs">';
395 foreach ($extrafields_list as $extraKey => $extraLabel) {
396 $outputShowOutputFields .=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
397 $outputShowOutputFields .=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
398 $outputShowOutputFields .= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'',
'', $objecttmp, $objecttmp->table_element);
399 $outputShowOutputFields .=
'</div>';
401 $outputShowOutputFields .=
'<script>
403 $("#extrafield-key-to-update").on(\'change\',function(){
404 let selectedExtrtafield = $(this).val();
405 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
406 $(".mass-action-extrafield").hide();
407 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
412 $outputShowOutputFields .=
'</div>';
416 $formquestion[] = array(
418 'value' => $outputShowOutputFields
421 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
427if ($massaction ==
'preenable') {
428 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
430if ($massaction ==
'predisable') {
431 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
433if ($massaction ==
'presetcommercial') {
434 $formquestion = array();
435 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
436 $formquestion[] = array(
'type' =>
'other',
437 'name' =>
'affectedcommercial',
438 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0),
439 'value' => $form->multiselectarray(
'commercial', $userlist, array(), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1)
441 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"assignsalerepresentative", $formquestion, 1, 0, 200, 500, 1);
443if ($massaction ==
'unsetcommercial') {
444 $formquestion = array();
445 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
446 $formquestion[] = array(
'type' =>
'other',
447 'name' =>
'unassigncommercial',
448 'label' => $form->editfieldkey(
'UnallocateCommercial',
'commercial_id',
'',
$object, 0),
449 'value' => $form->multiselectarray(
'commercial', $userlist, array(), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1)
451 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUnallocateCommercial"), $langs->trans(
"ConfirmUnallocateCommercialQuestion", count($toselect)),
"unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
454if ($massaction ==
'preapproveleave') {
455 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
459if (empty($toselect)) {
463 'toselect' => &$toselect,
464 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
465 'massaction' => $massaction
469$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters,
$object, $action);
473 print $hookmanager->resPrint;
if(! $sortfield) if(! $sortorder) $object
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_hash($chain, $type='0', $nosalt=0, $mode=0)
Returns a hash (non reversible encryption) of a string.