dolibarr 20.0.0
societe.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
4 * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
35
36$langs->loadLangs(array("admin", "companies", "other"));
37
38$action = GETPOST('action', 'aZ09');
39$value = GETPOST('value', 'alpha');
40$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
41
42if (!$user->admin) {
44}
45
46$formcompany = new FormCompany($db);
47
48
49
50/*
51 * Actions
52 */
53
54include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
55
56if ($action == 'setcodeclient') {
57 $result = dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
58 if ($result <= 0) {
59 dol_print_error($db);
60 }
61}
62
63if ($action == 'setcodecompta') {
64 $result = dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON", $value, 'chaine', 0, '', $conf->entity);
65 if ($result <= 0) {
66 dol_print_error($db);
67 }
68}
69
70if ($action == 'updateoptions') {
71 if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT')) {
72 $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT', 'alpha');
73 $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity);
74 if (!($res > 0)) {
75 $error++;
76 }
77 if (!$error) {
78 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
79 } else {
80 setEventMessages($langs->trans("Error"), null, 'errors');
81 }
82 }
83
84 if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT')) {
85 $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT', 'alpha');
86 $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch, 'chaine', 0, '', $conf->entity);
87 if (!($res > 0)) {
88 $error++;
89 }
90 if (!$error) {
91 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
92 } else {
93 setEventMessages($langs->trans("Error"), null, 'errors');
94 }
95 }
96
97 if (GETPOST('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) {
98 $customertypedefault = GETPOSTINT('defaultcustomertype');
99 $res = dolibarr_set_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $customertypedefault, 'chaine', 0, '', $conf->entity);
100 if (!($res > 0)) {
101 $error++;
102 }
103 if (!$error) {
104 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
105 } else {
106 setEventMessages($langs->trans("Error"), null, 'errors');
107 }
108 }
109}
110
111// Activate a document generator module
112if ($action == 'set') {
113 $label = GETPOST('label', 'alpha');
114 $scandir = GETPOST('scan_dir', 'alpha');
115
116 $type = 'company';
117 $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
118 $sql .= " VALUES ('".$db->escape($value)."', '".$db->escape($type)."', ".((int) $conf->entity).", ";
119 $sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
120 $sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null");
121 $sql .= ")";
122
123 $resql = $db->query($sql);
124 if (!$resql) {
125 dol_print_error($db);
126 }
127}
128
129// Disable a document generator module
130if ($action == 'del') {
131 $type = 'company';
132 $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
133 $sql .= " WHERE nom='".$db->escape($value)."' AND type='".$db->escape($type)."' AND entity=".((int) $conf->entity);
134 $resql = $db->query($sql);
135 if (!$resql) {
136 dol_print_error($db);
137 }
138}
139
140// Define default generator
141if ($action == 'setdoc') {
142 $label = GETPOST('label', 'alpha');
143 $scandir = GETPOST('scan_dir', 'alpha');
144
145 $db->begin();
146
147 dolibarr_set_const($db, "COMPANY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity);
148
149 // On active le modele
150 $type = 'company';
151 $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
152 $sql_del .= " WHERE nom = '".$db->escape(GETPOST('value', 'alpha'))."'";
153 $sql_del .= " AND type = '".$db->escape($type)."'";
154 $sql_del .= " AND entity = ".((int) $conf->entity);
155 dol_syslog("societe.php ".$sql);
156 $result1 = $db->query($sql_del);
157
158 $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
159 $sql .= " VALUES ('".$db->escape($value)."', '".$db->escape($type)."', ".((int) $conf->entity).", ";
160 $sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
161 $sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null");
162 $sql .= ")";
163 dol_syslog("societe.php", LOG_DEBUG);
164 $result2 = $db->query($sql);
165 if ($result1 && $result2) {
166 $db->commit();
167 } else {
168 $db->rollback();
169 }
170}
171
172//Activate Set accountancy code customer invoice mandatory
173if ($action == "setaccountancycodecustomerinvoicemandatory") {
174 $setaccountancycodecustomerinvoicemandatory = GETPOSTINT('value');
175 $res = dolibarr_set_const($db, "SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY", $setaccountancycodecustomerinvoicemandatory, 'yesno', 0, '', $conf->entity);
176 if (!($res > 0)) {
177 $error++;
178 }
179 if (!$error) {
180 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
181 } else {
182 setEventMessages($langs->trans("Error"), null, 'errors');
183 }
184}
185
186//Activate Set vat id unique
187if ($action == "setvatintraunique") {
188 $setvatintraunique = GETPOSTINT('value');
189 $res = dolibarr_set_const($db, "SOCIETE_VAT_INTRA_UNIQUE", $setvatintraunique, 'yesno', 0, '', $conf->entity);
190 if (!($res > 0)) {
191 $error++;
192 }
193 if (!$error) {
194 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
195 } else {
196 setEventMessages($langs->trans("Error"), null, 'errors');
197 }
198}
199
200//Activate Set ref in list
201if ($action == "setaddrefinlist") {
202 $setaddrefinlist = GETPOSTINT('value');
203 $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist, 'yesno', 0, '', $conf->entity);
204 if (!($res > 0)) {
205 $error++;
206 }
207 if (!$error) {
208 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
209 } else {
210 setEventMessages($langs->trans("Error"), null, 'errors');
211 }
212}
213
214//Activate Set vat in list
215if ($action == "setvatinlist") {
216 $setvatinlist = GETPOSTINT('value');
217 $res = dolibarr_set_const($db, "SOCIETE_SHOW_VAT_IN_LIST", $setvatinlist, 'yesno', 0, '', $conf->entity);
218 if (!($res > 0)) {
219 $error++;
220 }
221 if (!$error) {
222 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
223 } else {
224 setEventMessages($langs->trans("Error"), null, 'errors');
225 }
226}
227
228//Activate Set address in list
229if ($action == "setaddadressinlist") {
230 $val = GETPOSTINT('value');
231 $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val, 'yesno', 0, '', $conf->entity);
232 if (!($res > 0)) {
233 $error++;
234 }
235 if (!$error) {
236 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
237 } else {
238 setEventMessages($langs->trans("Error"), null, 'errors');
239 }
240}
241
242//Activate Set email phone town in contact list
243if ($action == "setaddemailphonetownincontactlist") {
244 $val = GETPOSTINT('value');
245 $res = dolibarr_set_const($db, "CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST", $val, 'yesno', 0, '', $conf->entity);
246 if (!($res > 0)) {
247 $error++;
248 }
249 if (!$error) {
250 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
251 } else {
252 setEventMessages($langs->trans("Error"), null, 'errors');
253 }
254}
255
256//Activate Ask For Preferred Shipping Method
257if ($action == "setaskforshippingmet") {
258 $setaskforshippingmet = GETPOSTINT('value');
259 $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet, 'yesno', 0, '', $conf->entity);
260 if (!($res > 0)) {
261 $error++;
262 }
263 if (!$error) {
264 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
265 } else {
266 setEventMessages($langs->trans("Error"), null, 'errors');
267 }
268}
269
270// Activate "Disable prospect/customer type"
271if ($action == "setdisableprospectcustomer") {
272 $setdisableprospectcustomer = GETPOSTINT('value');
273 $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity);
274 if (!($res > 0)) {
275 $error++;
276 }
277 if (!$error) {
278 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
279 } else {
280 setEventMessages($langs->trans("Error"), null, 'errors');
281 }
282}
283
284//Activate ProfId unique
285if ($action == 'setprofid') {
286 $status = GETPOST('status', 'alpha');
287
288 $idprof = "SOCIETE_".$value."_UNIQUE";
289 $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
290 if ($result <= 0) {
291 dol_print_error($db);
292 }
293}
294
295//Activate ProfId mandatory
296if ($action == 'setprofidmandatory') {
297 $status = GETPOST('status', 'alpha');
298
299 $idprof = "SOCIETE_".$value."_MANDATORY";
300 $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
301 if ($result <= 0) {
302 dol_print_error($db);
303 }
304}
305
306//Activate ProfId invoice mandatory
307if ($action == 'setprofidinvoicemandatory') {
308 $status = GETPOST('status', 'alpha');
309
310 $idprof = "SOCIETE_".$value."_INVOICE_MANDATORY";
311 $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity);
312 if ($result <= 0) {
313 dol_print_error($db);
314 }
315}
316
317//Set hide closed customer into combox or select
318if ($action == 'sethideinactivethirdparty') {
319 $status = GETPOST('status', 'alpha');
320
321 $result = dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX", $status, 'chaine', 0, '', $conf->entity);
322 if ($result <= 0) {
323 dol_print_error($db);
324 }
325}
326if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
327 $setonsearchandlistgooncustomerorsuppliercard = GETPOSTINT('value');
328 $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity);
329 if (!($res > 0)) {
330 $error++;
331 }
332 if (!$error) {
333 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
334 } else {
335 setEventMessages($langs->trans("Error"), null, 'errors');
336 }
337}
338
339
340/*
341 * View
342 */
343
344clearstatcache();
345
346$form = new Form($db);
347
348$help_url = 'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers|ES:Configuración_del_módulo_terceros';
349llxHeader('', $langs->trans("CompanySetup"), $help_url);
350
351$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
352print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup');
353
354
356
357print dol_get_fiche_head($head, 'general', $langs->trans("ThirdParties"), -1, 'company');
358
359$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
360foreach ($conf->modules_parts['models'] as $mo) {
361 $dirsociete[] = $mo.'core/modules/societe/'; //Add more models
362}
363
364// Module to manage customer/supplier code
365
366print load_fiche_titre($langs->trans("CompanyCodeChecker"), '', '');
367
368print '<div class="div-table-responsive-no-min">';
369print '<table class="noborder centpercent">'."\n";
370print '<tr class="liste_titre">'."\n";
371print ' <td>'.$langs->trans("Name").'</td>';
372print ' <td>'.$langs->trans("Description").'</td>';
373print ' <td>'.$langs->trans("Example").'</td>';
374print ' <td class="center" width="80">'.$langs->trans("Status").'</td>';
375print ' <td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
376print "</tr>\n";
377
378$arrayofmodules = array();
379
380foreach ($dirsociete as $dirroot) {
381 $dir = dol_buildpath($dirroot, 0);
382
383 $handle = @opendir($dir);
384 if (is_resource($handle)) {
385 // Loop on each module find in opened directory
386 while (($file = readdir($handle)) !== false) {
387 if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php') {
388 $file = substr($file, 0, dol_strlen($file) - 4);
389
390 try {
391 dol_include_once($dirroot.$file.'.php');
392 } catch (Exception $e) {
393 dol_syslog($e->getMessage(), LOG_ERR);
394 }
395
397 $modCodeTiers = new $file($db);
398
399 // Show modules according to features level
400 if ($modCodeTiers->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
401 continue;
402 }
403 if ($modCodeTiers->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
404 continue;
405 }
406
407 $arrayofmodules[$file] = $modCodeTiers;
408 }
409 }
410 closedir($handle);
411 }
412}
413
414$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
415
416foreach ($arrayofmodules as $file => $modCodeTiers) {
417 print '<tr class="oddeven">'."\n";
418 print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
419 print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
420 print '<td class="nowrap">'.$modCodeTiers->getExample($langs).'</td>'."\n";
421
422 if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file") {
423 print '<td class="center">'."\n";
424 print img_picto($langs->trans("Activated"), 'switch_on');
425 print "</td>\n";
426 } else {
427 $disabled = (isModEnabled('multicompany') && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false);
428 print '<td class="center">';
429 if (!$disabled) {
430 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&token='.newToken().'&value='.urlencode($file).'">';
431 }
432 print img_picto($langs->trans("Disabled"), 'switch_off');
433 if (!$disabled) {
434 print '</a>';
435 }
436 print '</td>';
437 }
438
439 print '<td class="center">';
440 $s = $modCodeTiers->getToolTip($langs, null, -1);
441 print $form->textwithpicto('', $s, 1);
442 print '</td>';
443
444 print '</tr>';
445}
446print '</table>';
447print '</div>';
448
449print "<br>";
450
451
452// Select accountancy code numbering module
453
454print load_fiche_titre($langs->trans("AccountCodeManager"), '', '');
455
456print '<div class="div-table-responsive-no-min">';
457print '<table class="noborder centpercent">';
458print '<tr class="liste_titre">';
459print '<td width="140">'.$langs->trans("Name").'</td>';
460print '<td>'.$langs->trans("Description").'</td>';
461print '<td>'.$langs->trans("Example").'</td>';
462print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
463print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
464print "</tr>\n";
465
466$arrayofmodules = array();
467
468foreach ($dirsociete as $dirroot) {
469 $dir = dol_buildpath($dirroot, 0);
470
471 $handle = @opendir($dir);
472 if (is_resource($handle)) {
473 while (($file = readdir($handle)) !== false) {
474 if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php') {
475 $file = substr($file, 0, dol_strlen($file) - 4);
476
477 try {
478 dol_include_once($dirroot.$file.'.php');
479 } catch (Exception $e) {
480 dol_syslog($e->getMessage(), LOG_ERR);
481 }
482
483 $modCodeCompta = new $file();
484
485 $arrayofmodules[$file] = $modCodeCompta;
486 }
487 }
488 closedir($handle);
489 }
490}
491
492$arrayofmodules = dol_sort_array($arrayofmodules, 'position');
493
494
495foreach ($arrayofmodules as $file => $modCodeCompta) {
496 print '<tr class="oddeven">';
497 print '<td>'.$modCodeCompta->name."</td><td>\n";
498 print $modCodeCompta->info($langs);
499 print '</td>';
500 print '<td class="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
501
502 if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file") {
503 print '<td class="center">';
504 print img_picto($langs->trans("Activated"), 'switch_on');
505 print '</td>';
506 } else {
507 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&token='.newToken().'&value='.urlencode($file).'">';
508 print img_picto($langs->trans("Disabled"), 'switch_off');
509 print '</a></td>';
510 }
511 print '<td class="center">';
512 $s = $modCodeCompta->getToolTip($langs, null, -1);
513 print $form->textwithpicto('', $s, 1);
514 print '</td>';
515 print "</tr>\n";
516}
517print "</table>\n";
518print '</div>';
519
520
521/*
522 * Document templates generators
523 */
524print '<br>';
525print load_fiche_titre($langs->trans("ModelModules"), '', '');
526
527// Load array def with activated templates
528$def = array();
529$sql = "SELECT nom";
530$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
531$sql .= " WHERE type = 'company'";
532$sql .= " AND entity = ".$conf->entity;
533$resql = $db->query($sql);
534if ($resql) {
535 $i = 0;
536 $num_rows = $db->num_rows($resql);
537 while ($i < $num_rows) {
538 $array = $db->fetch_array($resql);
539 if (is_array($array)) {
540 array_push($def, $array[0]);
541 }
542 $i++;
543 }
544} else {
545 dol_print_error($db);
546}
547
548print '<div class="div-table-responsive-no-min">';
549print '<table class="noborder centpercent">';
550print '<tr class="liste_titre">';
551print '<td width="140">'.$langs->trans("Name").'</td>';
552print '<td>'.$langs->trans("Description").'</td>';
553print '<td class="center" width="80">'.$langs->trans("Status").'</td>';
554print '<td class="center" width="60">'.$langs->trans("ShortInfo").'</td>';
555print '<td class="center" width="60">'.$langs->trans("Preview").'</td>';
556print "</tr>\n";
557
558foreach ($dirsociete as $dirroot) {
559 $dir = dol_buildpath($dirroot.'doc/', 0);
560
561 $handle = @opendir($dir);
562 if (is_resource($handle)) {
563 while (($file = readdir($handle)) !== false) {
564 if (preg_match('/\.modules\.php$/i', $file)) {
565 $name = substr($file, 4, dol_strlen($file) - 16);
566 $classname = substr($file, 0, dol_strlen($file) - 12);
567
568 try {
569 dol_include_once($dirroot.'doc/'.$file);
570 } catch (Exception $e) {
571 dol_syslog($e->getMessage(), LOG_ERR);
572 }
573
574 $module = new $classname($db);
575
576 $modulequalified = 1;
577 if (!empty($module->version)) {
578 if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
579 $modulequalified = 0;
580 } elseif ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
581 $modulequalified = 0;
582 }
583 }
584
585 if ($modulequalified) {
586 print '<tr class="oddeven"><td width="100">';
587 print dol_escape_htmltag($module->name);
588 print "</td><td>\n";
589 if (method_exists($module, 'info')) {
590 print $module->info($langs);
591 } else {
592 print $module->description;
593 }
594 print '</td>';
595
596 // Activate / Disable
597 if (in_array($name, $def)) {
598 print "<td class=\"center\">\n";
599 //if ($conf->global->COMPANY_ADDON_PDF != "$name")
600 //{
601 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&token='.newToken().'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
602 print img_picto($langs->trans("Enabled"), 'switch_on');
603 print '</a>';
604 //}
605 //else
606 //{
607 // print img_picto($langs->trans("Enabled"),'on');
608 //}
609 print "</td>";
610 } else {
611 if (versioncompare($module->phpmin, versionphparray()) > 0) {
612 print '<td class="center">'."\n";
613 print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", implode('.', $module->phpmin))), 'switch_off');
614 print "</td>";
615 } else {
616 print '<td class="center">'."\n";
617 print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.urlencode($name).'&token='.newToken().'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
618 print "</td>";
619 }
620 }
621
622 // Info
623 $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
624 $htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
625 if ($module->type == 'pdf') {
626 $htmltooltip .= '<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
627 }
628 $htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
629 $htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraft").': '.yn((isset($module->option_draft_watermark) ? $module->option_draft_watermark : ''), 1, 1);
630
631 print '<td class="center nowrap">';
632 print $form->textwithpicto('', $htmltooltip, 1, 0);
633 print '</td>';
634
635 // Preview
636 print '<td class="center nowrap">';
637 if ($module->type == 'pdf') {
638 $linkspec = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=specimen&token='.newToken().'&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
639 } else {
640 $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic');
641 }
642 print $linkspec;
643 print '</td>';
644
645 print "</tr>\n";
646 }
647 }
648 }
649 closedir($handle);
650 }
651}
652print '</table>';
653print '</div>';
654
655print '<br>';
656
657//IDProf
658print load_fiche_titre($langs->trans("CompanyIdProfChecker"), '', '');
659
660print '<div class="div-table-responsive-no-min">';
661print '<table class="noborder centpercent">';
662print '<tr class="liste_titre">';
663print '<td>'.$langs->trans("Name").'</td>';
664print '<td>'.$langs->trans("Description").'</td>';
665print '<td class="center">'.$langs->trans("MustBeUnique").'</td>';
666print '<td class="center">'.$langs->trans("MustBeMandatory").'</td>';
667print '<td class="center">'.$langs->trans("MustBeInvoiceMandatory").'</td>';
668print "</tr>\n";
669
670$profid = array('IDPROF1' => array(), 'IDPROF2' => array(), 'IDPROF3' => array(), 'IDPROF4' => array(), 'IDPROF5' => array(),'IDPROF6' => array(), 'EMAIL' => array());
671$profid['IDPROF1'][0] = $langs->trans("ProfId1");
672$profid['IDPROF1'][1] = $langs->transcountry('ProfId1', $mysoc->country_code);
673$profid['IDPROF2'][0] = $langs->trans("ProfId2");
674$profid['IDPROF2'][1] = $langs->transcountry('ProfId2', $mysoc->country_code);
675$profid['IDPROF3'][0] = $langs->trans("ProfId3");
676$profid['IDPROF3'][1] = $langs->transcountry('ProfId3', $mysoc->country_code);
677$profid['IDPROF4'][0] = $langs->trans("ProfId4");
678$profid['IDPROF4'][1] = $langs->transcountry('ProfId4', $mysoc->country_code);
679$profid['IDPROF5'][0] = $langs->trans("ProfId5");
680$profid['IDPROF5'][1] = $langs->transcountry('ProfId5', $mysoc->country_code);
681$profid['IDPROF6'][0] = $langs->trans("ProfId6");
682$profid['IDPROF6'][1] = $langs->transcountry('ProfId6', $mysoc->country_code);
683$profid['EMAIL'][0] = $langs->trans("EMail");
684$profid['EMAIL'][1] = $langs->trans('Email');
685if (isModEnabled('accounting')) {
686 $profid['ACCOUNTANCY_CODE_CUSTOMER'] = array();
687 $profid['ACCOUNTANCY_CODE_CUSTOMER'][0] = $langs->trans("CustomerAccountancyCodeShort");
688 $profid['ACCOUNTANCY_CODE_CUSTOMER'][1] = $langs->trans('CustomerAccountancyCodeShort');
689 $profid['ACCOUNTANCY_CODE_SUPPLIER'] = array();
690 $profid['ACCOUNTANCY_CODE_SUPPLIER'][0] = $langs->trans("SupplierAccountancyCodeShort");
691 $profid['ACCOUNTANCY_CODE_SUPPLIER'][1] = $langs->trans('SupplierAccountancyCodeShort');
692}
693
694$nbofloop = count($profid);
695foreach ($profid as $key => $val) {
696 if ($profid[$key][1] != '-') {
697 print '<tr class="oddeven">';
698 print '<td>'.$profid[$key][0]."</td><td>\n";
699 print $profid[$key][1];
700 print '</td>';
701
702 $idprof_unique = 'SOCIETE_'.$key.'_UNIQUE';
703 $idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY';
704 $idprof_invoice_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
705
706 $verif = (empty($conf->global->$idprof_unique) ? false : true);
707 $mandatory = (empty($conf->global->$idprof_mandatory) ? false : true);
708 $invoice_mandatory = (empty($conf->global->$idprof_invoice_mandatory) ? false : true);
709
710 if ($verif) {
711 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=0">';
712 print img_picto($langs->trans("Activated"), 'switch_on');
713 print '</a></td>';
714 } else {
715 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=1">';
716 print img_picto($langs->trans("Disabled"), 'switch_off');
717 print '</a></td>';
718 }
719
720 if ($mandatory) {
721 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=0">';
722 print img_picto($langs->trans("Activated"), 'switch_on');
723 print '</a></td>';
724 } else {
725 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=1">';
726 print img_picto($langs->trans("Disabled"), 'switch_off');
727 print '</a></td>';
728 }
729
730 if ($invoice_mandatory) {
731 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=0">';
732 print img_picto($langs->trans("Activated"), 'switch_on');
733 print '</a></td>';
734 } else {
735 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=1">';
736 print img_picto($langs->trans("Disabled"), 'switch_off');
737 print '</a></td>';
738 }
739
740 print "</tr>\n";
741 }
742}
743
744// VAT ID
745print '<tr class="oddeven">';
746print '<td colspan="2">'.$langs->trans('VATIntra')."</td>\n";
747
748if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) {
749 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=0">';
750 print img_picto($langs->trans("Activated"), 'switch_on');
751 print '</a></td>';
752} else {
753 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=1">';
754 print img_picto($langs->trans("Disabled"), 'switch_off');
755 print '</a></td>';
756}
757print '<td colspan="2"></td>';
758print "</tr>\n";
759
760print "</table>\n";
761print '</div>';
762
763print "<br>\n";
764
765print load_fiche_titre($langs->trans("Other"), '', '');
766
767// Autres options
768$form = new Form($db);
769
770print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
771print '<input type="hidden" name="token" value="'.newToken().'">';
772print '<input type="hidden" name="page_y" value="">';
773print '<input type="hidden" name="action" value="updateoptions">';
774
775print '<div class="div-table-responsive-no-min">';
776print '<table class="noborder centpercent">';
777print '<tr class="liste_titre">';
778print "<td>".$langs->trans("Parameters")."</td>\n";
779print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
780print '<td width="80">&nbsp;</td></tr>'."\n";
781
782// Utilisation formulaire Ajax sur choix societe
783
784print '<tr class="oddeven">';
785print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' </td>';
786if (!$conf->use_javascript_ajax) {
787 print '<td class="nowrap right" colspan="2">';
788 print $langs->trans("NotAvailableWhenAjaxDisabled");
789 print "</td>";
790} else {
791 print '<td width="60" class="right">';
792 $arrval = array('0' => $langs->trans("No"),
793 '1' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
794 '2' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
795 '3' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
796 );
797 print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
798 print '</td><td class="right">';
799 print '<input type="submit" class="button small reposition" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
800 print "</td>";
801}
802print '</tr>';
803
804
805print '<tr class="oddeven">';
806print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).'</td>';
807if (!$conf->use_javascript_ajax) {
808 print '<td class="nowrap right" colspan="2">';
809 print $langs->trans("NotAvailableWhenAjaxDisabled");
810 print "</td>";
811} else {
812 print '<td width="60" class="right">';
813 $arrval = array('0' => $langs->trans("No"),
814 '1' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
815 '2' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
816 '3' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
817 );
818 print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
819 print '</td><td class="right">';
820 print '<input type="submit" class="button small reposition" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
821 print "</td>";
822}
823print '</tr>';
824
825
826
827print '<tr class="oddeven">';
828print '<td width="80%">'.$langs->trans("AddRefInList").'</td>';
829print '<td>&nbsp;</td>';
830print '<td class="center">';
831if (getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
832 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&token='.newToken().'&value=0">';
833 print img_picto($langs->trans("Activated"), 'switch_on');
834} else {
835 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&token='.newToken().'&value=1">';
836 print img_picto($langs->trans("Disabled"), 'switch_off');
837}
838print '</a></td>';
839print '</tr>';
840
841print '<tr class="oddeven">';
842print '<td width="80%">'.$langs->trans("AddVatInList").'</td>';
843print '<td>&nbsp;</td>';
844print '<td class="center">';
845if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST')) {
846 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatinlist&token='.newToken().'&value=0">';
847 print img_picto($langs->trans("Activated"), 'switch_on');
848} else {
849 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatinlist&token='.newToken().'&value=1">';
850 print img_picto($langs->trans("Disabled"), 'switch_off');
851}
852print '</a></td>';
853print '</tr>';
854
855print '<tr class="oddeven">';
856print '<td width="80%">'.$langs->trans("AddAdressInList").'</td>';
857print '<td>&nbsp;</td>';
858print '<td class="center">';
859if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
860 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&token='.newToken().'&value=0">';
861 print img_picto($langs->trans("Activated"), 'switch_on');
862} else {
863 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&token='.newToken().'&value=1">';
864 print img_picto($langs->trans("Disabled"), 'switch_off');
865}
866print '</a></td>';
867print '</tr>';
868
869print '<tr class="oddeven">';
870print '<td width="80%">'.$langs->trans("AddEmailPhoneTownInContactList").'</td>';
871print '<td>&nbsp;</td>';
872print '<td class="center">';
873if (getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
874 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddemailphonetownincontactlist&token='.newToken().'&value=0">';
875 print img_picto($langs->trans("Activated"), 'switch_on');
876} else {
877 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddemailphonetownincontactlist&token='.newToken().'&value=1">';
878 print img_picto($langs->trans("Disabled"), 'switch_off');
879}
880print '</a></td>';
881print '</tr>';
882
883if (isModEnabled("shipping")) {
884 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
885 print '<tr class="oddeven">';
886 print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
887 print '<td>&nbsp;</td>';
888 print '<td class="center">';
889 if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD')) {
890 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=0">';
891 print img_picto($langs->trans("Activated"), 'switch_on');
892 } else {
893 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=1">';
894 print img_picto($langs->trans("Disabled"), 'switch_off');
895 }
896 print '</a></td>';
897 print '</tr>';
898 }
899}
900
901// Disable Prospect/Customer thirdparty type
902print '<tr class="oddeven">';
903print '<td width="80%">'.$langs->trans("DisableProspectCustomerType").'</td>';
904print '<td>&nbsp;</td>';
905print '<td class="center">';
906if (getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
907 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&token='.newToken().'&value=0">';
908 print img_picto($langs->trans("Activated"), 'switch_on');
909} else {
910 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&token='.newToken().'&value=1">';
911 print img_picto($langs->trans("Disabled"), 'switch_off');
912}
913print '</a></td>';
914print '</tr>';
915
916if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
917 // Default Prospect/Customer thirdparty type on customer création
918 print '<tr class="oddeven">';
919 print '<td>'.$langs->trans("DefaultCustomerType").'</td>';
920 print '<td>';
921 print $formcompany->selectProspectCustomerType(getDolGlobalString('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'), 'defaultcustomertype', 'defaultcustomertype', 'admin');
922 print '</td>';
923 print '<td class="center">';
924 print '<input type="submit" class="button small reposition" name="THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT" value="'.$langs->trans("Modify").'">';
925 print '</td>';
926 print '</tr>';
927}
928
929print '</table>';
930print '</div>';
931
932print '</form>';
933
934
935print dol_get_fiche_end();
936
937// End of page
938llxFooter();
939$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).
versionphparray()
Return version PHP.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition admin.lib.php:68
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 build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
societe_admin_prepare_head()
Return array head with list of tabs to view object information.
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)
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.
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_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.