Bug 10628: make sure AutomaticItemReturn doesn't prevent holds queue from filling local holds with local items

For some reason, C4::HoldsQueue::MapItemsToHoldRequests used the system
preference AutomaticItemReturn to decide if an attempt to fill local
holds with local items. No explanation of this behavior is provided.

This patch removes this behavior, and also adjusts the calculation
of the lead-cost library to always return the pickup library if it
is on the list of libraries that could fill the hold -- on the
basis that if the item is already at the pickup library, its
transport cost is inherently zero.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and adds unit tests.
Tested with some examples and those worked correctly.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit d46657f8af980524a4351e40abe0b901d1af3e6a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Small merge problem in the tests.
Bug 10743: Add styles to 'my privacy' page in OPAC

This patch does a couple things.  Most importantly it adds
a new div around the privacy rules summary so that it can
be easily changed. It also moves the start of the form to
right above the form's select box so that it's not in the
new privacy rules div.

To test:

* Apply patch
* Enable the use of privacy via the sys prefs
* Log in to the OPAC
* Visit the 'my privacy' tab
* Make sure it looks okay
* Submit the form and make sure it works
* Repeat in the other theme

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Edit: Replaced a few tabs with spaces to keep the QA script happy.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely, privacy options can still be edited.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 841fe4559f6264295ec4cfde6ddd6e22a151d6bf)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10741: restore holdability of in-transit items on OPAC search results

In search results, one could not place a hold on an item in transit
and for loan (items.notforloan=0).  This appears when AllowOnShelfHolds
is allowed.

This patch repairs a regression introduced by the patch for bug 8975.

Test plan :
- Set AllowOnShelfHolds to on
- Create a record with a normal item : not lost, not withdrawn, not
  damaged, notforloan=0
- Index this record
- Perform a search on OPAC that returns this record (and others)
=> You see in actions "Place hold"
- Add this item in transit : /cgi-bin/koha/circ/branchtransfers.pl
- Re-perform the search on OPAC
=> You see in actions "Place hold" and item "in transit"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 239513dc7a13a1a31356b59ab8e36b120c0fa281)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10741: reformat test for displaying place hold link in OPAC search results

To test:

[1] Turn on the syspref for enabling OPAC holds.
[2] Create an item and bring it up on the OPAC search
    results.  Run through the following possibilities,
    by changing the item, and verify that the place hold
    link in OPAC search results appears only when the item is

    - not lost AND
    - not withdrawn AND
    - not damaged (or is damged and AllowHoldsOnDamagedItems is ON) AND
    - the item is not marked not-for-loan OR
      the item has a negative notforloan value (e.g., it is on order)

    Note that it is necessary to reindex the test bib after making
    each change to the test item.

[3] Also verify that whether or not in the item is in transit does
    NOT affect whether the place hold link appears.
[4] Verify that there is no regression on bug 8975 (i.e., if an
    item is on order, that status should be displayed in staff client
    search results).

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 397ba93f97855625865689ef0dd0c69a20c8a915)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10741: (follow-up) add regression test

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 8e7379342d7cd8386baf884a77f54f95188bb85c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10766: unbreak reservoir search when UseQueryParser is OFF

To test:

[1] Turn UseQueryParser off.
[2] Ensure that your database has records in the reservoir.  Performing
    a Z39.50 search will do this.
[3] Perform a broad cataloging (i.e., cataloguing/addbooks.pl search).
    Note that results are returned from the main catalog but that no
    reservoir results are returned.
[4] Apply the patch.
[5] Perform the search again.  This time, there should be both catalog
    and reservoir results.
[7] Enable QueryParser.  Perform the search again, and verify that the
    catalog and reservoir results are the same.

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>
Patch works nicely, passes all tests, and the QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4309e5e6b4682b95db4ca26f7a49f96c2f6c2875)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10645: adding missing zebra languages to koha-create manpage

There were some missing zebra language options in the man page for koha-create.

Trivial string change.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested using the following commands:

$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
  debian/docs/koha-list.xml
$ man -l koha-list.8

Also:
prove -v xt/verify-debian-docbook.t

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 90cf2f3a265a741bc4d475077dc3a604a08e6192)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9820: display titles in MARC21 name headings better in XSLT mode

Prior to this patch, if a 100/700 had a $c, it would be
displayed with no space between the contents of $a and $c in XSLT mode.

For example,

100 1#$aSeuss,$cDr.

would be displayed as

SeussDr

The problem was caused by the original version of the stylesheets
drawing a bit too much from the MARC21 to MODS transformation.

To test:

[1] In a MARC21 database, turn on XSLT display mode for
    staff and OPAC.
[2] Create or identify a bib that has a 100 or 700 field
    with both a $a and a $c.
[3] Before applying the patch, verify that the name is
    displayed in bib details and search results with the
    name and title squashed together.  For example, "SeussDr"
[3] After applying the patch, verify that the name displays
    in bib details and search results with a space and
    intervening punctuation between the name and the title.  For
    example, "Seuss, Dr."

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plan, works nicely.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 75959da681ae5f78e70dfd7205a22d16fd28ae38)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9820 follow-up: fix a typo

Although the XSLT template was renamed to nameABCQ, one instance of
the old name (nameABCDQ) was not corrected. This patch corrects that.

To test: Follow test plan on previous patch

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1e1ccd68aa0642167c2578d167ff3ec343df3a78)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10557: remove unused branch parameter from GetBooksellersWithLateOrders

C4::Booksellers::GetBooksellersWithLateOrders has an unused parameter.
The $branch variable is never used in the routine.

Test plan:
Check that no behavior changes on the late orders page.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I couldn't find any use of the branch parameter apart from
the one corrected by this patch. Also tested late orders,
couldn't find any problems.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7f075448b8e00596ece780cca654471eebf949a3)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10528: add unit tests for C4::Bookseller.pm

The tests are wrapped in a transaction.

NOTE: some tests should pass but doesn't because of incoherences in
the code.  These tests are in comments and preceded by FIXME

Test plan:
prove t/db_dependent/Bookseller.t
t/db_dependent/Bookseller.t .. 15/53
[Some warnings about uninitialised values]
t/db_dependent/Bookseller.t .. ok
All tests successful.
Files=1, Tests=53,  1 wallclock secs ( 0.02 usr  0.00 sys +  0.46 cusr  0.03 csys =  0.51 CPU)
Result: PASS

http://bugs.koha-community.org/show_bug.cgi?id=10528

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
The new tests pass nicely, as do all old tests and the QA script.
All patches marked as dependencies have been pushed to master
already.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit dc7b5b10e737cc34452dfc6c061cd7c893f08983)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9247 - Add two more usage examples to the manpage for koha-mysql

It might not be immediately obvious that it is possible to send
SQL queries "directly" to the koha-mysql command, or that files
from mysqldump can be loaded with it. This patch adds these as
"example usage" to the man page for koha-mysql.

To test:

Run these commands and look at the formatted man page:
$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
  debian/docs/koha-mysql.xml
$ man -l koha-mysql.8

Make sure this test passes:
$ prove -v xt/verify-debian-docbook.t

This patch also corrects a couple places where "Koha" was written as "koha".

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test plan, all tests and QA script pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 5b121593800088656a0430da641b4c12a4e53980)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10593: make AuthoritiesLog default to yes

This trivial patch set the default to 'yes' for this system preference.
To test,
On a clean install
- Navigate Home > Administration > Global System preferences > Logs
- AuthoritiesLog is set to "Don't log"
Apply the patch, install koha on a new DB.
- Navigate Home > Administration > Global System preferences > Logs
- AuthoritiesLog should be set to "Log"

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
One line patch, changing the default for new installations only.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 0cfe0fa92328e62d1fbca33ea69869ad4f034c1b)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10587: fix HTML errors on authority detail page in OPAC

A validator check of the OPAC's authority detail returns a few minor
errors. This patch corrects the errors.

To test, apply the patch and run an OPAC authority detail page through
an HTML validator. There should be no errors which are specific to the
authorities detail template (as opposed to header and footer includes).

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Also checked using the W3C validator and testing the
authority detail page in the OPAC is still correctly
displayed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 452a4b7775ce10655543aa81f670e2fb497ccc9b)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10130: widen input fields for library configuration

Most input fields in the library entry form (admin/branches.pl) have no
explicit width, so they display with a browser-default width. This patch
gives explicit widths to those fields, giving more room for entry.

Other fields have been given an explicit width and/or maxwidth according
to the database table structure.

To test, add or edit a library in Administration -> Libraries and
Groups. Form fields should be more comfortable for entry, and add/edit
actions should complete correctly.

Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template changes only, works nicely.
Tested editing and adding libraries in administration.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 08330ec05b8854df61bb28c2498b6ef0a727589e)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10690 - Warn about trailing slashes in description of OPACBaseURL and staffClientBaseURL

The descriptions for OPACBaseURL and staffClientBaseURL are not explicit
about including a trailing slash or not. This patch makes it explicit
that the trailing slash should *not* be included.

To test:
- Apply the patch
- Search for "baseurl" in the system preferences
- Check that the description of both sysprefs includes a warning about
  not including a trailing slash.
- Sign off

If you want to check that the trailing slash is in fact superfluous you
can do something like 'grep -r "BaseURL" *' and check that these
sysprefs are usually concatenated with some string that starts with a
slash.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Changes to the description appear correctly on both system
preferences.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit da40fe77fc471cfe8e797a7be5f87a506cf9d921)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10508: add unit tests for C4::Branch

Unit tests are wrap in a transaction.

To test:
prove t/db_dependent/Branch.t
t/db_dependent/Branch.t .. 1/36 Using a hash as a reference is deprecated at t/db_dependent/Branch.t line 207.
t/db_dependent/Branch.t .. ok
All tests successful.
Files=1, Tests=36,  1 wallclock secs ( 0.02 usr  0.02 sys +  0.13 cusr  0.01 csys =  0.18 CPU)
Result: PASS

http://bugs.koha-community.org/show_bug.cgi?id=10508
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 68bf770f9238d6b05b9383e521969a6782b068d5)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10508: (follow-up) fix a typo

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Thx for the follow-up Chris!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7a6bd88e497901bd7dc02e1964717da20313c0d8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10508: (follow-up) remove Perl 5.14 construct

Also added parentheses to bare function calls.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 7fa8e92e8e261f822b610da65b28a094e21e452c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10629: remove inappropriate uses of $sth->finish() in C4::Branch

Test plan :
Check if the regression tests still works
prove t/db_dependent/Branch.t
t/db_dependent/Branch.t .. 1/36 Using a hash as a reference is deprecated at t/db_dependent/Branch.t line 207.
t/db_dependent/Branch.t .. ok
All tests successful.
Files=1, Tests=36,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.12 cusr  0.00 csys =  0.16 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

From the man page

finsh()
Indicate that no more data will be fetched from this statement handle
before it is either executed again or destroyed.
You almost certainly do not need to call this method.

Adding calls to "finish" after loop that fetches all rows is a common
mistake, don't do it, it can mask genuine problems like uncaught fetch errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4287fd9d1c3ae16a0496b6261de44642bc92ab9c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>