58@phan-var-force CommonObject $objecttmp
59@phan-var-force int[] $toselect
62if (!empty($sall) || !empty($search_all)) {
63 $search_all = empty($sall) ? $search_all : $sall;
65 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
68if ($massaction ==
'predeletedraft') {
69 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
72if ($massaction ==
'predelete') {
73 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
76if ($massaction ==
'preclonetasks') {
78 foreach (
GETPOST(
'toselect') as $tmpselected) {
79 $selected .=
'&selected[]=' . $tmpselected;
81 $formquestion = array(
84 array(
'type' =>
'other',
'name' =>
'projectid',
'label' => $langs->trans(
'Project') .
': ',
'value' => $form->selectProjects(
$object->id,
'projectid',
'', 0, 1,
'', 0, array(),
$object->socid,
'1', 1,
'',
null, 1)),
86 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
89if ($massaction ==
'preaffecttag' && isModEnabled(
'category')) {
90 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
92 $categ_types = array();
93 $categ_type_array = $categ->getMapList();
94 foreach ($categ_type_array as $categdef) {
96 if (isset(
$object) && $categdef[
'obj_table'] ==
$object->table_element) {
97 if (!array_key_exists($categdef[
'code'], $categ_types)) {
98 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
101 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
102 if (!array_key_exists($categdef[
'code'], $categ_types)) {
103 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
108 $formquestion = array();
109 if (!empty($categ_types)) {
110 foreach ($categ_types as $categ_type) {
111 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
112 $formquestion[] = array(
114 'name' =>
'affecttag_'.$categ_type[
'code'],
116 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'),
null,
null,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
119 $formquestion[] = array(
121 'name' =>
'affecttag_type',
123 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
125 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
131if ($massaction ==
'preupdateprice') {
132 $formquestion = array();
134 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
135 $valuefield .=
'<input type="number" name="pricerate" id="pricerate" min="-100" value="0" style="width: 100px; text-align: right; margin-right: 10px" />%';
136 $valuefield .=
'</div>';
138 $formquestion[] = array(
140 'name' =>
'pricerate',
141 'label' => $langs->trans(
"Rate"),
142 'value' => $valuefield
145 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect)),
"updateprice", $formquestion, 1, 0, 200, 500, 1);
148if ($massaction ==
'presetsupervisor') {
149 $formquestion = array();
151 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
152 $valuefield .=
img_picto(
'',
'user').
' ';
153 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
154 $valuefield .=
'</div>';
156 $formquestion[] = array(
158 'name' =>
'supervisortoset',
159 'label' => $langs->trans(
"Supervisor"),
160 'value' => $valuefield
163 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
166if ($massaction ==
'preaffectuser') {
167 $formquestion = array();
169 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
170 $valuefielduser .=
img_picto(
'',
'user').
' ';
171 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
172 $valuefielduser .=
'</div>';
174 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
175 $valuefieldprojrole .= $formcompany->selectTypeContact(
$object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
176 $valuefieldprojrole .=
'</div>';
178 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
179 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
180 $valuefieldtasksrole .=
'</div>';
182 $formquestion[] = array(
184 'name' =>
'usertoaffect',
185 'label' => $langs->trans(
"User"),
186 'value' => $valuefielduser
188 $formquestion[] = array(
190 'name' =>
'projectrole',
191 'label' => $langs->trans(
"ProjectRole"),
192 'value' => $valuefieldprojrole
195 $formquestion[] = array(
197 'name' =>
'tasksrole',
198 'label' => $langs->trans(
"TasksRole"),
199 'value' => $valuefieldtasksrole
202 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
205if ($massaction ==
'presend') {
206 $langs->load(
"mails");
208 $listofselectedid = array();
209 $listofselectedrecipientobjid = array();
210 $listofselectedref = array();
212 if (!
GETPOST(
'cancel',
'alpha')) {
213 foreach ($arrayofselected as $toselectid) {
214 $result = $objecttmp->fetch($toselectid);
216 $listofselectedid[$toselectid] = $toselectid;
217 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
218 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
219 $thirdpartyid = $objecttmp->id;
220 } elseif ($objecttmp->element ==
'contact') {
221 $thirdpartyid = $objecttmp->id;
222 } elseif ($objecttmp->element ==
'expensereport') {
223 $thirdpartyid = $objecttmp->fk_user_author;
225 if (empty($thirdpartyid)) {
229 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
231 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
236 print
'<input type="hidden" name="massaction" value="confirm_presend">';
241 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
243 $formmail->withform = -1;
246 if ($formmail->fromtype ===
'user') {
247 $formmail->fromid = $user->id;
249 $formmail->trackid = $trackid;
250 $formmail->withfrom = 1;
251 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
252 if (count($listofselectedrecipientobjid) == 1) {
254 $thirdpartyid = array_shift($listofselectedrecipientobjid);
255 if ($objecttmp->element ==
'expensereport') {
256 $fuser =
new User($db);
257 $fuser->fetch($thirdpartyid);
258 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
259 } elseif ($objecttmp->element ==
'contact') {
261 $fcontact->fetch($thirdpartyid);
262 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
263 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
265 $fadherent->fetch($objecttmp->fk_member);
266 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
269 $soc->fetch($thirdpartyid);
270 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
271 $liste[$key] = $value;
274 $formmail->withtoreadonly = 0;
276 $formmail->withtoreadonly = 1;
280 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOSTINT(
'oneemailperrecipient') ? 1 : -1);
281 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
282 $formmail->withoptiononeemailperrecipient = 0;
285 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
286 $formmail->withtofree = empty($liste) ? 1 : 0;
287 $formmail->withtocc = 1;
289 if (!empty($topicmail)) {
290 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
292 $formmail->withtopic = 1;
294 if ($objecttmp->element ==
'contact') {
295 $formmail->withfile = 0;
296 $formmail->withmaindocfile = 0;
298 $formmail->withfile = 1;
300 if (isset($withmaindocfilemail)) {
301 $formmail->withmaindocfile = $withmaindocfilemail;
303 $formmail->withmaindocfile = 1;
304 if ($objecttmp->element !=
'societe') {
305 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
306 $formmail->withmaindocfile = -1;
311 $formmail->withbody = 1;
312 $formmail->withdeliveryreceipt = 1;
313 $formmail->withcancel = 1;
318 $substitutionarray[
'__EMAIL__'] = $sendto;
319 $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"/>';
320 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
321 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
322 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
323 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
326 'mode' =>
'formemail'
331 $formmail->substit = $substitutionarray;
334 $formmail->param[
'action'] = $action;
335 $formmail->param[
'models'] = $modelmail;
336 $formmail->param[
'models_id'] =
GETPOSTINT(
'modelmailselected') ?
GETPOSTINT(
'modelmailselected') :
'-1';
337 $formmail->param[
'id'] = implode(
',', $arrayofselected);
339 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) >
$conf->global->MAILING_LIMIT_SENDBYWEB) {
341 $langs->load(
"errors");
343 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
344 $arrayofmassactions = array();
346 print $formmail->get_form();
352if ($massaction ==
'edit_extrafields') {
353 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
354 $elementtype = $objecttmp->element;
358 $extrafields->fetch_name_optionals_label($elementtype);
359 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
361 $formquestion = array();
362 if (!empty($extrafields_list)) {
363 $myParamExtra =
$object->showOptionals($extrafields,
'create');
365 foreach ($extrafields_list as $extraKey => $extraLabel) {
366 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
369 $formquestion[] = array(
371 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
375 $outputShowOutputFields =
'<div class="extrafields-inputs">';
377 foreach ($extrafields_list as $extraKey => $extraLabel) {
378 $outputShowOutputFields .=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
379 $outputShowOutputFields .=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
380 $outputShowOutputFields .= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'', 0, $objecttmp, $objecttmp->table_element);
381 $outputShowOutputFields .=
'</div>';
383 $outputShowOutputFields .=
'<script>
385 $("#extrafield-key-to-update").on(\'change\',function(){
386 let selectedExtrtafield = $(this).val();
387 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
388 $(".mass-action-extrafield").hide();
389 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
394 $outputShowOutputFields .=
'</div>';
398 $formquestion[] = array(
400 'value' => $outputShowOutputFields
403 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
409if ($massaction ==
'preenable') {
410 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
412if ($massaction ==
'predisable') {
413 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
415if ($massaction ==
'presetcommercial') {
416 $formquestion = array();
417 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
418 $formquestion[] = array(
'type' =>
'other',
419 'name' =>
'affectedcommercial',
420 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0),
421 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
422 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"affectcommercial", $formquestion, 1, 0, 200, 500, 1);
424if ($massaction ==
'unsetcommercial') {
425 $formquestion = array();
426 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
427 $formquestion[] = array(
'type' =>
'other',
428 'name' =>
'unassigncommercial',
429 'label' => $form->editfieldkey(
'UnallocateCommercial',
'commercial_id',
'',
$object, 0),
430 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
431 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUnallocateCommercial"), $langs->trans(
"ConfirmUnallocateCommercialQuestion", count($toselect)),
"unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
434if ($massaction ==
'preapproveleave') {
435 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
439if (empty($toselect)) {
443 'toselect' => &$toselect,
444 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
445 'massaction' => $massaction
448$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters,
$object, $action);
452 print $hookmanager->resPrint;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.
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.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.