dolibarr 19.0.3
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' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
398 continue;
399 }
400 if ($modCodeTiers->version == 'experimental' && getDolGlobalInt('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' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
574 $modulequalified = 0;
575 } elseif ($module->version == 'experimental' && getDolGlobalInt('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');
679if (isModEnabled('accounting')) {
680 $profid['ACCOUNTANCY_CODE_CUSTOMER'][0] = $langs->trans("CustomerAccountancyCodeShort");
681 $profid['ACCOUNTANCY_CODE_CUSTOMER'][1] = $langs->trans('CustomerAccountancyCodeShort');
682 $profid['ACCOUNTANCY_CODE_SUPPLIER'][0] = $langs->trans("SupplierAccountancyCodeShort");
683 $profid['ACCOUNTANCY_CODE_SUPPLIER'][1] = $langs->trans('SupplierAccountancyCodeShort');
684}
685
686$nbofloop = count($profid);
687foreach ($profid as $key => $val) {
688 if ($profid[$key][1] != '-') {
689 print '<tr class="oddeven">';
690 print '<td>'.$profid[$key][0]."</td><td>\n";
691 print $profid[$key][1];
692 print '</td>';
693
694 $idprof_unique = 'SOCIETE_'.$key.'_UNIQUE';
695 $idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY';
696 $idprof_invoice_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
697
698 $verif = (empty($conf->global->$idprof_unique) ? false : true);
699 $mandatory = (empty($conf->global->$idprof_mandatory) ? false : true);
700 $invoice_mandatory = (empty($conf->global->$idprof_invoice_mandatory) ? false : true);
701
702 if ($verif) {
703 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=0">';
704 print img_picto($langs->trans("Activated"), 'switch_on');
705 print '</a></td>';
706 } else {
707 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&token='.newToken().'&value='.$key.'&status=1">';
708 print img_picto($langs->trans("Disabled"), 'switch_off');
709 print '</a></td>';
710 }
711
712 if ($mandatory) {
713 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=0">';
714 print img_picto($langs->trans("Activated"), 'switch_on');
715 print '</a></td>';
716 } else {
717 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&token='.newToken().'&value='.$key.'&status=1">';
718 print img_picto($langs->trans("Disabled"), 'switch_off');
719 print '</a></td>';
720 }
721
722 if ($invoice_mandatory) {
723 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=0">';
724 print img_picto($langs->trans("Activated"), 'switch_on');
725 print '</a></td>';
726 } else {
727 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&token='.newToken().'&value='.$key.'&status=1">';
728 print img_picto($langs->trans("Disabled"), 'switch_off');
729 print '</a></td>';
730 }
731
732 print "</tr>\n";
733 }
734 $i++;
735}
736
737// VAT ID
738print '<tr class="oddeven">';
739print '<td colspan="2">'.$langs->trans('VATIntra')."</td>\n";
740
741if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) {
742 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=0">';
743 print img_picto($langs->trans("Activated"), 'switch_on');
744 print '</a></td>';
745} else {
746 print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=1">';
747 print img_picto($langs->trans("Disabled"), 'switch_off');
748 print '</a></td>';
749}
750print '<td colspan="2"></td>';
751print "</tr>\n";
752
753print "</table>\n";
754print '</div>';
755
756print "<br>\n";
757
758print load_fiche_titre($langs->trans("Other"), '', '');
759
760// Autres options
761$form = new Form($db);
762
763print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
764print '<input type="hidden" name="token" value="'.newToken().'">';
765print '<input type="hidden" name="page_y" value="">';
766print '<input type="hidden" name="action" value="updateoptions">';
767
768print '<div class="div-table-responsive-no-min">';
769print '<table class="noborder centpercent">';
770print '<tr class="liste_titre">';
771print "<td>".$langs->trans("Parameters")."</td>\n";
772print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
773print '<td width="80">&nbsp;</td></tr>'."\n";
774
775// Utilisation formulaire Ajax sur choix societe
776
777print '<tr class="oddeven">';
778print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' </td>';
779if (!$conf->use_javascript_ajax) {
780 print '<td class="nowrap right" colspan="2">';
781 print $langs->trans("NotAvailableWhenAjaxDisabled");
782 print "</td>";
783} else {
784 print '<td width="60" class="right">';
785 $arrval = array('0'=>$langs->trans("No"),
786 '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
787 '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
788 '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
789 );
790 print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
791 print '</td><td class="right">';
792 print '<input type="submit" class="button small reposition" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
793 print "</td>";
794}
795print '</tr>';
796
797
798print '<tr class="oddeven">';
799print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).'</td>';
800if (!$conf->use_javascript_ajax) {
801 print '<td class="nowrap right" colspan="2">';
802 print $langs->trans("NotAvailableWhenAjaxDisabled");
803 print "</td>";
804} else {
805 print '<td width="60" class="right">';
806 $arrval = array('0'=>$langs->trans("No"),
807 '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
808 '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
809 '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
810 );
811 print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
812 print '</td><td class="right">';
813 print '<input type="submit" class="button small eposition" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
814 print "</td>";
815}
816print '</tr>';
817
818
819
820print '<tr class="oddeven">';
821print '<td width="80%">'.$langs->trans("AddRefInList").'</td>';
822print '<td>&nbsp;</td>';
823print '<td class="center">';
824if (getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
825 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&token='.newToken().'&value=0">';
826 print img_picto($langs->trans("Activated"), 'switch_on');
827} else {
828 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&token='.newToken().'&value=1">';
829 print img_picto($langs->trans("Disabled"), 'switch_off');
830}
831print '</a></td>';
832print '</tr>';
833
834print '<tr class="oddeven">';
835print '<td width="80%">'.$langs->trans("AddVatInList").'</td>';
836print '<td>&nbsp;</td>';
837print '<td class="center">';
838if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST')) {
839 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatinlist&token='.newToken().'&value=0">';
840 print img_picto($langs->trans("Activated"), 'switch_on');
841} else {
842 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatinlist&token='.newToken().'&value=1">';
843 print img_picto($langs->trans("Disabled"), 'switch_off');
844}
845print '</a></td>';
846print '</tr>';
847
848print '<tr class="oddeven">';
849print '<td width="80%">'.$langs->trans("AddAdressInList").'</td>';
850print '<td>&nbsp;</td>';
851print '<td class="center">';
852if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
853 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&token='.newToken().'&value=0">';
854 print img_picto($langs->trans("Activated"), 'switch_on');
855} else {
856 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&token='.newToken().'&value=1">';
857 print img_picto($langs->trans("Disabled"), 'switch_off');
858}
859print '</a></td>';
860print '</tr>';
861
862print '<tr class="oddeven">';
863print '<td width="80%">'.$langs->trans("AddEmailPhoneTownInContactList").'</td>';
864print '<td>&nbsp;</td>';
865print '<td class="center">';
866if (getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
867 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddemailphonetownincontactlist&token='.newToken().'&value=0">';
868 print img_picto($langs->trans("Activated"), 'switch_on');
869} else {
870 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaddemailphonetownincontactlist&token='.newToken().'&value=1">';
871 print img_picto($langs->trans("Disabled"), 'switch_off');
872}
873print '</a></td>';
874print '</tr>';
875
876if (isModEnabled("expedition")) {
877 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal)
878 print '<tr class="oddeven">';
879 print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
880 print '<td>&nbsp;</td>';
881 print '<td class="center">';
882 if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD')) {
883 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=0">';
884 print img_picto($langs->trans("Activated"), 'switch_on');
885 } else {
886 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&token='.newToken().'&value=1">';
887 print img_picto($langs->trans("Disabled"), 'switch_off');
888 }
889 print '</a></td>';
890 print '</tr>';
891 }
892}
893
894// Disable Prospect/Customer thirdparty type
895print '<tr class="oddeven">';
896print '<td width="80%">'.$langs->trans("DisableProspectCustomerType").'</td>';
897print '<td>&nbsp;</td>';
898print '<td class="center">';
899if (getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
900 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&token='.newToken().'&value=0">';
901 print img_picto($langs->trans("Activated"), 'switch_on');
902} else {
903 print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&token='.newToken().'&value=1">';
904 print img_picto($langs->trans("Disabled"), 'switch_off');
905}
906print '</a></td>';
907print '</tr>';
908
909if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
910 // Default Prospect/Customer thirdparty type on customer création
911 print '<tr class="oddeven">';
912 print '<td>'.$langs->trans("DefaultCustomerType").'</td>';
913 print '<td>';
914 print $formcompany->selectProspectCustomerType(getDolGlobalString('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'), 'defaultcustomertype', 'defaultcustomertype', 'admin');
915 print '</td>';
916 print '<td class="center">';
917 print '<input type="submit" class="button small reposition" name="THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT" value="'.$langs->trans("Modify").'">';
918 print '</td>';
919 print '</tr>';
920}
921
922print '</table>';
923print '</div>';
924
925print '</form>';
926
927
928print dol_get_fiche_end();
929
930// End of page
931llxFooter();
932$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: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 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 a 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.