You are here

private function MerciDefaultController_non_inventory::merci_bucket_cmp_length in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

File

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

Class

MerciDefaultController_non_inventory
A null implementation of EntityReference_SelectionHandler.

Code

private function merci_bucket_cmp_length($a, $b) {
  $value = $this->date_column;
  $value2 = $this->date_column2;
  $len_a = date_format(date_create($a->{$value2}), 'U') - date_format(date_create($a->{$value}), 'U');
  $len_b = date_format(date_create($b->{$value2}), 'U') - date_format(date_create($b->{$value}), 'U');
  if ($len_a == $len_b) {
    return 0;
  }
  return $len_a < $len_b ? 1 : -1;
}