Fix: Bad coding
This commit is contained in:
parent
bf155f92dc
commit
04dc1ff63e
@ -393,7 +393,7 @@ class Societe extends CommonObject
|
|||||||
$this->forme_juridique_code=trim($this->forme_juridique_code);
|
$this->forme_juridique_code=trim($this->forme_juridique_code);
|
||||||
|
|
||||||
//Gencod
|
//Gencod
|
||||||
$this->gencod=trim($this->gencod);
|
$this->gencod=trim($this->gencod);
|
||||||
|
|
||||||
// For automatic creation
|
// For automatic creation
|
||||||
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
|
if ($this->code_client == -1) $this->get_codeclient($this->prefix_comm,0);
|
||||||
@ -458,8 +458,8 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$sql .= ",client = " . $this->client;
|
$sql .= ",client = " . $this->client;
|
||||||
$sql .= ",fournisseur = " . $this->fournisseur;
|
$sql .= ",fournisseur = " . $this->fournisseur;
|
||||||
$sql .= ",gencod = ".($this->gencod?"'".$this->gencod."'":"null");
|
$sql .= ",gencod = ".($this->gencod?"'".$this->gencod."'":"null");
|
||||||
$sql .= ",default_lang = ".($this->default_lang?"'".$this->default_lang."'":"null");
|
$sql .= ",default_lang = ".($this->default_lang?"'".$this->default_lang."'":"null");
|
||||||
|
|
||||||
|
|
||||||
if ($allowmodcodeclient)
|
if ($allowmodcodeclient)
|
||||||
@ -941,7 +941,7 @@ class Societe extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = '".$this->id . "'";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.fk_soc = '".$this->id . "'";
|
||||||
$sql .= " AND f.fk_statut = '1' AND f.paye = '0'";
|
$sql .= " AND f.fk_statut = '1' AND f.paye = '0'";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
@ -1442,7 +1442,7 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT rowid, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE rowid = '".$rowid."'";
|
$sql = "SELECT rowid, email, name, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE rowid = '".$rowid."'";
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$nump = $this->db->num_rows($resql);
|
$nump = $this->db->num_rows($resql);
|
||||||
@ -1901,22 +1901,22 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return if third party is a company (Business) or an end user (Consumer)
|
* \brief Return if third party is a company (Business) or an end user (Consumer)
|
||||||
* \param boolean true=is a company, false=a and user
|
* \param boolean true=is a company, false=a and user
|
||||||
*/
|
*/
|
||||||
function isACompany()
|
function isACompany()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Define if third party is treated as company of not when nature is unknown
|
// Define if third party is treated as company of not when nature is unknown
|
||||||
$isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default
|
$isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default
|
||||||
if (! empty($this->tva_intra)) $isacompany=1;
|
if (! empty($this->tva_intra)) $isacompany=1;
|
||||||
else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_PRIVATE'))) $isacompany=0;
|
else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_PRIVATE'))) $isacompany=0;
|
||||||
else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_SMALL','TE_MEDIUM','TE_LARGE'))) $isacompany=1;
|
else if (! empty($this->typent_code) && in_array($this->typent_code,array('TE_SMALL','TE_MEDIUM','TE_LARGE'))) $isacompany=1;
|
||||||
|
|
||||||
return $isacompany;
|
return $isacompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1950,14 +1950,14 @@ class Societe extends CommonObject
|
|||||||
'LV', // Latvia
|
'LV', // Latvia
|
||||||
'MC', // Monaco Seems to use same IntraVAT than France (http://www.gouv.mc/devwww/wwwnew.nsf/c3241c4782f528bdc1256d52004f970b/9e370807042516a5c1256f81003f5bb3!OpenDocument)
|
'MC', // Monaco Seems to use same IntraVAT than France (http://www.gouv.mc/devwww/wwwnew.nsf/c3241c4782f528bdc1256d52004f970b/9e370807042516a5c1256f81003f5bb3!OpenDocument)
|
||||||
'MT', // Malta
|
'MT', // Malta
|
||||||
//'NO', // Norway
|
//'NO', // Norway
|
||||||
'PL', // Poland
|
'PL', // Poland
|
||||||
'PT', // Portugal
|
'PT', // Portugal
|
||||||
'RO', // Romania
|
'RO', // Romania
|
||||||
'SE', // Sweden
|
'SE', // Sweden
|
||||||
'SK', // Slovakia
|
'SK', // Slovakia
|
||||||
'SI', // Slovenia
|
'SI', // Slovenia
|
||||||
//'CH', // Switzerland - No. Swizerland in not in EEC
|
//'CH', // Switzerland - No. Swizerland in not in EEC
|
||||||
);
|
);
|
||||||
//print "dd".$this->pays_code;
|
//print "dd".$this->pays_code;
|
||||||
return in_array($this->pays_code,$country_code_in_EEC);
|
return in_array($this->pays_code,$country_code_in_EEC);
|
||||||
@ -1977,15 +1977,15 @@ class Societe extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($resql) )
|
while ($obj = $this->db->fetch_object($resql) )
|
||||||
{
|
{
|
||||||
$this->SupplierCategories[$obj->rowid] = $obj->label;
|
$this->SupplierCategories[$obj->rowid] = $obj->label;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2000,8 +2000,7 @@ class Societe extends CommonObject
|
|||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_societe) ";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_societe) ";
|
||||||
$sql.= " VALUES ('".$categorie_id."','".$this->id."');";
|
$sql.= " VALUES ('".$categorie_id."','".$this->id."');";
|
||||||
|
|
||||||
if ($resql=$this->db->query($sql))
|
if ($resql=$this->db->query($sql)) return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2024,15 +2023,15 @@ class Societe extends CommonObject
|
|||||||
$sql.= "'".addslashes($user->login)."',";
|
$sql.= "'".addslashes($user->login)."',";
|
||||||
$sql.= "'Change statut from ".$oldstcomm." to ".$stcommid."'";
|
$sql.= "'Change statut from ".$oldstcomm." to ".$stcommid."'";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$result = $db->query($sql);
|
$result = $thi->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$stcommid." WHERE rowid=".$socid;
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm = ".$stcommid." WHERE rowid=".$socid;
|
||||||
$result = $db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$errmesg = $db->error;
|
$errmesg = $this->db->lasterror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user