diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 46085c126e0..4a9b467c32c 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -77,7 +77,7 @@ class FormResource * @param string $morecss More css * @return string HTML string with */ - public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '', $multiple=false) + public function select_resource_list($selected = '', $htmlname = 'fk_resource', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $event = array(), $filterkey = '', $outputmode = 0, $limit = 20, $morecss = '', $multiple = false) { // phpcs:enable global $conf, $user, $langs; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index acedb6759d9..42533c4100f 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -233,8 +233,8 @@ class Workstation extends CommonObject // Usergroups $groups = GETPOST('groups'); - if(empty($groups)) $groups = $this->usergroups; // createFromClone - if(!empty($groups)) { + if (empty($groups)) $groups = $this->usergroups; // createFromClone + if (!empty($groups)) { foreach ($groups as $id_group) { $ws_usergroup = new WorkstationUserGroup($db); $ws_usergroup->fk_workstation = $id; @@ -246,8 +246,8 @@ class Workstation extends CommonObject // Resources $resources = GETPOST('resources'); - if(empty($resources)) $resources = $this->resources; // createFromClone - if(!empty($resources)) { + if (empty($resources)) $resources = $this->resources; // createFromClone + if (!empty($resources)) { foreach ($resources as $id_resource) { $ws_resource = new WorkstationResource($db); $ws_resource->fk_workstation = $id; @@ -490,7 +490,7 @@ class Workstation extends CommonObject $resources = GETPOST('resources'); WorkstationResource::deleteAllResourcesOfWorkstation($this->id); $this->resources=array(); - if(!empty($resources)) { + if (!empty($resources)) { foreach ($resources as $id_resource) { $ws_resource = new WorkstationResource($this->db); $ws_resource->fk_workstation = $this->id; @@ -677,7 +677,7 @@ class Workstation extends CommonObject $this->status = $status; - if(empty($status)) $this->setDisabled($user, $notrigger); + if (empty($status)) $this->setDisabled($user, $notrigger); else $this->setEnabled($user, $notrigger); } diff --git a/htdocs/workstation/class/workstationresource.class.php b/htdocs/workstation/class/workstationresource.class.php index 2cae732377a..b9897b6f541 100644 --- a/htdocs/workstation/class/workstationresource.class.php +++ b/htdocs/workstation/class/workstationresource.class.php @@ -46,7 +46,8 @@ class WorkstationResource extends CommonObject } } - static public function getAllResourcesOfWorkstation($fk_workstation) { + static public function getAllResourcesOfWorkstation($fk_workstation) + { global $db; @@ -55,17 +56,17 @@ class WorkstationResource extends CommonObject $resql = $db->query($sql); $TRes = array(); - if(!empty($resql)) { - while($res = $db->fetch_object($resql)) { + if (!empty($resql)) { + while ($res = $db->fetch_object($resql)) { $TRes[] = $res->fk_resource; } } return $TRes; - } - static public function deleteAllResourcesOfWorkstation($fk_workstation) { + static public function deleteAllResourcesOfWorkstation($fk_workstation) + { global $db; @@ -73,10 +74,8 @@ class WorkstationResource extends CommonObject $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$obj->table_element.' WHERE fk_workstation = '.$fk_workstation; $resql = $db->query($sql); - if(empty($resql)) return 0; + if (empty($resql)) return 0; return 1; - } - } diff --git a/htdocs/workstation/class/workstationusergroup.class.php b/htdocs/workstation/class/workstationusergroup.class.php index af643a6d28e..1221476203c 100644 --- a/htdocs/workstation/class/workstationusergroup.class.php +++ b/htdocs/workstation/class/workstationusergroup.class.php @@ -46,7 +46,8 @@ class WorkstationUserGroup extends CommonObject } } - static public function getAllGroupsOfWorkstation($fk_workstation) { + static public function getAllGroupsOfWorkstation($fk_workstation) + { global $db; @@ -55,17 +56,17 @@ class WorkstationUserGroup extends CommonObject $resql = $db->query($sql); $TRes = array(); - if(!empty($resql)) { - while($res = $db->fetch_object($resql)) { + if (!empty($resql)) { + while ($res = $db->fetch_object($resql)) { $TRes[] = $res->fk_usergroup; } } return $TRes; - } - static public function deleteAllGroupsOfWorkstation($fk_workstation) { + static public function deleteAllGroupsOfWorkstation($fk_workstation) + { global $db; @@ -73,10 +74,8 @@ class WorkstationUserGroup extends CommonObject $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$obj->table_element.' WHERE fk_workstation = '.$fk_workstation; $resql = $db->query($sql); - if(empty($resql)) return 0; + if (empty($resql)) return 0; return 1; - } - } diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 5ec3a1f6842..d28aecce67d 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -161,15 +161,10 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'confirm_enable' && $confirm == "yes" && $permissiontoadd) { - - if(!empty($object->id)) $object->setStatus(1); - + if (!empty($object->id)) $object->setStatus(1); } elseif ($action == 'confirm_disable' && $confirm == "yes" && $permissiontoadd) { - - if(!empty($object->id)) $object->setStatus(0); - + if (!empty($object->id)) $object->setStatus(0); } - } @@ -418,11 +413,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field //unset($object->fields['fk_project']); // Hide field already shown in banner //unset($object->fields['fk_soc']); // Hide field already shown in banner - if($object->type === 'MACHINE') $object->fields['nb_operators_required']['visible'] = 0; + if ($object->type === 'MACHINE') $object->fields['nb_operators_required']['visible'] = 0; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Groups - if($object->type !== 'MACHINE') { + if ($object->type !== 'MACHINE') { $toprint = array(); foreach ($object->usergroups as $id_group) { $g = new UserGroup($db); @@ -435,7 +430,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Resources - if($object->type !== 'HUMAN') { + if ($object->type !== 'HUMAN') { $toprint = array(); foreach ($object->resources as $id_resource) { $r = new Dolresource($db); @@ -469,7 +464,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { - // Modify if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; @@ -503,7 +497,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''."\n"; } - } // End of page diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index c9aa575fad2..c544446aabb 100755 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -116,7 +116,7 @@ $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); - if(in_array($key, array('type', 'status')) && GETPOST('search_'.$key, 'alpha') == -1) $search[$key] = ''; + if (in_array($key, array('type', 'status')) && GETPOST('search_'.$key, 'alpha') == -1) $search[$key] = ''; } // List of fields to search into when doing a "search in all"