From 64451daa4307386f65b03c9af856855f20acee4b Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Thu, 12 Oct 2023 15:27:55 +0200 Subject: [PATCH] Handle registration number size; closes #1722 --- lib/GaletteAuto/Auto.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/GaletteAuto/Auto.php b/lib/GaletteAuto/Auto.php index d5bad09..6b37604 100644 --- a/lib/GaletteAuto/Auto.php +++ b/lib/GaletteAuto/Auto.php @@ -703,12 +703,30 @@ public function check($post) } switch ($prop) { + //string values with special check + case 'registration': + if (mb_strlen($value) <= 10) { + $this->$prop = $value; + } else { + $this->errors[] = str_replace( + array( + '%maxsize', + '%field', + '%cursize' + ), + array( + 10, + $this->getPropName($prop), + mb_strlen($value) + ), + _T("- Maximum size for %field is %maxsize (current %cursize)!") + ); + } + break; //string values, no check case 'name': case 'comment': - //string values with special check? case 'chassis_number': - case 'registration': $this->$prop = $value; break; //dates