'Stock', 'DatasetName' => 'stock', 'Entity' => '\Stock\Entity\Stock', 'References' => array( 'region' => '\Location\Entity\Region', 'type' => '\Stock\Entity\Type', 'fuelType' => '\Stock\Entity\FuelType', 'transmissionType' => '\Stock\Entity\TransmissionType', 'exteriorColour' => '\Stock\Entity\ExteriorColour', 'interiorColour' => '\Stock\Entity\InteriorColour', 'condition' => '\Stock\Entity\Condition', 'vehicleYear' => '\Stock\Entity\Year', 'upholstery' => '\Stock\Entity\Upholstery', 'papers' => '\Stock\Entity\Paper', 'natis' => '\Stock\Entity\Natis', 'fullServiceHistory' => '\Stock\Entity\FullServiceHistory', 'mainImage' => '\Utility\Entity\Image', 'frontImage' => '\Utility\Entity\Image', 'rightImage' => '\Utility\Entity\Image', 'leftImage' => '\Utility\Entity\Image', 'backImage' => '\Utility\Entity\Image', 'interiorImage' => '\Utility\Entity\Image', 'engineImage' => '\Utility\Entity\Image', 'natisImage' => '\Utility\Entity\Image' ), 'Dependants' => array( 'accessories' => '\Stock\Entity\Accessory' ) ); /** * @var array */ protected $metaList = array( 'Type' => 'List', 'Contract' => 'Recurring', 'RequiredInput' => array(), 'OptionalInput' => array( 'Filter' => array( 'created' => 'Date', 'updated' => 'Date', 'uvi' => 'String40', 'referenceNumber' => 'String12', 'company' => 'Id', 'createdBy' => 'Id', 'region' => 'Id', 'type' => 'Id', 'stockNumber' => 'String15', 'registrationNumber' => 'String15', 'vinNumber' => 'String40', 'engineNumber' => 'String40', 'fuelType' => 'Id', 'transmissionType' => 'Id', 'exteriorColour' => 'Id', 'interiorColour' => 'Id', 'condition' => 'Id', 'vehicleYear' => 'Id', 'km' => 'Integer', 'upholstery' => 'Id', 'papers' => 'Id', 'natis' => 'Id', 'spareKeys' => 'Boolean', 'fullServiceHistory' => 'Id', 'tradePrice' => 'Decimal', 'retailPrice' => 'Decimal', 'listPrice' => 'Decimal', 'retailAmountRequired' => 'Decimal', 'purchasePrice' => 'Decimal', 'salePrice' => 'Decimal', 'previousRepairsNotes' => 'String500', 'previousRepairsNoted' => 'Boolean', 'jobState' => 'String25', 'makeManual' => 'String150', 'modelManual' => 'String150', 'typeManual' => 'String150' ) ), 'Filter' => array(), 'Fields' => array( 'name', 'mmCode', 'introYear', 'introMonth', 'discYear', 'discMonth' ), 'Expand' => array() ); /** * @var array */ protected $metaGrid = array( 'Type' => 'Grid', 'Export' => true, 'Builder' => '\Stock\Report\StockGrid', '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' => 'stock', 'NumberOfRecords' => 20, 'Query' => 'SELECT [SELECTION] FROM \Stock\Entity\Stock stock JOIN stock.company company JOIN stock.vehicleYear vehicleYear JOIN stock.type type JOIN type.model model JOIN model.make make LEFT JOIN stock.auction auction LEFT JOIN stock.valuation valuation LEFT JOIN stock.priceGuide priceGuide LEFT JOIN company.group companyGroup LEFT JOIN company.groupDivision groupDivision LEFT JOIN stock.exteriorColour exteriorColour [WHERE] [ORDER]', 'Selection' => 'stock, valuation, company, companyGroup, groupDivision, auction, priceGuide, exteriorColour, vehicleYear, make, model, type', 'Filter' => array( 'stock.archived' => false, 'stock.jobState' => '!=Valuation' ), 'OrderBy' => array('stock.created' => 'DESC'), 'Fields' => array( 'id', 'referenceNumber', 'created' => 'DateTime', 'registrationNumber', 'vinNumber', 'type' => array( 'name', 'mmCode', 'model' => array( 'name', 'make' => array( 'name' ) ), ), 'vehicleYear' => array( 'name' ), 'exteriorColour' => array( 'name' ), 'priceGuide' => array( 'id' ), 'valuation' => array( 'amountOffered' ), 'auction' => array( 'jobState' ), 'km', 'tradePrice', 'retailPrice', 'listPrice', 'retailAmountRequired', 'highestBid', 'highestOffer', 'numberOfOffers', 'jobState' ) ); /** * @var array */ protected $metaTradeCenterGrid = array( 'Type' => 'Grid', 'Export' => true, 'Builder' => '\Stock\Report\StockGrid', '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' => 'stock', 'NumberOfRecords' => 10, 'Query' => 'SELECT [SELECTION] FROM \Stock\Entity\Stock stock JOIN stock.company company JOIN stock.vehicleYear vehicleYear JOIN stock.type type JOIN type.model model JOIN model.make make LEFT JOIN stock.auction auction LEFT JOIN stock.valuation valuation LEFT JOIN company.group companyGroup LEFT JOIN company.groupDivision groupDivision LEFT JOIN stock.exteriorColour exteriorColour [WHERE] [ORDER]', 'Selection' => 'stock, valuation, company, companyGroup, groupDivision, auction, exteriorColour, vehicleYear, make, model, type', 'Filter' => array( 'stock.archived' => false, 'stock.jobState' => 'IN Trade Center,Auction,Sold' ), 'OrderBy' => array('stock.created' => 'DESC'), 'Fields' => array( 'id', 'referenceNumber', 'created' => 'DateTime', 'registrationNumber', 'vinNumber', 'company' => array( 'name' ), 'type' => array( 'name', 'mmCode', 'model' => array( 'name', 'make' => array( 'name' ) ), ), 'vehicleYear' => array( 'name' ), 'valuation' => array( 'amountOffered' ), 'auction' => array( 'jobState' ), 'km', 'tradePrice', 'retailPrice', 'listPrice', 'retailAmountRequired', 'highestBid', 'jobState' ) ); /** * aht5 * @var array */ protected $metaView = array( 'Type' => 'View', 'Expand' => array( 'group', 'groupDivision', 'model', 'make', 'type' ), 'Intersect' => array() ); /** * @var array */ protected $metaCreate = array( 'Type' => 'Create', 'Contract' => 'Recurring', 'ExecuteBefore' => array( 'addCustomVehicles' ), 'ExecuteAfter' => array( 'generateHistoryList', 'pushCreateAction' ), 'RequiredInput' => array( 'Stock' => array( 'vehicleYear' => 'Id', 'stockNumber' => 'String15', 'registrationNumber' => 'String15', 'fuelType' => 'Id', 'transmissionType' => 'Id' ) ), 'OptionalInput' => array( 'Stock' => array( 'category' => 'Id', 'make' => 'Id', 'model' => 'Id', 'type' => 'Id', 'region' => 'Id', 'vinNumber' => 'String40', 'engineNumber' => 'String40', 'exteriorColour' => 'Id', 'interiorColour' => 'Id', 'condition' => 'Id', 'km' => 'Integer', 'upholstery' => 'Id', 'papers' => 'Id', 'natis' => 'Id', 'spareKeys' => 'Boolean', 'fullServiceHistory' => 'Id', 'fshNotes' => 'String500', 'tradePrice' => 'Decimal', 'retailPrice' => 'Decimal', 'listPrice' => 'Decimal', 'retailAmountRequired' => 'Decimal', 'purchasePrice' => 'Decimal', 'salePrice' => 'Decimal', 'mainImage' => 'Id', 'frontImage' => 'Id', 'rightImage' => 'Id', 'leftImage' => 'Id', 'backImage' => 'Id', 'interiorImage' => 'Id', 'engineImage' => 'Id', 'natisImage' => 'Id', 'accessories' => 'Collection', 'accessoryNotes' => 'String500', 'damages' => 'Collection', 'damageTotal' => 'Decimal', 'previousRepairsNoted' => 'Boolean', 'previousRepairsNotes' => 'String500', 'damageNotes' => 'String500', 'coverReceived' => 'String500', 'makeManual' => 'String150', 'modelManual' => 'String150', 'typeManual' => 'String150' ) ) ); /** * @var array */ protected $metaCreateAuction = array( 'Type' => 'Create', 'Contract' => 'Recurring', 'ExecuteBefore' => array( 'addCustomVehicles' ), 'ExecuteAfter' => array( 'generateHistoryList', 'pushCreateAction' ), 'Flags' => array( 'NewStockItem.Status' => 'Auction.NewItemFromStock' ), 'RequiredInput' => array( 'Context' => array( 'endDate' => 'Date', 'reservePrice' => 'Decimal' ), 'Stock' => array( 'vehicleYear' => 'Id', 'stockNumber' => 'String15', 'registrationNumber' => 'String15', 'fuelType' => 'Id', 'transmissionType' => 'Id' ) ), 'OptionalInput' => array( 'Stock' => array( 'category' => 'Id', 'make' => 'Id', 'model' => 'Id', 'type' => 'Id', 'region' => 'Id', 'vinNumber' => 'String40', 'engineNumber' => 'String40', 'exteriorColour' => 'Id', 'interiorColour' => 'Id', 'condition' => 'Id', 'km' => 'Integer', 'upholstery' => 'Id', 'papers' => 'Id', 'natis' => 'Id', 'spareKeys' => 'Boolean', 'fullServiceHistory' => 'Id', 'fshNotes' => 'String500', 'tradePrice' => 'Decimal', 'retailPrice' => 'Decimal', 'listPrice' => 'Decimal', 'retailAmountRequired' => 'Decimal', 'purchasePrice' => 'Decimal', 'salePrice' => 'Decimal', 'mainImage' => 'Id', 'frontImage' => 'Id', 'rightImage' => 'Id', 'leftImage' => 'Id', 'backImage' => 'Id', 'interiorImage' => 'Id', 'engineImage' => 'Id', 'natisImage' => 'Id', 'accessories' => 'Collection', 'accessoryNotes' => 'String500', 'damages' => 'Collection', 'damageTotal' => 'Decimal', 'previousRepairsNoted' => 'Boolean', 'previousRepairsNotes' => 'String500', 'damageNotes' => 'String500', 'coverReceived' => 'String500', 'makeManual' => 'String150', 'modelManual' => 'String150', 'typeManual' => 'String150' ) ) ); /** * @var array */ protected $metaUpdate = array( 'Type' => 'Update', 'Contract' => 'UseOnce', 'Expand' => array( 'auction', 'category', 'make', 'model', 'type', 'mainImage', 'frontImage', 'rightImage', 'leftImage', 'backImage', 'interiorImage', 'engineImage', 'natisImage' ), 'ExecuteBefore' => array( 'updateCustomVehicles' ), 'ExecuteAfter' => array( 'pushUpdateAction' ), 'RequiredInput' => array( 'Stock' => array( 'vehicleYear' => 'Id', 'stockNumber' => 'String15', 'registrationNumber' => 'String15', 'fuelType' => 'Id', 'transmissionType' => 'Id' ) ), 'OptionalInput' => array( 'Stock' => array( 'category' => 'Id', 'make' => 'Id', 'model' => 'Id', 'type' => 'Id', 'region' => 'Id', 'vinNumber' => 'String40', 'engineNumber' => 'String40', 'exteriorColour' => 'Id', 'interiorColour' => 'Id', 'condition' => 'Id', 'km' => 'Integer', 'upholstery' => 'Id', 'papers' => 'Id', 'natis' => 'Id', 'spareKeys' => 'Boolean', 'fullServiceHistory' => 'Id', 'fshNotes' => 'String500', 'tradePrice' => 'Decimal', 'retailPrice' => 'Decimal', 'listPrice' => 'Decimal', 'oldTradePrice' => 'Decimal', 'oldRetailPrice' => 'Decimal', 'oldListPrice' => 'Decimal', 'retailAmountRequired' => 'Decimal', 'purchasePrice' => 'Decimal', 'salePrice' => 'Decimal', 'mainImage' => 'Id', 'frontImage' => 'Id', 'rightImage' => 'Id', 'leftImage' => 'Id', 'backImage' => 'Id', 'interiorImage' => 'Id', 'engineImage' => 'Id', 'natisImage' => 'Id', 'accessories' => 'Collection', 'accessoryNotes' => 'String500', 'damages' => 'Collection', 'damageTotal' => 'Decimal', 'previousRepairsNoted' => 'Boolean', 'previousRepairsNotes' => 'String500', 'damageNotes' => 'String500', 'coverReceived' => 'String500', 'makeManual' => 'String150', 'modelManual' => 'String150', 'typeManual' => 'String150' ) ) ); /** * @var array */ protected $metaLimitedUpdate = array( 'Type' => 'Update', 'Contract' => 'UseOnce', 'ExecuteBefore' => array( 'updateCustomVehicles' ), 'ExecuteAfter' => array( 'pushUpdateAction' ), 'Expand' => array( 'auction', 'category', 'make', 'model', 'type', 'mainImage', 'frontImage', 'rightImage', 'leftImage', 'backImage', 'interiorImage', 'engineImage', 'natisImage', ), 'RequiredInput' => array(), 'OptionalInput' => array() ); /** * @var array */ protected $metaDelete = array( 'Type' => 'Delete', 'Contract' => 'UseOnce', 'ExecuteAfter' => array( 'pushDeleteAction' ) ); /** * @var array */ protected $metaSendToRetail = array( 'Type' => 'Update', 'Contract' => 'UseOnce', 'ExecuteAfter' => array( 'pushUpdateAction' ), 'RequiredInput' => array( 'Context' => array( 'retailOutlets' => 'Array' ), 'Stock' => array( 'minimumAmount' => 'Decimal' ) ), 'OptionalInput' => array() ); /** * @var array */ protected $metaRouteSendToRetail = array( 'Type' => 'Route', 'Contract' => 'UseOnce', 'Destination' => 'Retail.NewItemFromStock', 'Surrogate' => 'metaSendToRetail' ); /** * @var array */ protected $metaRouteSendToPriceGuide = array( 'Type' => 'Route', 'Contract' => 'UseOnce', 'Destination' => 'PriceGuide.NewItemFromStock', 'ExecuteAfter' => array( 'pushUpdateAction' ), 'RequiredInput' => array( 'Context' => array( 'clubs' => 'Array' ) ), 'OptionalInput' => array() ); /** * @var array */ protected $metaRouteSendToAuction = array( 'Type' => 'Route', 'Contract' => 'UseOnce', 'Destination' => 'Auction.NewItemFromStock', 'ExecuteAfter' => array( 'pushUpdateAction' ), 'RequiredInput' => array( 'Context' => array( 'endDate' => 'Date', 'reservePrice' => 'Decimal' ) ), 'OptionalInput' => array() ); /** * 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); $groupFilter && $this->metaGrid['Filter']['IDENTITY(company.group)'] = $groupFilter; $divisionFilter = \Utility\Registry::getSudo('Division', false); $divisionFilter && $this->metaGrid['Filter']['IDENTITY(company.groupDivision)'] = $divisionFilter; $companyFilter = \Utility\Registry::getSudo('Company', false); $companyFilter && $this->metaGrid['Filter']['company.id'] = $companyFilter; $companyFilter && $this->metaTradeCenterGrid['Filter']['IDENTITY(company.tradeCenter)'] = $companyFilter; break; case 'Group User': $this->metaGrid['Filter']['IDENTITY(company.group)'] = $authData['company']['group']['id']; $divisionFilter = \Utility\Registry::getSudo('Division', false); $divisionFilter && $this->metaGrid['Filter']['IDENTITY(company.groupDivision)'] = $divisionFilter; $companyFilter = \Utility\Registry::getSudo('Company', false); $companyFilter && $this->metaGrid['Filter']['company.id'] = $companyFilter; $companyFilter && $this->metaTradeCenterGrid['Filter']['IDENTITY(company.tradeCenter)'] = $companyFilter; break; case 'Dealer Principle': $this->metaGrid['Filter']['IDENTITY(company.groupDivision)'] = $authData['company']['groupDivision']['id']; $companyFilter = \Utility\Registry::getSudo('Company', false); $companyFilter && $this->metaGrid['Filter']['company.id'] = $companyFilter; $companyFilter && $this->metaTradeCenterGrid['Filter']['IDENTITY(company.tradeCenter)'] = $companyFilter; break; default: $this->metaGrid['Filter']['company.id'] = $authData['company']['id']; $this->metaTradeCenterGrid['Filter']['IDENTITY(company.tradeCenter)'] = $authData['company']['id']; break; } } }