diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index 623af8c79d8..0c7c4fc3c8a 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/modulebuilder/template/myobject_agenda.php - * \ingroup bom - * \brief Page of MyObject events + * \file htdocs/bom/bom_agenda.php + * \ingroup bom + * \brief Page of BOM events */ // Load Dolibarr environment diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 0ab79985ea7..04f47c8428d 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - holiday HRM=HRM -Holidays=Leave +Holidays=Leaves +Holiday=Leave CPTitreMenu=Leave MenuReportMonth=Monthly statement MenuAddCP=New leave request @@ -147,4 +148,4 @@ XIsAUsualNonWorkingDay=%s is usualy a NON working day BlockHolidayIfNegative=Block if balance negative LeaveRequestCreationBlockedBecauseBalanceIsNegative=The creation of this leave request is blocked because your balance is negative ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted -HolidayQtyNotModified=Balance of remaining days for %s has not been changed \ No newline at end of file +HolidayQtyNotModified=Balance of remaining days for %s has not been changed diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index c6671f9f6a3..22720779eaf 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - holiday HRM=GRH Holidays=Congés +Holiday=Congé CPTitreMenu=Demande de congés MenuReportMonth=État mensuel MenuAddCP=Créer demande de congés diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 2c6dd47b234..4f3ee5c32c8 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -33,13 +33,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; if (isModEnabled('holiday')) { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; } if (isModEnabled('expensereport')) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } -if (!empty($conf->salaries->enabled)) { +if (isModEnabled('salaries')) { require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; } @@ -122,6 +124,10 @@ if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) { $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); + $account->currency_code = trim(GETPOST("account_currency_code")); + $account->state_id = GETPOST("account_state_id", 'int'); + $account->country_id = GETPOST("account_country_id", 'int'); + $result = $account->create($user); if (!$result) { @@ -192,6 +198,10 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) { $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); + $account->currency_code = trim(GETPOST("account_currency_code")); + $account->state_id = GETPOST("account_state_id", 'int'); + $account->country_id = GETPOST("account_country_id", 'int'); + $result = $account->update($user); if (!$result) { @@ -274,6 +284,7 @@ if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { */ $form = new Form($db); +$formcompany = new FormCompany($db); $childids = $user->getAllChildIds(1); @@ -285,14 +296,42 @@ llxHeader('', $title, $help_url); $head = user_prepare_head($object); if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) { - print '
'; + if ($conf->use_javascript_ajax) { + print "\n\n"; + } + print ''; print ''; print ''; print ''; print ''; } if ($id && $action == 'create' && $user->rights->user->user->creer) { - print ''; + if ($conf->use_javascript_ajax) { + print "\n\n"; + } + print ''; print ''; print ''; print ''; @@ -772,6 +811,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); + print_liste_field_titre("Currency"); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print "\n"; @@ -806,7 +846,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print $string; print ''; // IBAN - print ''.$account->iban; + print ''.getIbanHumanReadable($account); if (!empty($account->iban)) { if (!checkIbanForAccount($account)) { print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); @@ -822,6 +862,9 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } print ''; + // Currency + print ''.$account->currency_code.''; + // Edit/Delete print ''; if ($permissiontoaddbankaccount) { @@ -864,6 +907,47 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->rights->user->us print ''.$langs->trans("BankName").''; print ''; + // Currency + print ''.$langs->trans("Currency"); + print ''; + print ''; + print ''; + $selectedcode = $account->currency_code; + if (!$selectedcode) { + $selectedcode = $conf->currency; + } + print img_picto('', 'multicurrency', 'class="pictofixedwidth"'); + print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code'); + print ''; + + // Country + $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id; + $selectedcode = $account->country_code; + if (GETPOSTISSET("account_country_id")) { + $selectedcode = GETPOST("account_country_id"); + } elseif (empty($selectedcode)) { + $selectedcode = $mysoc->country_code; + } + $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules + + print ''.$langs->trans("Country").''; + print ''; + print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print ''; + + // State + print ''.$langs->trans('State').''; + if ($selectedcode) { + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id'); + } else { + print $countrynotdefined; + } + print ''; + // Show fields of bank account foreach ($account->getFieldsToShow() as $val) { if ($val == 'BankCode') { diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 42164ce8b2c..271609139b1 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -134,6 +134,9 @@ class UserBankAccount extends Account $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; + $sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'"; + $sql .= ",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) : "null"); + $sql .= ",fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) : "null"); if (trim($this->label) != '') { $sql .= ",label = '".$this->db->escape($this->label)."'"; @@ -165,17 +168,23 @@ class UserBankAccount extends Account return -1; } - $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; - $sql .= " owner_address, label, datec, tms as datem"; - $sql .= " FROM ".$this->db->prefix()."user_rib"; + $sql = "SELECT ur.rowid, ur.fk_user, ur.entity, ur.bank, ur.number, ur.code_banque, ur.code_guichet, ur.cle_rib, ur.bic, ur.iban_prefix as iban, ur.domiciliation, ur.proprio"; + $sql .= ", ur.owner_address, ur.label, ur.datec, ur.tms as datem"; + $sql .= ', ur.currency_code, ur.state_id, ur.fk_country as country_id'; + $sql .= ', c.code as country_code, c.label as country'; + $sql .= ', d.code_departement as state_code, d.nom as state'; + $sql .= " FROM ".$this->db->prefix()."user_rib as ur"; + $sql .= ' LEFT JOIN '.$this->db->prefix().'c_country as c ON ur.fk_country=c.rowid'; + $sql .= ' LEFT JOIN '.$this->db->prefix().'c_departements as d ON ur.state_id=d.rowid'; + if ($id) { - $sql .= " WHERE rowid = ".((int) $id); + $sql .= " WHERE ur.rowid = ".((int) $id); } if ($ref) { - $sql .= " WHERE label = '".$this->db->escape($ref)."'"; + $sql .= " WHERE ur.label = '".$this->db->escape($ref)."'"; } if ($userid) { - $sql .= " WHERE fk_user = ".((int) $userid); + $sql .= " WHERE ur.fk_user = ".((int) $userid); } $resql = $this->db->query($sql); @@ -198,6 +207,15 @@ class UserBankAccount extends Account $this->label = $obj->label; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); + $this->currency_code = $obj->currency_code; + + $this->state_id = $obj->state_id; + $this->state_code = $obj->state_code; + $this->state = $obj->state; + + $this->country_id = $obj->country_id; + $this->country_code = $obj->country_code; + $this->country = $obj->country; } $this->db->free($resql);