Bug 14956

Summary: Remove C4::Dates from files opac/*.pl
Product: Koha Reporter: Marc Véron <veron>
Component: Architecture, internals, and plumbingAssignee: Marc Véron <veron>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: glasklas, hector.hecaxmmx, jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15146
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 14870    
Attachments: Bug 14956 - C4::Dates from files opac/*.pl
Bug 14956 - C4::Dates from files opac/*.pl
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac/opac-memberentry.pl
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac-memberentry.tt
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac-memberentry.tt
Bug 14956 - (follow) Validate incoming birth date
[SIGNED-OFF]Bug 14956 - C4::Dates from files opac/*.pl
[SIGNED-OFF]Bug 14956 - (follow) Validate incoming birth date
Bug 14956: (followup) Fix birthday date validation in Opac
[SIGNED-OFF]Bug 14956: (followup) Fix birthday date validation in Opac
[PASSED QA] Bug 14956 - C4::Dates from files opac/*.pl
[PASSED QA] Bug 14956: (followup) Fix birthday date validation in Opac
Bug 14957: Put database updates in perl script
Bug 14957: Add tests and pod for new options param to ModBiblio

Description Marc Véron 2015-10-05 12:34:17 UTC
C4::Dates from files:

-  opac/opac-memberentry.pl
-  opac/opac-reserve.pl
-  opac/opac-search-history.pl
-  opac/opac-showreviews.pl
-  opac/opac-suggestions.pl
-  opac/opac-serial-issues.pl

-  opac/opac-alert-subscribe.pl
-  opac/opac-ics.pl
Comment 1 Marc Véron 2015-10-05 13:01:15 UTC Comment hidden (obsolete)
Comment 2 Héctor Eduardo Castro Avalos 2015-10-12 17:26:30 UTC
Hi Marc

After applying patch I've found this:

/opac/opac-showreviews.pl got C4::Dates declaration in line 59, 116 and patch only eliminate the declaration 'use C4::Dates'

Regards
Comment 3 Marc Véron 2015-10-12 19:16:32 UTC Comment hidden (obsolete)
Comment 4 Héctor Eduardo Castro Avalos 2015-10-12 21:01:37 UTC
Hi Marc

When you go to "your personal details" (opac/opac-memberentry.pl) and if you alter to an invalid date the form it doesn't fail but when you go to staff in Home > Patrons requesting modifications, at the bottom of screen this redirect to members/members-update.pl and you get noticed that the date sent is '0000-00-00' (depends in which format you have dateformat syspref) this data shown in a table:

Field 		From 		To
Date of birth 	2015-11-01 	0000-00-00

To prevent this (IMHO) I suggest to add readonly="" to the input text or follow the example as koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt

Patch follow
Comment 5 Héctor Eduardo Castro Avalos 2015-10-12 21:03:59 UTC Comment hidden (obsolete)
Comment 6 Héctor Eduardo Castro Avalos 2015-10-12 21:27:23 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-10-12 21:37:28 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2015-10-13 11:19:44 UTC
The second patch is not the way to do, especially at the OPAC: if the user turned off JS, he cannot enter a date.
Comment 9 Marc Véron 2015-10-14 17:59:01 UTC
Comment on attachment 43362 [details] [review]
Bug 14956 - (follow) Prevent patrons to insert invalid dates in opac-memberentry.tt

Obsoleted this patch becaues of comment #8, replacment patch follows.
Comment 10 Marc Véron 2015-10-14 18:01:36 UTC Comment hidden (obsolete)
Comment 11 Marc Véron 2015-10-23 09:39:19 UTC
Still applies
Comment 12 Marc Véron 2015-10-29 14:09:36 UTC
Still applies
Comment 13 Héctor Eduardo Castro Avalos 2015-11-04 05:16:00 UTC Comment hidden (obsolete)
Comment 14 Héctor Eduardo Castro Avalos 2015-11-04 05:16:14 UTC Comment hidden (obsolete)
Comment 15 Héctor Eduardo Castro Avalos 2015-11-04 05:19:50 UTC
After long, long test, finally signed off
Comment 16 Jonathan Druart 2015-11-05 11:39:31 UTC
Define a date of birth at the opac, validate the changes.
Clear the date, go and see the changes: the new date is today.
Comment 17 Marc Véron 2015-11-05 14:05:46 UTC Comment hidden (obsolete)
Comment 18 Héctor Eduardo Castro Avalos 2015-11-06 03:09:37 UTC Comment hidden (obsolete)
Comment 19 Héctor Eduardo Castro Avalos 2015-11-06 03:19:15 UTC
Just one comment, Marc

The Patrons requesting modification (Home > Patrons > Update patron records) does not follow dateformat syspref.

file: members/members-update.pl
Comment 20 Marc Véron 2015-11-06 08:22:23 UTC
(In reply to Héctor Eduardo Castro Avalos from comment #19)
> Just one comment, Marc
> 
> The Patrons requesting modification (Home > Patrons > Update patron records)
> does not follow dateformat syspref.
> 
> file: members/members-update.pl

Thanks, Héctor, I filed Bug14956 (needs sign-off)
Comment 21 Marc Véron 2015-11-06 08:24:37 UTC
Sorry, mistaked: Bug 15146
(Need a double espresso)
Comment 22 Kyle M Hall 2015-11-06 16:31:56 UTC
Created attachment 44593 [details] [review]
[PASSED QA] Bug 14956 - C4::Dates from files opac/*.pl

Remove C4::Dates from files:
-  opac/opac-memberentry.pl
-  opac/opac-reserve.pl
-  opac/opac-search-history.pl
-  opac/opac-showreviews.pl
-  opac/opac-suggestions.pl
-  opac/opac-serial-issues.pl
-  opac/opac-alert-subscribe.pl
-  opac/opac-ics.pl

To test:
- Apply patch
- Verify, that self registration and holds work as before
- Verify that tabs in catalog item detail work and display
  as before
- For serials: Verify that subscriptions work as before. It is a
  little bit hidden, in tab Subscriptions, then 'More details', then
  tab 'Brief history', button 'Subscribe to email notificatin on
  new issues'
- For ics: Can not be tested at the moment, not yet used (Bug 5456),
  pls. have a look at the code changes

(Amended following comment #2)

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 23 Kyle M Hall 2015-11-06 16:32:05 UTC
Created attachment 44594 [details] [review]
[PASSED QA] Bug 14956: (followup) Fix birthday date validation in Opac

To reproduce / test:

- In Opac: Go to 'your personal details'
- Enter a valid birtday date
- In Staff client: Go to Home > Patrons > Update patron records
  (Link on start page: Patrons requesting modification)
- Verify that the birtday date is correct
- Back in Opac, clear the birthday date, try to submit
  => Validation message appears
- Enter an invalid date (32/32/2999 or 00/00/0000), try to submit
  => Birthday date field is cleared, validation message appears.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Wrong today corrected

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 24 Tomás Cohen Arazi 2015-11-06 18:13:41 UTC
Patches pushed to master.

Thanks Marc!
Comment 25 David Gustafsson 2019-04-17 15:36:21 UTC
Created attachment 88203 [details] [review]
Bug 14957: Put database updates in perl script

Also add schema changes to kohastructure.sql and syspref to sysprefs.sql
Comment 26 David Gustafsson 2019-04-17 15:36:24 UTC
Created attachment 88204 [details] [review]
Bug 14957: Add tests and pod for new options param to ModBiblio
Comment 27 David Gustafsson 2019-04-17 15:42:31 UTC
Sorry about that, mistyped the bug-number.