Clean code

This commit is contained in:
atm-lena 2022-02-08 16:01:18 +01:00
parent 8db75f0d04
commit 27cbd16bb9
3 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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;

View File

@ -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);