diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 0c3a029574e..d9a76064256 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -65,10 +65,14 @@ class CompanyBankAccount extends Account /** * Create bank information record + * + * @return int <0 if KO, >= 0 if OK */ function create() { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; + $now=dol_now(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')"; $resql=$this->db->query($sql); if ($resql) { @@ -85,12 +89,13 @@ class CompanyBankAccount extends Account } /** + * Update bank account * - * + * @param User $user Object user + * @return int <=0 if KO, >0 if OK */ function update($user='') { - $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql .= " WHERE fk_soc = ".$this->socid; @@ -135,8 +140,10 @@ class CompanyBankAccount extends Account /** * Load record from database - * @param id Id of record - * @param socid Id of company + * + * @param int $id Id of record + * @param int $socid Id of company + * @return int <0 if KO, >0 if OK */ function fetch($id,$socid=0) { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 2ccd64112ae..d10353e2be5 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -106,12 +106,6 @@ if (empty($account->socid)) $account->socid=$soc->id; if ($_GET["socid"] && $_GET["action"] != 'edit') { - // Check BBAN - if (! checkBanForAccount($account)) - { - print '
'.$langs->trans("RIBControlError").'

'; - } - print ''; print ''; @@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '
'.$langs->trans("Bank").'
'; - print ''; - - - - /* - * Barre d'actions - */ - print '
'; - - if ($user->rights->societe->creer) + // Check BBAN + if (! checkBanForAccount($account)) { - print ''.$langs->trans("Modify").''; + print '
'.$langs->trans("RIBControlError").'
'; } - print '
'; - } /* ************************************************************************** */ @@ -194,7 +178,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer $form = new Form($db); - if ($message) { print "$message

\n"; } + dol_htmloutput_mesg($message); print '
'; print ''; @@ -268,6 +252,23 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer dol_fiche_end(); + +if ($_GET["socid"] && $_GET["action"] != 'edit') +{ + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) + { + print ''.$langs->trans("Modify").''; + } + + print '
'; +} + + $db->close();