dolibarr 21.0.0-beta
cibles.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005-2024 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
32require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
33require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
38
39
40'
41@phan-var-force array{0:string,1:string} $bctag From main.inc
42';
52// Load translation files required by the page
53$langs->loadLangs(array("mails", "admin"));
54
55$action = GETPOST('action', 'aZ09');
56$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
57$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
58$mode = GETPOST('mode', 'aZ'); // The display mode ('list', 'kanban', 'hierarchy', 'calendar', 'gantt', ...)
59
60// Load variable for pagination
61$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
62$sortfield = GETPOST('sortfield', 'aZ09comma');
63$sortorder = GETPOST('sortorder', 'aZ09comma');
64$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
65if (empty($page) || $page == -1) {
66 $page = 0;
67} // If $page is not defined, or '' or -1
68$offset = $limit * $page;
69$pageprev = $page - 1;
70$pagenext = $page + 1;
71if (!$sortfield) {
72 $sortfield = "mc.statut,email";
73}
74if (!$sortorder) {
75 $sortorder = "DESC,ASC";
76}
77
78$id = GETPOSTINT('id');
79$rowid = GETPOSTINT('rowid');
80$search_lastname = GETPOST("search_lastname", 'alphanohtml');
81$search_firstname = GETPOST("search_firstname", 'alphanohtml');
82$search_email = GETPOST("search_email", 'alphanohtml');
83$search_other = GETPOST("search_other", 'alphanohtml');
84$search_dest_status = GETPOST('search_dest_status', 'int');
85
86// Search modules dirs
87$modulesdir = dolGetModulesDirs('/mailings');
88
89$object = new Mailing($db);
90$result = $object->fetch($id);
91
92// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
93$hookmanager->initHooks(array('ciblescard', 'globalcard'));
94
95$sqlmessage = '';
96$mesgs = array();
97
98// List of sending methods
99$listofmethods = array();
100//$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
101$listofmethods['mail'] = 'PHP mail function';
102//$listofmethods['simplemail']='Simplemail class';
103$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
104if (version_compare(phpversion(), '7.0', '>=')) {
105 $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
106}
107
108// Security check
109if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
111}
112if (empty($action) && empty($object->id)) {
113 accessforbidden('Object not found');
114}
115
116$permissiontoread = $user->hasRight('maling', 'lire');
117$permissiontocreate = $user->hasRight('mailing', 'creer');
118$permissiontovalidatesend = $user->hasRight('mailing', 'valider');
119$permissiontodelete = $user->hasRight('mailing', 'supprimer');
120
121
122/*
123 * Actions
124 */
125if (GETPOST('cancel', 'alpha')) {
126 $action = 'list';
127 $massaction = '';
128}
129if (!GETPOST('confirmmassaction', 'alpha')) {
130 $massaction = '';
131}
132
133if ($action == 'add' && $permissiontocreate) { // Add recipients
134 $module = GETPOST("module", 'alpha');
135 $result = -1;
136 $obj = null;
137
138 foreach ($modulesdir as $dir) {
139 // Load modules attributes in arrays (name, numero, orders) from dir directory
140 //print $dir."\n<br>";
141 dol_syslog("Scan directory ".$dir." for modules");
142
143 // Loading Class
144 $file = $dir."/".$module.".modules.php";
145 $classname = "mailing_".$module;
146
147 if (file_exists($file)) {
148 include_once $file;
149
150 // Add targets into database
151 dol_syslog("Call add_to_target() on class ".$classname." evenunsubscribe=".$object->evenunsubscribe);
152
153 $obj = null;
154 if (class_exists($classname)) {
155 $obj = new $classname($db);
156 '@phan-var-force MailingTargets $obj';
157 $obj->evenunsubscribe = $object->evenunsubscribe;
158
159 $result = $obj->add_to_target($id);
160
161 $sqlmessage = $obj->sql;
162 } else {
163 $result = -1;
164 break;
165 }
166 }
167 }
168 if ($result > 0) {
169 // If status of emailing is sent completely, change to to send partially
170 if ($object->status == $object::STATUS_SENTCOMPLETELY) {
171 $object->setStatut($object::STATUS_SENTPARTIALY);
172 }
173
174 setEventMessages($langs->trans("XTargetsAdded", $result), null, 'mesgs');
175 $action = '';
176 }
177 if ($result == 0) {
178 setEventMessages($langs->trans("WarningNoEMailsAdded"), null, 'warnings');
179 }
180 if ($result < 0 && is_object($obj)) {
181 setEventMessages($langs->trans("Error").($obj->error ? ' '.$obj->error : ''), null, 'errors');
182 }
183}
184
185if (GETPOSTINT('clearlist') && $permissiontocreate) {
186 // Loading Class
187 $obj = new MailingTargets($db);
188 $obj->clear_target($id);
189 /* Avoid this to allow reposition
190 header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
191 exit;
192 */
193}
194
195if (GETPOSTINT('exportcsv') && $permissiontoread) {
196 $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'.csv';
197 header('Content-Type: text/csv');
198 header('Content-Disposition: attachment;filename='.$completefilename);
199
200 // List of selected targets
201 $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
202 $sql .= " mc.source_id, mc.source_type, mc.error_text";
203 $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
204 $sql .= " WHERE mc.fk_mailing = ".((int) $object->id);
205 $sql .= $db->order($sortfield, $sortorder);
206
207 $resql = $db->query($sql);
208 if ($resql) {
209 $num = $db->num_rows($resql);
210 $sep = ',';
211
212 while ($obj = $db->fetch_object($resql)) {
213 print $obj->rowid.$sep;
214 print '"'.$obj->lastname.'"'.$sep;
215 print '"'.$obj->firstname.'"'.$sep;
216 print $obj->email.$sep;
217 print $obj->other.$sep;
218 print $obj->tms.$sep;
219 print $obj->source_type.$sep;
220 print $obj->source_id.$sep;
221 print $obj->date_envoi.$sep;
222 print $obj->status.$sep;
223 print '"'.$obj->error_text.'"'.$sep;
224 print "\n";
225 }
226
227 exit;
228 } else {
229 dol_print_error($db);
230 }
231 exit;
232}
233
234if ($action == 'delete' && $permissiontocreate) {
235 // Ici, rowid indique le destinataire et id le mailing
236 $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid = ".((int) $rowid);
237 $resql = $db->query($sql);
238 if ($resql) {
239 if (!empty($id)) {
240 $obj = new MailingTargets($db);
241 $obj->update_nb($id);
242
243 setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
244 } else {
245 header("Location: list.php");
246 exit;
247 }
248 } else {
249 dol_print_error($db);
250 }
251}
252
253if ($action == "confirm_reset_target" && $permissiontocreate) {
254 if ($object->id > 0) {
255 $db->begin();
256 $nbok = 0;
257 $error = 0;
258 foreach ($toselect as $toselectid) {
259 $result = $object->resetTargetErrorStatus($user, $toselectid);
260 if ($result < 0) {
261 setEventMessages($object->error, $object->errors, 'errors');
262 $error++;
263 break;
264 } elseif ($result > 0) {
265 $nbok++;
266 } else {
267 setEventMessages($object->error, $object->errors, 'errors');
268 $error++;
269 }
270 }
271 if (!$error) {
272 setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
273 $db->commit();
274 } else {
275 $db->rollback();
276 }
277 }
278}
279
280// Purge search criteria
281if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
282 $search_lastname = '';
283 $search_firstname = '';
284 $search_email = '';
285 $search_other = '';
286 $search_dest_status = '';
287 $toselect = array();
288}
289
290// Action update description of emailing
291if (($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') && $permissiontocreate) {
292 $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
293
294 if ($action == 'settitle') { // Test on permission already done
295 $object->title = trim(GETPOST('title', 'alpha'));
296 } elseif ($action == 'setemail_from') { // Test on permission already done
297 $object->email_from = trim(GETPOST('email_from', 'alphawithlgt')); // Must allow 'name <email>'
298 } elseif ($action == 'setemail_replyto') { // Test on permission already done
299 $object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
300 } elseif ($action == 'setemail_errorsto') { // Test on permission already done
301 $object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
302 } elseif ($action == 'settitle' && empty($object->title)) { // Test on permission already done
303 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
304 } elseif ($action == 'setfrom' && empty($object->email_from)) { // Test on permission already done
305 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
306 } elseif ($action == 'setevenunsubscribe') { // Test on permission already done
307 $object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
308 }
309
310 if (!$mesg) {
311 $result = $object->update($user);
312 if ($result >= 0) {
313 header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
314 exit;
315 }
316 $mesg = $object->error;
317 }
318
319 setEventMessages($mesg, $mesgs, 'errors');
320 $action = "";
321}
322
323
324/*
325 * View
326 */
327
328llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES:M&oacute;dulo_Mailing');
329
330$form = new Form($db);
331$formmailing = new FormMailing($db);
332$arrayofselected = is_array($toselect) ? $toselect : array();
333$totalarray = [
334 'nbfield' => 0,
335];
336
337if ($object->fetch($id) >= 0) {
338 $head = emailing_prepare_head($object);
339
340 print dol_get_fiche_head($head, 'targets', $langs->trans("Mailing"), -1, 'email');
341
342 $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
343
344 $morehtmlref = '<div class="refidno">';
345 // Ref customer
346 $morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, 0, 'string', '', 0, 1);
347 $morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, 0, 'string', '', null, null, '', 1);
348 $morehtmlref .= '</div>';
349
350 $morehtmlstatus = '';
351 $nbtry = $nbok = 0;
352 if ($object->status == $object::STATUS_SENTPARTIALY || $object->status == $object::STATUS_SENTCOMPLETELY) {
353 $nbtry = $object->countNbOfTargets('alreadysent');
354 $nbko = $object->countNbOfTargets('alreadysentko');
355 $nbok = ($nbtry - $nbko);
356
357 $morehtmlstatus .= ' ('.$nbtry.'/'.$object->nbemail;
358 if ($nbko) {
359 $morehtmlstatus .= ' - '.$nbko.' '.$langs->trans("Error");
360 }
361 $morehtmlstatus .= ') &nbsp; ';
362 }
363
364 dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
365
366 print '<div class="fichecenter">';
367 print '<div class="fichehalfleft">';
368 print '<div class="underbanner clearboth"></div>';
369
370 print '<table class="border centpercent tableforfield">';
371
372 // From
373 print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
374 $emailarray = CMailFile::getArrayAddress($object->email_from);
375 foreach ($emailarray as $email => $name) {
376 if ($name && $name != $email) {
377 print dol_escape_htmltag($name).' &lt;'.$email;
378 print '&gt;';
379 if (!isValidEmail($email)) {
380 $langs->load("errors");
381 print img_warning($langs->trans("ErrorBadEMail", $email));
382 }
383 } else {
384 print dol_print_email($object->email_from, 0, 0, 0, 0, 1);
385 }
386 }
387
388 print '</td></tr>';
389
390 // Errors to
391 if ($object->messtype != 'sms') {
392 print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
393 $emailarray = CMailFile::getArrayAddress($object->email_errorsto);
394 foreach ($emailarray as $email => $name) {
395 if ($name != $email) {
396 print dol_escape_htmltag($name).' &lt;'.$email;
397 print '&gt;';
398 if ($email && !isValidEmail($email)) {
399 $langs->load("errors");
400 print img_warning($langs->trans("ErrorBadEMail", $email));
401 } elseif ($email && !isValidMailDomain($email)) {
402 $langs->load("errors");
403 print img_warning($langs->trans("ErrorBadMXDomain", $email));
404 }
405 } else {
406 print dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1);
407 }
408 }
409 print '</td></tr>';
410 }
411
412 // Reply to
413 if ($object->messtype != 'sms') {
414 print '<tr><td>';
415 print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string');
416 print '</td><td>';
417 print $form->editfieldval("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string');
418 $email = CMailFile::getValidAddress($object->email_replyto, 2);
419 if ($action != 'editemail_replyto') {
420 if ($email && !isValidEmail($email)) {
421 $langs->load("errors");
422 print img_warning($langs->trans("ErrorBadEMail", $email));
423 } elseif ($email && !isValidMailDomain($email)) {
424 $langs->load("errors");
425 print img_warning($langs->trans("ErrorBadMXDomain", $email));
426 }
427 }
428 print '</td></tr>';
429 }
430
431 print '</table>';
432 print '</div>';
433
434
435 print '<div class="fichehalfright">';
436 print '<div class="underbanner clearboth"></div>';
437
438 print '<table class="border centpercent tableforfield">';
439
440 // Number of distinct emails
441 print '<tr><td>';
442 print $langs->trans("TotalNbOfDistinctRecipients");
443 print '</td><td>';
444 $nbemail = ($object->nbemail ? $object->nbemail : 0);
445 if (is_numeric($nbemail)) {
446 $text = '';
447 if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) {
448 if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) {
449 $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
450 } else {
451 $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed');
452 }
453 }
454 if (empty($nbemail)) {
455 $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
456 }
457 if ($text) {
458 // @phan-suppress-next-line PhanPluginSuspiciousParamPosition
459 print $form->textwithpicto($nbemail, $text, 1, 'warning');
460 } else {
461 print $nbemail;
462 }
463 }
464 print '</td></tr>';
465
466 print '<tr><td>';
467 print $langs->trans("MAIN_MAIL_SENDMODE");
468 print '</td><td>';
469 if ($object->messtype != 'sms') {
470 if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
471 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
472 } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) {
473 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')];
474 } else {
475 $text = $listofmethods['mail'];
476 }
477 print $text;
478 if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
479 if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
480 print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')</span>';
481 }
482 } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
483 print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
484 }
485 } else {
486 print 'SMS ';
487 print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
488 }
489 print '</td></tr>';
490
491 // Other attributes. Fields from hook formObjectOptions and Extrafields.
492 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
493
494 print '</table>';
495 print '</div>';
496 print '</div>';
497
498 print '<div class="clearboth"></div>';
499
500 print dol_get_fiche_end();
501
502 print '<br>';
503
504
505 $newcardbutton = '';
506 $allowaddtarget = ($object->status == $object::STATUS_DRAFT);
507 if (GETPOST('allowaddtarget')) {
508 $allowaddtarget = 1;
509 }
510 if (!$allowaddtarget) {
511 $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&allowaddtarget=1', '', $user->hasRight('mailing', 'creer'));
512 }
513
514 // Show email selectors
515 if ($allowaddtarget && $user->hasRight('mailing', 'creer')) {
516 print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ? info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
517
518 print '<div class="div-table-responsive">';
519 print '<div class="tagtable centpercentwithout1imp liste_titre_bydiv borderbottom" id="tablelines">';
520
521 print '<div class="tagtr liste_titre">';
522 print '<div class="tagtd"></div>';
523 print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
524 print '<div class="tagtd center maxwidth150">';
525 if ($object->messtype != 'sms') {
526 print $langs->trans("NbOfUniqueEMails");
527 } else {
528 print $langs->trans("NbOfUniquePhones");
529 }
530 print '</div>';
531 print '<div class="tagtd left"><div class="inline-block">'.$langs->trans("Filters").'</div>';
532 if ($object->messtype != 'sms') {
533 print ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=" inline-block">'.$langs->trans("EvenUnsubscribe").' ';
534 print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
535 print '</div>';
536 }
537 print '</div>';
538 print '<div class="tagtd">&nbsp;</div>';
539 print '</div>'; // End tr
540
541 clearstatcache();
542
543 foreach ($modulesdir as $dir) {
544 $modulenames = array();
545
546 // Load modules attributes in arrays (name, numero, orders) from dir directory
547 //print $dir."\n<br>";
548 dol_syslog("Scan directory ".$dir." for modules");
549 $handle = @opendir($dir);
550 if (is_resource($handle)) {
551 while (($file = readdir($handle)) !== false) {
552 if (substr($file, 0, 1) != '.' && substr($file, 0, 3) != 'CVS') {
553 $reg = array();
554 if (preg_match("/(.*)\.modules\.php$/i", $file, $reg)) {
555 if ($reg[1] == 'example') {
556 continue;
557 }
558 $modulenames[] = $reg[1];
559 }
560 }
561 }
562 closedir($handle);
563 }
564
565 // Sort $modulenames
566 sort($modulenames);
567
568 $var = true;
569
570 // Loop on each submodule
571 foreach ($modulenames as $modulename) {
572 // Loading Class
573 $file = $dir.$modulename.".modules.php";
574 $classname = "mailing_".$modulename;
575 require_once $file;
576
577 $obj = new $classname($db);
578 '@phan-var-force MailingTargets $obj';
579
580 // Check if qualified
581 $qualified = (is_null($obj->enabled) ? 1 : (int) dol_eval($obj->enabled, 1));
582
583 // Check dependencies
584 foreach ($obj->require_module as $key) {
585 if (empty($conf->$key->enabled) || (empty($user->admin) && $obj->require_admin)) {
586 $qualified = 0;
587 //print "Les prerequis d'activation du module mailing ne sont pas respectes. Il ne sera pas actif";
588 break;
589 }
590 }
591
592 // If module is qualified
593 if ($qualified) {
594 $var = !$var;
595
596 if ($allowaddtarget) {
597 print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
598 print '<input type="hidden" name="token" value="'.newToken().'">';
599 print '<input type="hidden" name="action" value="add">';
600 print '<input type="hidden" name="page_y" value="'.newToken().'">';
601 } else {
602 print '<div '.$bctag[$var].'>';
603 }
604
605 print '<div class="tagtd paddingleftimp marginleftonly paddingrightimp marginrightonly valignmiddle center">';
606 if (empty($obj->picto)) {
607 $obj->picto = 'generic';
608 }
609 print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle width25 size15x"');
610 print '</div>';
611 print '<div class="tagtd valignmiddle">'; // style="height: 4em"
612 print $obj->getDesc();
613 print '</div>';
614
615 $nbofrecipient = -1;
616
617 try {
618 $obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out.
619
620 $nbofrecipient = $obj->getNbOfRecipients('');
621 } catch (Exception $e) {
622 dol_syslog($e->getMessage(), LOG_ERR);
623 }
624
625 print '<div class="tagtd center valignmiddle">';
626 if ($nbofrecipient === '' || $nbofrecipient >= 0) {
627 print $nbofrecipient;
628 } else {
629 print $langs->trans("Error").' '.img_error($obj->error);
630 }
631 print '</div>';
632
633 print '<div class="tagtd left valignmiddle">';
634 if ($allowaddtarget) {
635 try {
636 $filter = $obj->formFilter();
637 } catch (Exception $e) {
638 dol_syslog($e->getMessage(), LOG_ERR);
639 }
640 if ($filter) {
641 print $filter;
642 } else {
643 print $langs->trans("None");
644 }
645 }
646 print '</div>';
647
648 print '<div class="tagtd right valignmiddle">';
649 if ($allowaddtarget) {
650 print '<input type="submit" class="button button-add small reposition" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
651 } else {
652 print '<input type="submit" class="button small disabled" disabled="disabled" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
653 //print $langs->trans("MailNoChangePossible");
654 print "&nbsp;";
655 }
656 print '</div>';
657
658 if ($allowaddtarget) {
659 print '</form>';
660 } else {
661 print '</div>';
662 }
663 }
664 }
665 } // End foreach dir
666
667 $parameters = array();
668 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
669 print $hookmanager->resPrint;
670
671 print '</div>'; // End table
672 print '</div>';
673
674 print '<br>';
675
676 if ($sqlmessage && $user->admin) {
677 print info_admin($langs->trans("SQLUsedForExport").':<br> '.$sqlmessage, 0, 0, '1', '', 'TechnicalInformation');
678 print '<br>';
679 }
680
681 print '<br>';
682 }
683
684 // List of selected targets
685 $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut as status, mc.date_envoi, mc.tms,";
686 $sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
687 $sql .= " COUNT(mu.rowid) as nb";
688 $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
689 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = mc.email";
690 $sql .= " WHERE mc.fk_mailing=".((int) $object->id);
691 $asearchcriteriahasbeenset = 0;
692 if ($search_lastname) {
693 $sql .= natural_search("mc.lastname", $search_lastname);
694 $asearchcriteriahasbeenset++;
695 }
696 if ($search_firstname) {
697 $sql .= natural_search("mc.firstname", $search_firstname);
698 $asearchcriteriahasbeenset++;
699 }
700 if ($search_email) {
701 $sql .= natural_search("mc.email", $search_email);
702 $asearchcriteriahasbeenset++;
703 }
704 if ($search_other) {
705 $sql .= natural_search("mc.other", $search_other);
706 $asearchcriteriahasbeenset++;
707 }
708 if ($search_dest_status != '' && (int) $search_dest_status >= -1) {
709 $sql .= " AND mc.statut = ".((int) $search_dest_status);
710 $asearchcriteriahasbeenset++;
711 }
712 $sql .= ' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text';
713 $sql .= $db->order($sortfield, $sortorder);
714
715
716 // Count total nb of records
717 $nbtotalofrecords = '';
718 if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
719 $result = $db->query($sql);
720 $nbtotalofrecords = $db->num_rows($result);
721 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
722 $page = 0;
723 $offset = 0;
724 }
725
726 // Fix/update nbemail on emailing record if it differs (may happen if user edit lines from database directly)
727 if (empty($asearchcriteriahasbeenset)) {
728 if ($nbtotalofrecords != $object->nbemail) {
729 dol_syslog("We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
730 //print "nbemail=".$object->nbemail." nbtotalofrecords=".$nbtotalofrecords;
731 $resultrefresh = $object->refreshNbOfTargets();
732 if ($resultrefresh < 0) {
733 dol_print_error($db, $object->error, $object->errors);
734 }
735 }
736 }
737 }
738
739 //$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
740 $sql .= $db->plimit($limit + 1, $offset);
741
742 $resql = $db->query($sql);
743 if ($resql) {
744 $num = $db->num_rows($resql);
745
746 $param = "&id=".$object->id;
747 //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
748 if ($limit > 0 && $limit != $conf->liste_limit) {
749 $param .= '&limit='.((int) $limit);
750 }
751 if ($search_lastname) {
752 $param .= "&search_lastname=".urlencode($search_lastname);
753 }
754 if ($search_firstname) {
755 $param .= "&search_firstname=".urlencode($search_firstname);
756 }
757 if ($search_email) {
758 $param .= "&search_email=".urlencode($search_email);
759 }
760 if ($search_other) {
761 $param .= "&search_other=".urlencode($search_other);
762 }
763
764 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
765 print '<input type="hidden" name="token" value="'.newToken().'">';
766 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
767 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
768 print '<input type="hidden" name="page" value="'.$page.'">';
769 print '<input type="hidden" name="id" value="'.$object->id.'">';
770 print '<input type="hidden" name="page_y" value="">';
771
772 $morehtmlcenter = '';
773 $arrayofmassactions = array();
774 if ($permissiontocreate) {
775 $arrayofmassactions['reset_target'] = img_picto('', 'refresh', 'class="pictofixedwidth"').$langs->trans("ResetMailingTargetMassaction");
776 }
777 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
778 $morehtmlcenter .= $massactionbutton .'<br>';
779
780 if ($object->status == $object::STATUS_DRAFT) {
781 $morehtmlcenter = '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ToClearAllRecipientsClickHere").'</span> <a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition smallpaddingimp">'.$langs->trans("TargetsReset").'</a>';
782 }
783 $morehtmlcenter .= ' &nbsp; <a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=exportcsv&token='.newToken().'&exportcsv=1&id='.$object->id.'">'.img_picto('', 'download', 'class="pictofixedwidth"').$langs->trans("Download").'</a>';
784
785 print '</form>';
786
787 print "\n<!-- Liste destinataires selectionnes -->\n";
788 print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
789 print '<input type="hidden" name="token" value="'.newToken().'">';
790 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
791 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
792 print '<input type="hidden" name="page" value="'.$page.'">';
793 print '<input type="hidden" name="id" value="'.$object->id.'">';
794 print '<input type="hidden" name="limit" value="'.$limit.'">';
795 print '<input type="hidden" name="page_y" value="">';
796
797 // @phan-suppress-next-line PhanPluginSuspiciousParamOrder
798 print_barre_liste($langs->trans("MailSelectedRecipients"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $morehtmlcenter, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1);
799
800 if ($massaction == 'reset_target') {
801 // Confirm reset
802 print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ConfirmResetMailingTargetMassaction"), $langs->trans("ConfirmResetMailingTargetMassactionQuestion"), "confirm_reset_target", null, '', 0, 0, 500, 1);
803 }
804
805 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
806 $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
807 $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
808 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
809
810 print '<div class="div-table-responsive">';
811 print '<table class="noborder centpercent">';
812
813 // Ligne des champs de filtres
814 print '<tr class="liste_titre_filter">';
815
816 // Action column
817 if ($conf->main_checkbox_left_column) {
818 print '<td class="liste_titre maxwidthsearch">';
819 $searchpicto = $form->showFilterButtons('left');
820 print $searchpicto;
821 print '</td>';
822 }
823 // EMail
824 print '<td class="liste_titre">';
825 print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
826 print '</td>';
827 // Name
828 print '<td class="liste_titre">';
829 print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
830 print '</td>';
831 // Firstname
832 print '<td class="liste_titre">';
833 print '<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
834 print '</td>';
835 // Other
836 print '<td class="liste_titre">';
837 print '<input class="flat maxwidth100" type="text" name="search_other" value="'.dol_escape_htmltag($search_other).'">';
838 print '</td>';
839 // Source
840 print '<td class="liste_titre">';
841 print '&nbsp;';
842 print '</td>';
843
844 // Date last update
845 print '<td class="liste_titre">';
846 print '&nbsp;';
847 print '</td>';
848
849 // Date sending
850 print '<td class="liste_titre">';
851 print '&nbsp;';
852 print '</td>';
853
854 // Status
855 print '<td class="liste_titre center parentonrightofpage">';
856 print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1, 'width100 onrightofpage');
857 print '</td>';
858
859 // Action column
860 if (empty($conf->main_checkbox_left_column)) {
861 print '<td class="liste_titre maxwidthsearch">';
862 $searchpicto = $form->showFilterButtons();
863 print $searchpicto;
864 print '</td>';
865 }
866
867 print '</tr>';
868
869 if ($page) {
870 $param .= "&page=".urlencode((string) ($page));
871 }
872
873 print '<tr class="liste_titre">';
874 // Action column
875 if ($conf->main_checkbox_left_column) {
876 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
877 $totalarray['nbfield']++;
878 }
879 print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
880 print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
881 print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
882 print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
883 print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", '', $sortfield, $sortorder, 'center ');
884 // Date last update
885 print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "mc.tms", $param, "", '', $sortfield, $sortorder, 'center ');
886 // Date sending
887 print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', '', $sortfield, $sortorder, 'center ');
888 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', '', $sortfield, $sortorder, 'center ');
889 // Action column
890 if (!$conf->main_checkbox_left_column) {
891 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
892 $totalarray['nbfield']++;
893 }
894 print '</tr>';
895
896 $i = 0;
897
898 if ($num) {
899 include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
900 include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
901 include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
902 include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
903 include_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
904
905 $objectstaticmember = new Adherent($db);
906 $objectstaticuser = new User($db);
907 $objectstaticcompany = new Societe($db);
908 $objectstaticcontact = new Contact($db);
909 $objectstaticeventorganization = new ConferenceOrBoothAttendee($db);
910
911 while ($i < min($num, $limit)) {
912 $obj = $db->fetch_object($resql);
913
914 print '<tr class="oddeven">';
915
916 // Action column
917 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
918 print '<td class="center">';
919 print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
920 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
921 $selected = 0;
922 if (in_array($obj->rowid, $arrayofselected)) {
923 $selected = 1;
924 }
925 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
926 }
927 if ($obj->status == $object::STATUS_DRAFT) { // Not sent yet
928 if ($user->hasRight('mailing', 'creer')) {
929 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
930 }
931 }
932 /*if ($obj->status == -1) // Sent with error
933 {
934 print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
935 }*/
936 print '</td>';
937 }
938
939 print '<td class="tdoverflowmax150">';
940 print img_picto($obj->email, 'email', 'class="paddingright"');
941 if ($obj->nb > 0) {
942 print img_warning($langs->trans("EmailOptedOut"), 'warning', 'pictofixedwidth');
943 }
944 print dol_escape_htmltag($obj->email);
945 print '</td>';
946
947 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
948
949 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
950
951 print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($obj->other).'"><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
952
953 print '<td class="center tdoverflowmax150">';
954 if (empty($obj->source_id) || empty($obj->source_type)) {
955 print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
956 } else {
957 if ($obj->source_type == 'member') {
958 $objectstaticmember->fetch($obj->source_id);
959 print $objectstaticmember->getNomUrl(1);
960 } elseif ($obj->source_type == 'user') {
961 $objectstaticuser->fetch($obj->source_id);
962 print $objectstaticuser->getNomUrl(1);
963 } elseif ($obj->source_type == 'thirdparty') {
964 $objectstaticcompany->fetch($obj->source_id);
965 print $objectstaticcompany->getNomUrl(1);
966 } elseif ($obj->source_type == 'contact') {
967 $objectstaticcontact->fetch($obj->source_id);
968 print $objectstaticcontact->getNomUrl(1);
969 } elseif ($obj->source_type == 'eventorganizationattendee') {
970 $objectstaticeventorganization->fetch($obj->source_id);
971 print $objectstaticeventorganization->getNomUrl(1);
972 } else {
973 print $obj->source_url;
974 }
975 }
976 print '</td>';
977
978 // Date last update
979 print '<td class="center nowraponall">';
980 print dol_print_date(dol_stringtotime($obj->tms), 'dayhour');
981 print '</td>';
982
983 // Date sent
984 print '<td class="center nowraponall">';
985 if ($obj->status != $object::STATUS_DRAFT) { // If status of target line is not draft
986 // Date sent
987 print $obj->date_envoi; // @TODO Must store date in date format
988 }
989 print '</td>';
990
991 // Status of recipient sending email (Warning != status of emailing)
992 print '<td class="nowrap center">';
993 if ($obj->status == $object::STATUS_DRAFT) { // If status of target line is not draft
994 print $object::libStatutDest((int) $obj->status, 2, '');
995 } else {
996 print $object::libStatutDest((int) $obj->status, 2, $obj->error_text);
997 }
998 print '</td>';
999
1000 // Action column
1001 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1002 print '<td class="center">';
1003 print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
1004 if ($obj->status == $object::STATUS_DRAFT) { // If status of target line is not sent yet
1005 if ($user->hasRight('mailing', 'creer')) {
1006 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
1007 }
1008 }
1009 /*if ($obj->status == -1) // Sent with error
1010 {
1011 print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
1012 }*/
1013 print '</td>';
1014 }
1015 print '</tr>';
1016
1017 $i++;
1018 }
1019 } else {
1020 if ($object->status < $object::STATUS_SENTPARTIALY) {
1021 print '<tr><td colspan="9">';
1022 print '<span class="opacitymedium">'.$langs->trans("NoTargetYet").'</span>';
1023 print '</td></tr>';
1024 } else {
1025 print '<tr><td colspan="9">';
1026 print '<span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span>';
1027 print '</td></tr>';
1028 }
1029 }
1030 print "</table><br>";
1031 print '</div>';
1032
1033 print '</form>';
1034
1035 $db->free($resql);
1036 } else {
1037 dol_print_error($db);
1038 }
1039
1040 print "\n<!-- Fin liste destinataires selectionnes -->\n";
1041}
1042
1043// End of page
1044llxFooter();
1045$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input=array(), $morecss='', $htmlname='', $forcenojs=0, $moreparam='')
On/off button to change a property status of an object This uses the ajax service objectonoff....
Definition ajax.lib.php:750
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage members of a foundation.
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
static getArrayAddress($address)
Return a formatted array of address string for SMTP protocol.
Class for ConferenceOrBoothAttendee.
Class to manage contact/addresses.
Class to manage generation of HTML components Only common components must be here.
Class to offer components to list and upload files.
Class to manage emailings module.
Parent class of emailing target selectors modules.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
Definition date.lib.php:431
llxFooter()
Footer empty.
Definition document.php:107
emailing_prepare_head(Mailing $object)
Prepare array with list of tabs.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
isValidMailDomain($mail)
Return true if email has a domain name that can be resolved to MX type.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete 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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_error($titlealt='default')
Show error logo.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.