PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | app/Services/EnquiryService.php +17 -3 3.0.5 → 3.0.16 View file →
@@ -191,11 +191,20 @@
191 191 if (empty($data['status'])) {
192 192 $data['status'] = 'pending';
193 193 }
194 194
195 - // Create enquiry
196 - $enquiryId = $this->enquiryRepository->create($data);
195 + // Create enquiry. The repository throws when the INSERT is rejected;
196 + // this endpoint is public, so turn that into the same friendly failure
197 + // every other rejection returns instead of a 500 that echoes the raw
198 + // database error back to the visitor.
199 + try {
200 + $enquiryId = $this->enquiryRepository->create($data);
201 + } catch (\Throwable $e) {
202 + error_log('Yatra: failed to create enquiry - ' . $e->getMessage());
197 203
204 + return ['success' => false, 'message' => __('Failed to submit enquiry.', 'yatra')];
205 + }
206 +
198 207 if (!$enquiryId) {
199 208 return ['success' => false, 'message' => __('Failed to submit enquiry.', 'yatra')];
200 209 }
201 210
@@ -338,9 +347,14 @@
338 347 */
339 348 public function bulkUpdateStatus(array $ids, string $status): array
340 349 {
341 350 // Allowed statuses for bulk updates. This list is mirrored in the admin UI.
342 - $validStatuses = ['pending', 'read', 'responded', 'archived', 'spam', 'trash'];
351 + // 'completed' marks enquiries that have been fully handled, distinct from
352 + // open/in-progress ones. 'closed' is the "no further action" end state the
353 + // enquiry edit screen has always offered; it is accepted here too so the
354 + // list's quick status actions and bulk actions can set it without the
355 + // operator having to open each enquiry.
356 + $validStatuses = ['pending', 'read', 'responded', 'completed', 'closed', 'archived', 'spam', 'trash'];
343 357
344 358 if (!in_array($status, $validStatuses, true)) {
345 359 return ['success' => false, 'affected' => 0, 'message' => __('Invalid status.', 'yatra')];
346 360 }