From ae17ce6f9abf08452929f62432865d2a12c33fc3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 19 Mar 2018 12:52:09 +0100 Subject: [PATCH] NEW Add a tab to specify accountant/auditor of the company --- htdocs/admin/accountant.php | 27 ++++++++------------------- htdocs/core/lib/admin.lib.php | 2 +- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 155534c5f3d..22f42ff0214 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -52,25 +52,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if ( ($action == 'update' && ! GETPOST("cancel",'alpha')) || ($action == 'updateedit') ) { - $tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0); - if (! empty($tmparray['id'])) - { - $mysoc->country_id =$tmparray['id']; - $mysoc->country_code =$tmparray['code']; - $mysoc->country_label=$tmparray['label']; - - $s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label; - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", $s,'chaine',0,'',$conf->entity); - - activateModulesRequiredByCountry($mysoc->country_code); - } - dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_TOWN", GETPOST("town",'nohtml'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ZIP", GETPOST("zipcode",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_STATE", GETPOST("state_id",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_REGION", GETPOST("region_code",'alpha'),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_COUNTRY", GETPOST('country_id','int'), 'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_PHONE", GETPOST("tel",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_FAX", GETPOST("fax",'alpha'),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_MAIL", GETPOST("mail",'alpha'),'chaine',0,'',$conf->entity); @@ -144,12 +132,12 @@ if ($action == 'edit' || $action == 'updateedit') // Country print ''; //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization - print $form->select_country($mysoc->country_id, 'country_id'); + print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''."\n"; print ''; - $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $mysoc->country_code, 'state_id'); + $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); print ''."\n"; print ''; @@ -216,13 +204,14 @@ else print ''.$langs->trans("CompanyCountry").''; - if ($mysoc->country_code) + if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY)) { - $img=picto_from_langcode($mysoc->country_code); + $code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2); + $img=picto_from_langcode($code); print $img?$img.' ':''; - print getCountry($mysoc->country_code,1); + print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY,1); } - else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; + else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Country")).''; print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7cf10b486b7..4bd9b097b3d 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1154,7 +1154,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql } /** - * Activate external modules mandatroy when country is country_code + * Activate external modules mandatory when country is country_code * * @param string $country_code CountryCode * @return int 1