If you create a new cash register with a "long" (not that long actually) name, the submit form fails with: 2020/11/06 09:56:19] [WARN] DBD::mysql::st execute failed: Data too long for column 'name' at row 1 [for Statement "INSERT INTO `cash_registers` ( `branch`, `description`, `name`, `starting_float`) VALUES ( ?, ?, ?, ? )" with ParamValues: 0="CPL", 1="<script>alert("â¤");</script>", 2="<script>alert("â¤");</script>", 3="0.00"] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
Good catch, I'll take a look now
Created attachment 113310 [details] [review] Bug 26946: Set maxlength for cash register name The cash register names is limited to 24 characters at the database level and so that restriction should also be reflected in the UI. Test plan 1/ Add or Edit a cash register ( admin > accounts > cash registers ) 2/ Note that you can enter a cash register name longer than 24 characters, but upon save the value is truncated. 3/ Apply patch 4/ Note you can not longer enter a cash register name longer than 24 characters. 5/ Signoff
Created attachment 113338 [details] [review] Bug 26946: Set maxlength for cash register name The cash register names is limited to 24 characters at the database level and so that restriction should also be reflected in the UI. Test plan 1/ Add or Edit a cash register ( admin > accounts > cash registers ) 2/ Note that you can enter a cash register name longer than 24 characters, but upon save the value is truncated. 3/ Apply patch 4/ Note you can not longer enter a cash register name longer than 24 characters. 5/ Signoff Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Works perfectly, signed off.
Is ther
Is there a reason to limit the size of the description? The database type is a LONGTEXT (2147483647). And also, the initial float limit is actually 22 before the decimal (number (28,6))
(In reply to Victor Grousset/tuxayo from comment #6) > Is there a reason to limit the size of the description? The database type is > a LONGTEXT (2147483647). And also, the initial float limit is actually 22 > before the decimal (number (28,6)) We're only setting 'length' and not 'maxlength' for description.. it's purely a styleing thing to keep the two text boxes lined up, it doesn't actually limit the input in the description case.
Created attachment 114269 [details] [review] Bug 26946: Set maxlength for cash register name The cash register names is limited to 24 characters at the database level and so that restriction should also be reflected in the UI. Test plan 1/ Add or Edit a cash register ( admin > accounts > cash registers ) 2/ Note that you can enter a cash register name longer than 24 characters, but upon save the value is truncated. 3/ Apply patch 4/ Note you can not longer enter a cash register name longer than 24 characters. 5/ Signoff Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
(In reply to Martin Renvoize from comment #7) > We're only setting 'length' and not 'maxlength' for description.. Indeed! I forgot about that one, thanks. So, works as expected and no QA issue ^^
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.01
Pushed to 20.05.x for 20.05.07
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.