Skip to content

Commit

Permalink
Revert "To provide solution to get thirdparty when name is not unique."
Browse files Browse the repository at this point in the history
This reverts commit 58328d3.
  • Loading branch information
eldy committed Jun 29, 2017
1 parent 58328d3 commit 2f8c0bb
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions htdocs/societe/class/societe.class.php
Expand Up @@ -1004,22 +1004,21 @@ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmod
* @param int $rowid Id of third party to load
* @param string $ref Reference of third party, name (Warning, this can return several records)
* @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr)
* @param string $ref_int Internal reference of third party (not used by dolibarr)
* @param string $ref_int Internal reference of third party
* @param string $idprof1 Prof id 1 of third party (Warning, this can return several records)
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
* @param string $idprof4 Prof id 4 of third party (Warning, this can return several records)
* @param string $idprof5 Prof id 5 of third party (Warning, this can return several records)
* @param string $idprof6 Prof id 6 of third party (Warning, this can return several records)
* @param string $email Email (Warning, this can return several records)
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
*/
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='', $email='')
function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='')
{
global $langs;
global $conf;

if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1;

$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm';
$sql .= ', s.status';
Expand Down Expand Up @@ -1063,7 +1062,6 @@ function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='
else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")";
else if ($email) $sql .= " WHERE email = '".$this->db->escape($email)."' AND s.entity IN (".getEntity($this->element, 1).")";

$resql=$this->db->query($sql);
dol_syslog(get_class($this)."::fetch ".$sql);
Expand Down Expand Up @@ -1888,7 +1886,7 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
$label.= '<u>' . $langs->trans("ShowMargin") . '</u>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/margin/tabs/thirdpartyMargins.php?socid='.$this->id.'&type=1';
}

// By default
if (empty($linkstart))
{
Expand All @@ -1909,7 +1907,7 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
$label.= '<br><b>' . $langs->trans('CustomerAccountancyCode') . ':</b> '. $this->code_compta_client;
if (! empty($conf->accounting->enabled) && $this->fournisseur)
$label.= '<br><b>' . $langs->trans('SupplierAccountancyCode') . ':</b> '. $this->code_compta_fournisseur;

if (! empty($this->logo) && class_exists('Form'))
{
$label.= '</br><div class="photointooltip">';
Expand Down Expand Up @@ -1951,7 +1949,7 @@ function getNomUrl($withpicto=0, $option='', $maxlen=0, $notooltip=0)
$linkstart='';
$linkend='';
}

if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), 'company', ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$linkstart.($maxlen?dol_trunc($name,$maxlen):$name).$linkend;
Expand Down Expand Up @@ -3451,9 +3449,9 @@ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedes
return 0;
}
}

$modelpath = "core/modules/societe/doc/";

$result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}

Expand All @@ -3474,7 +3472,7 @@ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedes
public function setCategories($categories, $type)
{
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';

// Decode type
if ($type == 'customer') {
$type_id = Categorie::TYPE_CUSTOMER;
Expand Down

0 comments on commit 2f8c0bb

Please sign in to comment.