Bug 27726 - OPACProblemReports cuts off message text
Summary: OPACProblemReports cuts off message text
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-18 23:41 UTC by Hannah Co
Modified: 2021-04-25 17:20 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11


Attachments
Bug 27726: Add maxlength attribute to OPACProblemReport textarea (1.76 KB, patch)
2021-02-26 15:23 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27726: Add maxlength attribute to OPACProblemReport textarea (1.81 KB, patch)
2021-03-10 09:47 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27726: (ALTERNATIVE) Increase 'content' field size (2.13 KB, patch)
2021-03-25 14:30 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 27726: Add maxlength attribute to OPACProblemReport textarea (1.86 KB, patch)
2021-03-26 03:44 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 27726: (ALTERNATIVE) Increase 'content' field size (2.17 KB, patch)
2021-03-26 03:44 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 27726: Add maxlength attribute to OPACProblemReport textarea (1.86 KB, patch)
2021-03-26 09:12 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27726: (ALTERNATIVE) Increase 'content' field size (2.23 KB, patch)
2021-03-26 09:12 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 27726: (ALTERNATIVE) Increase 'content' field size (2.29 KB, patch)
2021-03-27 15:52 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 27726: Increase 'content' field size (2.25 KB, patch)
2021-04-09 07:02 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hannah Co 2021-02-18 23:41:23 UTC
OPACProblemReport text is truncated to 255 characters, in both database and email. I tested and confirmed that the patron-facing form does not limit the amount of text entered, at least not before more than 500 characters. The form should either limit characters and warn patrons of the character limit, or the database field should be expanded to allow more data storage.
Comment 1 Owen Leonard 2021-02-26 15:23:42 UTC
Created attachment 117383 [details] [review]
Bug 27726: Add maxlength attribute to OPACProblemReport textarea

This patch adds a maxlength attribute to the OPACProblemReport textarea.
This will prevent the user from entering more characters than the table
column limit (255).

To test, apply the patch and enable the OPACProblemReport system
preference.

 - Log into the OPAC
 - Click the "Report a problem" link at the bottom of the page.
 - You should see a hint below the textarea, "255 characters maximum."
 - Enter enough text in the textarea to confirm that it is cut off at
   255 characters.
Comment 2 Peter Vashchuk 2021-03-10 09:46:18 UTC
Small note about testing, I didn't find "OPACProblemReport" in my sysprefs but found "OPACReportProblem" instead.
Comment 3 Peter Vashchuk 2021-03-10 09:47:17 UTC
Created attachment 118020 [details] [review]
Bug 27726: Add maxlength attribute to OPACProblemReport textarea

This patch adds a maxlength attribute to the OPACProblemReport textarea.
This will prevent the user from entering more characters than the table
column limit (255).

To test, apply the patch and enable the OPACProblemReport system
preference.

 - Log into the OPAC
 - Click the "Report a problem" link at the bottom of the page.
 - You should see a hint below the textarea, "255 characters maximum."
 - Enter enough text in the textarea to confirm that it is cut off at
   255 characters.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 4 Martin Renvoize 2021-03-25 14:19:18 UTC
Hmm, is this going the right way?

255 characters is around 50 words.. is that enough to describe your average problem?

I wonder if we aught to increase the char count of the column in the db as well as Owens hinting (but obviously updated to the new char limit)
Comment 5 Martin Renvoize 2021-03-25 14:30:44 UTC
Created attachment 118811 [details] [review]
Bug 27726: (ALTERNATIVE) Increase 'content' field size

This alternate patch increases the field size from a 255 character
varchar to a 65535 character text field. This allows for more detailed
problem reports to be submitted.
Comment 6 Martin Renvoize 2021-03-25 14:31:26 UTC
Alternative attached that increases the storage size for the field instead.
Comment 7 Amit Gupta 2021-03-26 03:44:12 UTC
Created attachment 118838 [details] [review]
Bug 27726: Add maxlength attribute to OPACProblemReport  textarea

To test, apply the patch and enable the OPACProblemReport system
preference.

 - Log into the OPAC
 - Click the "Report a problem" link at the bottom of the page.
 - You should see a hint below the textarea, "255 characters maximum."
 - Enter enough text in the textarea to confirm that it is cut off at
   255 characters.
Comment 8 Amit Gupta 2021-03-26 03:44:54 UTC
Created attachment 118839 [details] [review]
Bug 27726: (ALTERNATIVE) Increase 'content' field size

This alternate patch increases the field size from a 255 character
varchar to a 65535 character text field. This allows for more detailed
problem reports to be submitted.
Comment 9 Peter Vashchuk 2021-03-26 09:12:06 UTC
Created attachment 118840 [details] [review]
Bug 27726: Add maxlength attribute to OPACProblemReport textarea

This patch adds a maxlength attribute to the OPACProblemReport textarea.
This will prevent the user from entering more characters than the table
column limit (255).

To test, apply the patch and enable the OPACProblemReport system
preference.

 - Log into the OPAC
 - Click the "Report a problem" link at the bottom of the page.
 - You should see a hint below the textarea, "255 characters maximum."
 - Enter enough text in the textarea to confirm that it is cut off at
   255 characters.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 10 Peter Vashchuk 2021-03-26 09:12:09 UTC
Created attachment 118841 [details] [review]
Bug 27726: (ALTERNATIVE) Increase 'content' field size

This alternate patch increases the field size from a 255 character
varchar to a 65535 character text field. This allows for more detailed
problem reports to be submitted.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 11 Katrin Fischer 2021-03-27 15:52:14 UTC
Created attachment 118905 [details] [review]
Bug 27726: (ALTERNATIVE) Increase 'content' field size

This alternate patch increases the field size from a 255 character
varchar to a 65535 character text field. This allows for more detailed
problem reports to be submitted.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2021-03-27 15:53:19 UTC
I am in favor of the database change here. We don't have to worry about that space and I prefer people describing their problems without worrying about character limits :)
Comment 13 Jonathan Druart 2021-04-01 16:34:33 UTC
I am getting an error:

{UNKNOWN}: DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'content' can't have a default value [for Statement "ALTER TABLE problem_reports MODIFY content TEXT NOT NULL DEFAULT ''"]  at /usr/share/perl5/DBIx/Class/Schema.pm line 1118.
Comment 14 Martin Renvoize 2021-04-01 16:53:40 UTC
(In reply to Jonathan Druart from comment #13)
> I am getting an error:
> 
> {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column
> 'content' can't have a default value [for Statement "ALTER TABLE
> problem_reports MODIFY content TEXT NOT NULL DEFAULT ''"]  at
> /usr/share/perl5/DBIx/Class/Schema.pm line 1118.

Interesting.. that's a super easy fix, just drop the default as it doesn't make sense anyway.. but I'm surprised you got that.. what SQL server are you using?
Comment 15 Owen Leonard 2021-04-02 13:36:31 UTC
Same error:

DEV atomic update: bug_27726.perl
Atomic update generated errors: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'content' can't have a default value [for Statement "ALTER TABLE problem_reports MODIFY content TEXT NOT NULL DEFAULT ''"]  at /usr/share/perl5/DBIx/Class/Schema.pm line 1118.
	DBIx::Class::Schema::throw_exception(Koha::Schema=HASH(0x562f6298c240), "DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'co"...) called at /usr/share/perl5/DBIx/Class/Storage.pm line 113
	DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::mysql=HASH(0x562f62b267c8), "DBI Exception: DBD::mysql::db do failed: BLOB/TEXT column 'co"...) called at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1501
	DBIx::Class::Storage::DBI::__ANON__("DBD::mysql::db do failed: BLOB/TEXT column 'content' can't ha"..., DBI::db=HASH(0x562f631329c0), undef) called at (eval 1457) line 3
	eval '$DBversion = \'XXX\'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
    $dbh->do("ALTER TABLE problem_reports MODIFY content TEXT NOT NULL DEFAULT \'\'");

    NewVersion( $DBversion, 27726, "Increase field size for problem_reports.content");
}
' called at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 23755

Server version: 10.1.48-MariaDB-1~bionic mariadb.org binary distribution
Comment 16 Martin Renvoize 2021-04-09 07:02:47 UTC
Created attachment 119344 [details] [review]
Bug 27726: Increase 'content' field size

This alternate patch increases the field size from a 255 character
varchar to a 65535 character text field. This allows for more detailed
problem reports to be submitted.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 17 Martin Renvoize 2021-04-09 07:03:53 UTC
Patch amended to drop the 'DEFAULT' definition.. worked in testing on the various Maria and MySQL versions available in k-t-d.
Comment 18 Jonathan Druart 2021-04-12 13:32:35 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 19 Fridolin Somers 2021-04-19 12:42:48 UTC
Pushed to 20.11.x for 20.11.05
Comment 20 Andrew Fuerste-Henry 2021-04-25 14:40:37 UTC
Pushed to 20.05.x for 20.05.11
Comment 21 Victor Grousset/tuxayo 2021-04-25 17:20:58 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.