You are here

protected function MerciDefaultController_non_inventory::validate in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

Overrides MerciDefaultController::validate

File

merci_core/reservation.handler.inc, line 423
Abstraction of the selection logic of an entity reference field.

Class

MerciDefaultController_non_inventory
A null implementation of EntityReference_SelectionHandler.

Code

protected function validate() {
  if (!$this->validated) {
    $this->buckets = $this
      ->fillBuckets();
    $this->validated = TRUE;
    $conflicts = array();
    foreach ($this->buckets as $delta => $dates) {
      foreach ($dates as $date_value => $buckets) {
        if (!isset($this->quantity_reserved[$delta])) {
          $this->quantity_reserved[$delta] = array();
        }
        $this->quantity_reserved[$delta][$date_value] = count($buckets);
        if (!isset($conflicts[$delta])) {
          $conflicts[$delta] = array();
        }
        $conflicts[$delta][$date_value] = array();
        foreach ($buckets as $bucket) {
          $conflicts[$delta][$date_value] = array_merge($conflicts[$delta][$date_value], $bucket);
        }
      }
    }
    $this->conflicting_entities = $conflicts;
  }
}