Fix: The call of fetch method for societe.class with a second argument (ref) was wrong.
This commit is contained in:
parent
52dc19bc9f
commit
314b2e9509
@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if ($conf->facture->enabled) $langs->load("bills");
|
||||||
|
|
||||||
// Sécurité accés client
|
// Security check
|
||||||
$socid = $_GET["socid"];
|
$socid = $_GET["socid"];
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@ -42,9 +42,7 @@ if ($user->societe_id > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -52,7 +50,7 @@ llxHeader();
|
|||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.rowid > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
|
|||||||
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/comm/recap-client.php
|
* \file htdocs/comm/recap-client.php
|
||||||
\ingroup societe
|
* \ingroup societe
|
||||||
\brief Page de fiche recap client
|
* \brief Page de fiche recap client
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if ($conf->facture->enabled) $langs->load("bills");
|
||||||
|
|
||||||
// Sécurité accés client
|
// Security check
|
||||||
$socid = $_GET["socid"];
|
$socid = $_GET["socid"];
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@ -42,9 +42,7 @@ if ($user->societe_id > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -52,7 +50,7 @@ llxHeader();
|
|||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.rowid > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
|
|||||||
@ -37,9 +37,9 @@ class ComptaExport
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
\brief Constructeur de la class
|
\brief Constructeur de la class
|
||||||
\param DB Object de base de données
|
\param DB Object de base de donn<EFBFBD>es
|
||||||
\param USER Object utilisateur
|
\param USER Object utilisateur
|
||||||
\param classe Nom de la classe utilisée pour formater les rapports
|
\param classe Nom de la classe utilis<EFBFBD>e pour formater les rapports
|
||||||
*/
|
*/
|
||||||
function ComptaExport ($DB, $USER, $classe)
|
function ComptaExport ($DB, $USER, $classe)
|
||||||
{
|
{
|
||||||
@ -202,7 +202,7 @@ class ComptaExport
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Créé le fichier d'export
|
\brief Cr<EFBFBD><EFBFBD> le fichier d'export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function Export($id=0, $dir)
|
function Export($id=0, $dir)
|
||||||
|
|||||||
@ -83,7 +83,7 @@ $form = new Form($db);
|
|||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.rowid > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid);
|
||||||
if ($societe->id <= 0)
|
if ($societe->id <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$societe->error);
|
dol_print_error($db,$societe->error);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if ($conf->facture->enabled) $langs->load("bills");
|
||||||
|
|
||||||
// Sécurité accés client
|
// Security check
|
||||||
$socid = $_GET["socid"];
|
$socid = $_GET["socid"];
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@ -39,10 +39,9 @@ if ($user->societe_id > 0)
|
|||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -50,7 +49,7 @@ llxHeader();
|
|||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.rowid > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
@ -171,7 +170,7 @@ if ($socid > 0)
|
|||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
print '<td align="center">'.dol_print_date($objp->dp)."</td>\n";
|
print '<td align="center">'.dol_print_date($objp->dp)."</td>\n";
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print ' '; // Décalage
|
print ' '; // D<EFBFBD>calage
|
||||||
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
print '<a href="paiement/fiche.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$langs->trans("Payment").' '.$objp->rowid.'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
|
|||||||
@ -104,7 +104,7 @@ if ($_GET["id"] > 0) {
|
|||||||
$relativepath = "${fichinterref}/${fichinterref}.pdf";
|
$relativepath = "${fichinterref}/${fichinterref}.pdf";
|
||||||
$relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf";
|
$relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf";
|
||||||
|
|
||||||
// Chemin vers png aper<65>us
|
// Chemin vers png apercus
|
||||||
$relativepathimage = "${fichinterref}/${fichinterref}.pdf.png";
|
$relativepathimage = "${fichinterref}/${fichinterref}.pdf.png";
|
||||||
$fileimage = $file.".png"; // Si PDF d'1 page
|
$fileimage = $file.".png"; // Si PDF d'1 page
|
||||||
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
|
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
|
||||||
|
|||||||
@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
if ($conf->facture->enabled) $langs->load("bills");
|
if ($conf->facture->enabled) $langs->load("bills");
|
||||||
|
|
||||||
// Sécurité accés client
|
// Security check
|
||||||
$socid = $_GET["socid"];
|
$socid = $_GET["socid"];
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
@ -42,9 +42,7 @@ if ($user->societe_id > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
* Mode fiche
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -52,7 +50,7 @@ llxHeader();
|
|||||||
if ($socid > 0)
|
if ($socid > 0)
|
||||||
{
|
{
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($socid, $to); // si $to='next' ajouter " AND s.rowid > $socid ORDER BY idp ASC LIMIT 1";
|
$societe->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Affichage onglets
|
||||||
|
|||||||
@ -480,10 +480,10 @@ class Societe extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Load a third party from database into memory
|
* \brief Load a third party from database into memory
|
||||||
* \param socid Id third party to load
|
* \param socid Id third party to load
|
||||||
* \param user User object
|
* \param ref Name of third party (Warning, this can return several records)
|
||||||
* \return int >0 if OK, <0 if KO
|
* \return int >0 if OK, <0 if KO or if two records found for same ref.
|
||||||
*/
|
*/
|
||||||
function fetch($socid, $user=0)
|
function fetch($socid, $ref='')
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
global $conf;
|
global $conf;
|
||||||
@ -534,13 +534,21 @@ class Societe extends CommonObject
|
|||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as fj ON s.fk_forme_juridique = fj.code';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as fj ON s.fk_forme_juridique = fj.code';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id';
|
||||||
$sql .= ' WHERE s.rowid = '.$socid;
|
if ($socid) $sql .= ' WHERE s.rowid = '.$socid;
|
||||||
|
if ($ref) $sql .= " WHERE s.nom = '".addslashes($ref)."' AND s.entity = ".$conf->entity;
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
dol_syslog("Societe::fetch ".$sql);
|
dol_syslog("Societe::fetch ".$sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($this->db->num_rows($resql))
|
$num=$this->db->num_rows($resql);
|
||||||
|
if ($num > 1)
|
||||||
|
{
|
||||||
|
$this->error='Societe::Fetch several records found for ref='.$ref;
|
||||||
|
dol_syslog($this->error, LOG_ERR);
|
||||||
|
$result = -1;
|
||||||
|
}
|
||||||
|
if ($num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
@ -624,8 +632,8 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog('Erreur Societe::Fetch aucune societe avec id='.$this->id.' - '.$sql);
|
$this->error='Societe::Fetch no third party found for id='.$this->id;
|
||||||
$this->error='Erreur Societe::Fetch aucune societe avec id='.$this->id.' - '.$sql;
|
dol_syslog($this->error, LOG_ERR);
|
||||||
$result = -2;
|
$result = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,6 @@ $pagenext = $page + 1;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Recherche
|
// Recherche
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user