Bug 11478: Replace experimental given/when keywords

The keywords given and when are flagged experimental
in perl 5.18 and subject to change. This patch
replaces the construct by an if/elsif

To test:

[1] Verify that prove -v t/SimpleMARC.t passes.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 08d15a6fd1b51435b92f1056f6735c8317636068)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11479: Remove experimental given/when keywords

Replace constructs using given and when by if/else
feature now generates compilation warnings in 5.18
and is liable to change behaviour.

This patch:

* replaces the construct with if/else
* reformats the if branching using perltidy
  to remove the now redundant indent

To test:

[1] Verify that prove -v t/db_dependent/MarcModificationTemplates.t
    passes.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 11faf9fde8da48c58e853d5538a8e3bbd2ae41c5)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10714: Redirect to list contents view upon save after initiating edit from list contents view (staff)

In the staff client, if you initiate a list edit from the list contents
view you should be redirected to that same view after saving your
changes. The OPAC already works this way.

To test, view the contents of an existing list. Click the "Edit list"
item under the "Edit" menu. Click save on the list edit form and you
should be redirected back to the contents view of that list.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit daa98e73f8baf178f2b0f32b4988d2414519ea4b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10714 [Follow-up] Redirect to list contents view upon cancel after initiating edit from list contents view (staff)

This follow-up corrects the "cancel" action on list edit actions based
on whether the edit was initiated from the list of lists or the list
contents view.

To test, view the list of lists and click the edit link next to one of
them. Click the cancel link. You should return to the list of lists you
were just viewing.

View the contents of a list. Choose "Edit list" from the edit menu.
Click the cancel link on the edit screen. You should return to the list
contents view from which you initiated the edit action.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 6a323ce4ce914e757d5c1c999237ad2c0efc15e9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11785 - Use validation plugin when uploading local cover images

When uploading local cover images the form should not be submitted if
no file has been selected. The existing form validation script doesn't
work. This patch adds HTML5 validation attributes and use of Koha's
built-in form validation plugin.

To test, apply the patch and go to Tools -> Upload local cover image.
Try to submit the form without selecting a file to upload. You should be
prevented from doing so. Choose a file and confirm that the upload
completes correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7faff33c8b9bd670cf7813f4cefb7aee38709ebb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11787 - Use validation plugin when adding new vendor

The vendor entry form uses some custom JavaScript which can be removed
in favor of HTML5 validation attributes and Koha's built-in validation
plugin. This patch does so.

Also corrected: Minor validation issue.

To test, apply the patch and go to Acquisitions -> New vendor. Try
submitting the form without entering a vendor name. This should trigger
a validation warning.

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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 03675fd55320f3a9bc3d4c7475bc3b9696920bd9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11788 - Use validation plugin when creating new course

The page for adding a new course includes some custom form
validation JavaScript which can be removed in favor of HTML5 validation
attributes and Koha's built-in validation plugin. This patch does so.

To test, apply the patch and go to Course reserves -> New course. Try
submitting the form without entering a department, course number,
and/or course name. This should trigger validation warnings.

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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4e9b5110d90c3ac60c61f710ff5892b9720e643e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11795 - Use validation plugin when creating new Z39.50 server

The page for adding a new Z39.50 server includes some custom form
validation JavaScript which can be removed in favor of HTML5 validation
attributes and Koha's built-in validation plugin. This patch does so.

To test, apply the patch and go to Administration -> Z39.50 client
targets -> New Z39.50 server. Try submitting the form with any of the
following error conditions:

- Missing Z39.50 server name
- Missing hostname
- Missing port
- Non-numeric port
- Missing database
- Non-numeric rank
- Non-numeric timeout

These errors should trigger a validation warning.

Submission of the form with valid data should work correctly. Editing
an existing Z39.50 server should also work correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: replace tabs with spaces

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 19bf1e9a40ab5a8f3c86fb07dd6429bfc44f703b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11793 - Use validation plugin when creating new item type

The page for adding a new item type includes some custom form
validation JavaScript which can be removed in favor of HTML5 validation
attributes and Koha's built-in validation plugin. This patch does so.

To test, apply the patch and go to Administration -> Item types -> New
item type. Try submitting the form with the following error conditions:

- Missing item type
- Missing description
- A non-number in the "rental charge" field

These errors should trigger a validation warning.

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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1d9b86aabccf1bc916b6b27e568ad984caf081f6)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11792 - Use validation plugin when creating new currency

The page for adding a new currency includes some custom form
validation JavaScript which can be removed in favor of HTML5 validation
attributes and Koha's built-in validation plugin. This patch does so.

To test, apply the patch and go to Administration -> Currencies &
Exchange rates -> New currency. Try submitting the form without entering
a currency, rate, and/or symbol. This should trigger a validation warning.

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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5dc093b30e8d949f39a67bf2ac40f219f6167d0a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11791 - Use validation plugin when creating new city

The page for adding a new city includes some custom form
validation JavaScript which can be removed in favor of HTML5 validation
attributes and Koha's built-in validation plugin. This patch does so.

To test, apply the patch and go to Administration -> Cities -> New city.
Try submitting the form without entering a city or zip code. This should
trigger a validation warning.

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

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Note: This patch changes the behavior. Before the patch, only 1 out of city
and zip was required. Now both are. Since the 2 inputs were marked as
required, I think they should be.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit d95ad086a35a7927bb7bc02453a1a1341387dc6a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11796: fix display of search result facets if facet happens to have exactly six entries

If a search gives results with 6 facets, one of those facets won't be
displayed. This is due to a bug in the code that only considers great
than 6 facets in one area, and less than 6 in another.

Test Plan:
1) Perform a search that should give results for 6 different libraries
2) Note you only see 5 libraries in the facets with no option to expand
3) Apply this patch
4) Repeat step 1
5) Note you now have the option to expand the facets list

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch should provide a regression test but I really don't know how
to write it.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e7286e05137276f0a916f06d60a13c22c93294b2)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11611: Rephrase description and examples of 5 MARC related sysprefs

This patch rephrases the description or examples of 5 sysprefs:
1/ MARCAuthorityControlField008: "MARC" -> "MARC21"
2/ itemcallnumber: "Examples" -> "Examples (for MARC21 records)"
3/ DefaultLanguageField008: "Range 35-37" -> "Range 35-37 of MARC21 records"
4/ MARCOrgCode: "new MARC records" -> "new MARC21 records"
5/ UNIMARCAuthorityField100 description: "Do NOT include the date
   (position 00-05)." -> "position 08-35. Do NOT include the date
   (position 00-07)."

It also adds description in SQL systempreferences table for
UNIMARCAuthorityField100, MARCAuthorityControlField008 and MARCOrgCode.

Test plan:
- Apply and run updatedatabase.pl
- Check the changes are taken into account in syspref administration
  page
- Check the changes are taken into account in systempreferences table
  (for UNIMARCAuthorityField100, MARCAuthorityControlField008 and
   MARCOrgCode)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 68a7f7f4456078b1b9dc6fd1ba16f11ba45267fc)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11611: DBRev 3.14.06.002

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11087: Make the Pay Fines tab the default tab

Since paying fines is the most likely action when clicking on
the Fines tab, the pay fines tab should be the default rather
than the account summary.

http://bugs.koha-community.org/show_bug.cgi?id=11087
Signed-off-by: Holger Meißner <h.meissner.82@web.de>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Verified by accessing the fines pages from the various
patron account pages.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 65ae7a950de83b7bc9e741d0cc31a79d4797c579)
Bug 11272 - add second submit button to inventory form

The inventory tool allows for 2 ways of processing files. The first
is to upload a file. The second is to generate the shelf list.
Most libraries think they have to fill in all fields because the
submit button is at the bottom of the second option. They do not.
This patch adds a second submit button under the first method to
make this clearer.

To test:

* Generate a file of barcodes for inventorying
* Before applying the patch use the file upload method to mark as seen
* Apply the patch
* Use the file upload method to mark as seen using the new submit
* Repeat the above for the shelf list method
* Confirm that inventory still works as expected with 2 buttons

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 40ba1763afc40cd47b23892a3248fd877dc8edce)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11562: re-sort sysprefs.sql

The QA tools does not manage to catch error sorting on the sysprefs.sql
file if it is already badly sorted.

This patch tidies up the sysprefs file.

TEST PLAN
---------
[1] Verify that loading sysprefs.sql into an empty Koha
    database (or one whose system preferences table is
    is empty) works.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

RM note: I must point out that there ZERO functionality associated
with the order that system preferences occur in that SQL script; they are
sorted solely in an attempt to reduce the likelihood of merge conflicts
during the development process.  Consequently, I dislike language that
suggests it is an "error" if sysprefs.sql happens to not be perfectly
sorted; it is at most an inconvenience.

(cherry picked from commit 988dc3b64af00d34f535b811f4093782ac7925a1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10580: adjust Makefile.PL to reflect that Zebra no longer optional in Koha setup

Running Makefile.PL asks the user whether to install the Zebra
configuration files and different texts relate to the user having
chosen to use Zebra.

This patch removes references to choosing to use Zebra and removes
the related variables from the code.

To test:
- Apply the patch
- Go through the different install modes
- Verify that nothing nothing is broken

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 0b989fe0b2097d747da1fd6d04aa8aecc5652d06)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10580: (follow-up) tweak wording about looking for zebrasrv & zebraidx

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1d276d58099fa60666bccc13c7b9d839946946c1)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 11799: Housekeeping: Remove _biblionumber_sth from VirtualShelves.pm

This routine is no longer used.

Test plan:
Do a grep on the name.
(Bonus points:) Verify if you can perform some actions on lists.

No more occurences of _biblionumber_sth found
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5e0d450875f24d1f9ef6620b033b5179633589da)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>