* Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/societe/admin/societe.php * \ingroup company * \brief Third party module setup page */ // Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs * @var User $user */ $langs->loadLangs(array("admin", "accountancy", "companies", "other")); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php if (!$user->admin) { accessforbidden(); } $formcompany = new FormCompany($db); /* * Actions */ $error = 0; include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'setcodeclient') { $result = dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON", $value, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } if ($action == 'setcodecompta') { $result = dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON", $value, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } if ($action == 'updateoptions') { if (GETPOSTISSET('COMPANY_USE_SEARCH_TO_SELECT')) { $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT', 'alpha'); $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } if (GETPOSTISSET('CONTACT_USE_SEARCH_TO_SELECT')) { $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT', 'alpha'); $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } if (GETPOSTISSET('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')) { $customertypedefault = GETPOSTINT('defaultcustomertype'); $res = dolibarr_set_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $customertypedefault, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } if (GETPOSTISARRAY('CONTACTS_DEFAULT_ROLES')) { $rolessearch = GETPOST('activate_CONTACTS_DEFAULT_ROLES', 'array:aZ09'); $res = dolibarr_set_const($db, "CONTACTS_DEFAULT_ROLES", implode(',', $rolessearch), 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } } // Activate a document generator module if ($action == 'set') { $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $type = 'company'; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql .= " VALUES ('".$db->escape($value)."', '".$db->escape($type)."', ".((int) $conf->entity).", "; $sql .= ($label ? "'".$db->escape($label)."'" : 'null').", "; $sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null"); $sql .= ")"; $resql = $db->query($sql); if (!$resql) { dol_print_error($db); } } // Disable a document generator module if ($action == 'del') { $type = 'company'; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE nom='".$db->escape($value)."' AND type='".$db->escape($type)."' AND entity=".((int) $conf->entity); $resql = $db->query($sql); if (!$resql) { dol_print_error($db); } } // Define default generator if ($action == 'setdoc') { $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); $db->begin(); dolibarr_set_const($db, "COMPANY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity); // On active le modele $type = 'company'; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del .= " WHERE nom = '".$db->escape(GETPOST('value', 'alpha'))."'"; $sql_del .= " AND type = '".$db->escape($type)."'"; $sql_del .= " AND entity = ".((int) $conf->entity); dol_syslog("societe.php ".$sql); $result1 = $db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql .= " VALUES ('".$db->escape($value)."', '".$db->escape($type)."', ".((int) $conf->entity).", "; $sql .= ($label ? "'".$db->escape($label)."'" : 'null').", "; $sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null"); $sql .= ")"; dol_syslog("societe.php", LOG_DEBUG); $result2 = $db->query($sql); if ($result1 && $result2) { $db->commit(); } else { $db->rollback(); } } //Activate Set accountancy code customer invoice mandatory if ($action == "setaccountancycodecustomerinvoicemandatory") { $setaccountancycodecustomerinvoicemandatory = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY", $setaccountancycodecustomerinvoicemandatory, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* This code is not needed anymore as we can use the setprofid functions instead with key = 'VAT_INTRA' //Activate Set vat id unique if ($action == "setvatintraunique") { $setvatintraunique = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_VAT_INTRA_UNIQUE", $setvatintraunique, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } */ //Activate Set ref in list if ($action == "setaddrefinlist") { $setaddrefinlist = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } //Activate Set vat in list if ($action == "setvatinlist") { $setvatinlist = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_SHOW_VAT_IN_LIST", $setvatinlist, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } //Activate Set address in list if ($action == "setaddadressinlist") { $val = GETPOSTINT('value'); $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } //Activate Set email phone town in contact list if ($action == "setaddemailphonetownincontactlist") { $val = GETPOSTINT('value'); $res = dolibarr_set_const($db, "CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST", $val, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } //Activate Ask For Preferred Shipping Method if ($action == "setaskforshippingmet") { $setaskforshippingmet = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } // Activate "Disable prospect/customer type" if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } //Activate ProfId unique if ($action == 'setprofid') { $status = GETPOST('status', 'alpha'); $idprof = "SOCIETE_".$value."_UNIQUE"; $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } //Activate ProfId mandatory if ($action == 'setprofidmandatory') { $status = GETPOST('status', 'alpha'); $idprof = "SOCIETE_".$value."_MANDATORY"; $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } //Activate ProfId invoice mandatory if ($action == 'setprofidinvoicemandatory' || $action == 'setprofidinvoicemandatoryeeconly') { $status = GETPOST('status', 'alpha'); if ($status == '1' && $action == 'setprofidinvoicemandatoryeeconly') { $status = 'eeconly'; } $idprof = "SOCIETE_".$value."_INVOICE_MANDATORY"; $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } //Set hide closed customer into combox or select if ($action == 'sethideinactivethirdparty') { $status = GETPOST('status', 'alpha'); $result = dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX", $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { dol_print_error($db); } } if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { $setonsearchandlistgooncustomerorsuppliercard = GETPOSTINT('value'); $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity); if (!($res > 0)) { $error++; } if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ clearstatcache(); $form = new Form($db); $help_url = 'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers|ES:Configuración_del_módulo_terceros'; llxHeader('', $langs->trans("CompanySetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup'); $head = societe_admin_prepare_head(); print dol_get_fiche_head($head, 'general', $langs->trans("ThirdParties"), -1, 'company'); $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($conf->modules_parts['models'] as $mo) { $dirsociete[] = $mo.'core/modules/societe/'; //Add more models } // Module to manage customer/supplier code print load_fiche_titre($langs->trans("CompanyCodeChecker"), '', ''); print '
'; print ''."\n"; print ''."\n"; print ' '; print ' '; print ' '; print ' '; print ' '; print "\n"; $arrayofmodules = array(); foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot, 0); $handle = @opendir($dir); if (is_resource($handle)) { // Loop on each module find in opened directory while (($file = readdir($handle)) !== false) { if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); try { dol_include_once($dirroot.$file.'.php'); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } /** @var ModeleThirdPartyCode $modCodeTiers */ $modCodeTiers = new $file($db); '@phan-var-force ModeleThirdPartyCode $modCodeTiers'; // Show modules according to features level if ($modCodeTiers->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } if ($modCodeTiers->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } $arrayofmodules[$file] = $modCodeTiers; } } closedir($handle); } } $arrayofmodules = dol_sort_array($arrayofmodules, 'position'); '@phan-var-force array $arrayofmodules'; // Repeat type because of dol_sort_array foreach ($arrayofmodules as $file => $modCodeTiers) { print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file") { print '\n"; } else { $disabled = (isModEnabled('multicompany') && ((is_object($mc) && !empty($mc->sharings['referent'])) && ($mc->sharings['referent'] != $conf->entity))); print ''; } print ''; print ''; } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$modCodeTiers->name.''.$modCodeTiers->info($langs).''.$modCodeTiers->getExample($langs).''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; if (!$disabled) { print ''; } print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) { print ''; } print ''; $s = $modCodeTiers->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
'; print '
'; print "
"; // Select accountancy code numbering module print load_fiche_titre($langs->trans("AccountCodeManager"), '', ''); print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; $arrayofmodules = array(); foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot, 0); $handle = @opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); try { dol_include_once($dirroot.$file.'.php'); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } $modCodeCompta = new $file(); '@phan-var-force ModeleAccountancyCode $modCodeTiers'; $arrayofmodules[$file] = $modCodeCompta; } } closedir($handle); } } $arrayofmodules = dol_sort_array($arrayofmodules, 'position'); '@phan-var-force array $arrayofmodules'; foreach ($arrayofmodules as $file => $modCodeCompta) { print ''; print ''; print '\n"; if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file") { print ''; } else { print ''; } print ''; print "\n"; } print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$modCodeCompta->name."\n"; print $modCodeCompta->info($langs); print ''.$modCodeCompta->getExample($langs)."'; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; $s = $modCodeCompta->getToolTip($langs, null, -1); print $form->textwithpicto('', $s, 1); print '
\n"; print '
'; /* * Document templates generators */ print '
'; print load_fiche_titre($langs->trans("ModelModules"), '', ''); // Load array def with activated templates $def = array(); $sql = "SELECT nom"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = 'company'"; $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); while ($i < $num_rows) { $array = $db->fetch_array($resql); if (is_array($array)) { array_push($def, $array[0]); } $i++; } } else { dol_print_error($db); } print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; foreach ($dirsociete as $dirroot) { $dir = dol_buildpath($dirroot.'doc/', 0); $handle = @opendir($dir); if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { if (preg_match('/\.modules\.php$/i', $file)) { $name = substr($file, 4, dol_strlen($file) - 16); $classname = substr($file, 0, dol_strlen($file) - 12); try { dol_include_once($dirroot.'doc/'.$file); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } $module = new $classname($db); '@phan-var-force ModeleThirdPartyDoc $module'; $modulequalified = 1; if (!empty($module->version)) { if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } elseif ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } } if ($modulequalified) { print ''; // Activate / Disable if (in_array($name, $def)) { print ""; } else { if (versioncompare($module->phpmin, versionphparray()) > 0) { print '"; } else { print '"; } } // Info $htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip .= '
'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown")); if ($module->type == 'pdf') { $htmltooltip .= '
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; } $htmltooltip .= '

'.$langs->trans("FeaturesSupported").':'; $htmltooltip .= '
'.$langs->trans("WatermarkOnDraft").': '.yn((isset($module->option_draft_watermark) ? $module->option_draft_watermark : ''), 1, 1); print ''; // Preview print ''; print "\n"; } } } closedir($handle); } } print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; print dol_escape_htmltag($module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } print '\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; //} //else //{ // print img_picto($langs->trans("Enabled"),'on'); //} print "'."\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", implode('.', $module->phpmin))), 'switch_off'); print "'."\n"; print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; if ($module->type == 'pdf') { $linkspec = ''.img_object($langs->trans("Preview"), 'pdf').''; } else { $linkspec = img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic'); } print $linkspec; print '
'; print '
'; print '
'; //IDProf print load_fiche_titre($langs->trans("CompanyIdProfChecker"), '', ''); print '
'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; $profid = array('IDPROF1' => array(), 'IDPROF2' => array(), 'IDPROF3' => array(), 'IDPROF4' => array(), 'IDPROF5' => array(),'IDPROF6' => array(), 'EMAIL' => array()); $profid['IDPROF1'][0] = $langs->trans("ProfId1"); $profid['IDPROF1'][1] = $langs->transcountry('ProfId1', $mysoc->country_code); $profid['IDPROF2'][0] = $langs->trans("ProfId2"); $profid['IDPROF2'][1] = $langs->transcountry('ProfId2', $mysoc->country_code); $profid['IDPROF3'][0] = $langs->trans("ProfId3"); $profid['IDPROF3'][1] = $langs->transcountry('ProfId3', $mysoc->country_code); $profid['IDPROF4'][0] = $langs->trans("ProfId4"); $profid['IDPROF4'][1] = $langs->transcountry('ProfId4', $mysoc->country_code); $profid['IDPROF5'][0] = $langs->trans("ProfId5"); $profid['IDPROF5'][1] = $langs->transcountry('ProfId5', $mysoc->country_code); $profid['IDPROF6'][0] = $langs->trans("ProfId6"); $profid['IDPROF6'][1] = $langs->transcountry('ProfId6', $mysoc->country_code); $profid['EMAIL'][0] = $langs->trans("EMail"); $profid['EMAIL'][1] = $langs->trans('Email'); if (isModEnabled('accounting')) { $profid['ACCOUNTANCY_CODE_CUSTOMER'] = array(); $profid['ACCOUNTANCY_CODE_CUSTOMER'][0] = $langs->trans("CustomerAccountancyCodeShort"); $profid['ACCOUNTANCY_CODE_CUSTOMER'][1] = $langs->trans('CustomerAccountancyCodeShort'); $profid['ACCOUNTANCY_CODE_SUPPLIER'] = array(); $profid['ACCOUNTANCY_CODE_SUPPLIER'][0] = $langs->trans("SupplierAccountancyCodeShort"); $profid['ACCOUNTANCY_CODE_SUPPLIER'][1] = $langs->trans('SupplierAccountancyCodeShort'); } $nbofloop = count($profid); foreach ($profid as $key => $val) { if ($profid[$key][1] != '-') { print ''; print ''; $idprof_unique = 'SOCIETE_'.$key.'_UNIQUE'; $idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY'; $idprof_invoice_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY'; $verif = !empty($conf->global->$idprof_unique); $mandatory = !empty($conf->global->$idprof_mandatory); $invoice_mandatory = !empty($conf->global->$idprof_invoice_mandatory); if ($verif) { print ''; } else { print ''; } if ($mandatory) { print ''; } else { print ''; } if ($invoice_mandatory) { print ''; } else { print ''; } print "\n"; } } // VAT ID print ''; print '\n"; $key = 'VAT_INTRA'; if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) { print ''; } else { print ''; } if (getDolGlobalString('SOCIETE_VAT_INTRA_MANDATORY')) { print ''; } else { print ''; } print ''; print "\n"; print "
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").''.$langs->trans("MustBeInvoiceMandatory").'
'.$profid[$key][0]."\n"; print $profid[$key][1]; print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '
'.$langs->trans('VATIntra')."'; print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { print ''; print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("SaleEEC").'
'; print ''; print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("AnySale"); } elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) { print ''; print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("SaleEEC").'
'; print ''; print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("AnySale"); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("SaleEEC").'
'; print ''; print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); print ''; print $langs->trans("AnySale"); } print '
\n"; print '
'; print "
\n"; print load_fiche_titre($langs->trans("Other"), '', ''); // Autres options $form = new Form($db); print '
'; print ''; print ''; print ''; print '
'; print ''; print ''; print "\n"; print ''."\n"; print ''."\n"; // Utilisation formulaire Ajax sur choix societe print ''; print ''; if (!$conf->use_javascript_ajax) { print '"; } else { print '"; } print ''; print ''; print ''; if (!$conf->use_javascript_ajax) { print '"; } else { print '"; } print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (isModEnabled("shipping")) { if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal) print ''; print ''; print ''; print ''; print ''; } } // Disable Prospect/Customer thirdparty type print ''; print ''; print ''; print ''; print ''; if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) { // Default Prospect/Customer thirdparty type on customer création print ''; print ''; print ''; print ''; print ''; } if (getDolGlobalString('THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) { print ''; print ''; if (!$conf->use_javascript_ajax) { print '"; } else { print '"; } print ''; } print '
".$langs->trans("Parameters")."'.$langs->trans("Value").' 
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' '; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 1).'', '2' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 2).'', '3' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 3).'', ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp maxwidth400'); print ''; print ''; print "
'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 1).'', '2' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 2).'', '3' => $langs->trans("Yes").' - '.$langs->trans("NumberOfKeyToSearch", 3).'', ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString('CONTACT_USE_SEARCH_TO_SELECT'), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp maxwidth400'); print ''; print ''; print "
'.$langs->trans("AddRefInList").' '; if (getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("AddVatInList").' '; if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("AddAdressInList").' '; if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("AddEmailPhoneTownInContactList").' '; if (getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("AskForPreferredShippingMethod").' '; if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("DisableProspectCustomerType").' '; if (getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } print '
'.$langs->trans("DefaultCustomerType").''; print $formcompany->selectProspectCustomerType(getDolGlobalString('THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT'), 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; print ''; print '
'.$langs->trans('ContactsDefaultRoles').''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; $contact = new Contact($db); // InfraS add $contactType = $contact->listeTypeContacts('external', 0, 1); $selected = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); print $form->multiselectarray('activate_CONTACTS_DEFAULT_ROLES', $contactType, $selected, 0, 0, 'minwidth75imp'); print ''; print ''; print "
'; print '
'; print '
'; print dol_get_fiche_end(); // End of page llxFooter(); $db->close();