Bug 11806 - Use validation plugin when creating new OAI set

The form for adding a new OAI indicates that two fields are
required but does nothing to enforce this rule. This can be
handled client-side with HTML5 validation attributes and Koha's built-in
validation plugin. This patch implements this.

To test, apply the patch and go to Administration -> OAI sets
configuration -> New set. Try submitting the form without entering a
setSpec and/or setName. Doing so should trigger a validation warning.

Submission of the form with valid data should work correctly. Editing an
existing set should also work correctly.

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e634a5ad82e9fa0aef96ae5a23bb5b389d1704e7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11878 - Eliminate use of deprecated jQuery .toggle() method usage

jQuery's .toggle() method can no longer be used to trigger a pair of
specified functions. .toggle() can only be used to change the visibility
of an element. This patch fixes a few places in Koha where the
deprecated functionality was used.

To test, apply the patch and clear your browser cache.

- View the system preferences page in the staff client. Clicking a
  heading ("Appearance" under OPAC preferences, for instance) should
  collapse that section. Clicking again should expand it.

- View the MARC detail page for a record in the OPAC. Clicking the "view
  plain" link should display the plain MARC view. Clicking the "view
  labeled" view should return to the original view. Test in both prog
  and bootstrap themes.

Signed-off-by: wajasu <matted-34813@mypacks.net>

Followed test plan. Works fine.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, works as described.
No Javascript errors found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 06026a7e297c8537c7a4a7cb9c7720b482f26eba)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11946 - add table sorters to label batches

When viewing batches of titles in the label creator module the table is
not sortable. This patch adds table sorting.

The patch also makes some corrections of invalid markup and moves
informational/error messages to the top of the page rather than in a
sidebar. This change lets the table and sorting controls expand into a
wider space.

To test, go to Tools -> Labels -> Manage label batches. View an existing
batch or create a new batch and populate it with items. Table sorting
controls should work correctly.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Solves 1/2 of this bug which is to add the sorters to labels, the original
request was to add this to patron cards as well.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests and QA script.
Template could be improved forther by showing
the itemtype description instead of the code in the table.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 94d80555489a2f07163bdb2e1b1a8104de9c410c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11906: regression test for using DBIC to store & fetch UTF8 strings

This patch adds a regression test for verifying that a
DBIx::Class schema object initialized by Koha database sets up
the database connection to correct store and retrieve UTF8
values as Perl utf8 strings.

To test:

[1] Apply this patch.
[2] Run prove -v t/db_dependent/Koha_Database.t
[3] The test should fail.
[4] Apply the main patch for this bug, then do step 2 again.
[5] The test should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b21d16ca75bb40371773d3008fcb06c67200ab36)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11906: ensure that Koha::Database uses UTF8 mode when connecting to databases

This patch fixes an issue whereby the DBIx::Class schema objects
were not connecting to the underlying database in UTF8 mode.  This
most visibility manifested as patron list pages not displaying
diacritics correctly.

To test:

[1] Create a patron list, and make sure that it contains at least
    one patron whose name or patron category description contains
    a non-ASCII character.
[2] View the list contents; the diacritics should appear mangled.
[3] Apply the patch.
[4] View the patron list again.  This time, the diacritics should
    be displayed correctly.  Note that Apache will also log
    "list.pl: Wide character in print ...", but this is the lesser
    of two evils.
[5] Verify that prove -v t/db_dependent/Koha_Database.t passes.
[6] (extra credit) Verify that  t/db_dependent/Koha_Database.t
    passes when connect to a PostgreSQL database.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 05a6beba9f023f87d3355b6e72f35b220cd691b0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 12000: ensure that hold resumption dates can be set only to future dates

This patch makes the datepickers for the hold resumption date
(AKA the hold suspend until date) field only permit dates in
the future to be selected in the staff interface checkout page
and hold list pages.  This makes these pages consistent with
the OPAC and the patron details page in the staff interface.

To test:

[1] Ensure that AutoResumeSuspendedHolds and SuspendHoldsIntranet
    are enabled.
[2] Go to the checkout page for a patron that has at least one hold
    request.
[3] Verify that the datepicker for the hold suspend until
    date field only permits choosing a date in the future.
[4] Go to the page listing hold requests for a title.
[5] Verify that the datepicker for the hold suspend until
    date fields only permit choosing a date in the future.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7378d488414d1859c75f0d3b40e5ce99cde67cb7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>