From 882b66c58657016131e0ef654eedabd420c6fe45 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 1 Dec 2015 06:56:26 +0100 Subject: [PATCH 1/4] HRM - Add bank tab in user to pay salary or expense report --- htdocs/core/lib/usergroups.lib.php | 10 + .../install/mysql/migration/3.8.0-3.9.0.sql | 19 +- .../install/mysql/tables/llx_societe_rib.sql | 14 +- htdocs/install/mysql/tables/llx_user_rib.sql | 37 ++ htdocs/user/bank.php | 390 ++++++++++++++++++ htdocs/user/class/userbankaccount.class.php | 284 +++++++++++++ 6 files changed, 744 insertions(+), 10 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_user_rib.sql create mode 100644 htdocs/user/bank.php create mode 100644 htdocs/user/class/userbankaccount.class.php diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index b653cfbf5c0..e8961645c62 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2010-2012 Regis Houssin + * Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -93,6 +94,15 @@ function user_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); + if (! empty($conf->hrm->enabled)) + { + // Bank + $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; + $head[$h][1] = $langs->trans("Bank"); + $head[$h][2] = 'bank'; + $h++; + } + //Info on users is visible only by internal user if (empty($user->societe_id)) { diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index c15288d834b..cf3aa3fdf98 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -205,7 +205,24 @@ CREATE TABLE IF NOT EXISTS llx_establishment ( status smallint DEFAULT 1 ) ENGINE=InnoDB; - +CREATE TABLE IF NOT EXISTS llx_user_rib ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_user integer NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + datec datetime, + tms timestamp, + label varchar(30), + bank varchar(255), -- bank name + code_banque varchar(128), -- bank code + code_guichet varchar(6), -- desk code + number varchar(255), -- account number + cle_rib varchar(5), -- key of bank account + bic varchar(11), -- 11 according to ISO 9362 + iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 + domiciliation varchar(255), + proprio varchar(60), + owner_address varchar(255) +)ENGINE=innodb; ALTER TABLE llx_projet_task_time ADD COLUMN invoice_id integer DEFAULT NULL; ALTER TABLE llx_projet_task_time ADD COLUMN invoice_line_id integer DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index e8f995130d4..e003b6d706e 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -19,10 +19,11 @@ -- -- ============================================================================= -create table llx_societe_rib +create table llx_user_rib ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_soc integer NOT NULL, + fk_user integer NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, tms timestamp, label varchar(30), @@ -31,15 +32,10 @@ create table llx_societe_rib code_guichet varchar(6), -- desk code number varchar(255), -- account number cle_rib varchar(5), -- key of bank account - bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) + bic varchar(11), -- 11 according to ISO 9362 iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 domiciliation varchar(255), proprio varchar(60), owner_address varchar(255), - default_rib smallint NOT NULL DEFAULT 0, - - rum varchar(32), -- RUM value to use for SEPA generation - frstrecur varchar(16) default 'FRST', -- 'FRST' or 'RECUR' - - import_key varchar(14) -- import key + default_rib smallint NOT NULL DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_user_rib.sql b/htdocs/install/mysql/tables/llx_user_rib.sql new file mode 100644 index 00000000000..05738ce4582 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_user_rib.sql @@ -0,0 +1,37 @@ +-- ============================================================================= +-- Copyright (C) 2015 Alexandre Spangaro +-- +-- 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 . +-- +-- ============================================================================= + +create table llx_user_rib +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + fk_user integer NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + datec datetime, + tms timestamp, + label varchar(30), + bank varchar(255), -- bank name + code_banque varchar(128), -- bank code + code_guichet varchar(6), -- desk code + number varchar(255), -- account number + cle_rib varchar(5), -- key of bank account + bic varchar(11), -- 11 according to ISO 9362 + iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 + domiciliation varchar(255), + proprio varchar(60), + owner_address varchar(255) +)ENGINE=innodb; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php new file mode 100644 index 00000000000..0325fcd0a50 --- /dev/null +++ b/htdocs/user/bank.php @@ -0,0 +1,390 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2013 Peter Fontaine + * Copyright (C) 2015 Marcos GarcĂ­a + * Copyright (C) 2015 Alexandre Spangaro + * + * 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/user/bank.php + * \ingroup HRM + * \brief BAN tab for users + */ + +require '../main.inc.php'; +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.'/user/class/userbankaccount.class.php'; + +$langs->load("companies"); +$langs->load("commercial"); +$langs->load("banks"); +$langs->load("bills"); + +$id = GETPOST('id','int'); +$action = GETPOST("action"); + +// Security check +$socid=0; +if ($user->societe_id > 0) $socid = $user->societe_id; +$feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); +if ($user->id == $id) $feature2=''; // A user can always read its own card +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); + +$object = new User($db); +if ($id > 0 || ! empty($ref)) +{ + $result = $object->fetch($id, $ref); +} + +/* + * Actions + */ + +if ($action == 'update' && ! $_POST["cancel"]) +{ + // Modification + $account = new UserBankAccount($db); + + $account->fetch($id); + + $account->userid = $object->id; + + $account->bank = $_POST["bank"]; + $account->label = $_POST["label"]; + $account->courant = $_POST["courant"]; + $account->clos = $_POST["clos"]; + $account->code_banque = $_POST["code_banque"]; + $account->code_guichet = $_POST["code_guichet"]; + $account->number = $_POST["number"]; + $account->cle_rib = $_POST["cle_rib"]; + $account->bic = $_POST["bic"]; + $account->iban = $_POST["iban"]; + $account->domiciliation = $_POST["domiciliation"]; + $account->proprio = $_POST["proprio"]; + $account->owner_address = $_POST["owner_address"]; + + $result = $account->update($user); + if (! $result) + { + setEventMessage($account->error, 'errors'); + $_GET["action"]='edit'; // Force chargement page edition + } + else + { + $url=DOL_URL_ROOT.'/user/bank.php?id='.$object->id; + header('Location: '.$url); + exit; + } +} + +/* + * View + */ + +$form = new Form($db); + +llxHeader(); + +$head = user_prepare_head($object); + +$account = new UserBankAccount($db); +if (! $id) + $account->fetch(0,$object->id); +else + $account->fetch($id); +if (empty($account->userid)) $account->userid=$object->id; + + +if ($id && $action == 'edit' && $user->rights->user->user->creer) +{ + print '
'; + print ''; + print ''; + print ''; +} +if ($id && $action == 'create' && $user->rights->user->user->creer) +{ + print ''; + print ''; + print ''; +} + + +// View +if ($id && $action != 'edit') +{ + $title = $langs->trans("User"); + dol_fiche_head($head, 'bank', $title, 0, 'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + + print '
'; + + print '
'; + print ''; + + print ''; + print ''; + + print ''; + print ''; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + if ($val == 'DeskCode') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 2) + { + print ''; + print ''; + print ''; + } + } + + if ($val == 'AccountNumber') + { + print ''; + print ''; + print ''; + } + + if ($val == 'BankAccountNumberKey') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + } + + print ''; + print ''; + + print ''; + print ''; + + print '\n"; + + print '\n"; + + print '\n"; + + print '
'.$langs->trans("LabelRIB").''.$account->label.'
'.$langs->trans("BankName").''.$account->bank.'
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("DeskCode").''.$account->code_guichet.'
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("BankAccountNumber").''.$account->number.'
'.$langs->trans("BankAccountNumberKey").''.$account->cle_rib.'
'.$langs->trans("IBAN").''.$account->iban . ' '; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + print img_picto($langs->trans("IbanNotValid"),'warning'); + } else { + print img_picto($langs->trans("IbanValid"),'info'); + } + } + print '
'.$langs->trans("BIC").''.$account->bic.' '; + if (! empty($account->bic)) { + if (! checkSwiftForAccount($account)) { + print img_picto($langs->trans("SwiftNotValid"),'warning'); + } else { + print img_picto($langs->trans("SwiftValid"),'info'); + } + } + print '
'.$langs->trans("BankAccountDomiciliation").''; + print $account->domiciliation; + print "
'.$langs->trans("BankAccountOwner").''; + print $account->proprio; + print "
'.$langs->trans("BankAccountOwnerAddress").''; + print $account->owner_address; + print "
'; + + // Check BBAN + if ($account->label && ! checkBanForAccount($account)) + { + print '
'.$langs->trans("RIBControlError").'
'; + } + + print "
"; + + dol_fiche_end(); + + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->user->user->creer) + { + print ''.$langs->trans("Edit").''; + } + + print '
'; +} + +// Edit +if ($id && $action == 'edit' && $user->rights->user->user->creer) +{ + $title = $langs->trans("User"); + dol_fiche_head($head, 'bank', $title, 0, 'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + + print '
'; + + print '
'; + print ''; + + print ''; + print ''; + + print ''; + print ''; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + + if ($val == 'DeskCode') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + + if ($val == 'BankCode') + { + if ($account->useDetailedBBAN() == 2) + { + print ''; + print ''; + print ''; + } + } + + if ($val == 'AccountNumber') + { + print ''; + print ''; + print ''; + } + + if ($val == 'BankAccountNumberKey') + { + if ($account->useDetailedBBAN() == 1) + { + print ''; + print ''; + print ''; + } + } + } + + // IBAN + print ''; + print ''; + + print ''; + print ''; + + print '"; + + print ''; + print ''; + print "\n"; + + print '"; + + print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("BankName").'
'.$langs->trans("BankCode").'
'.$langs->trans("DeskCode").'
'.$langs->trans("BankCode").'
'.$langs->trans("BankAccountNumber").'
'.$langs->trans("BankAccountNumberKey").'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; + print "
'; + + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php new file mode 100644 index 00000000000..1f48be28187 --- /dev/null +++ b/htdocs/user/class/userbankaccount.class.php @@ -0,0 +1,284 @@ + + * Copyright (C) 2010-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013 Peter Fontaine + * Copyright (C) 2015 Alexandre Spangaro + * + * 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/user/class/userbankaccount.class.php + * \ingroup user + * \brief File of class to manage bank accounts description of users + */ + +require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; + + +/** + * Class to manage bank accounts description of third parties + */ +class UserBankAccount extends Account +{ + var $socid; + + var $default_rib; + + var $datec; + var $datem; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + + $this->socid = 0; + $this->clos = 0; + $this->solde = 0; + $this->error_number = 0; + $this->default_rib = 0; + return 1; + } + + + /** + * Create bank information record + * + * @param Object $user User + * @return int <0 if KO, >= 0 if OK + */ + function create($user='') + { + $now=dol_now(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rib (fk_user, datec)"; + $sql.= " VALUES (".$this->userid.", '".$this->db->idate($now)."')"; + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->affected_rows($resql)) + { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."user_rib"); + return 1; + } + } + else + { + print $this->db->error(); + return 0; + } + } + + /** + * Update bank account + * + * @param User $user Object user + * @return int <=0 if KO, >0 if OK + */ + function update($user='') + { + global $conf; + + if (! $this->id) + { + $this->create(); + } + + $sql = "UPDATE ".MAIN_DB_PREFIX."user_rib SET"; + $sql.= " bank = '" .$this->db->escape($this->bank)."'"; + $sql.= ",code_banque='".$this->code_banque."'"; + $sql.= ",code_guichet='".$this->code_guichet."'"; + $sql.= ",number='".$this->number."'"; + $sql.= ",cle_rib='".$this->cle_rib."'"; + $sql.= ",bic='".$this->bic."'"; + $sql.= ",iban_prefix = '".$this->iban."'"; + $sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql.= ",proprio = '".$this->db->escape($this->proprio)."'"; + $sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'"; + + if (trim($this->label) != '') + $sql.= ",label = '".$this->db->escape($this->label)."'"; + else + $sql.= ",label = NULL"; + $sql.= " WHERE rowid = ".$this->id; + + $result = $this->db->query($sql); + if ($result) + { + return 1; + } + else + { + dol_print_error($this->db); + return 0; + } + } + + /** + * Load record from database + * + * @param int $id Id of record + * @param int $socid Id of company. If this is filled, function will return the default RIB of company + * @return int <0 if KO, >0 if OK + */ + function fetch($id, $socid=0) + { + if (empty($id) && empty($socid)) 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, default_rib, label, datec, tms as datem"; + $sql.= " FROM ".MAIN_DB_PREFIX."user_rib"; + if ($id) $sql.= " WHERE rowid = ".$id; + if ($socid) $sql.= " WHERE fk_user = ".$userid; + + $resql = $this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->socid = $obj->fk_soc; + $this->bank = $obj->bank; + $this->code_banque = $obj->code_banque; + $this->code_guichet = $obj->code_guichet; + $this->number = $obj->number; + $this->cle_rib = $obj->cle_rib; + $this->bic = $obj->bic; + $this->iban = $obj->iban; + $this->domiciliation = $obj->domiciliation; + $this->proprio = $obj->proprio; + $this->owner_address = $obj->owner_address; + $this->label = $obj->label; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); + } + $this->db->free($resql); + + return 1; + } + else + { + dol_print_error($this->db); + return -1; + } + } + + /** + * Delete a rib from database + * + * @param User $user User deleting + * @return int <0 if KO, >0 if OK + */ + function delete($user) + { + global $conf; + + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rib"; + $sql.= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + return 1; + } + else { + dol_print_error($this->db); + return -1; + } + } + + /** + * Return RIB + * + * @param boolean $displayriblabel Prepend or Hide Label + * @return string RIB + */ + function getRibLabel($displayriblabel = true) + { + global $langs,$conf; + + if ($this->code_banque || $this->code_guichet || $this->number || $this->cle_rib) + { + if ($this->label && $displayriblabel) $rib = $this->label." : "; + + // Show fields of bank account + $fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey'; + if (! empty($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) + { + if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber'; + } + else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION; + } + $fieldlistsarray=explode(' ',$fieldlists); + + foreach($fieldlistsarray as $val) + { + if ($val == 'BankCode') + { + if ($this->useDetailedBBAN() == 1) + { + $rib.=$this->code_banque.' '; + } + } + + if ($val == 'DeskCode') + { + if ($this->useDetailedBBAN() == 1) + { + $rib.=$this->code_guichet.' '; + } + } + + if ($val == 'BankCode') + { + if ($this->useDetailedBBAN() == 2) + { + $rib.=$this->code_banque.' '; + } + } + + if ($val == 'AccountNumber') + { + $rib.=$this->number.' '; + } + + if ($val == 'BankAccountNumberKey') + { + if ($this->useDetailedBBAN() == 1) + { + $rib.=$this->cle_rib.' '; + } + } + } + } + else + { + $rib=''; + } + + return $rib; + } +} + From 09a6cc962545b23f8ff5bc743eaa115ede959421 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 1 Dec 2015 20:17:14 +0100 Subject: [PATCH 2/4] wrong table --- htdocs/install/mysql/tables/llx_societe_rib.sql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe_rib.sql b/htdocs/install/mysql/tables/llx_societe_rib.sql index e003b6d706e..e8f995130d4 100644 --- a/htdocs/install/mysql/tables/llx_societe_rib.sql +++ b/htdocs/install/mysql/tables/llx_societe_rib.sql @@ -19,11 +19,10 @@ -- -- ============================================================================= -create table llx_user_rib +create table llx_societe_rib ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_user integer NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_soc integer NOT NULL, datec datetime, tms timestamp, label varchar(30), @@ -32,10 +31,15 @@ create table llx_user_rib code_guichet varchar(6), -- desk code number varchar(255), -- account number cle_rib varchar(5), -- key of bank account - bic varchar(11), -- 11 according to ISO 9362 + bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility) iban_prefix varchar(34), -- full iban. 34 according to ISO 13616 domiciliation varchar(255), proprio varchar(60), owner_address varchar(255), - default_rib smallint NOT NULL DEFAULT 0 + default_rib smallint NOT NULL DEFAULT 0, + + rum varchar(32), -- RUM value to use for SEPA generation + frstrecur varchar(16) default 'FRST', -- 'FRST' or 'RECUR' + + import_key varchar(14) -- import key )ENGINE=innodb; From e1c8e6d8f63a68f3a68e45037743a0ac87b36df5 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 1 Dec 2015 20:27:29 +0100 Subject: [PATCH 3/4] Remove useless code --- htdocs/user/class/userbankaccount.class.php | 27 --------------------- 1 file changed, 27 deletions(-) diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 1f48be28187..c89d7162c2a 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -35,8 +35,6 @@ class UserBankAccount extends Account { var $socid; - var $default_rib; - var $datec; var $datem; @@ -54,7 +52,6 @@ class UserBankAccount extends Account $this->clos = 0; $this->solde = 0; $this->error_number = 0; - $this->default_rib = 0; return 1; } @@ -183,30 +180,6 @@ class UserBankAccount extends Account } } - /** - * Delete a rib from database - * - * @param User $user User deleting - * @return int <0 if KO, >0 if OK - */ - function delete($user) - { - global $conf; - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rib"; - $sql.= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - return 1; - } - else { - dol_print_error($this->db); - return -1; - } - } - /** * Return RIB * From 6598ac67457f182cddb9914b5ab279240cd17a94 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Fri, 4 Dec 2015 12:48:36 +0100 Subject: [PATCH 4/4] Add rights to see tab (hrm->employee->read) --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index e8961645c62..5083ec3b495 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -94,7 +94,7 @@ function user_prepare_head($object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'user'); - if (! empty($conf->hrm->enabled)) + if (! empty($conf->hrm->enabled) && $user->rights->hrm->employee->read) { // Bank $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;