Bug 9224: Make acqui/finishreceive.pl Plack-compatible

Under Plack/mod_perl wrapping, sub update_item() will become a closure,
so after the 1st run it will retain its own private instances of the
following variables: $booksellerid, $datereceived, $unitprice, $rrp,
$biblionumber.

I.e., in case update_item() gets invoked 2nd+ time (inside
the same process, but for different-subsequent receives) it may
incorrectly flag the (old, wrong) biblionumber for Zebra reindexing,
and erronously modify the current item[s] with the previously
used (wrong) values.

This simple patch should make acqui/finishreceive.pl Plack-compatible.

Test plan:
Test patched acqui/finishreceive.pl script (create and receive some
orders w/ items, etc.). Ensure items are gettting added and/or modified
correctly during receiving process.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised, no regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 6dcc34c1b44f72a8602c4ee95540836e6cd1e7bd)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11261: make sample serial numbering patterns mandatory during installation

Test plan:
Verify all sample_numberpatterns.* files have been moved from optional
to mandatory directories.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All sample files for numbering patterns are moved from optional
to mandatory.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 3c2e45a05816d69965445509d5ecd9db7ab3b98d)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11261: make sample serial frequencies mandatory during installation

Test plan:
Verify all sample_frequencies.* files have been moved from optional
to mandatory directories.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 97b270aa2e08089bfa888c191d32d0a9af075ffe)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11255: allow "relevance ascending" as a sort option

This patch fixes a problem where if a staff member sets the
*defaultSortField/*defaultSortOrder system preferences to relevance
ascending while QueryParser is enabled, default keyword search
would break -- the query parser config did not declare relevance asc
as a possible "modifier".

Note that setting the sort order to relevance ascending does not
actually make catalog search return results with the least relevant
records showing up first; Zebra does not support such a mode.  In other
words, relevance ascending acts exactly the same as relevance descending.

Test plan:

0/ Create some biblio with "history" in the title and
   ensure that the QueryParser system preference is enabled.
1/ Define prefs defaultSortField = relevance and defaultSortOrder = asc
2/ Search "history" on the staff interface
3/ Note that no result is returned.
4/ Apply the patch
5/ Verify the queryparser config file in use takes the modification into
account (see the queryparser_config value in your $KOHA_CONF file).
6/ Relaunch the search and verify results are returned

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 54937c5eb34c511e00de8d0831141516422885c7)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11124: disallow trying to run the staff benchmark script as the DB account

On step 6 (at least), the circulation and return page redirect to the
select branch page and nothing is done.

The script should die if the user used is the sql administrator account.

Test plan:
Suppose that the sql admin account is root/root and koha/koha a
superlibrarian account.

1/
perl misc/load_testing/benchmark_staff.pl --steps=6
--url=http://admin.koha.local/cgi-bin/koha/
--password="koha" --user="koha"
should produce:
  ...
  Step 6
  ...

2/
perl misc/load_testing/benchmark_staff.pl --steps=1
--url=http://admin.koha.local/cgi-bin/koha/
--password="root" --user="root"
should produce:
Authentication successful
You cannot use the database administrator account to launch this script

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 4604f595d66f65ba15d6625b2366acb147797ffc)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11124: QA Follow-up resolving a warning and three typos

Resolves warning on uninitialized author in split on line 128.
Just adds the same behavior for title on line 129 for completeness.
Fixes typo on occurrences and two other minor typos.

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 1219b3153ee3501d61f22a767b7b3e68c7c8933e)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11124: QA Follow-up adding optional dependency HTTPD::Bench::ApacheBench

This dependency is used in load testing (misc/load_testing/*)

Test plan:
Check if you see the dependency listed on About/Perl modules.
Verify if the version information is correct.

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 f90cca4831dc90c74f4b6c18e415b1cce361fdb2)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: Display acquisition details on the catalogue detail page

This patch adds a new tab "Acquitition details" on the catalogue detail
page. It provides a list of order made for this biblio.

New system preference:

AcquisitionDetails: Hide/Show the new tab.  The default for
new and upgraded installations is to display the new tab.

Test plan:
1/ Apply the patch.
2/ Select the "placing an order" value for the AcqCreateItem pref.
3/ Create a new order with X items.
4/ Go on the catalogue detail page for the selected biblio.
5/ Click on the "Acquisition details" tab and check that your order is
displayed. Itemnumbers are present in the last column. Check that links
are not broken.
6/ Close your basket.
7/ Status become "Ordered"
8/ Receive X-1 items.
9/ Come back on the catalogue detail page. There are 2 orders: 1
complete and 1 partial. The complete one has a receive date.
10/ Receive the last item.
11/ Now you have 2 orders with a complete status.
12/ Cancel the last receipt.
13/ You have 1 ordered and 1 complete (2 items).
14/ Cancel the first receipt.
15/ You have 1 ordered (3 items).
16/ Delete your order
17/ You have 1 deleted order.
18/ Switch the AcqCreateItem pref to "receiving an order"
19/ Do again steps 3 to 17.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7180eb1153cbb2849b0171014cf84eda0993b465)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>

Conflicts:
	installer/data/mysql/updatedatabase.pl
Bug 8230: (follow-up) reflect the fact that order statuses are now alphabetic codes

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised. No regressions found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ba3bb0a4f80bf565d784cb151a5623725ae4e3cf)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: DBrev 3.14.01.002

Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: (follow-up) don't link to basket unless user has appropriate permissions

With this patch, the basket number on the bib details page is linked
to the basket management page only if the staff user has the appropriate
permissions.

To test:

[1] Log in as a user with the acquisition/order_manage permission.
    Bring up a bib record that is attached to an order and verify
    that the basket number is an active link.
[2] Log in as a user that doesn't have the acquisition/order_manage
    permission.  Verify that the basket number displayed on the bib
    details page is not a hyperlink.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a050ca83b717c0212e4ae7d102ea1d1f13208edb)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: (follow-up) fix detection of cancelled orders

This patch fixes a problem where the quantity / items column
in the acquisitions detail table would display ilnks to
items for cancelled orders.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit da3e33bff37a92caeb00f69db7e83b17e60eada6)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: (follow-up) repair regression on order search

This patch repairs a regression introduced by the main
patch where it became impossible to search for cancelled
orders from the advanced order search form.

This patch also tweaks the wording on the order status
drop-down on the order search form to clarify that the
default status filter is orders that have any status
except cancelled.

To test:

[1] Before applying this patch, perform an advanced
    order search (acqui/histsearch.pl) for orders
    with status cancelled.  Observe that no hits are returned.
[2] Apply the patch and run the search again.  This time,
    the cancelled orders should be returned.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 44eb83388928a020812d6fc375d565b0b2d6f9d3)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 8230: (follow-up) update POD for C4::Acquisition::GetHistory

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit bfc0a2cb812636c5eb9cc10e3cf5bfba8eee8e61)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11414: warn user about dangerous MARC modification rules

Test plan:
On the MARC modification tool:

Add/edit a new action on a field and define a condition on the same
field.

Verify that you get a warning message in red.

See bug 11413 for more information

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Tested adding and editing a template with the same field in the
action and the condition.

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