From a88f61686fbde2dc12d03232d47f2a77e82c9f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 27 Oct 2022 12:14:58 +0200 Subject: [PATCH] Change Cafel Api regex validation for Batch Code allow batch_code like 30639/A --- app/Lib/CafelApi/Models/CafelBeaVol.php | 2 +- app/Lib/CafelApi/Models/CafelFood.php | 2 +- app/Lib/CafelApi/Models/CafelMepEgg.php | 2 +- app/Lib/CafelApi/Models/CafelMepPoultry.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Lib/CafelApi/Models/CafelBeaVol.php b/app/Lib/CafelApi/Models/CafelBeaVol.php index 2043da9..124726e 100644 --- a/app/Lib/CafelApi/Models/CafelBeaVol.php +++ b/app/Lib/CafelApi/Models/CafelBeaVol.php @@ -25,7 +25,7 @@ abstract class CafelBeaVol extends CafelClientModel // Eg Score A . 'bea_code' => 'required|string|min:2|max:10', // Eg 19377/0 . - 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]*\/\d$/', + 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]+\/(?:\d|[A-Z])$/', 'last_audit_date' => 'required|date_format:Y-m-d' ]; diff --git a/app/Lib/CafelApi/Models/CafelFood.php b/app/Lib/CafelApi/Models/CafelFood.php index 85ce7b7..bd3640a 100644 --- a/app/Lib/CafelApi/Models/CafelFood.php +++ b/app/Lib/CafelApi/Models/CafelFood.php @@ -28,7 +28,7 @@ abstract class CafelFood extends CafelClientModel // 1 Pondeuse ou 2 Poulet . 'food_type' => ['required', [EnumIsValidRule::class, FoodType::class]], // Eg 19377/0 . - 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]*\/\d$/', + 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]+\/(?:\d|[A-Z])$/', 'delivery_date' => 'required|date_format:Y-m-d' ]; diff --git a/app/Lib/CafelApi/Models/CafelMepEgg.php b/app/Lib/CafelApi/Models/CafelMepEgg.php index 1f53dc8..87ab9ea 100644 --- a/app/Lib/CafelApi/Models/CafelMepEgg.php +++ b/app/Lib/CafelApi/Models/CafelMepEgg.php @@ -25,7 +25,7 @@ abstract class CafelMepEgg extends CafelClientModel // Eg V072FXT (un seul par ligne). 'inuav_code' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', // Eg 19377/0 . - 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]*\/\d$/', + 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]+\/(?:\d|[A-Z])$/', 'transfert_date' => 'required|date_format:Y-m-d' ]; diff --git a/app/Lib/CafelApi/Models/CafelMepPoultry.php b/app/Lib/CafelApi/Models/CafelMepPoultry.php index e0be9ce..f06c2f9 100644 --- a/app/Lib/CafelApi/Models/CafelMepPoultry.php +++ b/app/Lib/CafelApi/Models/CafelMepPoultry.php @@ -25,7 +25,7 @@ abstract class CafelMepPoultry extends CafelClientModel // Eg V072FXT (un seul par ligne). 'inuav_code' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', // Eg 19377/0 . - 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]*\/\d$/', + 'batch_code' => 'required|max:10|regex:/^[0-9A-Z]+\/(?:\d|[A-Z])$/', 'transfert_date' => 'required|date_format:Y-m-d' ];