From 6574ebcbfff349edb806ce46aa1f1c17d95c614b Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 7 Sep 2016 12:40:15 +0200 Subject: [PATCH] Replace non existing ref parameter Replace non existing ref parameter with product_id and batch to fetch a specific batch from a product. Remove unused sceleton methods. --- .../product/stock/class/productlot.class.php | 104 +----------------- 1 file changed, 5 insertions(+), 99 deletions(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 9b15ed31fcc..9ed1e65dde4 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -189,11 +189,12 @@ class Productlot extends CommonObject * Load object in memory from the database * * @param int $id Id object - * @param string $ref Ref + * @param int $product_id Id of product, batch number parameter required + * @param string $batch batch number * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null) + public function fetch($id = 0, $product_id = null, $batch = null) { dol_syslog(__METHOD__, LOG_DEBUG); @@ -213,8 +214,8 @@ class Productlot extends CommonObject $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; - if (null !== $ref) { - $sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; + if ((null !== $product_id) && (null !== $batch)) { + $sql .= ' WHERE t.batch = ' . '\'' . $batch . '\' AND t.fk_product = ' . $product_id; } else { $sql .= ' WHERE t.rowid = ' . $id; } @@ -528,101 +529,6 @@ class Productlot extends CommonObject return - 1; } } - - /** - * Return a link to the user card (with optionaly the picto) - * Use this->id,this->lastname, this->firstname - * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to - * @param integer $notooltip 1=Disable tooltip - * @param int $maxlen Max length of visible user name - * @param string $morecss Add more css on link - * @return string String with URL - */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') - { - global $langs, $conf, $db; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; - - - $result = ''; - $companylink = ''; - - $label = '' . $langs->trans("MyModule") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; - - $link = 'ref . $linkend; - return $result; - } - - /** - * Retourne le libelle du status d'un user (actif, inactif) - * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status - */ - function getLibStatut($mode=0) - { - return $this->LibStatut($this->status,$mode); - } - - /** - * Renvoi le libelle d'un status donne - * - * @param int $status Id status - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status - */ - function LibStatut($status,$mode=0) - { - global $langs; - - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) - { - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 2) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 3) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); - } - if ($mode == 4) - { - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); - } - if ($mode == 5) - { - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); - } - } - /** * Initialise object with example values