public function MerciLineItemController::validate in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
File
- merci_line_item/
includes/ entity.controller.inc, line 34
Class
- MerciLineItemController
- The controller class for line items contains methods for the line item CRUD operations. The load method is inherited from the default controller.
Code
public function validate($entity) {
// No conflict checking or returned, missing or broken items.
if (empty($entity->status)) {
return;
}
// Check of conflicts.
$context = array(
'quantity_field' => 'field_quantity',
'date_field' => MERCI_CHECKOUT_DATES,
'item_field' => MERCI_RESOURCE_REFERENCE,
);
$line_item_wrapper = entity_metadata_wrapper('merci_line_item', $entity);
$controller = merci_get_controller($line_item_wrapper, 'non_inventory', $context);
if ($controller
->getErrors()) {
throw new MerciException('MERCI conflict errors', MERCI_RESOURCE_REFERENCE, $controller);
}
}