diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index bd0722ae63e..5691cd6687b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -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(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 46063c0f8c4..5b824d8c959 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -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); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9e0a0d6321d..5f094856e1c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -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(); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 312d228b2d4..1380b02d339 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -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); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8f2f233fb10..f89bcf534a2 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -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); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 1dba4a5b221..719a48c3e3c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -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; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 1636be2aace..84b61817a28 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -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 diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 184b9c80f3c..aba627dd8a2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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(); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f616ca728b6..eca1174bb59 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -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; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 537e37071bc..9d40001ad50 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -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(); /* diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index 1de616210e4..a5a6ea879ce 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -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 */ - + } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index df298831c22..01ae466f132 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -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; } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index ae16ad85eaf..698960974d5 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -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); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 85408c7e14a..b8eef6b5102 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -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 diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 49db7cddc00..2cbbd1be022 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -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) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 957794efd46..1bbde68172e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -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; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 292466ea0d8..1f84e71df96 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -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; diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 837b0af77f5..d0d24d39144 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -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 diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 73d867e7141..123330004ed 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -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(); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 69be51f11e8..ab2b60f564a 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -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(); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index d7915512b2c..31c28eaa5b3 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -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); diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 048be66461f..cbca4e5854d 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -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 = ''; - + } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index e24a444702c..8dbce2790fa 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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)) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e694b3c7bfd..eeacf27aaec 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -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); diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index c880f9538c7..c7126c6d3bb 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -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); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 652ffd8742e..3ca69fdb6fd 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -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 { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index d71f9a02a1f..c6ae3642bc9 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -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; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6a2a1b774e7..3fcdf411a24 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -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); } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 2e0cd0376c6..5104d813a05 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -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