Bug 9961: Add truncation support to QP driver

The original implementation of QueryParser did not handle truncation
based on the QueryAutoTruncate system preference. This patch adds support.

To test:
1) Apply patch.
2) Turn on UseQueryParser.
3) Set QueryAutoTruncate to "automatically."
4) Search for "har". Note that it returns results with words
   like "Harry" (i.e. with right truncation).
5) Search for "har*". Note that it still returns results with right
   truncation.
6) Set QueryAutoTruncate to "only when * is added."
7) Search for "har". Note that it returns only records that have the
   exact word "har" in them (most likely there will be none unless you
   have Hebrew items).
8) Search for "har*". Note that once again it returns results for "Harry"
   (i.e. right truncated results).
9) Sign off.

This patch also reindents a hash in Koha/QueryParser/Driver/PQF.pm
because it was hard to read before.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Thx for fixing this Jared!
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 8c6fe639b812665339a2cd84083f8c75d3957fdd)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10204 - Patron image no longer appears in the OPAC

With the addition of opac-memberentry.pl to the OPAC we lost a way to
display the image associated with a patron's account. This patch adds
display of the patron image to opac-memberentry.pl now that
opac-userdetails.pl and opac-userupdate.pl are deprecated.

To test:

1. Log into the OPAC as a patron who has an image associated with their
   account. View the "my personal details" tab and confirm that the
   patron image appears with and without OPACPatronDetails enabled.

2. Log into the OPAC as a patron who has no image associated with their
   account. View the "my personal details" tab and confirm that the
   layout looks correct.

3. Turn off OPACpatronimages and confirm that the "my personal details"
   page looks correct.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with OpacPatronDetails and OpacPatronImags turned on/off
and it's working well.
Template only changes.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit afccbfcce7192c6e1fcd73f137135cb5289c3d3d)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin

This plugin, for pseudo-authority-control of publisher information,
used YUI autocomplete to pull existing publisher data from the
biblioitems table. Despite its name it is not UNIMARC-specific.
It assumes publisher name data is saved in biblioitems.

This patch converts the autocomplete to jQueryUI. The search
script has been amended to return valid JSON. The template has
been modified to enable the jQueryUI autocomplete and to add
structure more consistent with other popups.

To test, link the publisher name field in your MARC structure to
the unimarc_field_210c_bis.pl plugin. Open a MARC record for
editing and click the "tag editor" link to launch the plugin.
Type the first few letters of a publisher which exists in your
database. You should get an autocomplete menu of publishers
which match your search. Select one and click the "choose"
button to fill the field in the MARC editor.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: work as described. No errors.

Test: link 260b to plugin. Edit record and search first letters
of present editors. Menú appears and can select and fill value.

Why plugin 210c_bis talk about field 225a?

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Plugin now works correctly for me, even when linked
to 260$b in a MARC21 installation. All tests and QA script
pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 626c27baf993b8a19a7cdace902c03ae26f23da5)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8278 : Follow up, fixing the permissions on cataloguing/ysearch.pl

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

Comment: Works. No errors.

Without patch and normal staff user, logged out
With patch, normal staff, valid output.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 588cc04571bd4eab1878c4abcac883ebe3ad060e)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8278 [Follow-up] Replace YUI autocomplete in UNIMARC 210c plugin

This follow-up corrects the heading of the plugin pop-up window to match
the UNIMARC field it targets.

To test, trigger the plugin and confirm that the pop-up window refers to
210c.

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

Smple patch, fixes label. No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit e75fd34e92c599da8daa7ab40ef0153acbf05bf6)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8278: build the structure with to_json instead of manually.

Test plan:
Same as previously.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit bb1b15d93937677aa61dbee8fce8c19846acb4d8)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10156 - Fix usr/bin/perl path for get_report_social_data.pl

Currently, the perl path for get_report_social_data.pl is "#!/bin/perl"
when it should be "#!/usr/bin/perl".

While I'm not entirely sure how to test this, rangi did mention:

23:47 (it wouldnt work on my debian install)
23:48  zsh: no such file or directory: /bin/perl

It's a pretty trivial change, so I'm not sure it needs much of a test
plan.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Before the patch "grep -r '#!/bin/perl' in the misc dir shows one file
with this line, and it is indeed get_report_social_data.pl. After the
patch there are no occurrences left.
Passed-QA-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 2e103a018cedc1c57d1c0db8acad6f93ab4ca428)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10185: Fix update 3.09.00.025

It can remove all reserves from reserves table when there is no entries
in old_reserves.
This is due to @ai which is set to NULL in
  SET @ai = ( SELECT MAX( reserve_id ) FROM tmp_reserves )
and reserve_id > NULL returns no results in
  INSERT INTO reserves SELECT * FROM tmp_reserves WHERE reserve_id > @ai

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test plan and comments on second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 37c52367b08f30514483b02a387cb5a463ea15d0)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10185: Add missing columns in update 3.09.00.025

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
SQL only changes fixing an important database update.

IMPORTANT: Patches must be backported to all versions containing
the database update 3.09.00.025.

I used the test plan provided by Julian with some additions:
1/ Do a fresh 3.8 install
2/ Do some reserves
3/ Check your old_reserves table is empty
4/ Update your sources to 3.10
5/ Run updatedatabase.pl
6/ Your reserves table is now empty!

I made sure I had item level and title level holds, also
suspended holds.

I repeated the test with entries in my old_reserves table
(cancelled and filled holds) to make sure this is also still
working correctly.

Before the patch we lost all suspended holds and when the
old_reserves table was empty also all holds in general.
After the patch the reserve_id is added but the other data
in both tables is not altered.

NOTE: Adding the reserve_id first to old_reserves and then
to reserves we are missing one id in between.
old_reserves: 1,2,3
reserves: 5,6
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 30d067400e6d15cd86d8b35daed4bb10438d0e2e)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9681: Add some indexes in database

Some table columns should have an index to speed SQL queries :
- statistics table has only one index (used to make heavy queries for reports)
- itemtype should have an index in items and biblioitems (this is used in circulation to check the number of existing issues of a specific item type)
- issue.branchcode and issue.issuingbranch

Test plan :
- Create a new database using kohastructure.pl
=> check there is no SQL error and that new indexes are present (mysql> show create table)
Apply update database on a master version
=> check there is no SQL error and that new indexes are present (mysql> show create table)

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

Comment: Indexes created as described. No errors.
Fixing small merge conflict.
Test presence of new indexes on all affected tables.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 68ff49bb7d982737c41a225cd697b8fb60d0b4ab)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9681: Increment version number

Database update for bug 9681 has been given version 3.11.00.301
(cherry picked from commit 5a9a82dcc3ebdb3b7f130edbfb8c6ef67f97eb68)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>