koha.git
8 years agoBug 15533: Fix 'ambiguous' SQL query in CanItemBeReserved
Julian Maurice [Tue, 12 Apr 2016 13:18:20 +0000 (15:18 +0200)]
Bug 15533: Fix 'ambiguous' SQL query in CanItemBeReserved

Adding reserves.itemtype made a query to fail in CanItemBeReserved.
This patch prefixes the column names with the corresponding table names
to prevent that.

You can trigger the error by running
  prove t/db_dependent/Holds.t

You should see something like this:
  Column 'itemtype' in where clause is ambiguous

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15533 - Allow patrons and librarians to select itemtype when placing hold
Kyle M Hall [Fri, 25 Dec 2015 12:05:57 +0000 (12:05 +0000)]
Bug 15533 - Allow patrons and librarians to select itemtype when placing hold

Some libraries would like the ability to select the itemtype to request
when placing holds. For example, if a record has 3 copies of BookA and 3
copies of BookA in large print, this feature would allow a person to
place a hold on the record, but still be able to target only the Large
Print edition so that the first Large Print copy that becomes available
is targeted, rather than forcing the patron to select a particular copy
to hold.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Create a record with items of two or more itemtypes
4) Place a record level hold on the record while choosing one particular
   itemtype
5) Check in an item from the record that is not of that itemtype
6) Notee it is not trapped for the hold
7) Check in an item from the record that does match the selected itemtype
8) Note the item is trapped for the hold

Signed-off-by: Andreas Hedström Mace <andreas.hedstrom.mace@sub.su.se>
Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 15532 - DBRev 3.23.00.054
Kyle M Hall [Fri, 29 Apr 2016 10:23:47 +0000 (10:23 +0000)]
Bug 15532 - DBRev 3.23.00.054

8 years agoBug 15532 [QA Followup] - Remove unused variable
Kyle M Hall [Wed, 27 Apr 2016 17:18:49 +0000 (17:18 +0000)]
Bug 15532 [QA Followup] - Remove unused variable

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 years agoBug 15532 [QA Followup] - Remove unecessary lines from unit test
Kyle M Hall [Mon, 18 Apr 2016 16:46:57 +0000 (16:46 +0000)]
Bug 15532 [QA Followup] - Remove unecessary lines from unit test

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 years agoBug 15532: Add ability to allow only items whose home/holding branch matches the...
Kyle M Hall [Sat, 19 Dec 2015 11:34:03 +0000 (11:34 +0000)]
Bug 15532: Add ability to allow only items whose home/holding branch matches the hold's pickup branch to fill a given hold

Some libraries would like to be able to limit hold filling to items that
match the pickup library for a hold based on the item's home or holding
library. The patron's home library should not affect whether a patron
can place the hold, instead the hold will only be fillable when an item
matching the pickup location becomes available.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Note the new "Hold pickup library match" rules for "checkout, hold,
   and return policy" and for "holds policy by item type"
4) Set the policy to "item's holding library"
5) Place a hold where the item's holding branch does not match
   the pickup branch
6) Check in the item
7) Note it is not trapped for the hold
8) Update the item's holding branch to match the pickup branch
8) Check in the item
9) Note the item is trapped for the hold
10) Repeat steps 4-9 but for home branch instead

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
8 years agoBug 16105: Do not initialize the memory cache if not needed
Jonathan Druart [Fri, 18 Mar 2016 13:39:27 +0000 (13:39 +0000)]
Bug 16105: Do not initialize the memory cache if not needed

Cache::Memory is loaded and Koha::Cache::_initialize_memory is called
even if a memcached cache has been correctly initialize, it does not
make sense.
It should only be initialize if needed.

Test plan:
Correctly configure a memcache server and confirm that the memory cache
is not initialize.
Do not configure correctly a memcache server and confirm that the cache
system default on Cache::Memory

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12721: (followup) Replace mysqlism by DBIx::Class
Marc Véron [Wed, 27 Apr 2016 10:38:58 +0000 (12:38 +0200)]
Bug 12721: (followup) Replace mysqlism by DBIx::Class

This patch removes the mysqlism (see comment #18)

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Fixed QA tools complaints about missing lines before
and after =cut in POD.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12721 - Prevent software error if incorrect fieldnames given in sypref Statistics...
Marc Véron [Sun, 18 Oct 2015 14:28:52 +0000 (16:28 +0200)]
Bug 12721 - Prevent software error if incorrect fieldnames given in sypref StatisticsFields

To reproduce issue:
See comment #1

To test:
- Apply patch
- Leave syspref StatisticsFields empty
- Display statistics for an author

  => Result: Table displays Shelving location, Collection code, Item type
           (as before)

- Change syspref to any combination of location|itype|ccode
  => Result: Table displays columns as appropriate

- Change syspref to some garbage
  => Result: Same as with empty syspref (was crashing without patch)

- Change syspref to valid combination with trailing |
  => Result: Table displays columns as appropriate (was crashing
     without patch)

- Change syspref to a combination of valid and invalid fields
  (location|blah|ccode)
  => Result: Table displays column of valid fields only (was crashing
     without patch)

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12721 - Syspref StatisticsFields: Warning on About page and text change in System...
Marc Véron [Sun, 18 Oct 2015 16:27:58 +0000 (18:27 +0200)]
Bug 12721 - Syspref StatisticsFields: Warning on About page and text change in System preferences

This patch adds a warning to the about page if the syspref 'StatisticsFields' is misconfigured.
Additionally, the text on Home > Administration > SystemPreferences for 'Statistics Fields'
is changed.

To test:
- Apply patch
- Edit syspref 'StatisticsFields'. Verify that the explanation makes sense.
- Leave field empty
  => verify that no message appears on About page, tab System information
- Insert valid field names, e.g. location|itype
  => verify that no message appears on the About page
- Add trailing char
  => verify that the warning message appears on the About page
- Fill in some garbage or misspell a field name
  => verify that the warning message appears on the About page

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 13877 - Fix QA issues
Alex Arnaud [Fri, 22 Apr 2016 09:03:50 +0000 (11:03 +0200)]
Bug 13877 - Fix QA issues

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 13877 - Make serialseq season name translatable regardless its position in a...
Alex Arnaud [Tue, 15 Mar 2016 15:36:28 +0000 (16:36 +0100)]
Bug 13877 - Make serialseq season name translatable regardless its position in a string

Signed-off-by: Chris Cormack <chrisc@catalyst.net.z>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoDBRev Bug 16217 - Notice' names may have diverged
Brendan Gallagher [Fri, 29 Apr 2016 02:26:46 +0000 (02:26 +0000)]
DBRev Bug 16217 - Notice' names may have diverged

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16217: Resync names of notices
Jonathan Druart [Wed, 6 Apr 2016 15:35:23 +0000 (16:35 +0100)]
Bug 16217: Resync names of notices

Bug 12752 has fixed a bug for installations upgrading from 3.14, but has
not fixed the problem for new installations.
Because of some wrong data manipulations, the names for a given letter
code may diverge.

In particular OVERDUE and PREDUE names of phone notices have been
wrongly modify by bug 11867: they have been set to the name of the first HOLD
notice.

Trying to be back on our feet, this update DB entry will try to guess
and set back up the correct name.

To know if your install is affected by this bug, the following SQL query
can help you:
  SELECT code, name, message_transport_type
  FROM letter
  WHERE code="PREDUE" OR code="OVERDUE";

If the names are different for the same code, something went wrong.
Executing this update DB entry should fix the divergence.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Fix the problem, see comment #6 for test.
No koha-qa errors

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16377: Fix t/db_dependent/Members/Attributes.t
Marcel de Rooy [Thu, 28 Apr 2016 06:50:47 +0000 (08:50 +0200)]
Bug 16377: Fix t/db_dependent/Members/Attributes.t

This is a follow-up for bug 12267 fixing the test, still referring to
password fields.

Test plan:
Run the test.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Test now pass
No errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12752: FIX letter names in 3.15.00.041
Jonathan Druart [Wed, 6 Apr 2016 14:59:02 +0000 (15:59 +0100)]
Bug 12752: FIX letter names in 3.15.00.041

3.15.00.041 was wrong, the name of the letter should not always been the
name of the first HOLD notice.
PREDUE_PHONE should be updated with the first name of the PREDUE notice,
same for OVERDUE_PHONE and OVERDUE

Signed-off-by: Chris Cormack <chrisc@catalyst.net.z>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16373: merge.pl reports success but files are not merged
Jacek Ablewicz [Thu, 28 Apr 2016 07:35:51 +0000 (09:35 +0200)]
Bug 16373: merge.pl reports success but files are not merged

To recreate:

1) Select two biblios to merge
2) Merge them
3) Sucess reported but list of bibs contains only the reference record.
4) View the 'new' record, it won't have any additional items
5) View the 'merged' record, it is still there with its items

This happens because record IDs (biblionumbers) are not correctly
set up in the template on the 2nd merge stage, since Bug 15358.

To test:

1) apply patch
2) try to recreate this issue once again, confirm that a problem
is resolved

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16378: Overdues.pm: Can't call method "store" without a package or object reference
Marc Véron [Thu, 28 Apr 2016 09:47:57 +0000 (11:47 +0200)]
Bug 16378: Overdues.pm: Can't call method "store" without a package or object reference

Overdues.pm line 588 tries to do an $accountline->set with column outstanding
instead of amountoutstanding.
This patch fixes it.

To test:
- Verify that code change is correct.
- Try to trigger a situation where an existing fine is updated
  (see comment in line 574 in C4/Overdues.pm)

Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 14686 - DBRev fix - add missing call to SetVersion
Kyle M Hall [Wed, 27 Apr 2016 17:00:22 +0000 (17:00 +0000)]
Bug 14686 - DBRev fix - add missing call to SetVersion

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoBug 16158: Move GetAuthorisedValues outside the loop
Jonathan Druart [Tue, 29 Mar 2016 15:38:18 +0000 (16:38 +0100)]
Bug 16158: Move GetAuthorisedValues outside the loop

In catalogue/detail.pl and catalogue/moredetail.pl, the
GetAuthorisedValues subroutine is called once per item. It's not needed,
only 1 call is enough.

Test plan:
Edit item and view a catalogue record.
The withdrawn, lost and damaged values should be correctly
displayed/saved.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 2324: Adding confirm dialog when undoing import
Aleisha [Tue, 29 Mar 2016 01:40:35 +0000 (01:40 +0000)]
Bug 2324: Adding confirm dialog when undoing import

EDIT: Comment 3

To test:
1) Go to Tools -> Staged MARC Management
2) Click on a batch to see details
3) If not already imported, then import, otherwise you should already see the button to undo import into catalog.
4) Click this button. Confirm you are asked to confirm. Confirm clicking Cancel will cancel the undo. Confirm clicking OK will continue with the undo.

Sponsored-by: Catalyst IT
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 10347 [Follow-up] Scroll down clicking on the "Add multiple copies" button
Jonathan Druart [Fri, 16 Aug 2013 10:25:58 +0000 (12:25 +0200)]
Bug 10347 [Follow-up] Scroll down clicking on the "Add multiple copies" button

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 10347 - Deactivate "Add item" button when "Add multiple copies" was activated
Owen Leonard [Thu, 15 Aug 2013 18:53:26 +0000 (14:53 -0400)]
Bug 10347 - Deactivate "Add item" button when "Add multiple copies" was activated

When the "Add multiple items" button is pressed the other submit buttons
should be hidden in order to eliminate confusion about which button
submits the form at that stage in the process.

This patch alters the form so that clicking the "add multiple" button
hides the other two buttons and displays form for submitting the number
of copies to add.

This patch also makes changes to accompanying text in order to make
things (hopefully) clearer. The button text has been changed (again, see
Bug 10346) to "Add multiple copies of this item."

Explanatory text has been added "The barcode you enter will be
incremented for each additional item," because that seemed non-obvious
about the process.

Unrelated change: a section of obsolete JavaScript has been removed.

To test, go to the add/edit items page for a new or existing record.
Test adding a single item, adding & duplicating, and adding multiple.
The add multiple form should be shown upon clicking 'add multiple,' and
hidden when 'cancel' is clicked.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, tried adding one, one & dup, multiple and cancel multiple
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoDBRev for Bug 14686 - New menu option and permission for file uploading
Brendan Gallagher [Wed, 27 Apr 2016 16:24:18 +0000 (16:24 +0000)]
DBRev for Bug 14686 - New menu option and permission for file uploading

Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 14686: Remove unused use
Jonathan Druart [Mon, 4 Apr 2016 13:21:08 +0000 (14:21 +0100)]
Bug 14686: Remove unused use

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 14686: [QA Follow-up] Move allows_add_by to Upload.pm
Marcel de Rooy [Fri, 1 Apr 2016 09:14:15 +0000 (11:14 +0200)]
Bug 14686: [QA Follow-up] Move allows_add_by to Upload.pm

As requested by QA, the sub should be moved.

Test plan:
See previous patches.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 14686: Add Upload to Tools menu
Marcel de Rooy [Mon, 8 Feb 2016 09:26:58 +0000 (10:26 +0100)]
Bug 14686: Add Upload to Tools menu

This patch makes sure that the added granular permissions work as
advertised.

Note: The field owner was not included in the Koha::Upload->get response.
The code to verify if a user is allowed to delete an upload, is concentrated
in the template now. When get returns a Koha::Object, this check could be
relocated.

Test plan:
[1] Verify that the current user has permission for tools, or has
    at least upload_general_files.
[2] Do you see Upload in the Tools menu? Follow the link.
[3] Upload a permanent file (with a category).
[4] Do you see the Delete button in the results form?
[5] Make sure that another user has no permission to upload.
[6] Login as that user and check the Tools menu.
    Try the URL [yourserver]/cgi-bin/koha/tools/upload.pl
    You should have no access to the upload form.
[7] Enable upload_general_files for this user. Go to upload and search for
    the upload from step 3. You should not see a Delete button.
[8] Enable upload_manage for this user. Search for the upload again.
    Delete the upload.
[9] Go to upload via the Cataloguing editor (856$u plugin) or add
    parameter "plugin=1" to the URL. You should not see the Tools menu.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 14686: Add two granular permission for upload under tools
Marcel de Rooy [Mon, 14 Mar 2016 12:42:10 +0000 (13:42 +0100)]
Bug 14686: Add two granular permission for upload under tools

[1] Upload_general_files
    This will allow you to access the tools/upload form via the Tools menu.
    And it will also allow you to add permanent uploads.

[2] Upload_manage
    It will allow you to delete uploads from other users.
    Note that anyone may delete his own uploads.
    It is not meant to include upload_general_files.

In order to not disturb existing users that now have edit_catalogue and are
using the plugin (read: added at least one record to uploaded_files), we
will add the first permission for them. New users will need to be authorized
in the usual way thereafter.

Note: If you only have one of the other permissions checked in allows_add_by,
e.g. stage_marc_import, you can add temporary uploads, but not permanent
uploads.

Test plan:
We are only testing the dbrev here, not if the perm works as advertised.
[1] Run the dbrev and check that you see the perms with a description on
    the Patron/Set permissions page.
[2] If you had records in uploaded_files and a user with edit_catalogue
    *only*, verify that this user now also has upload_general_files.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 14686: Add allows_add_by to check permissions for uploading
Marcel de Rooy [Mon, 14 Mar 2016 12:22:14 +0000 (13:22 +0100)]
Bug 14686: Add allows_add_by to check permissions for uploading

The three permissions in tools/upload-file.pl are moved to a custom
routine in DBIx's UploadedFile.pm. An additional granular permission
upload_general_files is added. (The dbrev patch will contain it too.)
At some point in time this could be moved to a Koha::Object class.

The routine is tested in Upload.t.

Test plan:
[1] Run t/db_dependent/Upload.t
[2] If you only apply this patch, you can also test uploading with a
    user that has edit_catalogue but does not have tools or circulate.
    Upload status should say: Denied.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
8 years agoBug 16361: Installer syntax error
Bernardo Gonzalez Kriegel [Wed, 27 Apr 2016 02:08:07 +0000 (23:08 -0300)]
Bug 16361: Installer syntax error

Bug 16354 introduces a syntax error on updatedatabase.pl
see comment #5 there

To test
1) Check error on update 3.23.00.051
2) Apply the patch
3) run updatedabase again (perhaps changing 051 to XXX)

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
happy again!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
8 years agoForgot extra $dbh
Brendan Gallagher [Wed, 27 Apr 2016 02:38:35 +0000 (02:38 +0000)]
Forgot extra $dbh

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16154: Fix some other occurrences
Jonathan Druart [Wed, 13 Apr 2016 16:22:18 +0000 (17:22 +0100)]
Bug 16154: Fix some other occurrences

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16154: CGI->multi_param - Assign a list
Jonathan Druart [Tue, 29 Mar 2016 08:52:25 +0000 (09:52 +0100)]
Bug 16154: CGI->multi_param - Assign a list

This patch replaces the occurrences of
  @foo = $cgi->param('foo');
with
  @foo = $cgi->multi_param('foo');

perl -p -i -e
's/^(\s*@\w+\s*=\s*)\$(cgi|input|query)\->param\(/$1\$$2\->multi_param\(/xms'
**/*.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16154: CGI->multi_param - Force scalar context
Jonathan Druart [Tue, 29 Mar 2016 08:51:07 +0000 (09:51 +0100)]
Bug 16154: CGI->multi_param - Force scalar context

This patch replaces the occurrences of
  $template->param( foo => $cgi->param('foo') );
with
  $template->param( foo => scalar $cgi->param('foo') );

perl -p -i -e 's/(\s*=>\s*)\$(cgi|input|query)\->param\(/$1scalar
\$$2\->param\(/xms' **/*.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16154: CGI->multi_param - Manual changes
Jonathan Druart [Tue, 29 Mar 2016 08:41:58 +0000 (09:41 +0100)]
Bug 16154: CGI->multi_param - Manual changes

This patch does the same as the previous one, but affects lines which
have not been caught by the regex.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16154: CGI->multi_param - Declare a list
Jonathan Druart [Tue, 29 Mar 2016 08:15:43 +0000 (09:15 +0100)]
Bug 16154: CGI->multi_param - Declare a list

This patch replaces the occurrences of
  my @foo = $cgi->param('foo');
with
  my @foo = $cgi->multi_param('foo');

perl -p -i -e
's/^(\s*my\s*@\w+\s*=\s*)\$(cgi|input|query)\->param\(/$1\$$2\->multi_param\(/xms'
**/*.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16321 - 'Show all details' checkbox triggers JS error after jQuery upgrade
Owen Leonard [Thu, 21 Apr 2016 16:39:53 +0000 (12:39 -0400)]
Bug 16321 - 'Show all details' checkbox triggers JS error after jQuery upgrade

This patch fixes problems with show/hide actions on a few pages
caused by some problematic jQuery syntax.

To test, apply the patch and go to Acquisitions.

Testing basket.tt:

- Locate a vendor which has an open basket with multiple orders.
- View the details of that basket.
- Click the 'Show all details' checkbox above the table of orders.
  - Checking the box should trigger the display of additional columns in
    the table.
  - Unchecking the box should hide them again.

Testing invoice.tt:

- Go to Acquisitions -> Invoices and perform an invoice search.
- Click to view an invoice which includes one or more received records.
- Click the 'Show all details' checkbox above the table of titles and
  confirm that it fuctions as described above.

Testing newordersubscription.tt:

- Go to Acquisitions and locate a vendor which is linked to a
  subscription
- Create or add to a basket for that vendor.
- Add an order using the 'From a subscription' option.
- Perform a search for subscriptions.
- In the table of subscriptions search results, checking or
  unchecking the "Show only renewed" checkbox should work correctly.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoDBREv Bug 16354 - Fix FK constraints for edifact_messages table
Brendan Gallagher [Tue, 26 Apr 2016 23:14:02 +0000 (23:14 +0000)]
DBREv Bug 16354 - Fix FK constraints for edifact_messages table

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16354 - TestBuilder.t fails due to key constraints
Kyle M Hall [Tue, 26 Apr 2016 15:45:38 +0000 (15:45 +0000)]
Bug 16354 - TestBuilder.t fails due to key constraints

Test Plan:
1) prove t/db_dependent/TestBuilder.t
2) Note failure
3) Apply this patch
4) prove t/db_dependent/TestBuilder.t
5) Tests should now pass!

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Failure noted and corrected.
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16249: Zebra-specific tests should pass with ES disabled
Tomas Cohen Arazi [Tue, 12 Apr 2016 18:26:44 +0000 (15:26 -0300)]
Bug 16249: Zebra-specific tests should pass with ES disabled

This patch makes the t/db_dependent/Search.t tests correctly set
'Zebra' for the 'SearchEngine' syspref.

To test:
- On top of bug 12478 branch, run
  $ prove t/db_dependent/Search.t
=> FAIL: Tests fail
- Apply the patch
- Run:
  $ prove t/db_dependent/Search.t
=> SUCCESS: Tests now pass.

Signed-off-by: Chris <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: (RM followup) fix syntax error in updatedatabase.pl
Brendan Gallagher [Tue, 26 Apr 2016 20:55:25 +0000 (20:55 +0000)]
Bug 12478: (RM followup) fix syntax error in updatedatabase.pl

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
8 years agoDBRev for Bug 12478 - Elasticsearch support for Koha
Brendan Gallagher [Tue, 26 Apr 2016 20:55:25 +0000 (20:55 +0000)]
DBRev for Bug 12478 - Elasticsearch support for Koha

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12748: (QA followup) make new tests pass
Jesse Weaver [Mon, 25 Apr 2016 18:00:13 +0000 (12:00 -0600)]
Bug 12748: (QA followup) make new tests pass

  * t/Koha/ItemType.pm:
    * Rename to .t
    * Fix method names
  * t/db_dependent/Koha/ItemTypes.t: Fix method names and Koha::Database usage

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12748: (QA followup) fix several tiny QA tools warnings
Jesse Weaver [Mon, 25 Apr 2016 18:00:13 +0000 (12:00 -0600)]
Bug 12748: (QA followup) fix several tiny QA tools warnings

  * admin/searchengine/elasticsearch/mappings.yaml:
    * Fix indentation so QA tools believe it's valid YAML
  * C4::AuthoritiesMarc: Remove tab character
  * C4::Search: Fix POD
  * Koha::BiblioUtils: remove "return undef"
  * Koha::Schema::Result::Search*: rename type to _type
  * Koha::SE::ES::Search:
    * Fix spelling/@_[0]
    * Add my to loop variable
    * Remove unused var $error
    * Add use Modern::Perl
    * Fix undefined variables
  * Koha::ES::Indexer: fix POD
  * Koha::SE::ES::QueryBuilder:
    * Don't define variables in conditionals
    * Fix POD
  * Koha::SE::Zebra::Search:
    * Fix debug warns/POD/barewords
    * Koha::SE::Zebra::Search: add use Modern::Perl
  * kohastructure.sql: remove old, unused elasticsearch_mappings table,
    add new tables
  * labels/label-item-search.pl: remove C4::Dates
  * opac/elasticsearch.pl: remove old file

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 16248: ModZebra doesn't update zebraqueue if ES is enabled
Tomas Cohen Arazi [Tue, 12 Apr 2016 18:33:25 +0000 (15:33 -0300)]
Bug 16248: ModZebra doesn't update zebraqueue if ES is enabled

The zebraqueue table should still be populated with updates if ES is enabled, so
the Zebra indexer keeps the Z39.50/SRU indexes up to date.

To test:
- Set SearchEngine = Elasticsearch
- Watch for zebraqueue changes
  $ watch -n 0.5 'echo "SELECT COUNT(*) FROM zebraqueue WHERE done=0" | sudo koha-mysql kohadev'
- Call touch_all_biblios.pl to simulate record changes
  $ sudo koha-shell kohadev ; cd kohaclone
  $ perl misc/maintenance/touch_all_biblios.pl -v
=> FAIL: Notice the watch is not changing the number of records to be indexed.
- Apply the patch
- Call touch_all_biblios.pl to simulate record changes
  $ sudo koha-shell kohadev ; cd kohaclone
  $ perl misc/maintenance/touch_all_biblios.pl -v
=> SUCCESS: The count raises (more than 0) and the zebra indexer picks the updates.
- Sign off

Signed-off-by: Chris <chrisc@catalyst.net.nz>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 Increasing test Coverage for Koha::SearchEngine::Elasticsearch::Search
Chris Cormack [Thu, 14 Apr 2016 21:27:10 +0000 (21:27 +0000)]
Bug 12478 Increasing test Coverage for Koha::SearchEngine::Elasticsearch::Search

Before this patch it was 24.6%, after it is 64%

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 Shifting tests and adding copyright headers
Chris Cormack [Thu, 14 Apr 2016 20:23:13 +0000 (20:23 +0000)]
Bug 12478 Shifting tests and adding copyright headers

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 : Fixing the tests for Koha::SearchEngine::Elasticsearch::Search
Chris Cormack [Wed, 13 Apr 2016 21:20:36 +0000 (21:20 +0000)]
Bug 12478 : Fixing the tests for Koha::SearchEngine::Elasticsearch::Search

perl t/Koha_SearchEngine_Elasticsearch_Search.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 : Fixing the tests in t/Koha_ElasticSearch_Indexer.t
Chris Cormack [Wed, 13 Apr 2016 20:51:59 +0000 (20:51 +0000)]
Bug 12478 : Fixing the tests in t/Koha_ElasticSearch_Indexer.t

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Making sure the syspref is set to Zebra by default
Chris [Tue, 12 Apr 2016 20:57:49 +0000 (08:57 +1200)]
Bug 12478: Making sure the syspref is set to Zebra by default

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 : Remove the rest of the references to the old mapping tables
Chris [Tue, 12 Apr 2016 20:45:28 +0000 (08:45 +1200)]
Bug 12478 : Remove the rest of the references to the old mapping tables

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478 : Remove reference to deprecated table elasticsearch_mapping.sql
Chris [Tue, 12 Apr 2016 20:42:53 +0000 (08:42 +1200)]
Bug 12478 : Remove reference to deprecated table elasticsearch_mapping.sql

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: (QA followup) Koha::SearchEngine should fallback to Zebra
Tomas Cohen Arazi [Tue, 12 Apr 2016 20:05:57 +0000 (17:05 -0300)]
Bug 12478: (QA followup) Koha::SearchEngine should fallback to Zebra

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Signed-off-by: Chris <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Define simple_search_compat for Zebra
Jonathan Druart [Mon, 11 Apr 2016 07:11:11 +0000 (08:11 +0100)]
Bug 12478: Define simple_search_compat for Zebra

When Zebra is defined as the search engine, the authority search is
broken (Can't locate object method "simple_search_compat" via package
"Koha::SearchEngine::Zebra::Search" at /home/koha/koha/C4/AuthoritiesMarc.pm line 357.)
simple_search_compat is not defined in
Koha::SearchEngine::Zebra::Search, it should be a wrapper for
C4::Search::SimpleSearch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Display facet terms ordered by number of occurrences
Jonathan Druart [Tue, 13 Oct 2015 09:45:32 +0000 (10:45 +0100)]
Bug 12478: Display facet terms ordered by number of occurrences

By default ES returns the facet terms ordered by most used, which makes
sense.

This patch removes resort done in the scripts (catalogue/search.pl and
opac/opac-search.pl) and moves it to the module.

For Zebra it's now done in C4::Search::getRecords, and there is no
change to expect (still alphabetically).

On the Elastic search side, we could imagine to let the library define
the order of the facets. The facet terms are now sorted by most used.

To test easily this change, turn on the displayFacetCount pref.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoRevert "Bug 12478: Display facet terms ordered by number of occurrences"
Robin Sheat [Tue, 13 Oct 2015 04:21:36 +0000 (17:21 +1300)]
Revert "Bug 12478: Display facet terms ordered by number of occurrences"

This reverts commit cd4905c2969b067476881016d0b03271f0bcc7c8.

This commit caused an error in C4::Search::GetFacets when running in
zebra mode.

Conflicts:
Koha/SearchEngine/Elasticsearch/Search.pm

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Remove previous mappings file (sql)
Jonathan Druart [Mon, 12 Oct 2015 16:03:38 +0000 (17:03 +0100)]
Bug 12478: Remove previous mappings file (sql)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Manually add the many_to_many relationships
Jonathan Druart [Mon, 12 Oct 2015 15:54:12 +0000 (16:54 +0100)]
Bug 12478: Manually add the many_to_many relationships

This will create the add_to_* accessors for us.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: update the schema
Jonathan Druart [Mon, 12 Oct 2015 15:52:11 +0000 (16:52 +0100)]
Bug 12478: update the schema

These files have been generated with the
misc/devel/update_dbix_class_files.pl script.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Move mapping attributes to the join table
Jonathan Druart [Mon, 12 Oct 2015 15:46:16 +0000 (16:46 +0100)]
Bug 12478: Move mapping attributes to the join table

To make things consistent, the attributes of the mappings (sort,
suggestible, facet) should be moved to the join tables
(search_marc_to_field).
Indeed the search_marc_map could represent a mapping for several search
fields with different attributes. Before this change it was not
possible.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Add Koha::SearchField[s] and Koha::SearchMarcMap[s] classes
Jonathan Druart [Fri, 25 Sep 2015 14:48:50 +0000 (15:48 +0100)]
Bug 12478: Add Koha::SearchField[s] and Koha::SearchMarcMap[s] classes

This was initially submited on bug 14899, but we will need it here.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Add the yaml mappings file
Jonathan Druart [Mon, 12 Oct 2015 16:11:28 +0000 (17:11 +0100)]
Bug 12478: Add the yaml mappings file

This should facilitate the modification of the mappings.
The yaml format is more readable than sql.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: "fix" notforloan
Robin Sheat [Thu, 8 Oct 2015 04:02:21 +0000 (17:02 +1300)]
Bug 12478: "fix" notforloan

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Take the FacetMaxCount pref into account
Jonathan Druart [Mon, 5 Oct 2015 16:15:01 +0000 (17:15 +0100)]
Bug 12478: Take the FacetMaxCount pref into account

The system preference FacetMaxCount should work as expected with ES.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Remove empty limit parameter
Jonathan Druart [Mon, 5 Oct 2015 10:34:54 +0000 (11:34 +0100)]
Bug 12478: Remove empty limit parameter

If no limit are passed, the url will contain '&limit=' anyway.
It is not necessary and can be avoided easily

Test plan:
1/ Search for a term in your catalogue
2/ Hover over a link in the facet area
3/ The link is
cgi-bin/koha/opac-search.pl?idx=kw&q=your_term&limit=&limit=[...]

With this patch, the empty limit parameter does not appear.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Display facet terms ordered by number of occurrences
Jonathan Druart [Mon, 5 Oct 2015 14:29:52 +0000 (15:29 +0100)]
Bug 12478: Display facet terms ordered by number of occurrences

By default ES returns the facet terms ordered by most used, which makes
sense.

This patch removes resort done in the scripts (catalogue/search.pl and
opac/opac-search.pl) and moves it to the module.

For Zebra it's now done in C4::Search::getRecords, and there is no
change to expect (still alphabetically).

On the Elastic search side, we could imagine to let the library define
the order of the facets. The facet terms are now sorted by most used.

To test easily this change, turn on the displayFacetCount pref.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: facets - Display description instead of code for locations
Jonathan Druart [Mon, 5 Oct 2015 11:50:52 +0000 (12:50 +0100)]
Bug 12478: facets - Display description instead of code for locations

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Add Koha::AuthorisedValue[s] class
Jonathan Druart [Mon, 5 Oct 2015 11:51:37 +0000 (12:51 +0100)]
Bug 12478: Add Koha::AuthorisedValue[s] class

These 2 classes come from bug 10363.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Use the new Koha::ItemTypes to retrieve itypes descriptions
Jonathan Druart [Mon, 5 Oct 2015 11:17:09 +0000 (12:17 +0100)]
Bug 12478: Use the new Koha::ItemTypes to retrieve itypes descriptions

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Add Koha::ItemType[s] classes
Jonathan Druart [Tue, 15 Sep 2015 16:02:28 +0000 (17:02 +0100)]
Bug 12478: Add Koha::ItemType[s] classes

These 2 classes come from bug 14828.
Tests in t/db_dependent/Koha/ItemTypes.t should be updated.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: (follow-up) Display the correct number of facets
Jonathan Druart [Mon, 5 Oct 2015 09:58:50 +0000 (10:58 +0100)]
Bug 12478: (follow-up) Display the correct number of facets

This patch fixes a side-effect of the previous "Display the correct
number of facets (5 instead of 6)" patch.

If you ask for more facets ('show more' link) and that the number of
facets is > 5 but < 10, 1 facet will be missing.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: abort early if there's no elasticserch definition
Robin Sheat [Mon, 5 Oct 2015 04:44:14 +0000 (17:44 +1300)]
Bug 12478: abort early if there's no elasticserch definition

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 14899: schema changes to make the database better
Robin Sheat [Mon, 5 Oct 2015 03:21:42 +0000 (16:21 +1300)]
Bug 14899: schema changes to make the database better

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 14899: DB changes
Jonathan Druart [Fri, 25 Sep 2015 15:06:07 +0000 (16:06 +0100)]
Bug 14899: DB changes

This patch applies several changes to the DB structure introduced by
the previous ES patch set:

1/ Add a search_field.label column
=> It will be easier to understand what the search_field does.
Indeed, some are not user friendly: acqdate, an, pl, ff8-23, ln, etc.
TODO later: Update the labels with correct values (at the moment
label=name)

2/ Update the foreign key search_marc_to_field.search_marc_map_id with
on delete cascase. This will permit to automatically remove the entries
in search_marc_to_field when they are deleted in search_marc_map.

3/ Remove the index_name_2 unique constraint on the search_marc_map table.
I don't understand how this could be useful, it was defined like (index_name,
marc_type, marc_field), so it means a mapping cannot be defined twice with
different values for facet, suggestible and sort.
This limitation does not seem to make sense.
Robin, please correct me if I am wrong :)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: add location, su-geo, se to facets
Robin Sheat [Fri, 2 Oct 2015 02:23:07 +0000 (15:23 +1300)]
Bug 12478: add location, su-geo, se to facets

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: fix errors from rebase and new upstream version
Robin Sheat [Thu, 1 Oct 2015 02:53:44 +0000 (15:53 +1300)]
Bug 12478: fix errors from rebase and new upstream version

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: fix some issues on rebase
Robin Sheat [Wed, 30 Sep 2015 02:46:18 +0000 (15:46 +1300)]
Bug 12478: fix some issues on rebase

There were rebase conflicts that it was just easier to postpone until
afterwards.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Fix error on indexing a specific record
Jonathan Druart [Fri, 4 Sep 2015 12:00:48 +0000 (13:00 +0100)]
Bug 12478: Fix error on indexing a specific record

% perl misc/search_tools/rebuild_elastic_search.pl -bn 42
Can't locate object method "idnumber" via package "MARC::Record" at
misc/search_tools/rebuild_elastic_search.pl line 171.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Fix encoding issue on facets
Jonathan Druart [Fri, 28 Aug 2015 10:59:26 +0000 (11:59 +0100)]
Bug 12478: Fix encoding issue on facets

Filer on "Ślez, Ts." => Can't escape \x{015A}, try uri_escape_utf8()
instead at
/home/koha/src/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm line 221.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Do not display the 'Show more' links if no more facet available
Jonathan Druart [Fri, 28 Aug 2015 10:29:23 +0000 (11:29 +0100)]
Bug 12478: Do not display the 'Show more' links if no more facet available

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Display the correct number of facets (5 instead of 6)
Jonathan Druart [Fri, 28 Aug 2015 10:24:24 +0000 (11:24 +0100)]
Bug 12478: Display the correct number of facets (5 instead of 6)

The loop on facet entries was wrong, it should stop after 5
iterations.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Remove Solr occurrences reintroduced by a previous patch
Jonathan Druart [Fri, 28 Aug 2015 10:13:45 +0000 (11:13 +0100)]
Bug 12478: Remove Solr occurrences reintroduced by a previous patch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Fix pod in the rebuild_ES.pl script
Jonathan Druart [Fri, 28 Aug 2015 10:13:07 +0000 (11:13 +0100)]
Bug 12478: Fix pod in the rebuild_ES.pl script

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Fix the verbose flag on reindexing
Jonathan Druart [Fri, 28 Aug 2015 10:08:27 +0000 (11:08 +0100)]
Bug 12478: Fix the verbose flag on reindexing

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Change the commit count to 5k
Jonathan Druart [Fri, 28 Aug 2015 10:07:51 +0000 (11:07 +0100)]
Bug 12478: Change the commit count to 5k

It will improve the indexing time.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: Fix the UNIMARC and NORMARC indexing
Jonathan Druart [Fri, 28 Aug 2015 10:07:04 +0000 (11:07 +0100)]
Bug 12478: Fix the UNIMARC and NORMARC indexing

1/ This patch fixes a major issue on UNIMARC and NORMARC installations
(Compulsive c/p on insert into insert into search_marc_to_field for unimarc and normarc)

2/ After fixing that, I got
invalid marc path at /usr/share/perl5/Catmandu/Fix/marc_map.pm line 35.
on reindexing.
It was caused by some "" values instead of NULL.

3/ Then, a "duplicate entry" error was caused by 3 lines for Local-number.
It seems to be an error, 1 is enough (I suppose 0909 was an error too).

Note that the following is not fixed by this patch:
MariaDB [koha_es_unimarc]>  insert into search_field (name, type) select distinct mapping, type from elasticsearch_mapping;
Query OK, 73 rows affected, 57 warnings (0.05 sec)
Records: 73  Duplicates: 0  Warnings: 57

MariaDB [koha_es_unimarc]> show warnings;
+---------+------+--------------------------------------------+
| Level   | Code | Message                                    |
+---------+------+--------------------------------------------+
| Warning | 1265 | Data truncated for column 'type' at row 1  |

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: allow more granular sorting configuration
Robin Sheat [Fri, 25 Sep 2015 03:11:29 +0000 (15:11 +1200)]
Bug 12478: allow more granular sorting configuration

This allows sorting to be configured within a field. For example, while
many values are included for search on author, sorting should only be
done on the main entry values. This permits that by have a sort value,
which can be true, false, or null. true and null are pretty much the
same, but false means that a field isn't available for sorting on. By
default (null), fields can be sorted on.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: pull the SQL updates from the browse interface
Robin Sheat [Thu, 27 Aug 2015 04:13:16 +0000 (16:13 +1200)]
Bug 12478: pull the SQL updates from the browse interface

Hopefully will reduce the rate of conflicts down the road. We'll see.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: pull the SQL updates from the browse interface
Robin Sheat [Wed, 26 Aug 2015 05:29:17 +0000 (17:29 +1200)]
Bug 12478: pull the SQL updates from the browse interface

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: the facet "show more" links work properly now
Robin Sheat [Tue, 25 Aug 2015 05:03:08 +0000 (17:03 +1200)]
Bug 12478: the facet "show more" links work properly now

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: add the lenient option to the query_string query
Robin Sheat [Tue, 25 Aug 2015 03:13:51 +0000 (15:13 +1200)]
Bug 12478: add the lenient option to the query_string query

It doesn't really help.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: improve error reporting a bit
Robin Sheat [Thu, 20 Aug 2015 06:12:42 +0000 (18:12 +1200)]
Bug 12478: improve error reporting a bit

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: update to support new Cat::Store::ES
Robin Sheat [Mon, 3 Aug 2015 05:55:54 +0000 (17:55 +1200)]
Bug 12478: update to support new Cat::Store::ES

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: ES is now updated when records are updated/deleted
Robin Sheat [Fri, 17 Jul 2015 02:38:19 +0000 (14:38 +1200)]
Bug 12478: ES is now updated when records are updated/deleted

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: fix capitalisation issue with index names
Robin Sheat [Fri, 10 Jul 2015 03:19:21 +0000 (15:19 +1200)]
Bug 12478: fix capitalisation issue with index names

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: make things using SimpleSearch use the new version
Robin Sheat [Wed, 8 Jul 2015 04:34:12 +0000 (16:34 +1200)]
Bug 12478: make things using SimpleSearch use the new version

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: a replacement to the SimpleSearch interface implemented
Robin Sheat [Fri, 19 Jun 2015 03:55:46 +0000 (15:55 +1200)]
Bug 12478: a replacement to the SimpleSearch interface implemented

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: fix issue with authority sort order being weird
Robin Sheat [Wed, 17 Jun 2015 03:37:29 +0000 (15:37 +1200)]
Bug 12478: fix issue with authority sort order being weird

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: auth search works in the staff client
Robin Sheat [Mon, 15 Jun 2015 05:35:41 +0000 (17:35 +1200)]
Bug 12478: auth search works in the staff client

Some issues with sort order though.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
8 years agoBug 12478: starting authority search in staff client
Robin Sheat [Mon, 15 Jun 2015 03:12:39 +0000 (15:12 +1200)]
Bug 12478: starting authority search in staff client

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>