34'@phan-var-force CommonObject $objecttmp';
36if (!empty($sall) || !empty($search_all)) {
37 $search_all = empty($sall) ? $search_all : $sall;
39 print
'<input type="hidden" name="search_all" value="'.$search_all.
'">';
42if ($massaction ==
'predeletedraft') {
43 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
46if ($massaction ==
'predelete') {
47 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
50if ($massaction ==
'preclonetasks') {
52 foreach (
GETPOST(
'toselect') as $tmpselected) {
53 $selected .=
'&selected[]=' . $tmpselected;
56 $formquestion = array(
59 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)),
61 print $form->formconfirm($_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id . $selected, $langs->trans(
'ConfirmMassClone'),
'',
'clonetasks', $formquestion,
'', 1, 300, 590);
64if ($massaction ==
'preaffecttag' && isModEnabled(
'category')) {
65 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
67 $categ_types = array();
68 $categ_type_array = $categ->getMapList();
69 foreach ($categ_type_array as $categdef) {
71 if (isset(
$object) && $categdef[
'obj_table'] ==
$object->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']));
76 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
77 if (!array_key_exists($categdef[
'code'], $categ_types)) {
78 $categ_types[$categdef[
'code']] = array(
'code' => $categdef[
'code'],
'label' => $langs->trans($categdef[
'obj_class']));
83 $formquestion = array();
84 if (!empty($categ_types)) {
85 foreach ($categ_types as $categ_type) {
86 $categ_arbo_tmp = $form->select_all_categories($categ_type[
'code'],
'',
'parent', 0, 0, 3);
87 $formquestion[] = array(
89 'name' =>
'affecttag_'.$categ_type[
'code'],
91 'value' => $form->multiselectarray(
'contcats_'.$categ_type[
'code'], $categ_arbo_tmp,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'),
null,
null,
'', 0,
'60%',
'',
'', $langs->transnoentitiesnoconv(
"SelectTheTagsToAssign"))
94 $formquestion[] = array(
96 'name' =>
'affecttag_type',
98 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>'
100 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
106if ($massaction ==
'preupdateprice') {
107 $formquestion = array();
109 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
110 $valuefield .=
'<input type="number" name="pricerate" id="pricerate" min="-100" value="0" style="width: 100px; text-align: right; margin-right: 10px" />%';
111 $valuefield .=
'</div>';
113 $formquestion[] = array(
115 'name' =>
'pricerate',
116 'label' => $langs->trans(
"Rate"),
117 'value' => $valuefield
120 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect)),
"updateprice", $formquestion, 1, 0, 200, 500, 1);
123if ($massaction ==
'presetsupervisor') {
124 $formquestion = array();
126 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
127 $valuefield .=
img_picto(
'',
'user').
' ';
128 $valuefield .= $form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
129 $valuefield .=
'</div>';
131 $formquestion[] = array(
133 'name' =>
'supervisortoset',
134 'label' => $langs->trans(
"Supervisor"),
135 'value' => $valuefield
138 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
141if ($massaction ==
'preaffectuser') {
142 $formquestion = array();
144 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
145 $valuefielduser .=
img_picto(
'',
'user').
' ';
146 $valuefielduser .= $form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
147 $valuefielduser .=
'</div>';
149 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
150 $valuefieldprojrole .= $formcompany->selectTypeContact(
$object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
151 $valuefieldprojrole .=
'</div>';
153 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
154 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
155 $valuefieldtasksrole .=
'</div>';
157 $formquestion[] = array(
159 'name' =>
'usertoaffect',
160 'label' => $langs->trans(
"User"),
161 'value' => $valuefielduser
163 $formquestion[] = array(
165 'name' =>
'projectrole',
166 'label' => $langs->trans(
"ProjectRole"),
167 'value' => $valuefieldprojrole
170 $formquestion[] = array(
172 'name' =>
'tasksrole',
173 'label' => $langs->trans(
"TasksRole"),
174 'value' => $valuefieldtasksrole
177 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
180if ($massaction ==
'presend') {
181 $langs->load(
"mails");
183 $listofselectedid = array();
184 $listofselectedrecipientobjid = array();
185 $listofselectedref = array();
187 if (!
GETPOST(
'cancel',
'alpha')) {
188 foreach ($arrayofselected as $toselectid) {
189 $result = $objecttmp->fetch($toselectid);
191 $listofselectedid[$toselectid] = $toselectid;
192 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
193 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
194 $thirdpartyid = $objecttmp->id;
195 } elseif ($objecttmp->element ==
'contact') {
196 $thirdpartyid = $objecttmp->id;
197 } elseif ($objecttmp->element ==
'expensereport') {
198 $thirdpartyid = $objecttmp->fk_user_author;
200 if (empty($thirdpartyid)) {
204 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
206 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
211 print
'<input type="hidden" name="massaction" value="confirm_presend">';
216 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
218 $formmail->withform = -1;
219 $formmail->fromtype = (
GETPOST(
'fromtype') ?
GETPOST(
'fromtype') : (
getDolGlobalString(
'MAIN_MAIL_DEFAULT_FROMTYPE') ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE :
'user'));
221 if ($formmail->fromtype ===
'user') {
222 $formmail->fromid = $user->id;
224 $formmail->trackid = $trackid;
225 $formmail->withfrom = 1;
226 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
227 if (count($listofselectedrecipientobjid) == 1) {
229 $thirdpartyid = array_shift($listofselectedrecipientobjid);
230 if ($objecttmp->element ==
'expensereport') {
231 $fuser =
new User($db);
232 $fuser->fetch($thirdpartyid);
233 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
234 } elseif ($objecttmp->element ==
'contact') {
236 $fcontact->fetch($thirdpartyid);
237 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
238 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
240 $fadherent->fetch($objecttmp->fk_member);
241 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
244 $soc->fetch($thirdpartyid);
245 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
246 $liste[$key] = $value;
249 $formmail->withtoreadonly = 0;
251 $formmail->withtoreadonly = 1;
255 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOSTINT(
'oneemailperrecipient') ? 1 : -1);
256 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
257 $formmail->withoptiononeemailperrecipient = 0;
260 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
261 $formmail->withtofree = empty($liste) ? 1 : 0;
262 $formmail->withtocc = 1;
264 if (!empty($topicmail)) {
265 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
267 $formmail->withtopic = 1;
269 if ($objecttmp->element ==
'contact') {
270 $formmail->withfile = 0;
271 $formmail->withmaindocfile = 0;
273 $formmail->withfile = 1;
275 if (isset($withmaindocfilemail)) {
276 $formmail->withmaindocfile = $withmaindocfilemail;
278 $formmail->withmaindocfile = 1;
279 if ($objecttmp->element !=
'societe') {
280 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
281 $formmail->withmaindocfile = -1;
286 $formmail->withbody = 1;
287 $formmail->withdeliveryreceipt = 1;
288 $formmail->withcancel = 1;
293 $substitutionarray[
'__EMAIL__'] = $sendto;
294 $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"/>';
295 $substitutionarray[
'__ONLINE_PAYMENT_URL__'] =
'UrlToPayOnlineIfApplicable';
296 $substitutionarray[
'__ONLINE_PAYMENT_TEXT_AND_URL__'] =
'TextAndUrlToPayOnlineIfApplicable';
297 $substitutionarray[
'__THIRDPARTY_NAME__'] =
'__THIRDPARTY_NAME__';
298 $substitutionarray[
'__PROJECT_NAME__'] =
'__PROJECT_NAME__';
301 'mode' =>
'formemail'
306 $formmail->substit = $substitutionarray;
309 $formmail->param[
'action'] = $action;
310 $formmail->param[
'models'] = $modelmail;
311 $formmail->param[
'models_id'] =
GETPOSTINT(
'modelmailselected') ?
GETPOSTINT(
'modelmailselected') :
'-1';
312 $formmail->param[
'id'] = implode(
',', $arrayofselected);
314 if (
getDolGlobalString(
'MAILING_LIMIT_SENDBYWEB') && count($listofselectedrecipientobjid) > $conf->global->MAILING_LIMIT_SENDBYWEB) {
316 $langs->load(
"errors");
318 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
319 $arrayofmassactions = array();
321 print $formmail->get_form();
327if ($massaction ==
'edit_extrafields') {
328 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
329 $elementtype = $objecttmp->element;
333 $extrafields->fetch_name_optionals_label($elementtype);
334 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
336 $formquestion = array();
337 if (!empty($extrafields_list)) {
338 $myParamExtra =
$object->showOptionals($extrafields,
'create');
340 foreach ($extrafields_list as $extraKey => $extraLabel) {
341 $extrafields_list[$extraKey] = $langs->trans($extraLabel);
344 $formquestion[] = array(
346 'value' => $form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
350 $outputShowOutputFields =
'<div class="extrafields-inputs">';
352 foreach ($extrafields_list as $extraKey => $extraLabel) {
353 $outputShowOutputFields .=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
354 $outputShowOutputFields .=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
355 $outputShowOutputFields .= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'', 0, $objecttmp->id, $objecttmp->table_element);
356 $outputShowOutputFields .=
'</div>';
358 $outputShowOutputFields .=
'<script>
360 $("#extrafield-key-to-update").on(\'change\',function(){
361 let selectedExtrtafield = $(this).val();
362 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
363 $(".mass-action-extrafield").hide();
364 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
369 $outputShowOutputFields .=
'</div>';
373 $formquestion[] = array(
375 'value' => $outputShowOutputFields
378 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
384if ($massaction ==
'preenable') {
385 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
387if ($massaction ==
'predisable') {
388 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
390if ($massaction ==
'presetcommercial') {
391 $formquestion = array();
392 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
393 $formquestion[] = array(
'type' =>
'other',
394 'name' =>
'affectedcommercial',
395 'label' => $form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'',
$object, 0),
396 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
397 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"affectcommercial", $formquestion, 1, 0, 200, 500, 1);
399if ($massaction ==
'unsetcommercial') {
400 $formquestion = array();
401 $userlist = $form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
402 $formquestion[] = array(
'type' =>
'other',
403 'name' =>
'unassigncommercial',
404 'label' => $form->editfieldkey(
'UnallocateCommercial',
'commercial_id',
'',
$object, 0),
405 'value' => $form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
406 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUnallocateCommercial"), $langs->trans(
"ConfirmUnallocateCommercialQuestion", count($toselect)),
"unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
409if ($massaction ==
'preapproveleave') {
410 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
415 'toselect' => isset($toselect) ? $toselect : array(),
416 'uploaddir' => isset($uploaddir) ? $uploaddir : null,
417 'massaction' => $massaction
420$reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters,
$object, $action);
424 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.
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)
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.
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.