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