Bug 6435: Add daemon mode to rebuild_zebra.pl

This change adds code to check the zebraqueue table with a cheap SQL query
and a daemon loop that checks for new entries and processes them incrementally
before sleeping for a controllable number of seconds.  The default is 5 seconds
which provides a near realtime search index update.  This is desirable particularly
for libraries that are doing active catalogue updating.  The query is adjusted
based on whether -a, -b, or -a -b are specified.

Help text updated.  Tested against a live 3.12 system.

Note that this fix will benefit from the fix to lack of locking (bug 11078)

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1b0992e8d5a2bc8f0f74623daa9a7eac4786644a)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 6435: (follow-up) rebuild_zebra -daemon option now smarter

Based on feedback, make daemon mode imply -z -a -b and abort
on startup if flags incompatible with an incremental update daemon
are used.  Update documentation to match.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 00240d6970795a176a12fb2d24fcd38e069d037f)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 6435: (follow-up) make -daemon really imply -a and -b

This patch follows up on the previous patch by moving the
check for whether authority and/or biblio indexing have been
specified so that -daemon has a chance to set those modes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit b25de3e7cf53265f0ded8e3ab4cce82457b8f14d)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11040: Add CircAutoPrintQuickSlip option to print regular slip

This patch adds a third option to the CircAutoPrintQuickSlip system
preference.  The three options are now:

* print quick slip
* print regular slip
* clear the screen

Test plan:
1.  Set the System Preference for CircAutoPrintQuickSlip to "clear the
    screen".
    Enter a borrower barcode for checkout
    Press Enter
    The screen should be cleared.

2.  Set the System Preference for CircCircAutoPrintQuickSlip to "open a
    quick slip window"
    Enter a borrower barcode for checkout
    Press Enter
    A Quick slip is printed.

3.  Apply the patch
    Update the database using UpdateDatabase.pl

4.  Set the System Preference for CircAutoPrintQuickSlip to "clear the
    screen".
    Enter a borrower barcode for checkout
    Press Enter
    The screen should be cleared.

5.  Set the System Preference for CircCircAutoPrintQuickSlip to "open a
    quick slip window"
    Enter a borrower barcode for checkout
    Press Enter
    A Quick slip is printed.

6.  Set the System Preference for CircCircAutoPrintQuickSlip to "open a
    slip window"
    Enter a borrower barcode for checkout
    Press Enter
    A Slip is printed.

7.  Reload the database using sysprefs.sql
    Set the System Preference for CircAutoPrintQuickSlip to "clear the
    screen".
    Enter a borrower barcode for checkout
    Press Enter
    The screen should be cleared.

8.  Set the System Preference for CircCircAutoPrintQuickSlip to "open a
    quick slip window"
    Enter a borrower barcode for checkout
    Press Enter
    A Quick slip is printed.

9.  Set the System Preference for CircCircAutoPrintQuickSlip to "open a
    slip window"
    Enter a borrower barcode for checkout
    Press Enter
    A Slip is printed.

10.  Verify that the Checkout Help includes information about printing Slips.

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 2131c78618bb8851bc37bc99f20fa1aaa02c3124)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>

Conflicts:
	installer/data/mysql/updatedatabase.pl
Bug 11040: DBRev 3.14.00.001

Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11308: fix RSS page in bootstrap theme

To test:
1/ Do a search in the opac, click on the rss feed icon
2/ Notice the page renders, not like an rss feed should
3/ Apply the patch and refresh
4/ Page should now be (more) valid xml

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Small change, big difference. With the patch the content of
the RSS feed renders like it does for the prog theme.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 71a3516d211600d35e4ddeef45f5403affc09598)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11283: make restriction type translatable

The new restrictions system has different types:
MANUAL, OVERDUES and SUSPENSION.

Those are shown in the interface and seem to come directly from the
database, so they are not translatable.

As they are hardcoded translations should be possible and be handled in
the template.

Test Plan:
1) Create a patron with one of each type of restriction
2) Apply this patch
3) Note you see the type with only the first letter capitialized,
   this indicates you are seeing the translatable string

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script. Strings now appear in
updated po files:
  msgid "%s %s Manual %s Overdues %s Suspension %s "

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 3a76f4298c0fb298cca0db31b04c0d8d5c028531)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11304: fix display of detail page holdings tab in translated Bootstrap theme

Detail page tabs are not displayed properly because JavaScript is broken
in French. This is due to _(' JS string construction used in place of
_(".

This patch fixes:

  - opac-detail.tt page
  - xt/single_quotes to test bootstrap theme

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

Tested by applying the patch, running translate update, then translate
install. Saw no JavaScript error on the French detail page.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Switches from single to double quotes for translatatable strings.
Unit tests for xt/single_quotes passes now.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1b80e77f84dd864342220b89acd1210ac53a3f70)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11275: make deleteditems.materials be of type text

Bug 7278 has made items.materials of type text.
It must be the same in deleteditems column.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Tested:
- definition of materials now matches between items and deleteditems
- database update works correctly

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
The only difference between tables items and deleteditems is
deleteditems.marc
Amended patch: Add a missing SetVersion in updatedb.pl

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 8aa6e51b6f684f98077dd1c3df1f847bef8d40ba)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11275: DBRev 3.14.00.002

Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11275: (follow-up) update DBIC schema class files

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 2f4b0a5064a97f775ada288d0269c4891589da4c)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11105: wrap places OPAC facet in a span

prog-only OPAC patch.

To test:
Verify places in the facets is wrapped in a span.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template change only, works as expected.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a9900b0d35bcd27483355f19985a9669e1c884e2)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11171: Display basket group name on the supplier list page

Test plan:

Search supplier and verify the basket group column is filled.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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 c9b873ff10694a9f36d15734bd2bb22e17c604c6)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11171: (follow-up) fix a javascript error

The previous patch adds an error on booksellers.pl:

TypeError: a.aoColumns[c] is undefined

It was caused by the add of the new column. The aoColumns DT parameter
should manage it.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit d5281fd41ec4b2f0c497d75550e2c865d96183d8)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11286: fix bug preventing adding a new subfield to an authority framework

Bug 10602 introduces a bug when adding a new subfield to an authority
framework. A new parameter is added in a sql query but the placeholder
is missing.

Test plan:
- edit an authority framework
- add a new subfield
- save
- boom!
DBD::mysql::st execute failed: called with 16 bind variables when 15 are
needed at
/home/home/src/admin/auth_subfields_structure.pl line 454.
- apply the patch and try again

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described. No koha-qa errors

Tested trying to add subfield to 100, 2 for example.
Without patch silently fails (but error is logged)
With patch subfield creation or elimination is fine

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
One line fix for a bad bug. Confirmed the bug on master and
the fix. Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 3c50683e0d6412b29144962e7f5d539fec28da04)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11214: improve create/edit routing list links in serial collection page

When a subscription has no routing list yet, the page
serials/subscription-detail.pl shows in left menu : "Create routing list".
In serials/serials-collection.pl page, the link in table is always
"Edit routing list", even when there is no routing list.

This patch adds a conditionnal link "Edit routing list"/"Create routing
list" into serials/serials-collection.pl page.

Test plan :
- Create a subscription no. 1 without routing list and a subscription
  no. 2 with a routing list
- Go to serials/serials-collection.pl of subscription no. 1
=> You see "Create routing list" link
- Click on link
=> You see "Create routing list for"
- Go to serials/serials-collection.pl of subscription no. 2
=> You see "Edit routing list" link
- Click on link
=> You see "Edit routing list for ..."

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Functional and automated tests pass. Passes koha-qa.pl.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
With the patch applied the serial collection page shows the
right link depending on the existance of a routing list.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 0c631934de5adf5c8d9d35aaaf94a19134f4a166)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 7484: keep selected values when changing search type on authority search form

1) I'm on the "Search authorities" tab. I select an authority type,
   then change the active tab. The type change is lost.
2) I'm on a tab and type a search pattern, then change tab, the string
   is lost.

This behaviour is logical, given the fact that we're using tabs, but it
would be more practical to keep the typed informations when the user
changes the search mode.

This patch add a few JQuery code to synchronise inputs between all
tabbed authorities search forms.

Test plan :
- Go to Authorities home page : cgi-bin/koha/authorities/authorities-home.pl
- In toolbar, "Search main heading" is selected
- Change all inputs : authotity type, operator, term, and sort order
- Click on "Search all headings" tab
=>  Inputs are the same has previous tab
- Click on "Keyword search" tab
=>  Inputs are the same has previous tab

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: Explicitly declare 2 new variables used.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described, Firebug doesn't show any problems with
the Javascript.
Could be useful for other tabbed searches like the start page
as well.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 85642ededaf71b0a67805151937014f42deea2dd)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11183: get rid of some log noise from the OPAC

To test in OPAC:
* With the OPAC System Preference EnableOpacSearchHistory set
  to Keep, a simple search triggers the warning patched on
  line 626 of opac-search.pl
* Selecting a search result item with no Collection Code
  set triggers the warning patched on line 576 of opac-detail.pl
* Have an item with Collection Code. Check that the Collection
  Code shows.
* Collection Code is set by editing an item in the staff client
  (952$8)

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>
(cherry picked from commit ec206d18980b2438cfe3da9e89455eda319dd8d7)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11242: fix opac-MARCdetail.pl display and warnings

This patch improves the public catalog MARC view display
of records that contain subfields that are not defined in
the framework used by the bib record.

To test:

(RM note: it may be easier to find or create a MARC record that
 contains a subfield not present in the default framework, then
 load it, rather than fiddle with the MARC frameworks in your
 test database.)

BACK UP YOUR DATABASE!
 1) Search for an item in OPAC
 2) Open OPAC detail
 3) Click 'MARC View' link
 4) Look for something with multiple lines (e.g. 260 or 942)
 5) In another tab, Go to staff client and log in
 6) Go to the staff client URL similar to:
     /cgi-bin/koha/catalogue/detail.pl?biblionumber=##### page
    where ##### is the biblionumber.
 7) Edit -> record
 8) Note the framework used.
 9) More -> Administration
10) MARC bibliographic frameworks
11) Click 'MARC structure' for the framework used by the item
     shown in OPAC.
12) Find the tag (e.g. 260 or 942) and click 'Subfields'
13) Delete of the matching subfields (e.g. 260$b) shown in the
     OPAC tab
14) Clear your opac error log.
15) Refresh OPAC tab. The tag subfields are split.
16) There are opac-MARCdetail.pl warnings.
17) Apply patch
18) Clear your opac error log.
19) Refresh OPAC tab. The tag subfields are no longer split strangely.
20) There are no opac-MARCdetail.pl warnings.
RESTORE YOUR DATABASE.

This also silences a series of warnings triggered by catching
undef hash references.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 38503e18a38116646c9746b13f013b3c11fe55c1)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
Bug 11059: fix date sorting of import batches in basket add form

This patch improves the sorting of staged import batches by date,
particularly when the dateformat system preference is set to anything
other than YYYY-MM-DD.

Adds title-string sorting type to enable this.

To test:

[1] Ensure that there are at least three staged
    bib import batches, with upload timestamps such that
    date sorting errors would be apparent.
[2] Set the dateformat system preference to either DD/MM/YYYY
    or MM/DD/YYYY.
[3] Create a new basket in acquisitions, then chose to add
    a new order line from a staged record batch.
[4] In the list of batches, click on the 'staged' column
    heading to sort by date.
[5] Observe that dates are sorted in alphanumeric order, not date
    order.
[6] Apply the patch and refresh.  This time, dates should sort
    correctly.

Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 097a92b3188d62e9797d18313715c35d9dc186b4)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>