35 if ($massaction ==
'predeletedraft') {
36 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDraftDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
39 if ($massaction ==
'predelete') {
40 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDeletion"), $langs->trans(
"ConfirmMassDeletionQuestion", count($toselect)),
"delete",
null,
'', 0, 200, 500, 1);
43 if ($massaction ==
'preaffecttag' &&
isModEnabled(
'category')) {
44 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
46 $categ_types = array();
47 $categ_type_array = $categ->getMapList();
48 foreach ($categ_type_array as $categdef) {
50 if (isset($object) && $categdef[
'obj_table'] == $object->table_element) {
51 if (!array_key_exists($categdef[
'code'], $categ_types)) {
52 $categ_types[$categdef[
'code']] = array(
'code'=>$categdef[
'code'],
'label'=>$langs->trans($categdef[
'obj_class']));
55 if (isset($objecttmp) && $categdef[
'obj_table'] == $objecttmp->table_element) {
56 if (!array_key_exists($categdef[
'code'], $categ_types)) {
57 $categ_types[$categdef[
'code']] = array(
'code'=>$categdef[
'code'],
'label'=>$langs->trans($categdef[
'obj_class']));
62 $formquestion = array();
63 if (!empty($categ_types)) {
64 foreach ($categ_types as $categ_type) {
65 $cate_arbo =
$form->select_all_categories($categ_type[
'code'],
null,
'parent',
null,
null, 1);
66 $formquestion[] = array(
'type' =>
'other',
67 'name' =>
'affecttag_'.$categ_type[
'code'],
68 'label' => $langs->trans(
"Tag").
' '.$categ_type[
'label'],
69 'value' =>
$form->multiselectarray(
'contcats_'.$categ_type[
'code'], $cate_arbo,
GETPOST(
'contcats_'.$categ_type[
'code'],
'array'),
null,
null,
null,
null,
'60%'));
71 $formquestion[] = array(
'type' =>
'other',
72 'name' =>
'affecttag_type',
74 'value' =>
'<input type="hidden" name="affecttag_type" id="affecttag_type" value="'.implode(
",", array_keys($categ_types)).
'"/>');
75 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectTag"), $langs->trans(
"ConfirmAffectTagQuestion", count($toselect)),
"affecttag", $formquestion, 1, 0, 200, 500, 1);
81 if ($massaction ==
'preupdateprice' &&
isModEnabled(
'category')) {
82 $formquestion = array();
84 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
85 $valuefield .=
'<input type="number" name="pricerate" id="pricerate" min="-100" value="0" style="width: 100px; text-align: right; margin-right: 10px" />%';
86 $valuefield .=
'</div>';
88 $formquestion[] = array(
90 'name' =>
'pricerate',
91 'label' => $langs->trans(
"Rate"),
92 'value' => $valuefield
95 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmUpdatePrice"), $langs->trans(
"ConfirmUpdatePriceQuestion", count($toselect)),
"updateprice", $formquestion, 1, 0, 200, 500, 1);
98 if ($massaction ==
'presetsupervisor') {
99 $formquestion = array();
101 $valuefield =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
102 $valuefield .=
img_picto(
'',
'user').
' ';
103 $valuefield .=
$form->select_dolusers(
'',
'supervisortoset', 1, $arrayofselected, 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
104 $valuefield .=
'</div>';
106 $formquestion[] = array(
108 'name' =>
'supervisortoset',
109 'label' => $langs->trans(
"Supervisor"),
110 'value' => $valuefield
113 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmSetSupervisor"), $langs->trans(
"ConfirmSetSupervisorQuestion", count($toselect)),
"setsupervisor", $formquestion, 1, 0, 200, 500, 1);
116 if ($massaction ==
'preaffectuser') {
117 $formquestion = array();
119 $valuefielduser =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 165px; padding-bottom: 6px; gap: 5px">';
120 $valuefielduser .=
img_picto(
'',
'user').
' ';
121 $valuefielduser .=
$form->select_dolusers(
'',
'usertoaffect', 1, $arrayofselected, 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
122 $valuefielduser .=
'</div>';
124 $valuefieldprojrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px; padding-bottom: 6px">';
125 $valuefieldprojrole .= $formcompany->selectTypeContact($object,
'',
'projectrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
126 $valuefieldprojrole .=
'</div>';
128 $valuefieldtasksrole =
'<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
129 $valuefieldtasksrole .= $formcompany->selectTypeContact($taskstatic,
'',
'tasksrole',
'internal',
'position', 0,
'widthcentpercentminusx maxwidth300', 0);
130 $valuefieldtasksrole .=
'</div>';
132 $formquestion[] = array(
134 'name' =>
'usertoaffect',
135 'label' => $langs->trans(
"User"),
136 'value' => $valuefielduser
138 $formquestion[] = array(
140 'name' =>
'projectrole',
141 'label' => $langs->trans(
"ProjectRole"),
142 'value' => $valuefieldprojrole
145 $formquestion[] = array(
147 'name' =>
'tasksrole',
148 'label' => $langs->trans(
"TasksRole"),
149 'value' => $valuefieldtasksrole
152 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAffectUser"), $langs->trans(
"ConfirmAffectUserQuestion", count($toselect)),
"affectuser", $formquestion, 1, 0, 200, 500, 1);
155 if ($massaction ==
'presend') {
156 $langs->load(
"mails");
158 $listofselectedid = array();
159 $listofselectedrecipientobjid = array();
160 $listofselectedref = array();
162 if (!
GETPOST(
'cancel',
'alpha')) {
163 foreach ($arrayofselected as $toselectid) {
164 $result = $objecttmp->fetch($toselectid);
166 $listofselectedid[$toselectid] = $toselectid;
167 $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid);
168 if (in_array($objecttmp->element, array(
'societe',
'conferenceorboothattendee'))) {
169 $thirdpartyid = $objecttmp->id;
170 } elseif ($objecttmp->element ==
'contact') {
171 $thirdpartyid = $objecttmp->id;
172 } elseif ($objecttmp->element ==
'expensereport') {
173 $thirdpartyid = $objecttmp->fk_user_author;
175 if (empty($thirdpartyid)) {
179 $listofselectedrecipientobjid[$thirdpartyid] = $thirdpartyid;
181 $listofselectedref[$thirdpartyid][$toselectid] = $objecttmp->ref;
186 print
'<input type="hidden" name="massaction" value="confirm_presend">';
191 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
193 $formmail->withform = -1;
194 $formmail->fromtype = (
GETPOST(
'fromtype') ?
GETPOST(
'fromtype') : (!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE) ? $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE :
'user'));
196 if ($formmail->fromtype ===
'user') {
197 $formmail->fromid = $user->id;
199 $formmail->trackid = $trackid;
200 $formmail->withfrom = 1;
201 $liste = $langs->trans(
"AllRecipientSelected", count($arrayofselected));
202 if (count($listofselectedrecipientobjid) == 1) {
204 $thirdpartyid = array_shift($listofselectedrecipientobjid);
205 if ($objecttmp->element ==
'expensereport') {
206 $fuser =
new User($db);
207 $fuser->fetch($thirdpartyid);
208 $liste[
'thirdparty'] = $fuser->getFullName($langs).
" <".$fuser->email.
">";
209 } elseif ($objecttmp->element ==
'contact') {
211 $fcontact->fetch($thirdpartyid);
212 $liste[
'contact'] = $fcontact->getFullName($langs).
" <".$fcontact->email.
">";
213 } elseif ($objecttmp->element ==
'partnership' &&
getDolGlobalString(
'PARTNERSHIP_IS_MANAGED_FOR') ==
'member') {
215 $fadherent->fetch($objecttmp->fk_member);
216 $liste[
'member'] = $fadherent->getFullName($langs).
" <".$fadherent->email.
">";
219 $soc->fetch($thirdpartyid);
220 foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) {
221 $liste[$key] = $value;
224 $formmail->withtoreadonly = 0;
226 $formmail->withtoreadonly = 1;
230 $formmail->withoptiononeemailperrecipient = ((count($listofselectedref) == 1 && count(reset($listofselectedref)) == 1) || empty($liste)) ? 0 : (
GETPOST(
'oneemailperrecipient',
'int') ? 1 : -1);
231 if (in_array($objecttmp->element, array(
'conferenceorboothattendee'))) {
232 $formmail->withoptiononeemailperrecipient = 0;
235 $formmail->withto = empty($liste) ? (
GETPOST(
'sendto',
'alpha') ?
GETPOST(
'sendto',
'alpha') : array()) : $liste;
236 $formmail->withtofree = empty($liste) ? 1 : 0;
237 $formmail->withtocc = 1;
238 $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC;
239 if (!empty($topicmail)) {
240 $formmail->withtopic = $langs->transnoentities($topicmail,
'__REF__',
'__REF_CLIENT__');
242 $formmail->withtopic = 1;
244 if ($objecttmp->element ==
'contact') {
245 $formmail->withfile = 0;
246 $formmail->withmaindocfile = 0;
248 $formmail->withfile = 1;
250 if (isset($withmaindocfilemail)) {
251 $formmail->withmaindocfile = $withmaindocfilemail;
253 $formmail->withmaindocfile = 1;
254 if ($objecttmp->element !=
'societe') {
255 $formmail->withfile =
'<span class="hideonsmartphone opacitymedium">' . $langs->trans(
"OnlyPDFattachmentSupported") .
'</span>';
256 $formmail->withmaindocfile = -1;
261 $formmail->withbody = 1;
262 $formmail->withdeliveryreceipt = 1;
263 $formmail->withcancel = 1;
268 $substitutionarray[
'__EMAIL__'] = $sendto;
269 $substitutionarray[
'__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ?
'<img src="'.DOL_MAIN_URL_ROOT.
'/public/emailing/mailing-read.php?tag='.urlencode($object->thirdparty->tag).
'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).
'" width="1" height="1" style="width:1px;height:1px" border="0"/>' :
'';
270 $substitutionarray[
'__PERSONALIZED__'] =
'';
271 $substitutionarray[
'__CONTACTCIVNAME__'] =
'';
274 'mode' =>
'formemail'
279 $formmail->substit = $substitutionarray;
282 $formmail->param[
'action'] = $action;
283 $formmail->param[
'models'] = $modelmail;
284 $formmail->param[
'models_id'] =
GETPOST(
'modelmailselected',
'int') ?
GETPOST(
'modelmailselected',
'int') :
'-1';
285 $formmail->param[
'id'] = join(
',', $arrayofselected);
287 if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && count($listofselectedrecipientobjid) > $conf->global->MAILING_LIMIT_SENDBYWEB) {
288 $langs->load(
"errors");
289 print
img_warning().
' '.$langs->trans(
'WarningNumberOfRecipientIsRestrictedInMassAction', $conf->global->MAILING_LIMIT_SENDBYWEB);
290 print
' - <a href="javascript: window.history.go(-1)">'.$langs->trans(
"GoBack").
'</a>';
291 $arrayofmassactions = array();
293 print $formmail->get_form();
299 if ($massaction ==
'edit_extrafields') {
300 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
301 $elementtype = $objecttmp->element;
305 $extrafields->fetch_name_optionals_label($elementtype);
306 $extrafields_list = $extrafields->attributes[$elementtype][
'label'];
308 $formquestion = array();
309 if (!empty($extrafields_list)) {
310 $myParamExtra = $object->showOptionals($extrafields,
'create');
312 $formquestion[] = array(
314 'value' =>
$form->selectarray(
'extrafield-key-to-update', $extrafields_list,
GETPOST(
'extrafield-key-to-update'), 1)
318 $outputShowOutputFields =
'<div class="extrafields-inputs">';
320 foreach ($extrafields_list as $extraKey => $extraLabel) {
321 $outputShowOutputFields.=
'<div class="mass-action-extrafield" data-extrafield="'.$extraKey.
'" style="display:none;" >';
322 $outputShowOutputFields.=
'<br><span>'. $langs->trans(
'NewValue').
'</span>';
323 $outputShowOutputFields.= $extrafields->showInputField($extraKey,
'',
'', $keysuffix,
'', 0, $objecttmp->id, $objecttmp->table_element);
324 $outputShowOutputFields.=
'</div>';
326 $outputShowOutputFields.=
'<script>
328 $("#extrafield-key-to-update").on(\'change\',function(){
329 let selectedExtrtafield = $(this).val();
330 if($(".extrafields-inputs .product_extras_"+selectedExtrtafield) != undefined){
331 $(".mass-action-extrafield").hide();
332 $(".mass-action-extrafield[data-extrafield=" + selectedExtrtafield + "]").show();
337 $outputShowOutputFields.=
'</div>';
341 $formquestion[] = array(
343 'value' => $outputShowOutputFields
346 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmEditExtrafield"), $langs->trans(
"ConfirmEditExtrafieldQuestion", count($toselect)),
"confirm_edit_value_extrafields", $formquestion, 1, 0, 200, 500, 1);
352 if ($massaction ==
'preenable') {
353 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassEnabling"), $langs->trans(
"ConfirmMassEnablingQuestion", count($toselect)),
"enable",
null,
'yes', 0, 200, 500, 1);
355 if ($massaction ==
'predisable') {
356 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassDisabling"), $langs->trans(
"ConfirmMassDisablingQuestion", count($toselect)),
"disable",
null,
'', 0, 200, 500, 1);
358 if ($massaction ==
'presetcommercial') {
359 $formquestion = array();
360 $userlist =
$form->select_dolusers(
'',
'', 0,
null, 0,
'',
'', 0, 0, 0,
'AND u.statut = 1', 0,
'',
'', 0, 1);
361 $formquestion[] = array(
'type' =>
'other',
362 'name' =>
'affectedcommercial',
363 'label' =>
$form->editfieldkey(
'AllocateCommercial',
'commercial_id',
'', $object, 0),
364 'value' =>
$form->multiselectarray(
'commercial', $userlist,
null, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0,
'',
'',
'', 1));
365 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmAllocateCommercial"), $langs->trans(
"ConfirmAllocateCommercialQuestion", count($toselect)),
"affectcommercial", $formquestion, 1, 0, 200, 500, 1);
367 if ($massaction ==
'preapproveleave') {
368 print
$form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassLeaveApproval"), $langs->trans(
"ConfirmMassLeaveApprovalQuestion", count($toselect)),
"approveleave",
null,
'yes', 0, 200, 500, 1);
373 'toselect' => isset($toselect) ? $toselect : array(),
374 'uploaddir' => isset($uploaddir) ? $uploaddir :
null,
375 'massaction' => $massaction
378 $reshook = $hookmanager->executeHooks(
'doPreMassActions', $parameters, $object, $action);
382 print $hookmanager->resPrint;
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
isModEnabled($module)
Is Dolibarr module enabled.