| '.$langs->trans("Ref")." | ";
+ print ''.$fichinter->ref.' | ';
- $nbrow=4;
+ $nbrow=4;
print '';
/*
- * Documents
+ * Documents
*/
$fichinterref = dol_sanitizeFileName($fichinter->ref);
$dir_output = $conf->ficheinter->dir_output . "/";
@@ -104,7 +104,7 @@ if ($_GET["id"] > 0) {
$relativepath = "${fichinterref}/${fichinterref}.pdf";
$relativepathdetail = "${fichinterref}/${fichinterref}-detail.pdf";
- // Chemin vers png aper�us
+ // Chemin vers png apercus
$relativepathimage = "${fichinterref}/${fichinterref}.pdf.png";
$fileimage = $file.".png"; // Si PDF d'1 page
$fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page
diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php
index 7421bc91e4c..d97ac1385a0 100644
--- a/htdocs/fourn/recap-fourn.php
+++ b/htdocs/fourn/recap-fourn.php
@@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
$langs->load("companies");
if ($conf->facture->enabled) $langs->load("bills");
-// Sécurité accés client
+// Security check
$socid = $_GET["socid"];
if ($user->societe_id > 0)
{
@@ -42,9 +42,7 @@ if ($user->societe_id > 0)
/*
- *
- * Mode fiche
- *
+ * View
*/
llxHeader();
@@ -52,7 +50,7 @@ llxHeader();
if ($socid > 0)
{
$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
diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php
index 636487a44c4..3e172fcbe81 100644
--- a/htdocs/societe.class.php
+++ b/htdocs/societe.class.php
@@ -479,11 +479,11 @@ class Societe extends CommonObject
/**
* \brief Load a third party from database into memory
- * \param socid Id third party to load
- * \param user User object
- * \return int >0 if OK, <0 if KO
+ * \param socid Id third party to load
+ * \param ref Name of third party (Warning, this can return several records)
+ * \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 $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_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 .= ' 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);
dol_syslog("Societe::fetch ".$sql);
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);
@@ -624,8 +632,8 @@ class Societe extends CommonObject
}
else
{
- dol_syslog('Erreur Societe::Fetch aucune societe avec id='.$this->id.' - '.$sql);
- $this->error='Erreur Societe::Fetch aucune societe avec id='.$this->id.' - '.$sql;
+ $this->error='Societe::Fetch no third party found for id='.$this->id;
+ dol_syslog($this->error, LOG_ERR);
$result = -2;
}
diff --git a/htdocs/societe.php b/htdocs/societe.php
index 606ea93db98..d11d0fe824a 100644
--- a/htdocs/societe.php
+++ b/htdocs/societe.php
@@ -60,7 +60,6 @@ $pagenext = $page + 1;
/*
* Actions
- *
*/
// Recherche
|