|
|
@ -923,24 +923,22 @@ function reserve_valid_lengths($rid, $ebundle, $yyyy_mmdd, $time, $id = NULL, $a |
|
|
|
* FALSE - the maximum has not been exceeded. |
|
|
|
* FALSE - the maximum has not been exceeded. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function reserve_daily_max_exceeded($yyyy_mmdd) { |
|
|
|
function reserve_daily_max_exceeded($yyyy_mmdd) { |
|
|
|
global $user; |
|
|
|
$user = \Drupal::currentUser(); |
|
|
|
$config = \Drupal::config('reserve.settings'); |
|
|
|
$config = \Drupal::config('reserve.settings'); |
|
|
|
|
|
|
|
|
|
|
|
$max = $config->get('reservations_per_day'); |
|
|
|
$max = $config->get('reservations_per_day'); |
|
|
|
if (!$max) { |
|
|
|
if (!$max) { |
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$record_count = 0; |
|
|
|
$record_count = 0; |
|
|
|
if ($user->uid) { |
|
|
|
if ($user->id()) { |
|
|
|
$ids = \Drupal::service('entity_type.manager') |
|
|
|
$ids = \Drupal::service('entity_type.manager') |
|
|
|
->getStorage('reserve_reservation')->getQuery() |
|
|
|
->getStorage('reserve_reservation')->getQuery() |
|
|
|
->condition('user_id', $user->id) |
|
|
|
->condition('user_id', $user->id()) |
|
|
|
->condition('reservation_date', 'value', $yyyy_mmdd . '%', 'like') |
|
|
|
->condition('reservation_date', $yyyy_mmdd . '%', 'like') |
|
|
|
->execute(); |
|
|
|
->execute(); |
|
|
|
$record_count = count($ids); |
|
|
|
$record_count = count($ids); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
debug($record_count, 'pp-record-count', TRUE); |
|
|
|
if ($record_count < $max) { |
|
|
|
if ($record_count < $max) { |
|
|
|
return FALSE; |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
} |
|
|
|