Bug 11505: fix untranslatable table headers in Label batch manager

The label batch manager script hard-codes the table header cell labels
in order to pass them to an HTML-building function. This obviously isn't
the best solution for internationalization, but picking the whole scheme
apart would be very complicated.

Instead this patch uses a SWITCH statement to check for each possible
case and outputs the correct translatable string for each.

To test, apply the patch and run "perl translate update" for any
translation. Check the revised po file and confirm that the new strings
are present. View the label batch edit page and confirm that the table
headings look correct: Tools -> Labels -> Manage batches -> Edit batch.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests.
Similar fixes are probably needed for other pages of the labels
modules.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit e8f5ee9eef7a558ae1af8237493f8dc52e52945a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 11502: make library filter in "Holds To Pull" more precise

This patch uses regex checking via the DataTables fnFilter API method
to make the branch filter more precise on the "Holds to Pull" page.

The ability to use regex is built into DataTables so this just adds
the actual expression.

_TEST PLAN_

Before applying:

1) Add library (branches) with codes of NM, NMH, and NB
2) Add items (that can be placed on hold) at all these branches
3) Place a hold on an item that is only available at NM
4) Place a hold on an item that is only available at NMH
5) Place a hold on an item that is only available at NM and NB
6) Go to "Holds to Pull" in the Circulation module
7) Filter by these three different values
8) Note that filtering by "NM" will incorrectly bring up all three
holds, while "NMH" and "NB" will only pull up one (like they should).

Apply the patch.

9) Shift+refresh the page so that your Javascript refreshes
10) Repeat step 7 (filtering by the different branch values)
11) Note that filtering by "NM" will now only bring up the hold for "NM"
and the hold for "NM" and "NB", while the others still only bring up
one hold.

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 e96d73aa9f462fb653b8b67d7d5bff81dab94be7)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit d8a0e92c718e7c180a44b98fbe380c26667deacd)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bug 9210: wrap long lines in printed hold notices

This commit adds wrapping styles to print-notices.tt template

Test plan:
  * place a hold on a title with a very very long title or author
  * mark it as "waiting for pickup" by doing a checkin
  * go to command line interface, and run
  * misc/cronjobs/gather_print_notices.pl /tmp
  * misc/cronjobs/printoverdues.sh /tmp
  * if your title/author is long enough, it's split on 2 lines
    with this patch (it is not before this patch)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 06a8b6f314ded89fa6b4f94276e68e390b7afc3a)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 18c295a49ac2614d37ee6efdce774b65ea381617)
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Bumping version number for release
3.12.12 release notes
Bug 8773 - Start per-instance koha-index-daemon in .deb setup

Short:

Launch a koha-index-daemon (from Koha::Contrib::tamil) process for each
enabled instance. Enabling/disabling the use of the indexer is handled
using a new(ly introduced) /etc/default/koha-common config file that
can be used for other stuff too, and is the Debian way of handling
init scripts control variables[1].

Also provide command line tools to manage the running indexer daemons
for your instances.

Long:

Using an indexing daemon avoids launching a new interpreter each time
the cron triggers the indexing, and also allows sub-minute incremental
reindexing, a requirement from our librarians.[2]

Using the indexer daemon should remain "experimental" so is disabled by
default. To enable the use of the indexer the user has to tweak the
/etc/default/koha-common config file (introduced by this patch). Specifically
the USE_INDEXER_DAEMON variable, which is clearly explained in the file.

Update frecquency defaults to 30 sec, and can be changed by tweaking the
/etc/default/koha-common config file too.

This patch relies on Koha::Contrib::Tamil's koha-index-daemon script [3],
but could be easily adjusted to use another if we got a new one (SolR?).
As Robin proposed it checks for availability of the relevant files before
trying to spawn the daemon.

If there's something I could change to make this patches better just let me know.

Note: there was a problem Robin found regarding the spawned processes forgetting
the PERL5LIB and/or KOHA_CONF env variables, this is fixed in this version
with the inclusion of the 'export' keyword for the relevant variables.

Edit: fixed koha-create to call the koha-indexer script instead, and added
-q to make koha-inxeder quiet (useful for the init script).

Regards
To+

[1] Section 9.3.2 of http://www.debian.org/doc/debian-policy/ch-opersys.html
[2] This is the .deb version of http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8519
[3] The default cronjob that is set using the debian/koha-common.cron.d file
is being disbaled by this patch to avoid collision.

Sponsored-by: Universidad Nacional de Cordoba
Bug 10733: add 'memcached' as suggested dependency

Adds 'memcached' to the control.in file so the user is suggested by apt
to install it.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 578205746fc22e6ff8aecc97d646420d8e847291)
Bug 10733: Memcached on package installs

This patch makes the koha-create script adjust the koha-conf.xml file
with the proper string substitutions to enable the use of memcached
for the created Koha instance.

It adds three option switches that control this:

 --use-memcached (defaults to "no")
 --memcached-servers "host1:port1,..." (defaults to '127.0.0.1:11211')
 --memcached-prefix "desired_namespace prefix" (defaults to 'koha_')

It respects the current schema configuration schema, where configuration
values are pondered like this:

hardcoded < koha-sites.conf < koha-create option switches

koha-sites.conf is read for USE_MEMCACHED, MEMCACHED_SERVERS and
MEMCACHED_PREFIX.

Note: the docs discourage setting user's own namespace prefix.

Using memcached is off as the default. The relevant configuration
variables will remain empty if the user doesn't pass --use-memcached
to the command. It matches the current behaviour.

To test:
- Apply the patch
- Build your own packages and install them on a test server
a) Create a new instance without using the new switches like:
 $ koha-create --create-db memctest
 - Check that /etc/koha/sites/memctest/koha-conf.xml contains:
   * Empty <memcached_servers> tag.
   * Empty <memcached_namespace> tag.

b) Play with the possible combination of option switches
(Note that the code defaults to empty and will remain like that if
--use-memcached is not used, so less tests...)

 $ koha-create --create-db --use-memcached memctest
 $ koha-create --create-db --use-memcached --memcached-servers "anything:xxx" memctest
 $ koha-create --create-db --use-memcached --memcached-servers "anything:xxx" --memcached-prefix "something" memctest
 $ koha-create --create-db --use-memcached --memcached-prefix "something" memctest

 - Check the koha-conf.xml and /etc/apache2/sites-enabled/memctest
   file reflect the chosen options.

c) Run
 $ koha-create --help
 - It should advertise this addition accordingly.

d) Run
 $ man koha-create
 - Man page for koha-create should provide good information on the new
   switches behaviour

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit c6f091cc2348512e5a707cc9e0d8286b8e2ada0c)
Bug 10733: Follow up - unset variables from koha-sites.conf if USE_MEMCACHED=no

As configuration variables from koha-sites.conf overwrite the ones in the
koha-create script we need to unset them in case we have USE_MEMCACHED="no".

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit fb1748ee8ba8003742e497e059c187b64bde7fa2)
Bug 10691: 5xx not properly linked by authid in authority search result list [Staff]

This patch changes the URL and data used to show the 'see also' links
on the Staff's authority search results page.

Bonus points: makes some strings translatable.

To test:
- On your dev setup (master) create some authority records (i created personal name authorities).
- Pick one of them and link 400$a to another one, do the same with 500$a
- Add some other 400$a and 500$a entries with plain text (i.e. no linking)
- Make sure zebra is running and changes got indexed.
- In the staff interface search for the authority that is linked to the others.
- Check the 'see also:' link points to an authority search
- Apply the patch
- Reload/re-do the search
- Check the 'see also:' link points to the authority id for linked authorities,
  and to an authority search result in the case of plain text entries.
- Check that the authority search from the cataloguing interface still works as usual.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Work as described. No errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Bug 10691: 5xx not properly linked by authid in authority search result list

This patch changes the URL and data used to show the 'see also' links
on the OPAC's authority search results page.

Bonus points: makes some strings translatable.

To test:
- On your dev setup (master) create some authority records (i created personal name authorities).
- Pick one of them and link 400$a to another one, do the same with 500$a
- Add some other 400$a and 500$a without linking (i.e. plain text)
- Make sure zebra is running and changes got indexed.
- In the OPAC search for the authority that is linked to the others.
- Check the 'see also:' link points to an authority search
- Apply the patch
- Reload/re-do the search
- Check the 'see also:' link points to the authority id in the case of linked authorities,
  and to an authority search in the case of plain text names.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Work as described. No errors

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Bug 10691: Small glitch fixed

A small glitch prevented 'see from' headings to show.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Bug 10987: Too many 'see also' and 'see from' labels occurences

If an authority record has more than one 4xx$a (or 5xx$a) entries the
corresponding labels 'see also' and 'used for/see from' are repeated.

To test:
- Have authority records with more than one entry on the 4xx (or 5xx) fields.
- Do a search, check "see also:" (or 'used for/see from') appear more than once.
- Apply the patch
- Reload and check it looks nicer :-D
- Repeat for: staff auth search, opac using ccsr, opac using prog
- Signoff

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Work as decribed. No koha-qa errors
Nice view on staff and both opac

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Bug 11533: fix authority searching with no sorting when QueryParser is enabled

This patch fixes an issue where chosing 'None' as the sort order
for an authority search would result in zero hits if QueryParser is
eanbled.

This patch also adds some additional test cases.

To test:

[1] Enable QueryParser.
[2] Perform an authority search in the staff interface that
    uses 'Heading A-Z' as the sort order and returns hits.
[3] Run the same search, but with the sort order set to 'None'.
    No hits are returned.
[4] Apply the patch.
[5] Do step 3 again.  This time, hits should be returned.
[6] Verify that prove -v t/db_dependent/Search.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 27c312b721d5533560234675712391a60f354c51)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Bug 10987: (follow-up) fix display of authorities containing only one see from or see also lnik

This patch fixes an incorrect test on the number of see from and
see also links in the authority record, as otherwise if a record
had only one 4XX or 5XX, the linked headings weren't displayed at
all.  This patch also makes the test consistent across the staff
theme and the two OPAC themes.

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

Conflicts:
	koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc