Fix: Correction pb fecth_object
This commit is contained in:
parent
dceeaa4d85
commit
fdd7966c22
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
\file htdocs/comm/fiche.php
|
\file htdocs/comm/fiche.php
|
||||||
\ingroup commercial
|
\ingroup commercial
|
||||||
\brief Onglet client de la fiche societe
|
\brief Onglet client de la fiche societe
|
||||||
@ -44,12 +44,8 @@ llxHeader('',$langs->trans('CustomerCard'));
|
|||||||
$sortorder=$_GET["sortorder"];
|
$sortorder=$_GET["sortorder"];
|
||||||
$sortfield=$_GET["sortfield"];
|
$sortfield=$_GET["sortfield"];
|
||||||
|
|
||||||
if ($sortorder == "") {
|
if (! $sortorder) $sortorder="ASC";
|
||||||
$sortorder="ASC";
|
if (! $sortfield) $sortfield="nom";
|
||||||
}
|
|
||||||
if ($sortfield == "") {
|
|
||||||
$sortfield="nom";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($_GET["action"] == 'attribute_prefix')
|
if ($_GET["action"] == 'attribute_prefix')
|
||||||
@ -99,7 +95,6 @@ if ($action == 'stcomm')
|
|||||||
/*
|
/*
|
||||||
* Recherche
|
* Recherche
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if ($mode == 'search') {
|
if ($mode == 'search') {
|
||||||
if ($mode-search == 'soc') {
|
if ($mode-search == 'soc') {
|
||||||
@ -115,10 +110,8 @@ if ($mode == 'search') {
|
|||||||
$db->free();
|
$db->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
$_socid = $_GET["socid"];
|
$_socid = $_GET["socid"];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sécurité si un client essaye d'accéder à une autre fiche que la sienne
|
* Sécurité si un client essaye d'accéder à une autre fiche que la sienne
|
||||||
*/
|
*/
|
||||||
@ -126,11 +119,12 @@ if ($user->societe_id > 0)
|
|||||||
{
|
{
|
||||||
$_socid = $user->societe_id;
|
$_socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
*
|
*
|
||||||
* Mode fiche
|
* Mode fiche
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
if ($_socid > 0)
|
if ($_socid > 0)
|
||||||
{
|
{
|
||||||
@ -258,9 +252,6 @@ if ($_socid > 0)
|
|||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
print '<td valign="top" width="50%">';
|
print '<td valign="top" width="50%">';
|
||||||
@ -372,17 +363,18 @@ if ($_socid > 0)
|
|||||||
$sql .= " WHERE p.fk_soc = $objsoc->id";
|
$sql .= " WHERE p.fk_soc = $objsoc->id";
|
||||||
$sql .= " ORDER BY p.dateo DESC";
|
$sql .= " ORDER BY p.dateo DESC";
|
||||||
|
|
||||||
if ( $db->query($sql) ) {
|
$result=$db->query($sql);
|
||||||
|
if ($result) {
|
||||||
$var=true;
|
$var=true;
|
||||||
$i = 0 ;
|
$i = 0 ;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
if ($num > 0) {
|
if ($num > 0) {
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td colspan="2"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/index.php?socidp='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
print '<td colspan="2"><table width="100%" class="noborder"><tr><td>'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/projet/index.php?socidp='.$objsoc->id.'">'.$langs->trans("AllProjects").' ('.$num.')</td></tr></table></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
while ($i < $num && $i < $MAXLIST) {
|
while ($i < $num && $i < $MAXLIST) {
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object($result);
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
print '<td><a href="../projet/fiche.php?id='.$obj->rowid.'">'.$obj->title.'</a></td>';
|
||||||
@ -390,7 +382,7 @@ if ($_socid > 0)
|
|||||||
print "<td align=\"right\">".$obj->ref ."</td></tr>";
|
print "<td align=\"right\">".$obj->ref ."</td></tr>";
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free();
|
$db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -399,10 +391,6 @@ if ($_socid > 0)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
print "</table></div>\n";
|
print "</table></div>\n";
|
||||||
|
|
||||||
@ -446,11 +434,6 @@ if ($_socid > 0)
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($action == 'changevalue')
|
if ($action == 'changevalue')
|
||||||
{
|
{
|
||||||
print "<hr noshade>";
|
print "<hr noshade>";
|
||||||
@ -492,11 +475,13 @@ if ($_socid > 0)
|
|||||||
$sql .= " ORDER by p.datec";
|
$sql .= " ORDER by p.datec";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$i = 0 ; $num = $db->num_rows(); $tag = True;
|
$i = 0;
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$tag = true;
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object($result);
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
@ -560,14 +545,15 @@ if ($_socid > 0)
|
|||||||
$sql .= " AND c.id=a.fk_action AND a.percent < 100";
|
$sql .= " AND c.id=a.fk_action AND a.percent < 100";
|
||||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||||
|
|
||||||
if ( $db->query($sql) ) {
|
$result=$db->query($sql);
|
||||||
|
if ($result) {
|
||||||
print "<table width=\"100%\" class=\"noborder\">\n";
|
print "<table width=\"100%\" class=\"noborder\">\n";
|
||||||
|
|
||||||
$i = 0 ; $num = $db->num_rows();
|
$i = 0 ; $num = $db->num_rows($result);
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
|
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object($result);
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
if ($oldyear == strftime("%Y",$obj->da) )
|
if ($oldyear == strftime("%Y",$obj->da) )
|
||||||
@ -625,7 +611,7 @@ if ($_socid > 0)
|
|||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->free();
|
$db->free($result);
|
||||||
} else {
|
} else {
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
@ -646,19 +632,20 @@ if ($_socid > 0)
|
|||||||
$sql .= " AND c.id=a.fk_action AND a.percent = 100";
|
$sql .= " AND c.id=a.fk_action AND a.percent = 100";
|
||||||
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
$sql .= " ORDER BY a.datea DESC, a.id DESC";
|
||||||
|
|
||||||
if ( $db->query($sql) )
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
$i = 0 ;
|
$i = 0 ;
|
||||||
$num = $db->num_rows();
|
$num = $db->num_rows($result);
|
||||||
$oldyear='';
|
$oldyear='';
|
||||||
$oldmonth='';
|
$oldmonth='';
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
|
|
||||||
$obj = $db->fetch_object();
|
$obj = $db->fetch_object($result);
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
if ($oldyear == strftime("%Y",$obj->da) )
|
if ($oldyear == strftime("%Y",$obj->da) )
|
||||||
@ -667,7 +654,7 @@ if ($_socid > 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<TD align=\"center\">" .strftime("%Y",$obj->da)."</td>\n";
|
print "<td align=\"center\">" .strftime("%Y",$obj->da)."</td>\n";
|
||||||
$oldyear = strftime("%Y",$obj->da);
|
$oldyear = strftime("%Y",$obj->da);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,13 +703,14 @@ if ($_socid > 0)
|
|||||||
}
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->free();
|
$db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
}
|
}
|
||||||
print "</td></tr></table>";
|
print "</td></tr></table>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Notes sur la societe
|
* Notes sur la societe
|
||||||
@ -734,11 +722,6 @@ if ($_socid > 0)
|
|||||||
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
print "<tr><td>".nl2br($objsoc->note)."</td></tr>";
|
||||||
print "</table>";
|
print "</table>";
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user