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/ItineraryService.php +11 -12 3.0.4 → 3.0.16 View file →
@@ -185,9 +185,9 @@
185 185 * without `id` is created. Returns per-row result objects so the caller can
186 186 * surface partial failures. Cache invalidation fires once at the end (via
187 187 * the existing per-row hooks already invoked by the repository).
188 188 *
189 - * @param int $dayId The yatra_new_trip_itinerary_days.id row.
189 + * @param int $dayId The yatra_trip_itinerary_days.id row.
190 190 * @param int $tripId The trip id (used for the create branch).
191 191 * @param array $activities Array of activity payloads. Each row may include
192 192 * an `id` (update) or omit it (create).
193 193 * @return array {created: int, updated: int, results: array}
@@ -281,25 +281,24 @@
281 281 * Bulk delete itinerary entries
282 282 * @param array $ids Array of entry IDs to delete
283 283 * @return array ['deleted' => count, 'failed' => count]
284 284 */
285 - public function bulkDelete(array $ids): array
285 + public function bulkDelete(array $ids, array $dayIds = []): array
286 286 {
287 - if (empty($ids)) {
288 - return ['deleted' => 0, 'failed' => 0];
289 - }
290 -
291 - // Validate all IDs are integers
292 - $ids = array_map('intval', $ids);
293 - $ids = array_filter($ids, function($id) {
287 + // Activity entry ids and day ids are validated independently — see
288 + // ItineraryRepository::bulkDelete() for why they must stay separate.
289 + $ids = array_values(array_filter(array_map('intval', $ids), function ($id) {
294 290 return $id > 0;
295 - });
291 + }));
292 + $dayIds = array_values(array_filter(array_map('intval', $dayIds), function ($id) {
293 + return $id > 0;
294 + }));
296 295
297 - if (empty($ids)) {
296 + if (empty($ids) && empty($dayIds)) {
298 297 return ['deleted' => 0, 'failed' => 0];
299 298 }
300 299
301 - return $this->repository->bulkDelete($ids);
300 + return $this->repository->bulkDelete($ids, $dayIds);
302 301 }
303 302
304 303 /**
305 304 * Get all itinerary entries for a specific trip