2 namespace Dispute\DataBin;
10 class Dispute extends \Workspace\Service\DataBin
16 protected $meta = array(
18 'DatasetName' => 'valuations',
19 'Entity' => '\Dispute\Entity\Dispute',
20 'References' => array(
21 'auction' => '\Auction\Entity\Auction',
22 'createdBy' => '\User\Entity\Profile',
23 'fromCompany' => '\Company\Entity\Company',
24 'againstCompany' => '\Company\Entity\Company'
26 'Dependants' => array()
31 protected $metaAdminGrid = array(
34 'Builder' => '\Dispute\Report\DisputeGrid',
35 'Writer' => '\Utility\Export\ExcelReport',
36 'Output' => 'Download',
37 'Contract' => 'Recurring',
40 'ExportToExcel' => false
43 'RequiredInput' => array(),
44 'OptionalInput' => array(
46 'NumberOfRecords' => 'Integer',
53 'NumberOfRecords' => 10,
54 'Query' => 'SELECT [SELECTION]
55 FROM \Dispute\Entity\Dispute dispute
56 JOIN dispute.fromCompany fromCompany
57 JOIN dispute.againstCompany againstCompany
58 JOIN dispute.auction auction
59 JOIN auction.stock stock
60 JOIN stock.vehicleYear vehicleYear
65 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type',
67 'OrderBy' => array('dispute.created' => 'DESC'),
70 'created' => 'DateTime',
72 'fromCompany' => array(
75 'againstCompany' => array(
81 'endDate' => 'DateTime',
83 'created' => 'DateTime',
93 'vehicleYear' => array(
107 protected $metaGrid = array(
110 'Builder' => '\Dispute\Report\DisputeGrid',
111 'Writer' => '\Utility\Export\ExcelReport',
112 'Output' => 'Download',
113 'Contract' => 'Recurring',
116 'ExportToExcel' => false
119 'RequiredInput' => array(),
120 'OptionalInput' => array(
122 'NumberOfRecords' => 'Integer',
129 'NumberOfRecords' => 10,
130 'Query' => 'SELECT [SELECTION]
131 FROM \Dispute\Entity\Dispute dispute
132 JOIN dispute.fromCompany fromCompany
133 JOIN dispute.againstCompany againstCompany
134 JOIN dispute.auction auction
135 JOIN auction.stock stock
136 JOIN stock.vehicleYear vehicleYear
138 JOIN type.model model
141 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type',
143 'OrderBy' => array('dispute.created' => 'DESC'),
146 'created' => 'DateTime',
148 'fromCompany' => array(
151 'againstCompany' => array(
157 'endDate' => 'DateTime',
159 'created' => 'DateTime',
169 'vehicleYear' => array(
184 protected $metaGridDef = array(
187 'Builder' => '\Dispute\Report\DisputeGrid',
188 'Writer' => '\Utility\Export\ExcelReport',
189 'Output' => 'Download',
190 'Contract' => 'Recurring',
193 'ExportToExcel' => false
196 'RequiredInput' => array(),
197 'OptionalInput' => array(
199 'NumberOfRecords' => 'Integer',
206 'NumberOfRecords' => 10,
207 'Query' => 'SELECT [SELECTION]
208 FROM \Dispute\Entity\Dispute dispute
209 JOIN dispute.fromCompany fromCompany
210 JOIN dispute.againstCompany againstCompany
211 JOIN dispute.auction auction
212 JOIN auction.stock stock
213 JOIN stock.vehicleYear vehicleYear
215 JOIN type.model model
218 'Selection' => 'dispute, fromCompany, againstCompany, auction, stock, vehicleYear, make, model, type',
220 'OrderBy' => array('dispute.created' => 'DESC'),
223 'created' => 'DateTime',
225 'fromCompany' => array(
228 'againstCompany' => array(
234 'endDate' => 'DateTime',
236 'created' => 'DateTime',
246 'vehicleYear' => array(
260 protected $metaView = array(
262 'Contract' => 'Recurring',
278 'RequiredInput' => array(),
279 'OptionalInput' => array()
284 protected $metaCreate = array(
286 'Contract' => 'Recurring',
287 'ExecuteAfter' => array(
288 'sendDisputeNotification'
290 'RequiredInput' => array(
292 'againstCompany' => 'Id',
294 'complaint' => 'String500'
297 'OptionalInput' => array()
302 protected $metaUpdate = array(
304 'Contract' => 'UseOnce',
305 'RequiredInput' => array(
307 'complaint' => 'String500'
310 'OptionalInput' => array(
312 'resolution' => 'String500'
320 * Add some dynamic filtering to our grids.
322 public function __construct()
324 $authData = \Utility\Registry::getAuthData();
325 switch (\Utility\Registry::getUserType())
328 $groupFilter = \Utility\Registry::getSudo('Group', false);
329 $divisionFilter = \Utility\Registry::getSudo('Division', false);
330 $companyFilter = \Utility\Registry::getSudo('Company', false);
331 if ($groupFilter && $divisionFilter && $companyFilter)
333 $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter;
337 $divisionFilter = \Utility\Registry::getSudo('Division', false);
338 $companyFilter = \Utility\Registry::getSudo('Company', false);
339 if ($divisionFilter && $companyFilter)
341 $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter;
344 case 'Dealer Principle':
345 $companyFilter = \Utility\Registry::getSudo('Company', false);
348 $this->metaGrid['Filter']['IDENTITY(dispute.againstCompany)'] = $companyFilter;
352 $this->metaGridDef['Filter']['IDENTITY(dispute.againstCompany)'] = $authData['company']['id'];
353 $this->metaGrid['Filter']['IDENTITY(dispute.fromCompany)'] = $authData['company']['id'];