Rev 116 | Rev 122 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 116 | Rev 120 | ||
|---|---|---|---|
| Line 258... | Line 258... | ||
| 258 | public function item_status($bnum) { |
258 | public function item_status($bnum) { |
| 259 | 259 | ||
| 260 | $iii_server_info = self::iii_server_info(); |
260 | $iii_server_info = self::iii_server_info(); |
| 261 | $avail_token = locum::csv_parser($this->locum_config['ils_custom_config']['iii_available_token']); |
261 | $avail_token = locum::csv_parser($this->locum_config['ils_custom_config']['iii_available_token']); |
| 262 | $default_age = $this->locum_config['iii_custom_config']['default_age']; |
262 | $default_age = $this->locum_config['iii_custom_config']['default_age']; |
| - | 263 | $default_branch = $this->locum_config['iii_custom_config']['default_branch']; |
|
| 263 | $loc_codes_flipped = array_flip($this->locum_config['iii_location_codes']); |
264 | $loc_codes_flipped = array_flip($this->locum_config['iii_location_codes']); |
| 264 | $bnum = trim($bnum); |
265 | $bnum = trim($bnum); |
| 265 | 266 | ||
| 266 | // Grab Hold Numbers |
267 | // Grab Hold Numbers |
| 267 | $url = $iii_server_info['nosslurl'] . '/search~24/.b' . $bnum . '/.b' . $bnum . '/1,1,1,B/marc~' . $bnum . '&FF=&1,0,'; |
268 | $url = $iii_server_info['nosslurl'] . '/search~24/.b' . $bnum . '/.b' . $bnum . '/1,1,1,B/marc~' . $bnum . '&FF=&1,0,'; |
| Line 295... | Line 296... | ||
| 295 | $location = trim($location); |
296 | $location = trim($location); |
| 296 | $loc_code = $loc_codes_flipped[$location]; |
297 | $loc_code = $loc_codes_flipped[$location]; |
| 297 | $call = str_replace("'", "'", trim($matches[3][$i])); |
298 | $call = str_replace("'", "'", trim($matches[3][$i])); |
| 298 | $status = trim($matches[5][$i]); |
299 | $status = trim($matches[5][$i]); |
| 299 | $age = $default_age; |
300 | $age = $default_age; |
| - | 301 | $branch = $default_branch; |
|
| 300 | 302 | ||
| 301 | if (in_array($status, $avail_token)) { |
303 | if (in_array($status, $avail_token)) { |
| 302 | $avail = 1; |
304 | $avail = 1; |
| 303 | $due_date = 0; |
305 | $due_date = 0; |
| 304 | } else { |
306 | } else { |
| Line 309... | Line 311... | ||
| 309 | $due_date = mktime(0, 0, 0, $due_date_arr[0], $due_date_arr[1], (2000 + (int) $due_date_arr[2])); |
311 | $due_date = mktime(0, 0, 0, $due_date_arr[0], $due_date_arr[1], (2000 + (int) $due_date_arr[2])); |
| 310 | } else { |
312 | } else { |
| 311 | $due_date = 0; |
313 | $due_date = 0; |
| 312 | } |
314 | } |
| 313 | } |
315 | } |
| - | 316 | ||
| - | 317 | // Determine age from location |
|
| - | 318 | if (count($this->locum_config['iii_record_ages'])) { |
|
| 314 | foreach ($this->locum_config['iii_record_ages'] as $item_age => $match_crit) { |
319 | foreach ($this->locum_config['iii_record_ages'] as $item_age => $match_crit) { |
| 315 | if (preg_match('/^\//', $match_crit)) { |
320 | if (preg_match('/^\//', $match_crit)) { |
| 316 | if (preg_match($match_crit, $loc_code)) { $age = $item_age; } |
321 | if (preg_match($match_crit, $loc_code)) { $age = $item_age; } |
| 317 | } else { |
322 | } else { |
| 318 | if (in_array($loc_code, locum::csv_parser($match_crit))) { $age = $item_age; } |
323 | if (in_array($loc_code, locum::csv_parser($match_crit))) { $age = $item_age; } |
| - | 324 | } |
|
| - | 325 | } |
|
| - | 326 | } |
|
| - | 327 | ||
| - | 328 | // Determine branch from location |
|
| - | 329 | if (count($this->locum_config['branch_assignments'])) { |
|
| - | 330 | foreach ($this->locum_config['branch_assignments'] as $branch_code => $match_crit) { |
|
| - | 331 | if (preg_match('/^\//', $match_crit)) { |
|
| - | 332 | if (preg_match($match_crit, $loc_code)) { $branch = $branch_code; } |
|
| - | 333 | } else { |
|
| - | 334 | if (in_array($loc_code, locum::csv_parser($match_crit))) { $branch = $branch_code; } |
|
| - | 335 | } |
|
| 319 | } |
336 | } |
| 320 | } |
337 | } |
| - | 338 | ||
| 321 | $avail_array['items'][] = array( |
339 | $avail_array['items'][] = array( |
| 322 | 'location' => $location, |
340 | 'location' => $location, |
| 323 | 'loc_code' => $loc_code, |
341 | 'loc_code' => $loc_code, |
| 324 | 'callnum' => $call, |
342 | 'callnum' => $call, |
| 325 | 'statusmsg' => $status, |
343 | 'statusmsg' => $status, |
| 326 | 'due' => $due_date, |
344 | 'due' => $due_date, |
| 327 | 'avail' => $avail, |
345 | 'avail' => $avail, |
| 328 | 'age' => $age, |
346 | 'age' => $age, |
| - | 347 | 'branch' => $branch, |
|
| 329 | ); |
348 | ); |
| 330 | } |
349 | } |
| 331 | 350 | ||
| 332 | return $avail_array; |
351 | return $avail_array; |
| 333 | 352 | ||