63@phan-var-force string $string
64@phan-var-force CommonObject $objecttmp
65@phan-var-force CommonObject $object
66@phan-var-force int[] $toselect
67@phan-var-force ?string $uploaddir
68@phan-var-force int<0,1> $withmaindocfilemail
69@phan-var-force string $sendto
70@phan-var-force string $massaction
71@phan-var-force int[] $arrayofselected
72@phan-var-force string $trackid
73@phan-var-force string $modelmail
74@phan-var-force ?string $search_all
75@phan-var-force ?Task $taskstatic
78if (!empty($sall) || !empty($search_all)) {
79 $search_all = empty($sall) ? $search_all : $sall;
81 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
84if ($massaction ==
'predeletedraft') {
85 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
88if ($massaction ==
'predelete') {
89 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
92if ($massaction ==
'preclonetasks') {
94 foreach (
GETPOST(
'toselect') as $tmpselected) {
95 $selected .=
'&selected[]=' . $tmpselected;
97 $formquestion = array(
100 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)),
102 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
105if ($massaction ==
'preaffecttag' &&
isModEnabled(
'category')) {
106 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
108 $categ_types = array();
109 $categ_type_array = $categ->getMapList();
110 foreach ($categ_type_array as $categdef) {
112 if (isset(
$object) && $categdef[
'obj_table'] ==
$object->table_element) {
113 if (!array_key_exists($categdef[
'code'], $categ_types)) {
114 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
117 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
118 if (!array_key_exists($categdef[
'code'], $categ_types)) {
119 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
124 $formquestion = array();
125 if (!empty($categ_types)) {
126 foreach ($categ_types as $categ_type) {
127 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
128 $formquestion[] = array(
130 'name' =>
'affecttag_'.$categ_type[
'code'],
132 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'), 0, 0,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
135 $formquestion[] = array(
137 'name' =>
'affecttag_type',
139 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
141 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
147if ($massaction ==
'preupdateprice'
153 $formquestion = array();
155 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
156 $valuefield .=
'<input class="width50 right" type="text" name="pricerate" id="pricerate" min="-100" placeholder="0" value="" /> %';
157 $valuefield .=
'</div>';
159 $formquestion[] = array(
161 'name' =>
'pricerate',
162 'label' => $langs->trans(
"Rate"),
163 'value' => $valuefield
166 $descConfirmPreUpdatePrice = $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect));
168 $descConfirmPreUpdatePrice = $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect) *
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT') .
' ('.$langs->transnoentities(
'PricingRule').
', '.$langs->transnoentities(
'MultiPricesNumPrices').
')');
171 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $descConfirmPreUpdatePrice,
"updateprice", $formquestion, 1, 0, 200, 500, 1);
174if ($massaction ==
'presetsupervisor') {
175 $formquestion = array();
177 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
178 $valuefield .=
img_picto(
'',
'user').
' ';
179 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
180 $valuefield .=
'</div>';
182 $formquestion[] = array(
184 'name' =>
'supervisortoset',
185 'label' => $langs->trans(
"Supervisor"),
186 'value' => $valuefield
189 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
192if ($massaction ==
'preaffectuser') {
193 $formquestion = array();
195 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
196 $valuefielduser .=
img_picto(
'',
'user').
' ';
197 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
198 $valuefielduser .=
'</div>';
200 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
201 $valuefieldprojrole .= $formcompany->selectTypeContact(
$object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
202 $valuefieldprojrole .=
'</div>';
204 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
205 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
206 $valuefieldtasksrole .=
'</div>';
208 $formquestion[] = array(
210 'name' =>
'usertoaffect',
211 'label' => $langs->trans(
"User"),
212 'value' => $valuefielduser
214 $formquestion[] = array(
216 'name' =>
'projectrole',
217 'label' => $langs->trans(
"ProjectRole"),
218 'value' => $valuefieldprojrole
221 $formquestion[] = array(
223 'name' =>
'tasksrole',
224 'label' => $langs->trans(
"TasksRole"),
225 'value' => $valuefieldtasksrole
228 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
231if ($massaction ==
'presend') {
232 $langs->load(
"mails");
234 $listofselectedid = array();
235 $listofselectedrecipientobjid = array();
236 $listofselectedref = array();
238 if (!
GETPOST(
'cancel',
'alpha')) {
239 foreach ($arrayofselected as $toselectid) {
240 $result = $objecttmp->fetch($toselectid);
242 $listofselectedid[$toselectid] = $toselectid;
243 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
244 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
245 $thirdpartyid = $objecttmp->id;
246 } elseif ($objecttmp->element ==
'contact') {
247 $thirdpartyid = $objecttmp->id;
248 } elseif ($objecttmp->element ==
'expensereport') {
249 $thirdpartyid = $objecttmp->fk_user_author;
251 if (empty($thirdpartyid)) {
255 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
257 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
262 print
'<input type="hidden" name="massaction" value="confirm_presend">';
267 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
269 $formmail->withform = -1;
272 if ($formmail->fromtype ===
'user') {
273 $formmail->fromid = $user->id;
275 $formmail->trackid = $trackid;
276 $formmail->withfrom = 1;
277 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
278 if (count($listofselectedrecipientobjid) == 1) {
280 $thirdpartyid = array_shift($listofselectedrecipientobjid);
281 if ($objecttmp->element ==
'expensereport') {
283 $fuser->fetch($thirdpartyid);
284 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
285 } elseif ($objecttmp->element ==
'contact') {
287 $fcontact->fetch($thirdpartyid);
288 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
289 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
291 $fadherent->fetch($objecttmp->fk_member);
292 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
295 $soc->fetch($thirdpartyid);
296 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
297 $liste[$key] = $value;
300 $formmail->withtoreadonly = 0;
302 $formmail->withtoreadonly = 1;
306 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOSTINT(
'oneemailperrecipient') ? 1 : -1);
307 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
308 $formmail->withoptiononeemailperrecipient = 0;
311 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
312 $formmail->withtofree = empty($liste) ? 1 : 0;
313 $formmail->withtocc = 1;
315 if (!empty($topicmail)) {
316 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
318 $formmail->withtopic = 1;
320 if ($objecttmp->element ==
'contact') {
321 $formmail->withfile = 0;
322 $formmail->withmaindocfile = 0;
324 $formmail->withfile = 1;
326 if (isset($withmaindocfilemail)) {
327 $formmail->withmaindocfile = $withmaindocfilemail;
329 $formmail->withmaindocfile = 1;
330 if ($objecttmp->element !=
'societe') {
331 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
332 $formmail->withmaindocfile = -1;
337 $formmail->withbody = 1;
338 $formmail->withdeliveryreceipt = 1;
339 $formmail->withcancel = 1;
342 $substitutionarray = getCommonSubstitutionArray($langs, 0,
null,
$object);
344 $substitutionarray[
'__EMAIL__'] = empty($sendto) ?
'__EMAIL__' : $sendto;
345 $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"/>';
346 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
347 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
348 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
349 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
352 'mode' =>
'formemail'
357 $formmail->substit = $substitutionarray;
360 $formmail->param[
'action'] = $action;
361 $formmail->param[
'models'] = $modelmail;
362 $formmail->param[
'models_id'] =
GETPOSTINT(
'modelmailselected') ?
GETPOSTINT(
'modelmailselected') :
'';
363 $formmail->param[
'id'] = implode(
',', $arrayofselected);
365 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) >
$conf->global->MAILING_LIMIT_SENDBYWEB) {
367 $langs->load(
"errors");
369 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
370 $arrayofmassactions = array();
372 print $formmail->get_form();
378if ($massaction ==
'edit_extrafields') {
379 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
380 $elementtype = $objecttmp->element;
383 $extrafields->fetch_name_optionals_label($elementtype);
384 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
386 $formquestion = array();
387 if (!empty($extrafields_list)) {
388 $myParamExtra =
$object->showOptionals($extrafields,
'create');
390 foreach ($extrafields_list as $extraKey => $extraLabel) {
391 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
394 $formquestion[] = array(
396 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
400 $outputShowOutputFields =
'<div class="extrafields-inputs">';
402 foreach ($extrafields_list as $extraKey => $extraLabel) {
403 $outputShowOutputFields .=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
404 $outputShowOutputFields .=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
405 $outputShowOutputFields .= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'',
'', $objecttmp, $objecttmp->table_element);
406 $outputShowOutputFields .=
'</div>';
408 $outputShowOutputFields .=
'<script>
410 $("#extrafield-key-to-update").on(\'change\',function(){
411 let selectedExtrtafield = $(this).val();
412 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
413 $(".mass-action-extrafield").hide();
414 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
419 $outputShowOutputFields .=
'</div>';
423 $formquestion[] = array(
425 'value' => $outputShowOutputFields
428 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
434if ($massaction ==
'preenable') {
435 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
437if ($massaction ==
'predisable') {
438 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
440if ($massaction ==
'presetcommercial') {
441 $formquestion = array();
442 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
443 $formquestion[] = array(
'type' =>
'other',
444 'name' =>
'affectedcommercial',
445 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0),
446 'value' => $form->multiselectarray(
'commercial', $userlist, array(), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1)
448 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"assignsalerepresentative", $formquestion, 1, 0, 200, 500, 1);
450if ($massaction ==
'unsetcommercial') {
451 $formquestion = array();
452 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'',
'0', 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
453 $formquestion[] = array(
'type' =>
'other',
454 'name' =>
'unassigncommercial',
455 'label' => $form->editfieldkey(
'UnallocateCommercial',
'commercial_id',
'',
$object, 0),
456 'value' => $form->multiselectarray(
'commercial', $userlist, array(), 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1)
458 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUnallocateCommercial"), $langs->trans(
"ConfirmUnallocateCommercialQuestion", count($toselect)),
"unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
461if ($massaction ==
'preapproveleave') {
462 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
465if ($massaction ==
'precreatecreditnote') {
467 $text .= $langs->trans(
"ConfirmMassCreateCreditNoteQuestion", count($toselect)) .
'<br>';
471 foreach ($toselect as $toselectid) {
472 $result = $objecttmp->fetch($toselectid);
474 require_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
476 $text .= $notify->confirmMessage(
'BILL_VALIDATE', $objecttmp->socid, $objecttmp) .
'<br>';
480 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassCreateCreditNote"), $text,
"createcreditnote",
null,
'yes', 0, 200, 500, 1);
484if (empty($toselect)) {
488 'toselect' => &$toselect,
489 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
490 'massaction' => $massaction
494$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters,
$object, $action);
498 print $hookmanager->resPrint;
if(! $sortfield) if(! $sortorder) $object
Class to manage members of a foundation.
Class to manage categories.
Class to manage the table of subscription to notifications.
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.