* Copyright (C) 2024-2025 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/admin/subcontractors.php * \ingroup core * \brief Setup page to configure subcontractors like accountantint provider / IT service provider... */ // Load Dolibarr environment require '../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user */ 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.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminsubcontractors'; // To manage different context of search // Load translation files required by the page $langs->loadLangs(array('admin', 'companies')); if (!$user->admin) { accessforbidden(); } $object = new stdClass(); /* * Actions */ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (($action == 'update' && !GETPOST("cancel", 'alpha')) || ($action == 'updateedit')) { dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOSTINT("state_id"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOSTINT('country_id'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("phone", 'alphanohtml'), 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'restricthtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_NAME", GETPOST("itprovider_nom", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_ADDRESS", GETPOST("itprovider_address", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_TOWN", GETPOST("itprovider_town", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_ZIP", GETPOST("itprovider_zipcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_STATE", GETPOSTINT("itprovider_state_id"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_REGION", GETPOST("itprovider_region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_COUNTRY", GETPOSTINT('itprovider_country_id'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_PHONE", GETPOST("itprovider_phone", 'alphanohtml'), 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_FAX", GETPOST("itprovider_fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_MAIL", GETPOST("itprovider_mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_WEB", GETPOST("itprovider_web", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_CODE", GETPOST("itprovider_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_ITPROVIDER_NOTE", GETPOST("itprovider_note", 'restricthtml'), 'chaine', 0, '', $conf->entity); if ($action != 'updateedit') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } } /* * View */ $help_url = ''; llxHeader('', $langs->trans("CompanyFoundation"), $help_url, '', 0, 0, '', '', '', 'mod-admin page-subcontractors'); print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup'); $head = company_admin_prepare_head(); print dol_get_fiche_head($head, 'subcontractors', '', -1, ''); $form = new Form($db); $formother = new FormOther($db); $formcompany = new FormCompany($db); $countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; print ''.$langs->trans("SubcontractorsDesc")."
\n"; print "

\n"; /** * Edit parameters */ if (!empty($conf->use_javascript_ajax)) { print "\n".''."\n"; } print '
'; print ''; print ''; print ''; print load_fiche_titre($langs->trans("AccountantingProvider"), '', 'accounting', 0, '', '', '', ''); print ''; print ''."\n"; // Name of Accountant Company print ''."\n"; // Address print ''."\n"; // ZIP print ''."\n"; // Town/City print ''."\n"; // Country print ''."\n"; // State print ''."\n"; // Telephone print ''; print ''."\n"; // Fax /* print ''; print ''."\n"; */ // eMail print ''; print ''."\n"; // Web print ''; print ''."\n"; // Code print ''."\n"; // Note print ''; print ''; print '
'.$langs->trans("CompanyInfo").'
'; print '
'; print '
'; print '
'; print '
'; print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); print $form->select_country((GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : getDolGlobalString('MAIN_INFO_ACCOUNTANT_COUNTRY')), 'country_id'); print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'; print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state((GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : getDolGlobalString('MAIN_INFO_ACCOUNTANT_STATE')), (GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : getDolGlobalString('MAIN_INFO_ACCOUNTANT_COUNTRY')), 'state_id'); print '
'; print img_picto('', 'object_phoning', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'object_phoning_fax', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'object_email', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'globe', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print '
'; print '
'; print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); print '
'; // IT service provider print load_fiche_titre($langs->trans("ITProvider"), '', 'hdd', 0, '', '', '', ''); print ''; print ''."\n"; // Name of Accountant Company print ''."\n"; // Address print ''."\n"; // ZIP print ''."\n"; // Town/City print ''."\n"; // Country print ''."\n"; // State print ''."\n"; // Telephone print ''; print ''."\n"; // Fax /* print ''; print ''."\n"; */ // eMail print ''; print ''."\n"; // Web print ''; print ''."\n"; // Code print ''."\n"; // Note print ''; print ''; print '
'.$langs->trans("CompanyInfo").'
'; print '
'; print '
'; print '
'; print '
'; print img_picto('', 'globe-americas', 'class="pictofixedwidth"'); print $form->select_country((GETPOSTISSET('itprovider_country_id') ? GETPOSTINT('itprovider_country_id') : getDolGlobalString('MAIN_INFO_ITPROVIDER_COUNTRY')), 'itprovider_country_id'); print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'; print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state((GETPOSTISSET('itprovider_state_id') ? GETPOSTINT('itprovider_state_id') : getDolGlobalString('MAIN_INFO_ITPROVIDER_STATE')), (GETPOSTISSET('itprovider_country_id') ? GETPOSTINT('itprovider_country_id') : getDolGlobalString('MAIN_INFO_ITPROVIDER_COUNTRY')), 'itprovider_state_id'); print '
'; print img_picto('', 'object_phoning', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'object_phoning_fax', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'object_email', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print img_picto('', 'globe', '', 0, 0, 0, '', 'pictofixedwidth'); print '
'; print '
'; print '
'; print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition'); print '
'; llxFooter(); $db->close();