mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code around fetch_optionals()
This commit is contained in:
parent
8b54a80593
commit
c4130730cb
|
|
@ -1156,12 +1156,9 @@ class Adherent extends CommonObject
|
|||
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
// Load other properties
|
||||
$result=$this->fetch_subscriptions();
|
||||
|
|
|
|||
|
|
@ -236,7 +236,9 @@ class Categorie extends CommonObject
|
|||
$this->type = $res['type'];
|
||||
$this->entity = $res['entity'];
|
||||
|
||||
$this->fetch_optionals($this->id,null);
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
|
|||
|
|
@ -465,7 +465,10 @@ class ActionComm extends CommonObject
|
|||
// Load source object
|
||||
$objFrom = clone $this;
|
||||
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
// $this->fetch_userassigned();
|
||||
$this->fetchResources();
|
||||
|
||||
|
|
|
|||
|
|
@ -1434,12 +1434,9 @@ class Propal extends CommonObject
|
|||
$this->brouillon = 1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
|
|||
|
|
@ -1668,12 +1668,9 @@ class Commande extends CommonOrder
|
|||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
|
|
|
|||
|
|
@ -913,12 +913,9 @@ class Account extends CommonObject
|
|||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_update = $this->db->jdate($obj->date_update);
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,12 +381,9 @@ class FactureRec extends CommonInvoice
|
|||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Lines
|
||||
|
|
|
|||
|
|
@ -790,14 +790,17 @@ class Facture extends CommonInvoice
|
|||
// Charge facture source
|
||||
$facture=new Facture($this->db);
|
||||
|
||||
$this->fetch_optionals();
|
||||
if(!empty($this->array_options)){
|
||||
$facture->array_options = $this->array_options;
|
||||
}
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
foreach($this->lines as &$line){
|
||||
if(!empty($this->array_options)){
|
||||
$facture->array_options = $this->array_options;
|
||||
}
|
||||
|
||||
foreach($this->lines as &$line){
|
||||
$line->fetch_optionals();//fetch extrafields
|
||||
}
|
||||
}
|
||||
|
||||
$facture->fk_facture_source = $this->fk_facture_source;
|
||||
$facture->type = $this->type;
|
||||
|
|
@ -1328,16 +1331,13 @@ class Facture extends CommonInvoice
|
|||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
// Retrieve all extrafield for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
*/
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -801,12 +801,9 @@ class Contact extends CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
// Retreive all extrafield for contact
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -635,7 +635,9 @@ class Contrat extends CommonObject
|
|||
$this->db->free($resql);
|
||||
|
||||
|
||||
$this->fetch_optionals($this->id, null);
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ class Ctyperesource
|
|||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
public $code;
|
||||
public $label;
|
||||
public $active;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -82,7 +82,7 @@ class Ctyperesource
|
|||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
|
|
@ -93,26 +93,26 @@ class Ctyperesource
|
|||
$this->active = trim($this->active);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
|
||||
|
||||
$sql.= 'code,';
|
||||
$sql.= 'label';
|
||||
$sql.= 'active';
|
||||
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
|
||||
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
|
||||
$sql .= ' '.(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").',';
|
||||
$sql .= ' '.(! isset($this->active)?'NULL':$this->active);
|
||||
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -165,18 +165,18 @@ class Ctyperesource
|
|||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if ($id) $sql.= " WHERE t.id = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
|
||||
|
||||
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
|
|
@ -184,25 +184,20 @@ class Ctyperesource
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->active = $obj->active;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
*/
|
||||
|
||||
// $this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
|
|
@ -236,12 +231,12 @@ class Ctyperesource
|
|||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.active";
|
||||
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
|
|
@ -251,7 +246,7 @@ class Ctyperesource
|
|||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
|
@ -270,12 +265,12 @@ class Ctyperesource
|
|||
$line = new self($this->db);
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
|
||||
$line->code = $obj->code;
|
||||
$line->label = $obj->label;
|
||||
$line->active = $obj->active;
|
||||
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
@ -303,7 +298,7 @@ class Ctyperesource
|
|||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->code)) {
|
||||
$this->code = trim($this->code);
|
||||
}
|
||||
|
|
@ -319,12 +314,12 @@ class Ctyperesource
|
|||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
|
||||
|
||||
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
|
||||
$sql .= ' label = '.(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").',';
|
||||
$sql .= ' active = '.(isset($this->active)?$this->active:"null");
|
||||
|
||||
|
||||
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -387,7 +382,7 @@ class Ctyperesource
|
|||
}
|
||||
|
||||
// If you need to delete child tables to, you can insert them here
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
|
@ -468,7 +463,7 @@ class Ctyperesource
|
|||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
|
||||
$this->code = '';
|
||||
$this->label = '';
|
||||
$this->active = '';
|
||||
|
|
@ -488,7 +483,7 @@ class CtyperesourceLine
|
|||
/**
|
||||
* @var mixed Sample line property 1
|
||||
*/
|
||||
|
||||
|
||||
public $code;
|
||||
public $label;
|
||||
public $active;
|
||||
|
|
@ -496,5 +491,5 @@ class CtyperesourceLine
|
|||
/**
|
||||
* @var mixed Sample line property 2
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,12 +665,9 @@ class Don extends CommonObject
|
|||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->commentaire = $obj->note; // deprecated
|
||||
|
||||
// Retrieve all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,12 +337,8 @@ class EcmFiles //extends CommonObject
|
|||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
*/
|
||||
// $this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
|
|
|||
|
|
@ -547,12 +547,9 @@ class Expedition extends CommonObject
|
|||
*/
|
||||
$result=$this->fetch_thirdparty();
|
||||
|
||||
// Retrieve all extrafields for expedition
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Lines
|
||||
|
|
|
|||
|
|
@ -383,14 +383,13 @@ class Fichinter extends CommonObject
|
|||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
*/
|
||||
$result=$this->fetch_lines();
|
||||
if ($result < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,12 +310,9 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Retrieve all extrafields
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -643,10 +643,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -301,13 +301,9 @@ class Livraison extends CommonObject
|
|||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
|
||||
// Retrieve all extrafields for delivery
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
/*
|
||||
* Lignes
|
||||
|
|
|
|||
|
|
@ -1951,13 +1951,9 @@ class Product extends CommonObject
|
|||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
// Retreive all extrafield for current object
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
// multilangs
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs();
|
||||
|
|
|
|||
|
|
@ -576,12 +576,9 @@ class MouvementStock extends CommonObject
|
|||
$this->sellby = $this->db->jdate($obj->sellby);
|
||||
}
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
|
|
|
|||
|
|
@ -233,12 +233,9 @@ class Productlot extends CommonObject
|
|||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
public $tms = '';
|
||||
public $fk_product;
|
||||
public $fk_entrepot;
|
||||
|
|
@ -61,7 +61,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -88,7 +88,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
|
||||
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
|
||||
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
|
||||
|
|
@ -100,23 +100,23 @@ class ProductStockEntrepot extends CommonObject
|
|||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
|
||||
|
||||
$sql.= 'fk_product,';
|
||||
$sql.= 'fk_entrepot,';
|
||||
$sql.= 'seuil_stock_alerte,';
|
||||
$sql.= 'desiredstock,';
|
||||
$sql.= 'import_key';
|
||||
|
||||
|
||||
|
||||
$sql .= ') VALUES (';
|
||||
|
||||
|
||||
$sql .= ' '.(! isset($this->fk_product)?'NULL':$this->fk_product).',';
|
||||
$sql .= ' '.(! isset($this->fk_entrepot)?'NULL':$this->fk_entrepot).',';
|
||||
$sql .= ' '.(! isset($this->seuil_stock_alerte)?'0':$this->seuil_stock_alerte).',';
|
||||
$sql .= ' '.(! isset($this->desiredstock)?'0':$this->desiredstock).',';
|
||||
$sql .= ' '.(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'");
|
||||
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -166,12 +166,12 @@ class ProductStockEntrepot extends CommonObject
|
|||
public function fetch($id, $fk_product, $fk_entrepot)
|
||||
{
|
||||
if(empty($id) && (empty($fk_product) || empty($fk_entrepot))) return -1;
|
||||
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
|
||||
$sql .= " t.tms,";
|
||||
$sql .= " t.fk_product,";
|
||||
$sql .= " t.fk_entrepot,";
|
||||
|
|
@ -179,11 +179,11 @@ class ProductStockEntrepot extends CommonObject
|
|||
$sql .= " t.desiredstock,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if(!empty($id)) $sql .= ' WHERE t.rowid = ' . $id;
|
||||
else $sql.= ' WHERE t.fk_product = '.$fk_product.' AND t.fk_entrepot = '.$fk_entrepot;
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
|
|
@ -191,7 +191,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->fk_entrepot = $obj->fk_entrepot;
|
||||
|
|
@ -199,18 +199,15 @@ class ProductStockEntrepot extends CommonObject
|
|||
$this->desiredstock = $obj->desiredstock;
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
|
|
@ -246,7 +243,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
|
||||
$sql .= " t.tms,";
|
||||
$sql .= " t.fk_product,";
|
||||
$sql .= " t.fk_entrepot,";
|
||||
|
|
@ -254,11 +251,11 @@ class ProductStockEntrepot extends CommonObject
|
|||
$sql .= " t.desiredstock,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
|
||||
$sql .= ' WHERE 1=1';
|
||||
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
|
|
@ -267,19 +264,19 @@ class ProductStockEntrepot extends CommonObject
|
|||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
|
||||
|
||||
if(!empty($fk_product)) $sql .= ' AND fk_product = '.$fk_product;
|
||||
elseif(!empty($fk_entrepot)) $sql .= ' AND fk_entrepot = '.$fk_entrepot;
|
||||
// "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch
|
||||
|
||||
|
||||
if (!empty($sortfield)) $sql .= $this->db->order($sortfield,$sortorder);
|
||||
if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
|
||||
|
||||
$lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$lines[$obj->rowid] = array(
|
||||
'id'=>$obj->rowid
|
||||
|
|
@ -315,20 +312,20 @@ class ProductStockEntrepot extends CommonObject
|
|||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
|
||||
|
||||
if (isset($this->fk_product)) $this->fk_product = trim($this->fk_product);
|
||||
if (isset($this->fk_entrepot)) $this->fk_entrepot = trim($this->fk_entrepot);
|
||||
if (isset($this->seuil_stock_alerte)) $this->seuil_stock_alerte = trim($this->seuil_stock_alerte);
|
||||
if (isset($this->desiredstock)) $this->desiredstock = trim($this->desiredstock);
|
||||
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
|
||||
|
||||
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").',';
|
||||
$sql .= ' fk_product = '.(isset($this->fk_product)?$this->fk_product:"null").',';
|
||||
$sql .= ' fk_entrepot = '.(isset($this->fk_entrepot)?$this->fk_entrepot:"null").',';
|
||||
|
|
@ -336,7 +333,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
$sql .= ' desiredstock = '.(isset($this->desiredstock)?$this->desiredstock:"null").',';
|
||||
$sql .= ' import_key = '.(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
|
||||
|
||||
|
||||
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
|
@ -573,7 +570,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
|
||||
$this->tms = '';
|
||||
$this->fk_product = '';
|
||||
$this->fk_entrepot = '';
|
||||
|
|
@ -581,7 +578,7 @@ class ProductStockEntrepot extends CommonObject
|
|||
$this->desiredstock = '';
|
||||
$this->import_key = '';
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -444,7 +444,8 @@ class Project extends CommonObject
|
|||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
||||
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
|
||||
|
|
|
|||
|
|
@ -266,8 +266,9 @@ class Task extends CommonObject
|
|||
$this->task_parent_position = $obj->task_parent_position;
|
||||
}
|
||||
|
||||
// Retreive all extrafield data
|
||||
$this->fetch_optionals();
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
|
|
|||
|
|
@ -213,13 +213,9 @@ class Dolresource extends CommonObject
|
|||
$this->note_private = $obj->note_private;
|
||||
$this->type_label = $obj->type_label;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ class Societe extends CommonObject
|
|||
*/
|
||||
var $price_level;
|
||||
var $outstanding_limit;
|
||||
|
||||
|
||||
/**
|
||||
* Min order amounts
|
||||
*/
|
||||
|
|
@ -1315,8 +1315,9 @@ class Societe extends CommonObject
|
|||
|
||||
$result = 1;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
$this->fetch_optionals();
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1215,12 +1215,9 @@ class SupplierProposal extends CommonObject
|
|||
$this->brouillon = 1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
@ -1311,12 +1308,9 @@ class SupplierProposal extends CommonObject
|
|||
return -1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for askprice
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -324,12 +324,9 @@ class User extends CommonObject
|
|||
// in such case, this admin user must be admin for ALL entities.
|
||||
if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) $this->entity = 0;
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,12 +116,9 @@ class UserGroup extends CommonObject
|
|||
$this->members=$this->listUsersForGroup();
|
||||
|
||||
|
||||
// Retreive all extrafield for group
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
dol_include_once('/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
$this->fetch_optionals();
|
||||
|
||||
|
||||
// Sav current LDAP Current DN
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user