diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php new file mode 100644 index 00000000000..155534c5f3d --- /dev/null +++ b/htdocs/admin/accountant.php @@ -0,0 +1,260 @@ + + * + * 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/accountant.php + * \ingroup accountant + * \brief Setup page to configure accountant / auditor + */ + +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.'/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'); + +$langs->load("admin"); +$langs->load("companies"); + +if (! $user->admin) accessforbidden(); + +$error=0; + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$contextpage=array('adminaccoutant','globaladmin'); +$hookmanager->initHooks($contextpage); + +/* + * 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') ) +{ + $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_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); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_WEB", GETPOST("web",'alpha'),'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note",'none'),'chaine',0,'',$conf->entity); + + if ($action != 'updateedit' && ! $error) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } +} + +/* + * View + */ + +$help_url=''; +llxHeader('',$langs->trans("CompanyFoundation"),$help_url); + +print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup'); + +$head = company_admin_prepare_head(); + +dol_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company'); + +$form=new Form($db); +$formother=new FormOther($db); +$formcompany=new FormCompany($db); + +$countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; + +print $langs->trans("AccountantDesc")."
\n"; +print "
\n"; + +if ($action == 'edit' || $action == 'updateedit') +{ + /** + * Edit parameters + */ + print "\n".''."\n"; + + print '
'; + print ''; + print ''; + + print ''; + print ''."\n"; + + // Name + print ''."\n"; + + // Address + print ''."\n"; + + print ''."\n"; + + print ''."\n"; + + // Country + print ''."\n"; + + print ''."\n"; + + print ''; + print ''."\n"; + + print ''; + print ''."\n"; + + print ''; + print ''."\n"; + + // Web + print ''; + print ''."\n"; + + // Note + print ''; + print ''; + + print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; + print '
'; + print '
'; + print '
'; + 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'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print '
'; + $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $mysoc->country_code, 'state_id'); + print '
'; + print '
'; + print '
'; + print '
'; + print '
'; + print '
'; + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + print '
'; + + print '
'; +} +else +{ + /* + * Show parameters + */ + + // Actions buttons + //print '
'; + //print ''.$langs->trans("Modify").''; + //print '

'; + + print '
'; + print ''; + print ''; + + + print ''; + + + print ''; + + + print ''; + + + print ''; + + + print ''; + + + if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''; + + print ''; + + print ''; + + print ''; + + // Web + + print ''; + + print ''; + + print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; + print $conf->global->MAIN_INFO_ACCOUNTANT_NAME; + print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '
'.$langs->trans("CompanyCountry").''; + if ($mysoc->country_code) + { + $img=picto_from_langcode($mysoc->country_code); + print $img?$img.' ':''; + print getCountry($mysoc->country_code,1); + } + else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; + print '
'.$langs->trans("Region-State").''; + else print '
'.$langs->trans("State").''; + if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE,$conf->global->MAIN_SHOW_STATE_CODE,0,$conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); + else print ' '; + print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX,$mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL,0,0,0,80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB,'_blank',80) . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '
'; + print "
"; + + print ''; + + // Actions buttons + print '
'; + print ''; + print '
'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 64e515ac76f..655a10f5735 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -295,6 +295,10 @@ $countrynotdefined=''.$langs->trans("ErrorSetACountryFirst") print load_fiche_titre($langs->trans("CompanyFoundation"),'','title_setup'); +$head = company_admin_prepare_head(); + +dol_fiche_head($head, 'company', $langs->trans("Company"), -1, 'company'); + print $langs->trans("CompanyFundationDesc")."
\n"; print "
\n"; @@ -1134,8 +1138,6 @@ else print '
'; print ''; print '
'; - - print '
'; } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 7c21b89ae3c..7cf10b486b7 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1612,6 +1612,33 @@ function phpinfo_array() return $info_arr; } +/** + * Return array head with list of tabs to view object informations. + * + * @return array head array with tabs + */ +function company_admin_prepare_head() +{ + global $langs, $conf, $user; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/company.php"; + $head[$h][1] = $langs->trans("Company"); + $head[$h][2] = 'company'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/accountant.php"; + $head[$h][1] = $langs->trans("Accountant"); + $head[$h][2] = 'accountant'; + $h++; + + complete_head_from_modules($conf,$langs,null,$head,$h,'company_admin','remove'); + + return $head; +} + /** * Return array head with list of tabs to view object informations. * diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b9e4c33f227..da58499482a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1054,6 +1054,7 @@ AreaForAdminOnly=Setup parameters can be set by administrator users only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit. CompanyFundationDesc=Edit on this page all known information of the company or foundation you need to manage (For this, click on "Modify" or "Save" button at bottom of page) +AccountantDesc=Edit on this page all known information of your accountant/auditor to manage (For this, click on "Modify" or "Save" button at bottom of page) DisplayDesc=You can choose each parameter related to the Dolibarr look and feel here AvailableModules=Available app/modules ToActivateModule=To activate modules, go on setup Area (Home->Setup->Modules). diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c1027e20466..ce29459e022 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -426,6 +426,7 @@ ActionDoneShort=Finished ActionUncomplete=Uncomplete LatestLinkedEvents=Latest %s linked events CompanyFoundation=Company/Organization +Accountant=Accountant ContactsForCompany=Contacts for this third party ContactsAddressesForCompany=Contacts/addresses for this third party AddressesForCompany=Addresses for this third party