Bug 26261: Split calendar.inc into include file and JavaScript file
commit701fde53ed703c751e37fd184de342838e8a9f2f
authorOwen Leonard <oleonard@myacpl.org>
Thu, 20 Aug 2020 20:10:40 +0000 (20 20:10 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 29 Sep 2020 12:28:19 +0000 (29 14:28 +0200)
treed0bc91a567b2164dbe2893e627154e8a0eefe04e
parent171e7bfc5103c63675766b504fb4cef530cb815f
Bug 26261: Split calendar.inc into include file and JavaScript file

This patch moves most of the JavaScript out of calendar.inc and into a
new file, calendar.js. English strings in calendar.js are now wrapped in
the double-underscore function to allow for translation.

The patch shouldn't affect datepicker functionality in any way.

To test, apply the patch and test the datepicker in various contexts:

- Reports -> Statistics wizards -> Patrons
- Date of birth "from" and "to" should be linked so that the former
  must come before the latter.
- Patrons -> Add or edit patron
- The date of birth field datepicker shouldn't allow you to pick a
  future year from the dropdown.
- Tools -> Calendar.
- Test that the calendar tool works correctly.
- Test with various settings of the dateformat system preference.

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/en/js/calendar.js for translation,
  e.g.:

  msgid "August"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and test the datepicker again. Translated strings like days of
  the week and months should be correct.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
koha-tmpl/intranet-tmpl/prog/js/calendar.js [new file with mode: 0644]