Qual: Postgresql compatibility

Qual: W3C
This commit is contained in:
Laurent Destailleur 2011-09-20 21:44:24 +00:00
parent 53d8bf2f17
commit ce0a72c546
2 changed files with 33 additions and 25 deletions

View File

@ -65,10 +65,14 @@ class CompanyBankAccount extends Account
/** /**
* Create bank information record * Create bank information record
*
* @return int <0 if KO, >= 0 if OK
*/ */
function create() 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); $resql=$this->db->query($sql);
if ($resql) 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='') 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;
@ -135,8 +140,10 @@ class CompanyBankAccount extends Account
/** /**
* Load record from database * 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) function fetch($id,$socid=0)
{ {

View File

@ -106,12 +106,6 @@ 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>';
@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit')
print '</table>'; print '</table>';
print '</div>'; // Check BBAN
if (! checkBanForAccount($account))
/*
* 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 class="warning">'.$langs->trans("RIBControlError").'</div>';
} }
print '</div>';
} }
/* ************************************************************************** */ /* ************************************************************************** */
@ -194,7 +178,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer
$form = new Form($db); $form = new Form($db);
if ($message) { print "$message<br><br>\n"; } dol_htmloutput_mesg($message);
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'].'">';
@ -268,6 +252,23 @@ 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();