From 925fc692b92f381b80bc6841534055367c8cf2c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:21:04 +0000 Subject: [PATCH] Qual: Removed warnings --- htdocs/societe/class/client.class.php | 47 +++++++++++++++---- .../class/companybankaccount.class.php | 17 ++----- htdocs/societe/rib.php | 41 ++++++++-------- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 1d8d9c57213..6670540d1a3 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -30,24 +30,55 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); */ class Client extends Societe { - var $nb; + var $db; + /** - * Constructor - * - * @param DoliDB $DB Database handler + * \brief Constructeur de la classe + * \param DB handler acces base de donnees + * \param id id societe (0 par defaut) */ - function Client($DB) + function Client($DB, $id=0) { global $config; $this->db = $DB; + $this->id = $id; + $this->factures = array(); + + return 0; } + function read_factures() + { + $sql = "SELECT rowid, facnumber"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.fk_soc = ".$this->id; + $sql .= " ORDER BY datef DESC"; + + $i = 0; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + + while ($i < $num ) + { + $row = $this->db->fetch_row($resql); + + $this->factures[$i][0] = $row[0]; + $this->factures[$i][1] = $row[1]; + + $i++; + } + } + return $result; + } + + /** - * Load indicators into this->nb for board - * - * @return int <0 if KO, >0 if OK + * \brief Charge indicateurs this->nb de tableaux de bord + * \return int <0 si ko, >0 si ok */ function load_state_board() { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index d9a76064256..0c3a029574e 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -65,14 +65,10 @@ class CompanyBankAccount extends Account /** * Create bank information record - * - * @return int <0 if KO, >= 0 if OK */ function create() { - $now=dol_now(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; $resql=$this->db->query($sql); if ($resql) { @@ -89,13 +85,12 @@ 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; @@ -140,10 +135,8 @@ class CompanyBankAccount extends Account /** * Load record from database - * - * @param int $id Id of record - * @param int $socid Id of company - * @return int <0 if KO, >0 if OK + * @param id Id of record + * @param socid Id of company */ function fetch($id,$socid=0) { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index d10353e2be5..2ccd64112ae 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -106,6 +106,12 @@ 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 ''; @@ -159,12 +165,22 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '
'.$langs->trans("Bank").'
'; - // Check BBAN - if (! checkBanForAccount($account)) + print ''; + + + + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) { - print '
'.$langs->trans("RIBControlError").'
'; + print ''.$langs->trans("Modify").''; } + print '
'; + } /* ************************************************************************** */ @@ -178,7 +194,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer $form = new Form($db); - dol_htmloutput_mesg($message); + if ($message) { print "$message

\n"; } print '
'; print ''; @@ -252,23 +268,6 @@ 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();