Created attachment 2483 [details] Screenshot shows acq date in MARC details. Date formats in catalogue > MARC > items are not formatted according to sys pref dateformat. Tested with Koha version 3.01.00.145 and different settings for dateformat.
This is true of the OPAC as well. This is definitely not a template issue: The table of items is built very generically: <!-- TMPL_LOOP NAME="item_loop" --> <tr> <!-- TMPL_VAR NAME="item_value" --> </tr> <!-- /TMPL_LOOP --> And the script doesn't appear to have any means of knowing whether the data it's putting into that "item_loop" is a date or not. Wouldn't the script have to know which subfields contained dates?
Created attachment 99627 [details] [review] Bug 5103: Format dates in MARC detail using dateformat syspref This patch fixes the formatting of dates on the following pages: - catalogue/MARCdetail.pl (staff) - cataloguing/additem.pl (staff) - opac-MARCdetail.pl (opac) To test: 1) Ensure that the following fields are visible in the opac, intranet and editor. You may need to edit the subfields in your default bibliographic framework 952$d date accessioned 952$q date due/on loan 952$r date last seen 952$s date last borrowed 952$w replacement price date Also ensure you have dateformat system preference set 2) Go to cataloguing/additem.pl for a biblio. Fill in the fields above if required. Save 3) Remain on cataloguing/additem.pl. Notice the items table at the top of the page, the dates are in the generic yyyy-mm-dd format 4) Go to catalogue/MARCdetail.pl for that biblio. Notice dates in wrong format 5) View this biblio in the opac opac-MARCdetail.pl. Scroll to bottom to items table. Notice dates in wrong format. 6) Apply patch, restart memcached and plack and refresh pages 7) Dates should now be formatted according to dateformat preference 8) Confirm that changing the preference changes the format of the dates Sponsored-by: Catalyst IT
Created attachment 99671 [details] [review] Bug 5103: Format dates in MARC detail using dateformat syspref This patch fixes the formatting of dates on the following pages: - catalogue/MARCdetail.pl (staff) - cataloguing/additem.pl (staff) - opac-MARCdetail.pl (opac) To test: 1) Ensure that the following fields are visible in the opac, intranet and editor. You may need to edit the subfields in your default bibliographic framework 952$d date accessioned 952$q date due/on loan 952$r date last seen 952$s date last borrowed 952$w replacement price date Also ensure you have dateformat system preference set 2) Go to cataloguing/additem.pl for a biblio. Fill in the fields above if required. Save 3) Remain on cataloguing/additem.pl. Notice the items table at the top of the page, the dates are in the generic yyyy-mm-dd format 4) Go to catalogue/MARCdetail.pl for that biblio. Notice dates in wrong format 5) View this biblio in the opac opac-MARCdetail.pl. Scroll to bottom to items table. Notice dates in wrong format. 6) Apply patch, restart memcached and plack and refresh pages 7) Dates should now be formatted according to dateformat preference 8) Confirm that changing the preference changes the format of the dates Sponsored-by: Catalyst IT
The same if-block is repeated three times, in different files. This is very fragile and error prone. Should create a sub in one place (Koha::DateUtils maybe), and just call that instead.
Hi Aleisha, I really love that you have taken on these old bugs! Sadly, we got a UNIMARC vs MARC21 issue here - the mappings with UNIMARC are usually quite different. I think the best would be to look up the subfield codes with the known date columns we have in the items table instead of hardcoding the subfields - this way the MARC flavour and people having mapped things differently won't matter and it will always work. As long as the code reads easily I am not that worried about repeating it at the moment, and it could be something to improve later on.
Created attachment 100501 [details] [review] Bug 5103: (follow-up) Using mapped item fields instead of hardcoding subfields
Created attachment 100527 [details] [review] Bug 5103: Format dates in MARC detail using dateformat syspref This patch fixes the formatting of dates on the following pages: - catalogue/MARCdetail.pl (staff) - cataloguing/additem.pl (staff) - opac-MARCdetail.pl (opac) To test: 1) Ensure that the following fields are visible in the opac, intranet and editor. You may need to edit the subfields in your default bibliographic framework 952$d date accessioned 952$q date due/on loan 952$r date last seen 952$s date last borrowed 952$w replacement price date Also ensure you have dateformat system preference set 2) Go to cataloguing/additem.pl for a biblio. Fill in the fields above if required. Save 3) Remain on cataloguing/additem.pl. Notice the items table at the top of the page, the dates are in the generic yyyy-mm-dd format 4) Go to catalogue/MARCdetail.pl for that biblio. Notice dates in wrong format 5) View this biblio in the opac opac-MARCdetail.pl. Scroll to bottom to items table. Notice dates in wrong format. 6) Apply patch, restart memcached and plack and refresh pages 7) Dates should now be formatted according to dateformat preference 8) Confirm that changing the preference changes the format of the dates Sponsored-by: Catalyst IT Signed-off-by: David Nind <david@davidnind.com>
Created attachment 100528 [details] [review] Bug 5103: (follow-up) Using mapped item fields instead of hardcoding subfields Signed-off-by: David Nind <david@davidnind.com>
Created attachment 100636 [details] [review] Bug 5103: Format dates in MARC detail using dateformat syspref This patch fixes the formatting of dates on the following pages: - catalogue/MARCdetail.pl (staff) - cataloguing/additem.pl (staff) - opac-MARCdetail.pl (opac) To test: 1) Ensure that the following fields are visible in the opac, intranet and editor. You may need to edit the subfields in your default bibliographic framework 952$d date accessioned 952$q date due/on loan 952$r date last seen 952$s date last borrowed 952$w replacement price date Also ensure you have dateformat system preference set 2) Go to cataloguing/additem.pl for a biblio. Fill in the fields above if required. Save 3) Remain on cataloguing/additem.pl. Notice the items table at the top of the page, the dates are in the generic yyyy-mm-dd format 4) Go to catalogue/MARCdetail.pl for that biblio. Notice dates in wrong format 5) View this biblio in the opac opac-MARCdetail.pl. Scroll to bottom to items table. Notice dates in wrong format. 6) Apply patch, restart memcached and plack and refresh pages 7) Dates should now be formatted according to dateformat preference 8) Confirm that changing the preference changes the format of the dates Sponsored-by: Catalyst IT Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 100637 [details] [review] Bug 5103: (follow-up) Using mapped item fields instead of hardcoding subfields Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 100638 [details] [review] Bug 5103: Refactor the code to avoid repetition Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x branch for 19.11.05
backported to 19.05.x for 19.05.10
Minor/enhancement will not be backported to 18.11.x series