/** * Returns true if a location exists and is not disabled * @param $id * @return bool */ private function doesLocationExist($id) { $locMdl = new LocationsModel(); $loc = $locMdl->get($id); if (sizeof($loc) > 0) { $loc = $loc[0]; if ($loc['disabled'] == 0) { // for this function we don't want disabled devices // (ie, it would allow adding disabled location to a device or enabling device with disabled location) return true; } } return false; }
/** * @param array $result * * @return array of POS location records */ public function getPosLocations($result) { $locMdl = new LocationsModel(); $locations = $locMdl->get(); if (is_array($locations)) { $data = []; foreach ($locations as $location) { $data[$location['id']] = $location; } $data[0] = ["id" => 0, "name" => "Admin dash"]; $result['data'] = $data; } else { $result['error'] = $locMdl->errorInfo; } return $result; }