59@phan-var-force CommonObject $objecttmp
60@phan-var-force int[] $toselect
63if (!empty($sall) || !empty($search_all)) {
64 $search_all = empty($sall) ? $search_all : $sall;
66 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
69if ($massaction ==
'predeletedraft') {
70 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
73if ($massaction ==
'predelete') {
74 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
77if ($massaction ==
'preclonetasks') {
79 foreach (
GETPOST(
'toselect') as $tmpselected) {
80 $selected .=
'&selected[]=' . $tmpselected;
82 $formquestion = array(
85 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)),
87 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
90if ($massaction ==
'preaffecttag' && isModEnabled(
'category')) {
91 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
93 $categ_types = array();
94 $categ_type_array = $categ->getMapList();
95 foreach ($categ_type_array as $categdef) {
97 if (isset(
$object) && $categdef[
'obj_table'] ==
$object->table_element) {
98 if (!array_key_exists($categdef[
'code'], $categ_types)) {
99 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
102 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
103 if (!array_key_exists($categdef[
'code'], $categ_types)) {
104 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
109 $formquestion = array();
110 if (!empty($categ_types)) {
111 foreach ($categ_types as $categ_type) {
112 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
113 $formquestion[] = array(
115 'name' =>
'affecttag_'.$categ_type[
'code'],
117 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'),
null,
null,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
120 $formquestion[] = array(
122 'name' =>
'affecttag_type',
124 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
126 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
132if ($massaction ==
'preupdateprice'
137 $formquestion = array();
139 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
140 $valuefield .=
'<input class="width50 right" type="text" name="pricerate" id="pricerate" min="-100" placeholder="0" value="" /> %';
141 $valuefield .=
'</div>';
143 $formquestion[] = array(
145 'name' =>
'pricerate',
146 'label' => $langs->trans(
"Rate"),
147 'value' => $valuefield
150 $descConfirmPreUpdatePrice=$langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect));
152 $descConfirmPreUpdatePrice=$langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect)*
getDolGlobalInt(
'PRODUIT_MULTIPRICES_LIMIT') .
' ('.$langs->transnoentities(
'PricingRule').
', '.$langs->transnoentities(
'MultiPricesNumPrices').
')');
155 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $descConfirmPreUpdatePrice,
"updateprice", $formquestion, 1, 0, 200, 500, 1);
158if ($massaction ==
'presetsupervisor') {
159 $formquestion = array();
161 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
162 $valuefield .=
img_picto(
'',
'user').
' ';
163 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
164 $valuefield .=
'</div>';
166 $formquestion[] = array(
168 'name' =>
'supervisortoset',
169 'label' => $langs->trans(
"Supervisor"),
170 'value' => $valuefield
173 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
176if ($massaction ==
'preaffectuser') {
177 $formquestion = array();
179 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
180 $valuefielduser .=
img_picto(
'',
'user').
' ';
181 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
182 $valuefielduser .=
'</div>';
184 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
185 $valuefieldprojrole .= $formcompany->selectTypeContact(
$object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
186 $valuefieldprojrole .=
'</div>';
188 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
189 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
190 $valuefieldtasksrole .=
'</div>';
192 $formquestion[] = array(
194 'name' =>
'usertoaffect',
195 'label' => $langs->trans(
"User"),
196 'value' => $valuefielduser
198 $formquestion[] = array(
200 'name' =>
'projectrole',
201 'label' => $langs->trans(
"ProjectRole"),
202 'value' => $valuefieldprojrole
205 $formquestion[] = array(
207 'name' =>
'tasksrole',
208 'label' => $langs->trans(
"TasksRole"),
209 'value' => $valuefieldtasksrole
212 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
215if ($massaction ==
'presend') {
216 $langs->load(
"mails");
218 $listofselectedid = array();
219 $listofselectedrecipientobjid = array();
220 $listofselectedref = array();
222 if (!
GETPOST(
'cancel',
'alpha')) {
223 foreach ($arrayofselected as $toselectid) {
224 $result = $objecttmp->fetch($toselectid);
226 $listofselectedid[$toselectid] = $toselectid;
227 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
228 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
229 $thirdpartyid = $objecttmp->id;
230 } elseif ($objecttmp->element ==
'contact') {
231 $thirdpartyid = $objecttmp->id;
232 } elseif ($objecttmp->element ==
'expensereport') {
233 $thirdpartyid = $objecttmp->fk_user_author;
235 if (empty($thirdpartyid)) {
239 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
241 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
246 print
'<input type="hidden" name="massaction" value="confirm_presend">';
251 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
253 $formmail->withform = -1;
256 if ($formmail->fromtype ===
'user') {
257 $formmail->fromid = $user->id;
259 $formmail->trackid = $trackid;
260 $formmail->withfrom = 1;
261 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
262 if (count($listofselectedrecipientobjid) == 1) {
264 $thirdpartyid = array_shift($listofselectedrecipientobjid);
265 if ($objecttmp->element ==
'expensereport') {
266 $fuser =
new User($db);
267 $fuser->fetch($thirdpartyid);
268 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
269 } elseif ($objecttmp->element ==
'contact') {
271 $fcontact->fetch($thirdpartyid);
272 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
273 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
275 $fadherent->fetch($objecttmp->fk_member);
276 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
279 $soc->fetch($thirdpartyid);
280 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
281 $liste[$key] = $value;
284 $formmail->withtoreadonly = 0;
286 $formmail->withtoreadonly = 1;
290 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOSTINT(
'oneemailperrecipient') ? 1 : -1);
291 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
292 $formmail->withoptiononeemailperrecipient = 0;
295 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
296 $formmail->withtofree = empty($liste) ? 1 : 0;
297 $formmail->withtocc = 1;
299 if (!empty($topicmail)) {
300 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
302 $formmail->withtopic = 1;
304 if ($objecttmp->element ==
'contact') {
305 $formmail->withfile = 0;
306 $formmail->withmaindocfile = 0;
308 $formmail->withfile = 1;
310 if (isset($withmaindocfilemail)) {
311 $formmail->withmaindocfile = $withmaindocfilemail;
313 $formmail->withmaindocfile = 1;
314 if ($objecttmp->element !=
'societe') {
315 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
316 $formmail->withmaindocfile = -1;
321 $formmail->withbody = 1;
322 $formmail->withdeliveryreceipt = 1;
323 $formmail->withcancel = 1;
328 $substitutionarray[
'__EMAIL__'] = empty($sendto) ?
'__EMAIL__' : $sendto;
329 $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"/>';
330 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
331 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
332 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
333 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
336 'mode' =>
'formemail'
341 $formmail->substit = $substitutionarray;
344 $formmail->param[
'action'] = $action;
345 $formmail->param[
'models'] = $modelmail;
346 $formmail->param[
'models_id'] =
GETPOSTINT(
'modelmailselected') ?
GETPOSTINT(
'modelmailselected') :
'-1';
347 $formmail->param[
'id'] = implode(
',', $arrayofselected);
349 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) >
$conf->global->MAILING_LIMIT_SENDBYWEB) {
351 $langs->load(
"errors");
353 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
354 $arrayofmassactions = array();
356 print $formmail->get_form();
362if ($massaction ==
'edit_extrafields') {
363 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
364 $elementtype = $objecttmp->element;
368 $extrafields->fetch_name_optionals_label($elementtype);
369 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
371 $formquestion = array();
372 if (!empty($extrafields_list)) {
373 $myParamExtra =
$object->showOptionals($extrafields,
'create');
375 foreach ($extrafields_list as $extraKey => $extraLabel) {
376 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
379 $formquestion[] = array(
381 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
385 $outputShowOutputFields =
'<div class="extrafields-inputs">';
387 foreach ($extrafields_list as $extraKey => $extraLabel) {
388 $outputShowOutputFields .=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
389 $outputShowOutputFields .=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
390 $outputShowOutputFields .= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'', 0, $objecttmp, $objecttmp->table_element);
391 $outputShowOutputFields .=
'</div>';
393 $outputShowOutputFields .=
'<script>
395 $("#extrafield-key-to-update").on(\'change\',function(){
396 let selectedExtrtafield = $(this).val();
397 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
398 $(".mass-action-extrafield").hide();
399 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
404 $outputShowOutputFields .=
'</div>';
408 $formquestion[] = array(
410 'value' => $outputShowOutputFields
413 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
419if ($massaction ==
'preenable') {
420 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
422if ($massaction ==
'predisable') {
423 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
425if ($massaction ==
'presetcommercial') {
426 $formquestion = array();
427 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
428 $formquestion[] = array(
'type' =>
'other',
429 'name' =>
'affectedcommercial',
430 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0),
431 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
432 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"assignsalerepresentative", $formquestion, 1, 0, 200, 500, 1);
434if ($massaction ==
'unsetcommercial') {
435 $formquestion = array();
436 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'u.statut:=:1', 0,
'',
'', 0, 1);
437 $formquestion[] = array(
'type' =>
'other',
438 'name' =>
'unassigncommercial',
439 'label' => $form->editfieldkey(
'UnallocateCommercial',
'commercial_id',
'',
$object, 0),
440 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
441 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUnallocateCommercial"), $langs->trans(
"ConfirmUnallocateCommercialQuestion", count($toselect)),
"unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
444if ($massaction ==
'preapproveleave') {
445 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
449if (empty($toselect)) {
453 'toselect' => &$toselect,
454 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
455 'massaction' => $massaction
458$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters,
$object, $action);
462 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_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)
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.
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, $mode=0)
Returns a hash (non reversible encryption) of a string.