|
|
|
@ -25,13 +25,9 @@ function reserve_categories($ebundle = null) {
|
|
|
|
|
$ids = array_filter($fconfig['categories']); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$query = \Drupal::service('entity_type.manager')->getStorage('reserve_category')->getQuery(); |
|
|
|
|
$query = \Drupal::service('entity_type.manager') |
|
|
|
|
->getStorage('reserve_category')->getQuery(); |
|
|
|
|
$ids = $query->condition('status', TRUE)->execute(); |
|
|
|
|
//$ids = Drupal::service('entity.query') |
|
|
|
|
//->get('reserve_category') |
|
|
|
|
//->condition('status', TRUE) |
|
|
|
|
//->sort('reserve_display_order', 'ASC') |
|
|
|
|
//->execute(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$cats = \Drupal::entityTypeManager()->getStorage('reserve_category')->loadMultiple($ids); |
|
|
|
@ -61,11 +57,9 @@ function reserve_categories($ebundle = null) {
|
|
|
|
|
function reserve_entities($ebundle) { |
|
|
|
|
$entity_type = ebundle_split($ebundle, 'type'); |
|
|
|
|
$bundle = ebundle_split($ebundle, 'bundle'); |
|
|
|
|
$query = \Drupal::service('entity_type.manager')->getStorage($entity_type)->getQuery(); |
|
|
|
|
$query = \Drupal::service('entity_type.manager') |
|
|
|
|
->getStorage($entity_type)->getQuery(); |
|
|
|
|
$query->condition('status', TRUE); |
|
|
|
|
//$query = Drupal::service('entity.query') |
|
|
|
|
// ->get($entity_type) |
|
|
|
|
// ->condition('status', TRUE); |
|
|
|
|
|
|
|
|
|
if ($entity_type != $bundle) { |
|
|
|
|
$query->condition('type', $bundle); |
|
|
|
@ -809,8 +803,8 @@ function reserve_valid_lengths($rid, $ebundle, $yyyy_mmdd, $time, $id = NULL, $a
|
|
|
|
|
$start_time = $search_item['start_time']; |
|
|
|
|
|
|
|
|
|
$conflicts_found = false; |
|
|
|
|
$query = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
//$query = Drupal::service('entity.query') |
|
|
|
|
$query = \Drupal::service('entity_type.manager') |
|
|
|
|
->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
->condition('reservation_date', $date . '%', 'LIKE') |
|
|
|
|
->condition('reservation_time', $start_time) |
|
|
|
|
->condition('reservable_id', $rid) |
|
|
|
@ -939,8 +933,8 @@ function reserve_daily_max_exceeded($yyyy_mmdd) {
|
|
|
|
|
|
|
|
|
|
$record_count = 0; |
|
|
|
|
if ($user->uid) { |
|
|
|
|
$ids = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
//$ids = \Drupal::service('entity.query') |
|
|
|
|
$ids = \Drupal::service('entity_type.manager') |
|
|
|
|
->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
->condition('user_id', $user->id) |
|
|
|
|
->condition('reservation_date', 'value', $yyyy_mmdd . '%', 'like') |
|
|
|
|
->execute(); |
|
|
|
@ -973,9 +967,8 @@ function reserve_user_reservations() {
|
|
|
|
|
if ($user->id()) { |
|
|
|
|
$earliest_date = date('Y-m-d', strtotime(date('Y-m-d'))); |
|
|
|
|
$latest_date = date('Y-m-d', strtotime("now +13 days")); |
|
|
|
|
$ids = \Drupal::service('entity_type.manager')->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
//$ids = \Drupal::service('entity.query') |
|
|
|
|
// ->get('reserve_reservation') |
|
|
|
|
$ids = \Drupal::service('entity_type.manager') |
|
|
|
|
->getStorage('reserve_reservation')->getQuery() |
|
|
|
|
->condition('user_id', $user->id()) |
|
|
|
|
->condition('reservation_date', $earliest_date, '>=') |
|
|
|
|
->condition('reservation_date', $latest_date, '<=') |
|
|
|
@ -1074,8 +1067,9 @@ function reserve_category_fields($ebundle = NULL) {
|
|
|
|
|
|
|
|
|
|
function ebundle_split($ebundle, $part) { |
|
|
|
|
$ebits = explode('.', $ebundle); |
|
|
|
|
if ($part == 'type') return $ebits[0]; |
|
|
|
|
if ($part == 'bundle') return $ebits[1]; |
|
|
|
|
if ($part == 'type' && isset($ebits[0])) return $ebits[0]; |
|
|
|
|
if ($part == 'bundle' && isset($ebits[1])) return $ebits[1]; |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|