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