From 27cbd16bb9eb581107e78e6bd094af8599d2841a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 8 Feb 2022 16:01:18 +0100 Subject: [PATCH] Clean code --- htdocs/core/actions_addupdatedelete.inc.php | 4 +--- htdocs/mrp/class/mo.class.php | 13 +++++++++---- htdocs/mrp/mo_card.php | 2 -- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 7a40b543303..20e9db63ff1 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -26,7 +26,7 @@ // $object must be defined // $permissiontoadd must be defined // $permissiontodelete must be defined -// $backurlforlist may be defined +// $backurlforlist must be defined // $backtopage may be defined // $noback may be defined // $triggermodname may be defined @@ -128,9 +128,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } } -// var_dump($object); exit; if (!$error) { - $result = $object->create($user); if ($result > 0) { // Creation OK diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index a9f304a158d..c02a19d9d66 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -202,8 +202,11 @@ class Mo extends CommonObject */ public $lines = array(); - public $fk_parent_line; + /** + * @var integer Mo parent line + * */ + public $fk_parent_line; /** @@ -1206,13 +1209,15 @@ class Mo extends CommonObject * * @return array|int array of lines if OK, <0 if KO */ - public function getLinesArray($role = '') + public function getLinesArray($rolefilter = '') { $this->lines = array(); $objectline = new MoLine($this->db); - if($role) $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_mo = '.((int) $this->id),'role' => $role)); - else $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_mo = '.((int) $this->id))); + + $TFilters = array('customsql'=>'fk_mo = '.((int) $this->id)); + if(!empty($rolefilter)) $TFilters['role'] = $rolefilter; + $result = $objectline->fetchAll('ASC', 'position', 0, 0, $TFilters); if (is_numeric($result)) { $this->error = $this->error; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 2808345e54c..d405e7fe341 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -47,8 +47,6 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $TBomLineId = GETPOST('bomlineid', 'array'); //$lineid = GETPOST('lineid', 'int'); - -//var_dump($_POST); exit; // Initialize technical objects $object = new Mo($db); $objectbom = new BOM($db);