2 namespace Retail\Service;
10 public function hello()
12 return "Hello world!";
16 * Return Hello whatever
20 public function helloBob($name)
22 return "Hello " . (string) $name;
26 * Return all retail data for a given retailer based on their authtoken.
27 * @param string $authToken
30 public function getVehicleListing($authToken)
32 $dataSet = \Utility\Registry::getEntityManager()
34 'SELECT stock, company, retailers, type, model, make, fuelType, transmissionType,'
35 . ' exteriorColour, interiorColour, condition, vehicleYear, upholstery,'
36 . ' papers, natis, fsh, introYear, discYear,'
37 . ' mainImage, frontImage, rightImage, leftImage,'
38 . ' backImage, interiorImage, engineImage, natisImage,'
39 . ' accessories, accessory, damages, damage '
40 . 'FROM \Stock\Entity\Stock stock '
41 . 'JOIN stock.company company '
42 . 'JOIN company.retailers retailers '
43 . 'JOIN retailers.retail retail '
44 . 'JOIN stock.type type '
45 . 'JOIN type.model model '
46 . 'JOIN model.make make '
47 . 'LEFT JOIN type.introYear introYear '
48 . 'LEFT JOIN type.discYear discYear '
49 . 'LEFT JOIN stock.fuelType fuelType '
50 . 'LEFT JOIN stock.transmissionType transmissionType '
51 . 'LEFT JOIN stock.exteriorColour exteriorColour '
52 . 'LEFT JOIN stock.interiorColour interiorColour '
53 . 'LEFT JOIN stock.condition condition '
54 . 'LEFT JOIN stock.vehicleYear vehicleYear '
55 . 'LEFT JOIN stock.upholstery upholstery '
56 . 'LEFT JOIN stock.papers papers '
57 . 'LEFT JOIN stock.natis natis '
58 . 'LEFT JOIN stock.fullServiceHistory fsh '
59 . 'LEFT JOIN stock.mainImage mainImage '
60 . 'LEFT JOIN stock.frontImage frontImage '
61 . 'LEFT JOIN stock.rightImage rightImage '
62 . 'LEFT JOIN stock.leftImage leftImage '
63 . 'LEFT JOIN stock.backImage backImage '
64 . 'LEFT JOIN stock.interiorImage interiorImage '
65 . 'LEFT JOIN stock.engineImage engineImage '
66 . 'LEFT JOIN stock.natisImage natisImage '
67 . 'LEFT JOIN stock.accessories accessories '
68 . 'LEFT JOIN accessories.accessory accessory '
69 . 'LEFT JOIN stock.damages damages '
70 . 'LEFT JOIN damages.damage damage '
71 . 'WHERE stock.jobState=\'Retail\' '
72 . ' AND retail.authToken = \'' . addslashes($authToken) . '\' '
73 . ' AND stock.archived = 0'
74 . ' AND company.archived = 0'
75 . ' AND retailers.archived = 0'
79 $imgUrl = \Utility\Registry::getConfigParam('Host') . '/img/bin/';
80 foreach ($dataSet as $row)
82 \Utility\Debug::errorLog('DATA for XMLRPC api', $row);
83 $accessories = array();
84 foreach ($row['accessories'] as $acc)
86 $accessories[] = $acc['accessory']['name'];
89 foreach ($row['damages'] as $dmg)
94 'type' => $dmg['damage']['name'],
95 'estimated_repair' => $dmg['amount'],
101 'registration_number' => $row['registrationNumber'],
102 'vehicle_year' => $row['vehicleYear']['name'],
103 'stock_number' => $row['stockNumber'],
105 'specific_color' => !is_null($row['exteriorColour'])
106 ? $row['exteriorColour']['name']
108 'vin_number' => $row['vinNumber'],
109 'engine_number' => $row['engineNumber'],
110 'full_service_history_notes' => $row['fshNotes'],
111 'mm_code' => $row['type']['mmCode'],
112 'stand_in_value' => null,
113 'reserve_price' => $row['retailAmountRequired'],
115 'faults_explenation' => '',
116 'previous_repair_notes' => $row['previousRepairsNotes'],
117 'accessory_remarks' => $row['accessoryNotes'],
118 'dealer_retail_account_no' => $row['company']['retailers'][0]['username'],
119 'main_photo_url' => !is_null($row['mainImage'])
120 ? $imgUrl . $row['mainImage']['filename']
122 'first_additional_photo_url' => !is_null($row['frontImage'])
123 ? $imgUrl . $row['frontImage']['filename']
125 'second_additional_photo_url' => !is_null($row['rightImage'])
126 ? $imgUrl . $row['rightImage']['filename']
128 'third_additional_photo_url' => !is_null($row['leftImage'])
129 ? $imgUrl . $row['leftImage']['filename']
131 'fourth_additional_photo_url' => !is_null($row['backImage'])
132 ? $imgUrl . $row['backImage']['filename']
134 'fifth_additional_photo_url' => !is_null($row['interiorImage'])
135 ? $imgUrl . $row['interiorImage']['filename']
137 'sixth_additional_photo_url' => !is_null($row['engineImage'])
138 ? $imgUrl . $row['engineImage']['filename']
140 'seventh_additional_photo_url' => !is_null($row['natisImage'])
141 ? $imgUrl . $row['natisImage']['filename']
143 'full_service_history' => !is_null($row['fullServiceHistory'])
144 ? $row['fullServiceHistory']['name']
146 'vehicle_spare_key' => is_null($row['spareKeys'])
148 : ($row['spareKeys'] ? true : false),
149 'vehicle_paper' => !is_null($row['papers'])
150 ? $row['papers']['name']
152 'condition' => !is_null($row['condition'])
153 ? $row['condition']['name']
155 'make' => $row['type']['model']['make']['name'],
156 'model' => $row['type']['model']['name'],
157 'type' => $row['type']['name'],
158 'base_color' => !is_null($row['exteriorColour'])
159 ? $row['exteriorColour']['name']
161 'interior' => !is_null($row['upholstery'])
162 ? $row['upholstery']['name']
164 'interior_color' => !is_null($row['interiorColour'])
165 ? $row['interiorColour']['name']
167 'natis' => !is_null($row['natis'])
168 ? $row['natis']['name']
170 'vehicle_intro_year' => !is_null($row['type']['introYear'])
171 ? $row['type']['introYear']['name']
173 'vehicle_intro_month' => $row['type']['introMonth'],
174 'vehicle_disc_year' => !is_null($row['type']['discYear'])
175 ? $row['type']['discYear']['name']
177 'vehicle_disc_month' => $row['type']['discMonth'],
178 'vehicle_cyl' => $row['type']['cylinders'],
179 'vehicle_cubic_capacity' => $row['type']['cubicCapacity'],
180 'vehicle_kilowatts' => $row['type']['kilowatts'],
181 'vehicle_body_type' => $row['type']['bodyType'],
182 'vehicle_number_of_doors' => $row['type']['doors'],
183 'fuel_type' => !is_null($row['fuelType'])
184 ? $row['fuelType']['name']
186 'transmission_type' => !is_null($row['transmissionType'])
187 ? $row['transmissionType']['name']
189 'accessories' => $accessories,
190 'damages' => $damages