Fix: pgsql compatibility

This commit is contained in:
Laurent Destailleur 2011-03-09 10:27:19 +00:00
parent 0ffc86fe02
commit 4e1d689bf8
2 changed files with 137 additions and 132 deletions

View File

@ -89,11 +89,16 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
*/ */
$html=new Form($db); $html=new Form($db);
llxHeader();
$company_static=new Societe($db); $company_static=new Societe($db);
$morequerystring='';
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
foreach($listofparams as $param)
{
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
}
llxHeader('','','','',0,0,'','',$morequerystring);
$fsearch.='<br>'; $fsearch.='<br>';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
@ -174,13 +179,13 @@ if (is_array($coll_list))
$i = 1; $i = 1;
foreach($coll_list as $coll) foreach($coll_list as $coll)
{ {
if($min == 0 or ($min>0 and $coll[2]>$min)) if($min == 0 or ($min > 0 && $coll->amount > $min))
{ {
$var=!$var; $var=!$var;
$intra = str_replace($find,$replace,$coll[1]); $intra = str_replace($find,$replace,$coll->tva_intra);
if(empty($intra)) if(empty($intra))
{ {
if($coll[4] == '1') if($coll->assuj == '1')
{ {
$intra = $langs->trans('Unknown'); $intra = $langs->trans('Unknown');
} }
@ -191,15 +196,15 @@ if (is_array($coll_list))
} }
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td nowrap>".$i."</td>"; print "<td nowrap>".$i."</td>";
$company_static->id=$coll[5]; $company_static->id=$coll->socid;
$company_static->nom=$coll[0]; $company_static->nom=$coll->nom;
print '<td nowrap>'.$company_static->getNomUrl(1).'</td>'; print '<td nowrap>'.$company_static->getNomUrl(1).'</td>';
$find = array(' ','.'); $find = array(' ','.');
$replace = array('',''); $replace = array('','');
print "<td nowrap>".$intra."</td>"; print "<td nowrap>".$intra."</td>";
print "<td nowrap align=\"right\">".price($coll[2])."</td>"; print "<td nowrap align=\"right\">".price($coll->amount)."</td>";
print "<td nowrap align=\"right\">".price($coll[3])."</td>"; print "<td nowrap align=\"right\">".price($coll->tva)."</td>";
$total = $total + $coll[3]; $total = $total + $coll->tva;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
@ -246,13 +251,13 @@ if (is_array($coll_list))
$i = 1; $i = 1;
foreach($coll_list as $coll) foreach($coll_list as $coll)
{ {
if($min == 0 or ($min>0 and $coll[2]>$min)) if($min == 0 or ($min > 0 && $coll->amount > $min))
{ {
$var=!$var; $var=!$var;
$intra = str_replace($find,$replace,$coll[1]); $intra = str_replace($find,$replace,$coll->tva_intra);
if(empty($intra)) if(empty($intra))
{ {
if($coll[4] == '1') if($coll->assuj == '1')
{ {
$intra = $langs->trans('Unknown'); $intra = $langs->trans('Unknown');
} }
@ -263,15 +268,15 @@ if (is_array($coll_list))
} }
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print "<td nowrap>".$i."</td>"; print "<td nowrap>".$i."</td>";
$company_static->id=$coll[5]; $company_static->id=$coll->socid;
$company_static->nom=$coll[0]; $company_static->nom=$coll->nom;
print '<td nowrap>'.$company_static->getNomUrl(1).'</td>'; print '<td nowrap>'.$company_static->getNomUrl(1).'</td>';
$find = array(' ','.'); $find = array(' ','.');
$replace = array('',''); $replace = array('','');
print "<td nowrap>".$intra."</td>"; print "<td nowrap>".$intra."</td>";
print "<td nowrap align=\"right\">".price($coll[2])."</td>"; print "<td nowrap align=\"right\">".price($coll->amount)."</td>";
print "<td nowrap align=\"right\">".price($coll[3])."</td>"; print "<td nowrap align=\"right\">".price($coll->tva)."</td>";
$total = $total + $coll[3]; $total = $total + $coll->tva;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -148,7 +148,7 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
while($assoc = $db->fetch_array($resql)) while($assoc = $db->fetch_object($resql))
{ {
$list[] = $assoc; $list[] = $assoc;
} }