Depreciate variables not used by Dolibarr.

This commit is contained in:
Laurent Destailleur 2020-03-06 14:38:06 +01:00
parent d0f22c7bff
commit 054ffb7547
11 changed files with 59 additions and 50 deletions

View File

@ -109,22 +109,21 @@ class Proposals extends DolibarrApi
*
* Return an array with proposal informations
*
* @param int $id ID of order
* @param int $id ID of order
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other objec
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @throws RestException
*/
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id, $ref, $ref_ext, $ref_int);
$result = $this->propal->fetch($id, $ref, $ref_ext);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}

View File

@ -260,7 +260,7 @@ class Propal extends CommonObject
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'datep' =>array('type'=>'date', 'label'=>'Datep', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@ -1453,9 +1453,10 @@ class Propal extends CommonObject
*
* @param int $rowid id of object to load
* @param string $ref Ref of proposal
* @param string $ref_ext Ref ext of proposal
* @return int >0 if OK, <0 if KO
*/
public function fetch($rowid, $ref = '')
public function fetch($rowid, $ref = '', $ref_ext = '')
{
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";

View File

@ -111,19 +111,18 @@ class Orders extends DolibarrApi
* @param int $id ID of order
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other objec
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @throws RestException
*/
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
{
if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
}
$result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int);
$result = $this->commande->fetch($id, $ref, $ref_ext);
if( ! $result ) {
throw new RestException(404, 'Order not found');
}

View File

@ -101,6 +101,7 @@ class Commande extends CommonOrder
/**
* @var string Internal ref for order
* @deprecated
*/
public $ref_int;
@ -269,7 +270,7 @@ class Commande extends CommonOrder
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>40),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
@ -1773,13 +1774,13 @@ class Commande extends CommonOrder
* @param int $id Id of object to load
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other object
* @param string $notused Internal reference of other object
* @return int >0 if OK, <0 if KO, 0 if not found
*/
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
{
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
@ -1810,7 +1811,7 @@ class Commande extends CommonOrder
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql .= " AND c.ref_int='".$this->db->escape($ref_int)."'";
if ($notused) $sql .= " AND c.ref_int='".$this->db->escape($notused)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -111,19 +111,18 @@ class Invoices extends DolibarrApi
* @param int $id ID of order
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other objec
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
* @return array|mixed data without useless information
*
* @throws RestException
*/
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
{
if (!DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id, $ref, $ref_ext, $ref_int);
$result = $this->invoice->fetch($id, $ref, $ref_ext);
if (!$result) {
throw new RestException(404, 'Invoice not found');
}

View File

@ -1,4 +1,6 @@
<?php
use Sabre\CalDAV\ICSExportPluginTest;
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
@ -112,7 +114,13 @@ class Facture extends CommonInvoice
public $date; // Date invoice
public $datem;
public $ref_client;
public $ref_int;
/**
* @var int Ref Int
* @deprecated
*/
public $ref_int; // deprecated
//Check constants for types
public $type = self::TYPE_STANDARD;
@ -255,7 +263,7 @@ class Facture extends CommonInvoice
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30),
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30), // deprecated
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
@ -1450,18 +1458,18 @@ class Facture extends CommonInvoice
/**
* Get object from database. Get also lines.
*
* @param int $rowid Id of object to load
* @param string $ref Reference of invoice
* @param string $ref_ext External reference of invoice
* @param int $ref_int Internal reference of other object
* @param int $rowid Id of object to load
* @param string $ref Reference of invoice
* @param string $ref_ext External reference of invoice
* @param int $notused Not used
* @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice
* @return int >0 if OK, <0 if KO, 0 if not found
* @return int >0 if OK, <0 if KO, 0 if not found
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false)
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
{
global $conf;
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
if (empty($rowid) && empty($ref) && empty($ref_ext)) return -1;
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc';
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
@ -1493,7 +1501,7 @@ class Facture extends CommonInvoice
$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; // Dont't use entity if you use rowid
if ($ref) $sql .= " AND f.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql .= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql .= " AND f.ref_int='".$this->db->escape($ref_int)."'";
if ($notused) $sql .= " AND f.ref_int='".$this->db->escape($notused)."'"; // deprecated
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);

View File

@ -85,6 +85,7 @@ class Expedition extends CommonObject
/**
* @var string internal ref
* @deprecated
*/
public $ref_int;
@ -523,15 +524,15 @@ class Expedition extends CommonObject
* @param int $id Id of object to load
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other object
* @param string $notused Internal reference of other object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
{
global $conf;
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_customer, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut, e.fk_projet as fk_project, e.billed";
$sql.= ", e.date_valid";
@ -551,7 +552,7 @@ class Expedition extends CommonObject
if ($id) $sql.= " AND e.rowid=".$id;
if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'";
if ($notused) $sql.= " AND e.ref_int='".$this->db->escape($notused)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -243,10 +243,9 @@ class FichinterRec extends Fichinter
* @param int $rowid Id of object to load
* @param string $ref Reference of fichinter
* @param string $ref_ext External reference of fichinter
* @param int $ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO, 0 if not found
*/
public function fetch($rowid = 0, $ref = '', $ref_ext = '', $ref_int = '')
public function fetch($rowid = 0, $ref = '', $ref_ext = '')
{
$sql = 'SELECT f.titre, f.fk_soc';
$sql .= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description';
@ -258,11 +257,6 @@ class FichinterRec extends Fichinter
if ($rowid > 0) $sql .= ' WHERE f.rowid='.$rowid;
elseif ($ref) $sql .= " WHERE f.titre='".$this->db->escape($ref)."'";
/* This field are not used for template fichinter
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
*/
dol_syslog(get_class($this)."::fetch rowid=".$rowid, LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -56,7 +56,13 @@ class Reception extends CommonObject
public $socid;
public $ref_supplier;
/**
* @var int Ref int
* @deprecated
*/
public $ref_int;
public $brouillon;
public $entrepot_id;
public $lines = array();
@ -372,15 +378,15 @@ class Reception extends CommonObject
* @param int $id Id of object to load
* @param string $ref Ref of object
* @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other object
* @param string $notused Internal reference of other object
* @return int >0 if OK, 0 if not found, <0 if KO
*/
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
{
global $conf;
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut";
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
@ -397,7 +403,7 @@ class Reception extends CommonObject
if ($id) $sql .= " AND e.rowid=".$id;
if ($ref) $sql .= " AND e.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql .= " AND e.ref_int='".$this->db->escape($ref_int)."'";
if ($notused) $sql .= " AND e.ref_int='".$this->db->escape($notused)."'";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -134,7 +134,7 @@ class Societe extends CommonObject
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>45),
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
'code_client' =>array('type'=>'varchar(24)', 'label'=>'Code client', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'code_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'Code fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'Code compta', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@ -625,13 +625,13 @@ class Societe extends CommonObject
/**
* @var string Internal ref
* @deprecated
*/
public $ref_int;
/**
* External user reference.
* This is to allow external systems to store their id and make self-developed synchronizing functions easier to
* build.
* This is to allow external systems to store their id and make self-developed synchronizing functions easier to build.
* @var string
*/
public $ref_ext;
@ -1454,7 +1454,7 @@ class Societe extends CommonObject
* @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 $notused Not used
* @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)
@ -1465,12 +1465,12 @@ class Societe extends CommonObject
* @param string $ref_alias Name_alias 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 or idprof, 0 if not found.
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '')
{
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($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) 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';
@ -1515,7 +1515,7 @@ class Societe extends CommonObject
if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'";
if ($ref_alias) $sql .= " AND s.name_alias = '".$this->db->escape($ref_alias)."'";
if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql .= " AND s.ref_int = '".$this->db->escape($ref_int)."'";
if ($notused) $sql .= " AND s.ref_int = '".$this->db->escape($notused)."'";
if ($idprof1) $sql .= " AND s.siren = '".$this->db->escape($idprof1)."'";
if ($idprof2) $sql .= " AND s.siret = '".$this->db->escape($idprof2)."'";
if ($idprof3) $sql .= " AND s.ape = '".$this->db->escape($idprof3)."'";

View File

@ -304,7 +304,8 @@ class User extends CommonObject
$sql .= " u.color,";
$sql .= " u.dateemployment, u.dateemploymentend,";
$sql .= " u.fk_warehouse,";
$sql .= " u.ref_int, u.ref_ext,";
$sql .= " u.ref_int,";
$sql .= " u.ref_ext,";
$sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode
$sql .= " c.code as country_code, c.label as country,";
$sql .= " d.code_departement as state_code, d.nom as state";