Qual: Removed warnings

This commit is contained in:
Laurent Destailleur 2011-09-20 21:21:04 +00:00
parent ce0a72c546
commit 925fc692b9
3 changed files with 64 additions and 41 deletions

View File

@ -30,24 +30,55 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
*/ */
class Client extends Societe class Client extends Societe
{ {
var $nb; var $db;
/** /**
* Constructor * \brief Constructeur de la classe
* * \param DB handler acces base de donnees
* @param DoliDB $DB Database handler * \param id id societe (0 par defaut)
*/ */
function Client($DB) function Client($DB, $id=0)
{ {
global $config; global $config;
$this->db = $DB; $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 * \brief Charge indicateurs this->nb de tableaux de bord
* * \return int <0 si ko, >0 si ok
* @return int <0 if KO, >0 if OK
*/ */
function load_state_board() function load_state_board()
{ {

View File

@ -65,14 +65,10 @@ class CompanyBankAccount extends Account
/** /**
* Create bank information record * Create bank information record
*
* @return int <0 if KO, >= 0 if OK
*/ */
function create() function create()
{ {
$now=dol_now(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) 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='') function update($user='')
{ {
$sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib";
$sql .= " WHERE fk_soc = ".$this->socid; $sql .= " WHERE fk_soc = ".$this->socid;
@ -140,10 +135,8 @@ class CompanyBankAccount extends Account
/** /**
* Load record from database * Load record from database
* * @param id Id of record
* @param int $id Id of record * @param socid Id of company
* @param int $socid Id of company
* @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$socid=0) function fetch($id,$socid=0)
{ {

View File

@ -106,6 +106,12 @@ if (empty($account->socid)) $account->socid=$soc->id;
if ($_GET["socid"] && $_GET["action"] != 'edit') if ($_GET["socid"] && $_GET["action"] != 'edit')
{ {
// Check BBAN
if (! checkBanForAccount($account))
{
print '<div class="warning">'.$langs->trans("RIBControlError").'</div><br>';
}
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>'; print '<tr><td valign="top" width="35%">'.$langs->trans("Bank").'</td>';
@ -159,12 +165,22 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '</table>'; print '</table>';
// Check BBAN print '</div>';
if (! checkBanForAccount($account))
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{ {
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>'; print '<a class="butAction" href="rib.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
} }
print '</div>';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -178,7 +194,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
$form = new Form($db); $form = new Form($db);
dol_htmloutput_mesg($message); if ($message) { print "$message<br><br>\n"; }
print '<form action="rib.php?socid='.$soc->id.'" method="post">'; print '<form action="rib.php?socid='.$soc->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -252,23 +268,6 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
dol_fiche_end(); dol_fiche_end();
if ($_GET["socid"] && $_GET["action"] != 'edit')
{
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
if ($user->rights->societe->creer)
{
print '<a class="butAction" href="rib.php?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
}
print '</div>';
}
$db->close(); $db->close();