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