dolibarr  20.0.0-beta
mails_ticket.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
33 
34 $action = GETPOST('action', 'aZ09');
35 $cancel = GETPOST('cancel', 'aZ09');
36 
37 $usersignature = $user->signature;
38 // For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
39 if ($action == 'test' || $action == 'send') {
40  $usersignature = dol_string_nohtmltag($usersignature, 2);
41 }
42 
43 $substitutionarrayfortest = array(
44  '__ID__' => 'TESTIdRecord',
45  '__USER_LOGIN__' => $user->login,
46  '__USER_EMAIL__' => $user->email,
47  '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
48  '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
49  '__LASTNAME__' => 'RecipientLastname',
50  '__FIRSTNAME__' => 'RecipientFirstname',
51  '__ADDRESS__'=> 'RecipientAddress',
52  '__ZIP__'=> 'RecipientZip',
53  '__TOWN_'=> 'RecipientTown',
54  '__COUNTRY__'=> 'RecipientCountry',
55  '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
56 );
57 complete_substitutions_array($substitutionarrayfortest, $langs);
58 
59 // List of sending methods
60 $listofmethods = array();
61 $listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
62 $listofmethods['mail'] = 'PHP mail function';
63 //$listofmethods['simplemail']='Simplemail class';
64 $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
65 if (version_compare(phpversion(), '7.0', '>=')) {
66  $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
67 }
68 
69 // Security check
70 if (!$user->admin) {
72 }
73 
74 
75 /*
76  * Actions
77  */
78 
79 if ($action == 'update' && !$cancel) {
80  // Send mode parameters
81  dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_TICKET", GETPOST("MAIN_MAIL_SENDMODE_TICKET"), 'chaine', 0, '', $conf->entity);
82  dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity);
83  dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity);
84  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_TICKET", GETPOST("MAIN_MAIL_SMTPS_ID_TICKET"), 'chaine', 0, '', $conf->entity);
85  if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_TICKET")) {
86  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_TICKET", GETPOST("MAIN_MAIL_SMTPS_PW_TICKET", 'none'), 'chaine', 0, '', $conf->entity);
87  }
88  if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET")) {
89  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
90  }
91  if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET")) {
92  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
93  }
94  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
95  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_TICKET"), 'chaine', 0, '', $conf->entity);
96  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET"), 'chaine', 0, '', $conf->entity);
97 
98  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
99  exit;
100 }
101 
102 
103 // Actions to send emails
104 $id = 0;
105 $actiontypecode = ''; // Not an event for agenda
106 $triggersendname = ''; // Disable triggers
107 $paramname = 'id';
108 $mode = 'emailfortest';
109 $trackid = (($action == 'testhtml') ? "testhtml" : "test");
110 $sendcontext = 'ticket'; // Force to use dedicated context of setup for ticket
111 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
112 
113 if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
114  $action = 'test';
115 }
116 if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
117  $action = 'testhtml';
118 }
119 
120 
121 
122 
123 /*
124  * View
125  */
126 
127 $form = new Form($db);
128 
129 $linuxlike = 1;
130 if (preg_match('/^win/i', PHP_OS)) {
131  $linuxlike = 0;
132 }
133 if (preg_match('/^mac/i', PHP_OS)) {
134  $linuxlike = 0;
135 }
136 
137 if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) {
138  $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default';
139 }
140 $port = getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : ini_get('smtp_port');
141 if (!$port) {
142  $port = 25;
143 }
144 $server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : ini_get('SMTP');
145 if (!$server) {
146  $server = '127.0.0.1';
147 }
148 
149 
150 $wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
151 llxHeader('', $langs->trans("Setup"), $wikihelp);
152 
153 print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
154 
155 $head = email_admin_prepare_head();
156 
157 // List of oauth services
158 $oauthservices = array();
159 
160 foreach ($conf->global as $key => $val) {
161  if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
162  $key = preg_replace('/^OAUTH_/', '', $key);
163  $key = preg_replace('/_ID$/', '', $key);
164  if (preg_match('/^.*-/', $key)) {
165  $name = preg_replace('/^.*-/', '', $key);
166  } else {
167  $name = $langs->trans("NoName");
168  }
169  $provider = preg_replace('/-.*$/', '', $key);
170  $provider = ucfirst(strtolower($provider));
171 
172  $oauthservices[$key] = $name." (".$provider.")";
173  }
174 }
175 
176 
177 if ($action == 'edit') {
178  if ($conf->use_javascript_ajax) {
179  print "\n".'<script type="text/javascript">';
180  print 'jQuery(document).ready(function () {
181  function initfields()
182  {
183  if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'default\')
184  {
185  jQuery(".hideifdefault").hide();
186  }
187  else
188  {
189  jQuery(".hideifdefault").show();
190  }
191 
192  if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\')
193  {
194  console.log("I choose php mail mode");
195  jQuery(".drag").hide();
196  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
197  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").prop("disabled", true);
198  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
199  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").prop("disabled", true);
200  jQuery(".smtp_method").hide();
201  jQuery(".smtp_auth_method").hide();
202  ';
203  if ($linuxlike) {
204  print '
205  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").hide();
206  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").hide();
207  jQuery("#smtp_server_mess").show();
208  jQuery("#smtp_port_mess").show();
209  ';
210  } else {
211  print '
212  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").prop("disabled", true);
213  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").prop("disabled", true);
214  jQuery("#smtp_server_mess").hide();
215  jQuery("#smtp_port_mess").hide();
216  ';
217  }
218  print '
219  }
220  if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\')
221  {
222  console.log("I choose smtps mail mode");
223  jQuery(".drag").show();
224  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
225  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
226  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
227  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
228  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
229  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
230  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
231  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
232  jQuery("#smtp_server_mess").hide();
233  jQuery("#smtp_port_mess").hide();
234  jQuery(".smtp_method").show();
235  jQuery(".smtp_auth_method").show();
236  }
237  if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\')
238  {
239  console.log("I choose swiftmailer mail mode");
240  jQuery(".drag").show();
241  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
242  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
243  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
244  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
245  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
246  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
247  jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
248  jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
249  jQuery("#smtp_server_mess").hide();
250  jQuery("#smtp_port_mess").hide();
251  jQuery(".smtp_method").show();
252  jQuery(".smtp_auth_method").show();
253  }
254  }
255  function change_smtp_auth_method() {
256  console.log("Call smtp auth method");
257  if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
258  jQuery(".smtp_pw").hide();
259  jQuery(".smtp_oauth_service").show();
260  } else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
261  jQuery(".smtp_pw").hide();
262  jQuery(".smtp_oauth_service").show();
263  } else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
264  jQuery(".smtp_pw").hide();
265  jQuery(".smtp_oauth_service").hide();
266  } else {
267  jQuery(".smtp_pw").show();
268  jQuery(".smtp_oauth_service").hide();
269  }
270  }
271 
272  initfields();
273  change_smtp_auth_method();
274 
275  jQuery("#MAIN_MAIL_SENDMODE_TICKET").change(function() {
276  initfields();
277  change_smtp_auth_method();
278  });
279  jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
280  change_smtp_auth_method();
281  });
282  jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
283  if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val() == 1)
284  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
285  });
286  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").change(function() {
287  if (jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val() == 1)
288  jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
289  });
290  })';
291  print '</script>'."\n";
292  }
293 
294  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
295  print '<input type="hidden" name="token" value="'.newToken().'">';
296  print '<input type="hidden" name="action" value="update">';
297 
298  print dol_get_fiche_head($head, 'common_ticket', '', -1);
299 
300  print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
301  print "<br><br>\n";
302 
303 
304  clearstatcache();
305 
306  print '<table class="noborder centpercent">';
307  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
308 
309  // Method
310 
311  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
312 
313  // SuperAdministrator access only
314  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
315  print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_TICKET);
316  } else {
317  $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
318  if (empty($text)) {
319  $text = $langs->trans("Undefined");
320  }
321  $htmltext = $langs->trans("ContactSuperAdminForChange");
322  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
323  print '<input type="hidden" name="MAIN_MAIL_SENDMODE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET').'">';
324  }
325  print '</td></tr>';
326 
327  // Host server
328 
329  print '<tr class="oddeven hideifdefault">';
330  if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
331  print '<td>';
332  print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
333  print '</td><td>';
334  print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
335  print '</td>';
336  } else {
337  print '<td>';
338  $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '');
339  $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined");
340  if ($linuxlike) {
341  print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
342  } else {
343  print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
344  }
345  print '</td><td>';
346  // SuperAdministrator access only
347  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
348  print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
349  print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
350  print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
351  print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
352  } else {
353  $text = !empty($mainserver) ? $mainserver : $smtpserver;
354  $htmltext = $langs->trans("ContactSuperAdminForChange");
355  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
356  print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" value="'.$mainserver.'">';
357  }
358  print '</td>';
359  }
360  print '</tr>';
361 
362  // Port
363 
364  print '<tr class="oddeven hideifdefault hideonmodemail"><td>';
365  if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
366  print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
367  print '</td><td>';
368  print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
369  } else {
370  $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '');
371  $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined");
372  if ($linuxlike) {
373  print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
374  } else {
375  print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
376  }
377  print '</td><td>';
378  // SuperAdministrator access only
379  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
380  print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" size="3" value="'.$mainport.'">';
381  print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET_sav" name="MAIN_MAIL_SMTP_PORT_TICKET_sav" value="'.$mainport.'">';
382  print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
383  } else {
384  $text = (!empty($mainport) ? $mainport : $smtpport);
385  $htmltext = $langs->trans("ContactSuperAdminForChange");
386  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
387  print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" value="'.$mainport.'">';
388  }
389  }
390  print '</td></tr>';
391 
392  // AUTH method
393  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
394  print '<tr class="oddeven smtp_auth_method hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
395  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
396  // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
397  print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
398  print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
399  print '&nbsp; &nbsp; &nbsp;';
400  print '<input type="radio" id="radio_plain" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="PLAIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
401  print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
402  print '&nbsp; &nbsp; &nbsp;';
403  print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'XOAUTH2' ? ' checked' : '').'> ';
404  print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
405  } else {
406  $value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
407  $htmltext = $langs->trans("ContactSuperAdminForChange");
408  print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
409  print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
410  }
411  print '</td></tr>';
412  }
413 
414  // ID
415  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
416  $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : '');
417  print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
418  // SuperAdministrator access only
419  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
420  print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_TICKET" size="32" value="'.$mainstmpid.'">';
421  } else {
422  $htmltext = $langs->trans("ContactSuperAdminForChange");
423  print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_TICKET, $htmltext, 1, 'superadmin');
424  print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_TICKET" value="'.$mainstmpid.'">';
425  }
426  print '</td></tr>';
427  }
428 
429  // PW
430  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
431  $mainsmtppw = (getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_PW_TICKET : '');
432  print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
433  // SuperAdministrator access only
434  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
435  print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_TICKET" size="32" value="'.$mainsmtppw.'">';
436  } else {
437  $htmltext = $langs->trans("ContactSuperAdminForChange");
438  print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_TICKET, $htmltext, 1, 'superadmin');
439  print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_TICKET" value="'.$mainsmtppw.'">';
440  }
441  print '</td></tr>';
442  }
443 
444  // OAUTH service provider
445  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
446  print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
447  // SuperAdministrator access only
448  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
449  print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET);
450  } else {
451  $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
452  if (empty($text)) {
453  $text = $langs->trans("Undefined");
454  }
455  $htmltext = $langs->trans("ContactSuperAdminForChange");
456  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
457  print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET').'">';
458  }
459  print '</td></tr>';
460  }
461 
462  // TLS
463 
464  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
465  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
466  if (function_exists('openssl_open')) {
467  print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_TICKET : 0), 1);
468  } else {
469  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
470  }
471  } else {
472  print yn(0).' ('.$langs->trans("NotSupported").')';
473  }
474  print '</td></tr>';
475 
476  // STARTTLS
477 
478  print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
479  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
480  if (function_exists('openssl_open')) {
481  print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET : 0), 1);
482  } else {
483  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
484  }
485  } else {
486  print yn(0).' ('.$langs->trans("NotSupported").')';
487  }
488  print '</td></tr>';
489 
490  // SMTP_ALLOW_SELF_SIGNED_TICKET
491  print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
492  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
493  if (function_exists('openssl_open')) {
494  print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET : 0), 1);
495  } else {
496  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
497  }
498  } else {
499  print yn(0).' ('.$langs->trans("NotSupported").')';
500  }
501  print '</td></tr>';
502 
503  print '</table>';
504 
505  print dol_get_fiche_end();
506 
507  print $form->buttonsSaveCancel();
508 
509  print '</form>';
510 } else {
511  print dol_get_fiche_head($head, 'common_ticket', '', -1);
512 
513  print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
514  print "<br><br>\n";
515 
516  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
517  print '<table class="noborder centpercent">';
518  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
519 
520  // Method
521  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
522  $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
523  if (empty($text)) {
524  $text = $langs->trans("Undefined").img_warning();
525  }
526  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') {
527  print '<span class="opacitymedium">'.$text.'</span>';
528  } else {
529  print $text;
530  }
531  print '</td></tr>';
532 
533  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
534  // Host server
535  if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
536  //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
537  } else {
538  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '').'</td></tr>';
539  }
540 
541  // Port
542  if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
543  //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
544  } else {
545  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').'</td></tr>';
546  }
547 
548  // AUTH method
549  if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
550  $authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
551  $text = '';
552  if ($authtype === "LOGIN") {
553  $text = $langs->trans("UseAUTHLOGIN");
554  } elseif ($authtype === "PLAIN") {
555  $text = $langs->trans("UseAUTHPLAIN");
556  } elseif ($authtype === "XOAUTH2") {
557  $text = $langs->trans("UseOauth");
558  }
559  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
560  }
561 
562  // SMTPS ID
563  if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
564  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'</td></tr>';
565  }
566 
567  // SMTPS PW
568  if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
569  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).'</td></tr>';
570  }
571 
572  // SMTPS oauth service
573  if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') === "XOAUTH2") {
574  $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
575  if (empty($text)) {
576  $text = $langs->trans("Undefined").img_warning();
577  }
578  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET").'</td><td>'.$text.'</td></tr>';
579  }
580 
581  // TLS
582  if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
583  // Nothing
584  } else {
585  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
586  if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
587  if (function_exists('openssl_open')) {
588  print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET'));
589  } else {
590  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
591  }
592  } else {
593  print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
594  }
595  print '</td></tr>';
596  }
597 
598  // STARTTLS
599  if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
600  // Nothing
601  } else {
602  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
603  if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
604  if (function_exists('openssl_open')) {
605  print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET'));
606  } else {
607  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
608  }
609  } else {
610  print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
611  }
612  print '</td></tr>';
613  }
614 
615  // SMTP_ALLOW_SELF_SIGNED_EMAILING
616  if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
617  // Nothing
618  } else {
619  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
620  if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
621  if (function_exists('openssl_open')) {
622  print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET'));
623  } else {
624  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
625  }
626  } else {
627  print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
628  }
629  print '</td></tr>';
630  }
631  }
632 
633  print '</table>';
634  print '</div>';
635 
636  print dol_get_fiche_end();
637 
638 
639  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
640  print '<br>';
641  /*
642  // Warning 1
643  if ($linuxlike)
644  {
645  $sendmailoption=ini_get('mail.force_extra_parameters');
646  if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
647  {
648  print info_admin($langs->trans("SendmailOptionNotComplete"));
649  }
650  }*/
651  // Warning 2
652  print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
653  }
654 
655 
656  // Buttons for actions
657 
658  print '<div class="tabsAction">';
659 
660  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
661 
662  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
663  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'mail' || !$linuxlike) {
664  if (function_exists('fsockopen') && $port && $server) {
665  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
666  }
667  } else {
668  print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
669  }
670 
671  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
672 
673  if (isModEnabled('fckeditor')) {
674  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
675  }
676  }
677 
678  print '</div>';
679 
680 
681  if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) {
682  $text = $langs->trans("WarningPHPMail");
683  print info_admin($text);
684  }
685 
686  // Run the test to connect
687  if ($action == 'testconnect') {
688  print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
689  print load_fiche_titre($langs->trans("DoTestServerAvailability"));
690 
691  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
692  $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
693 
694  $result = $mail->check_server_port($server, $port);
695  if ($result) {
696  print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
697  } else {
698  $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
699 
700  if ($mail->error) {
701  $errormsg .= ' - '.$mail->error;
702  }
703 
704  setEventMessages($errormsg, null, 'errors');
705  }
706  print '<br>';
707  }
708 
709  // Show email send test form
710  if ($action == 'test' || $action == 'testhtml') {
711  print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
712  print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
713 
714  print dol_get_fiche_head(array(), '', '', -1);
715 
716  // Cree l'objet formulaire mail
717  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
718  $formmail = new FormMail($db);
719  $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
720  $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
721  $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
722  $formmail->fromid = $user->id;
723  $formmail->fromalsorobot = 1;
724  $formmail->withfromreadonly = 0;
725  $formmail->withsubstit = 0;
726  $formmail->withfrom = 1;
727  $formmail->witherrorsto = 1;
728  $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
729  $formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1);
730  $formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1);
731  $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
732  $formmail->withtopicreadonly = 0;
733  $formmail->withfile = 2;
734  $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
735  $formmail->withbodyreadonly = 0;
736  $formmail->withcancel = 1;
737  $formmail->withdeliveryreceipt = 1;
738  $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
739  $formmail->ckeditortoolbar = 'dolibarr_mailings';
740  // Tableau des substitutions
741  $formmail->substit = $substitutionarrayfortest;
742  // Tableau des parameters complementaires du post
743  $formmail->param["action"] = "send";
744  $formmail->param["models"] = "body";
745  $formmail->param["mailid"] = 0;
746  $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
747 
748  // Init list of files
749  if (GETPOST("mode", "aZ09") == 'init') {
750  $formmail->clear_attached_files();
751  }
752 
753  print $formmail->get_form('addfile', 'removefile');
754 
755  print dol_get_fiche_end();
756  }
757 }
758 
759 // End of page
760 llxFooter();
761 $db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:656
email_admin_prepare_head()
Return array head with list of tabs to view object information.
Definition: admin.lib.php:2068
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:55
llxFooter()
Empty footer.
Definition: wrapper.php:69
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information in HTML for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.