'Dispute', 'DatasetName' => 'valuations', 'Entity' => '\Dispute\Entity\Dispute', 'References' => array( 'auction' => '\Auction\Entity\Auction', 'createdBy' => '\User\Entity\Profile', 'fromCompany' => '\Company\Entity\Company', 'againstCompany' => '\Company\Entity\Company' ), 'Dependants' => array() ); /** * @var array */ protected $metaAdminGrid = array( 'Type' => 'Grid', 'Export' => true, 'Builder' => '\Dispute\Report\DisputeGrid', 'Writer' => '\Utility\Export\ExcelReport', 'Output' => 'Download', 'Contract' => 'Recurring', 'Options' => array( 'Boolean' => array( 'ExportToExcel' => false ) ), 'RequiredInput' => array(), 'OptionalInput' => array( 'Grid' => array( 'NumberOfRecords' => 'Integer', 'Page' => 'Integer', 'Filter' => 'Array', 'OrderBy' => 'Array' ) ), 'Base' => 'dispute', 'NumberOfRecords' => 10, 'Query' => 'SELECT [SELECTION] FROM \Dispute\Entity\Dispute dispute JOIN dispute.fromCompany fromCompany JOIN dispute.againstCompany againstCompany JOIN dispute.auction auction JOIN auction.stock stock JOIN stock.vehicleYear vehicleYear JOIN stock.type type JOIN type.model model JOIN model.make make [WHERE] [ORDER]', 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type', 'Filter' => array(), 'OrderBy' => array('dispute.created' => 'DESC'), 'Fields' => array( 'id', 'created' => 'DateTime', 'jobState', 'fromCompany' => array( 'name' ), 'againstCompany' => array( 'name' ), 'auction' => array( 'id', 'currentBidPrice', 'endDate' => 'DateTime', 'stock' => array( 'created' => 'DateTime', 'type' => array( 'name', 'model' => array( 'name', 'make' => array( 'name' ) ), ), 'vehicleYear' => array( 'name' ), 'km', 'tradePrice', 'retailPrice', 'listPrice' ) ) ) ); /** * @var array */ protected $metaGrid = array( 'Type' => 'Grid', 'Export' => true, 'Builder' => '\Dispute\Report\DisputeGrid', 'Writer' => '\Utility\Export\ExcelReport', 'Output' => 'Download', 'Contract' => 'Recurring', 'Options' => array( 'Boolean' => array( 'ExportToExcel' => false ) ), 'RequiredInput' => array(), 'OptionalInput' => array( 'Grid' => array( 'NumberOfRecords' => 'Integer', 'Page' => 'Integer', 'Filter' => 'Array', 'OrderBy' => 'Array' ) ), 'Base' => 'dispute', 'NumberOfRecords' => 10, 'Query' => 'SELECT [SELECTION] FROM \Dispute\Entity\Dispute dispute JOIN dispute.fromCompany fromCompany JOIN dispute.againstCompany againstCompany JOIN dispute.auction auction JOIN auction.stock stock JOIN stock.vehicleYear vehicleYear JOIN stock.type type JOIN type.model model JOIN model.make make [WHERE] [ORDER]', 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type', 'Filter' => array(), 'OrderBy' => array('dispute.created' => 'DESC'), 'Fields' => array( 'id', 'created' => 'DateTime', 'jobState', 'fromCompany' => array( 'name' ), 'againstCompany' => array( 'name' ), 'auction' => array( 'id', 'currentBidPrice', 'endDate' => 'DateTime', 'stock' => array( 'created' => 'DateTime', 'type' => array( 'name', 'model' => array( 'name', 'make' => array( 'name' ) ), ), 'vehicleYear' => array( 'name' ), 'km', 'tradePrice', 'retailPrice', 'listPrice' ) ) ) ); /** * @var array */ protected $metaGridDef = array( 'Type' => 'Grid', 'Export' => true, 'Builder' => '\Dispute\Report\DisputeGrid', 'Writer' => '\Utility\Export\ExcelReport', 'Output' => 'Download', 'Contract' => 'Recurring', 'Options' => array( 'Boolean' => array( 'ExportToExcel' => false ) ), 'RequiredInput' => array(), 'OptionalInput' => array( 'Grid' => array( 'NumberOfRecords' => 'Integer', 'Page' => 'Integer', 'Filter' => 'Array', 'OrderBy' => 'Array' ) ), 'Base' => 'dispute', 'NumberOfRecords' => 10, 'Query' => 'SELECT [SELECTION] FROM \Dispute\Entity\Dispute dispute JOIN dispute.fromCompany fromCompany JOIN dispute.againstCompany againstCompany JOIN dispute.auction auction JOIN auction.stock stock JOIN stock.vehicleYear vehicleYear JOIN stock.type type JOIN type.model model JOIN model.make make [WHERE] [ORDER]', 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type', 'Filter' => array(), 'OrderBy' => array('dispute.created' => 'DESC'), 'Fields' => array( 'id', 'created' => 'DateTime', 'jobState', 'fromCompany' => array( 'name' ), 'againstCompany' => array( 'name' ), 'auction' => array( 'id', 'currentBidPrice', 'endDate' => 'DateTime', 'stock' => array( 'created' => 'DateTime', 'type' => array( 'name', 'model' => array( 'name', 'make' => array( 'name' ) ), ), 'vehicleYear' => array( 'name' ), 'km', 'tradePrice', 'retailPrice', 'listPrice' ) ) ) ); /** * @var array */ protected $metaView = array( 'Type' => 'Update', 'Contract' => 'Recurring', 'Expand' => array( 'createdBy', 'fromCompany', 'againstCompany', 'contact', 'group', 'groupDivision', 'auction', 'stock', 'make', 'model', 'type', 'vehicleYear', 'km' ), 'RequiredInput' => array(), 'OptionalInput' => array() ); /** * @var array */ protected $metaCreate = array( 'Type' => 'Create', 'Contract' => 'Recurring', 'ExecuteAfter' => array( 'sendDisputeNotification' ), 'RequiredInput' => array( 'Dispute' => array( 'againstCompany' => 'Id', 'auction' => 'Id', 'complaint' => 'String500' ) ), 'OptionalInput' => array() ); /** * @var array */ protected $metaUpdate = array( 'Type' => 'Update', 'Contract' => 'UseOnce', 'RequiredInput' => array( 'Dispute' => array( 'complaint' => 'String500' ) ), 'OptionalInput' => array( 'Dispute' => array( 'resolution' => 'String500' ) ) ); /** * Add some dynamic filtering to our grids. */ public function __construct() { $authData = \Utility\Registry::getAuthData(); switch (\Utility\Registry::getUserType()) { case 'B4C User': $groupFilter = \Utility\Registry::getSudo('Group', false); $divisionFilter = \Utility\Registry::getSudo('Division', false); $companyFilter = \Utility\Registry::getSudo('Company', false); if ($groupFilter && $divisionFilter && $companyFilter) { $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter; } break; case 'Group User': $divisionFilter = \Utility\Registry::getSudo('Division', false); $companyFilter = \Utility\Registry::getSudo('Company', false); if ($divisionFilter && $companyFilter) { $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter; } break; case 'Dealer Principle': $companyFilter = \Utility\Registry::getSudo('Company', false); if ($companyFilter) { $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter; } break; default: $this->metaGridDef['Filter']['IDENTITY(dispute.againstCompany)'] = $authData['company']['id']; $this->metaGrid['Filter']['IDENTITY(dispute.fromCompany)'] = $authData['company']['id']; break; } } }