Bug 32663 - Street number should not allow for entering more than 10 characters in OPAC
Summary: Street number should not allow for entering more than 10 characters in OPAC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: David Cook
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-17 23:51 UTC by David Nind
Modified: 2023-12-28 20:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04,22.05.11,21.11.19
Circulation function:


Attachments
Bug 32663: Limit streetnumber to 10 characters in OPAC (2.10 KB, patch)
2023-01-18 01:31 UTC, David Cook
Details | Diff | Splinter Review
Bug 32663: Limit streetnumber to 10 characters in OPAC (2.15 KB, patch)
2023-01-18 04:17 UTC, David Nind
Details | Diff | Splinter Review
Bug 32663: Limit streetnumber to 10 characters in OPAC (2.21 KB, patch)
2023-01-31 14:36 UTC, solene.ngamga
Details | Diff | Splinter Review
Bug 32663: Limit streetnumber to 10 characters in OPAC (2.26 KB, patch)
2023-02-26 11:36 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2023-01-17 23:51:51 UTC
When logged in to the OPAC and editing your personal details, you get an error trace if you enter a reasonable amount of text in the main address street number input field, for example: abcdefghijk.

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Data too long for column 'streetnumber' at row 1 at /kohadevbox/koha/Koha/Object.pm line 170
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77

    in DBIx::Class::Exception::throw at /usr/share/perl5/DBIx/Class/Exception.pm line 77

       74:     my $self = { msg => $msg };
       75:     bless $self => $class;
       76: 
       77:     die $self;
       78: }
       79: 
       80: =head2 rethrow

    Show function arguments

To replicate:
1. Log in to the OPAC (I used koha and koha with KTD).
2. Go to Your account > Personal details
3. Enter abcdefghijk in the Main address > Street number input field.
4. Error trace occurs.
5. Enter abcdefghij in the Main address > Street number input field.
6. Form submitted.
Comment 1 David Cook 2023-01-18 01:31:36 UTC
Created attachment 145379 [details] [review]
Bug 32663: Limit streetnumber to 10 characters in OPAC

This change harmonizes the patron streetnumber input between
the staff interface and the OPAC, so that you can only enter 10
characters into the streetnumber for the OPAC. Without this change,
a fatal error will be thrown trying to save the too long data.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
2. Note that you can only enter 10 characters into the "Street number"
field as a self-registration patron
3. Log into Koha
4. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
5. Note that you can only enter 10 characters into the "Street number"
field when editing logged in patron details too
6. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=S
7. Note that you can only enter 10 characters into the "Street number"
field as a staff member
Comment 2 David Nind 2023-01-18 04:17:33 UTC
Created attachment 145381 [details] [review]
Bug 32663: Limit streetnumber to 10 characters in OPAC

This change harmonizes the patron streetnumber input between
the staff interface and the OPAC, so that you can only enter 10
characters into the streetnumber for the OPAC. Without this change,
a fatal error will be thrown trying to save the too long data.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
2. Note that you can only enter 10 characters into the "Street number"
field as a self-registration patron
3. Log into Koha
4. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
5. Note that you can only enter 10 characters into the "Street number"
field when editing logged in patron details too
6. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=S
7. Note that you can only enter 10 characters into the "Street number"
field as a staff member

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 solene.ngamga 2023-01-31 14:36:27 UTC
Created attachment 145879 [details] [review]
Bug 32663: Limit streetnumber to 10 characters in OPAC

This change harmonizes the patron streetnumber input between
the staff interface and the OPAC, so that you can only enter 10
characters into the streetnumber for the OPAC. Without this change,
a fatal error will be thrown trying to save the too long data.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
2. Note that you can only enter 10 characters into the "Street number"
field as a self-registration patron
3. Log into Koha
4. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
5. Note that you can only enter 10 characters into the "Street number"
field when editing logged in patron details too
6. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=S
7. Note that you can only enter 10 characters into the "Street number"
field as a staff member

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Comment 4 Marcel de Rooy 2023-02-03 10:53:25 UTC
  `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your patron/borrower''s primary address',

Are we going the right direction here?
Comment 5 David Cook 2023-02-05 22:13:22 UTC
(In reply to Marcel de Rooy from comment #4)
>   `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your
> patron/borrower''s primary address',
> 
> Are we going the right direction here?

Perhaps not.

Looks like borrower_modifications is out of sync with borrowers and deletedborrowers.

Looks like many fields in borrower_modifications have the wrong type: streetnumber, streettype, zipcode, mobile, B_streetnumber, B_streettype, B_address, B_zipcode, password, altcontactfirstname, altcontactsurname, altcontactaddress1, altcontactaddress2, altcontactaddress3, altcontactzipcode, altcontactphone
Comment 6 David Cook 2023-02-05 22:13:48 UTC
(In reply to David Cook from comment #5)
> (In reply to Marcel de Rooy from comment #4)
> >   `streetnumber` tinytext DEFAULT NULL COMMENT 'the house number for your
> > patron/borrower''s primary address',
> > 
> > Are we going the right direction here?
> 
> Perhaps not.
> 
> Looks like borrower_modifications is out of sync with borrowers and
> deletedborrowers.
> 
> Looks like many fields in borrower_modifications have the wrong type:
> streetnumber, streettype, zipcode, mobile, B_streetnumber, B_streettype,
> B_address, B_zipcode, password, altcontactfirstname, altcontactsurname,
> altcontactaddress1, altcontactaddress2, altcontactaddress3,
> altcontactzipcode, altcontactphone

At least that's in kohastructure.sql. 

I am not sure about an upgraded database.

Yikes...
Comment 7 Katrin Fischer 2023-02-26 11:31:11 UTC
I believe the discussion about harmonizing the datatypes would be better moved elsewhere so we can proceed with this patch that brings the form in line with the form in the staff interface. A simple change that will help avoid issues for now and add to consistency.
Comment 8 Katrin Fischer 2023-02-26 11:36:00 UTC
Created attachment 147421 [details] [review]
Bug 32663: Limit streetnumber to 10 characters in OPAC

This change harmonizes the patron streetnumber input between
the staff interface and the OPAC, so that you can only enter 10
characters into the streetnumber for the OPAC. Without this change,
a fatal error will be thrown trying to save the too long data.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
2. Note that you can only enter 10 characters into the "Street number"
field as a self-registration patron
3. Log into Koha
4. Go to http://localhost:8080/cgi-bin/koha/opac-memberentry.pl
5. Note that you can only enter 10 characters into the "Street number"
field when editing logged in patron details too
6. Go to http://localhost:8081/cgi-bin/koha/members/memberentry.pl?op=add&categorycode=S
7. Note that you can only enter 10 characters into the "Street number"
field as a staff member

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Solene Ngamga <solene.ngamga@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-03-02 17:45:59 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Matt Blenkinsop 2023-03-03 12:23:38 UTC
Nice work everyone!

Pushed to stable for 22.11.x
Comment 11 Lucas Gass (lukeg) 2023-03-10 14:57:45 UTC
Backported to 22.05.x for upcoming 22.05.11
Comment 12 Arthur Suzuki 2023-03-29 13:12:33 UTC
applied to 21.11 for 21.11.19
Comment 13 Wainui Witika-Park 2023-04-27 05:38:18 UTC
Not backported to 21.05.x