/** * Getting a default required date based on hold settings. * * @param array $checkHolds Hold settings returned by the ILS driver's * checkFunction method. * @param Connection $catalog ILS connection (optional) * @param array $patron Patron details (optional) * @param array $holdInfo Hold details (optional) * * @return int A timestamp representing the default required date */ public function getDefaultRequiredDate($checkHolds, $catalog = null, $patron = null, $holdInfo = null) { // Load config: $dateArray = isset($checkHolds['defaultRequiredDate']) ? explode(":", $checkHolds['defaultRequiredDate']) : [0, 1, 0]; // Process special "driver" prefix and adjust default date // settings accordingly: if ($dateArray[0] == 'driver') { $useDriver = true; array_shift($dateArray); if (count($dateArray) < 3) { $dateArray = [0, 1, 0]; } } else { $useDriver = false; } // If the driver setting is active, try it out: if ($useDriver && $catalog) { $check = $catalog->checkCapability('getHoldDefaultRequiredDate', [$patron, $holdInfo]); if ($check) { $result = $catalog->getHoldDefaultRequiredDate($patron, $holdInfo); if (!empty($result)) { return $result; } } } // If the driver setting is off or the driver didn't work, use the // standard relative date mechanism: return $this->getDateFromArray($dateArray); }