Bug 5502 - Patron card category search field should be menu

When searching for patrons to add to a patron card creator batch there
is a text input field for submitting a patron category. This should be a
dropdown menu. This patch corrects it.

To test, go to Tools -> Patron card creator and click "New batch."
 - Click the "Add item(s)" button.
 - Confirm that in the Patron search pop-up window there is a dropdown
   menu populated with existing patron categories.
 - Confirm that searches limited by patron category return correct
   results.
 - Confirm that the correct patron category is automatically preselected
   after performing a search limited by category.
 - Confirm that reordering the table of search results works correctly.

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12600: remove duplicate use statement from code

A use C4::Charset was added deep in the body of the code
we have already imported it at the top of the file
(the by convention normal place) As use is executed at compile time
specifying it in the code body does not serve a
useful purpose and detracts from the readability of an already
overly complex subroutine.
Remove the superfluous statement
also removed the tabs introduced to the surrounding lines
by the same commit

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Search still works, no errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 5672: Gives RSS icons to catalog search history

This patch adds an extra column to the table for the search history (this session and previous searches) with RSS icons for each search.

Test plan:
* Verify that there is no RSS icons for saved searches in opac
* Install the patch
* Verify that there is no RSS icons for saved searches and searches for the current session in Opac.
* Test that the RSS links produce the expected result.

Note: I left out authority searches since I have very little experience with authority searches and didn't feel I could test it properly.
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 5672: Gives RSS icons to catalog search history placed to the left of saved searches

Test plan:
* Verify that there is no RSS icons for saved searches in opac
* Install the patch
* Verify that there is no RSS icons for saved searches and searches for the current session in Opac.
* Test that the RSS links produce the expected result.

Note: I left out authority searches since I have very little experience with authority searches and didn't feel I could test it properly.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12738: (regression tests) C4::Context should set keyword search as default for QueryParser

This patch introduces tests for the QueryParser PQF driver usage in Koha. Specifically its
initialization on C4::Context, and initial setup.

It also introduces a .pl script that is used to load C4::Context with different hash randomization
seeds on purpose, to verify the initialization result is deterministic and consistent between
runs.

To test:
  $ prove -v t/db_dependent/QueryParser.t

It should fail because different default_search_class is set on each run, and it is not often the
one we expect.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12738: C4::Context should set 'keyword' as the default search class

On a Perl 5.18 environment (e.g. Ubuntu 14.04 LTS):

To reproduce:
- Have UseQueryParser == "Don't try"
- Perform a search typing just a word that would have many matches on your Zebra db.
- Take note of the search results count.
- Make sure you have the queryparser.yaml file in your config dir.
- Set UseQueryParser == "Try"
- Perform the same search a couple of times
=> FAIL: Notice that the search results count differs from one run to the other.
- Run the regression tests
  $ prove -v t/db_dependent/QueryParser.t
=> FAIL: tests fail

To test:
- Apply the patch
- Run tests
  $ prove -v t/db_dependent/QueryParser.t
=> SUCCESS: tests pass
- Repeat the steps 'To reproduce'
=> SUCCESS: Search results count is deterministic :-D
- Sign off :-D

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Now search with QueryParser always returns the correct number of
results on a system with the newer Perl version.
Passes all tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12647: PQF QueryParser driver and unit tests fixes

Due to Perl 5.18, QueryParser the default search class is no longer
'keyword' (see bug 12738), and needs to be set manually. This patch
adds a line that does that. The problem that gets fixed is with test
'super simple keyword query'.

The rest of the non-deterministically failing tests are due to the same
problem, keys returning differently sorted keys from hashes.

So this patch sorts keys in the step that concatenates attributes when building
the PQF queries (and tests get adjusted to match the now deterministic result).

I did that (sorting there) under Jared's recommendation. Hopefuly he will step
in and comment/fix any mistake I made. My main concern was a possible loss
in performance. That we agreed it is almost void, because of the tiny size
of the hash.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests are passing now again :)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10542: Fix QueryParser with OpacSupression

OpacSupressions manipulates the query string after the buildQuery
call and so breaks with queryParser enabled.  This patch adds
checks for queryParser and manipulates the query before passing it
to buildQuery if it is enabled, but leaves the post buildQuery
manipultation when queryParser is disabled

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Adding a sing after test

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10542: QueryParser + OpacSuppression doesn't allow search in 'all libraries'

Since we're using the $query_type variable to detect if this pre-built
query is PQF, we need to use PQF syntax (rather than QueryParser
syntax) when adding to the query. I've made a lot of notes of somewhat
incoherent notes on Bugzilla talking about PQF, CCL, and QP syntaxes,
but I'm hoping to refine these notes on a wiki page for future
reference.

_TEST PLAN_

1) Set 'Suppress in Opac' (ie 942$n) to 1 for one record
2) Re-index Zebra
3) Set 'OpacSuppression' to 'Hide'
4) Set 'UseQueryParser' to 'Do not try'
5) In the staff client, do a search that will return that suppressed
record as well as a few records that are NOT suppressed
6) Note that you can return that suppressed record in the staff client
7) Do the same search in the OPAC
8) Note that the suppressed record doesn't appear
9) Set 'UseQueryParser' to 'Try' && re-run the OPAC search
10) Note that no results appear (the logs will probably mention a
ZOOM error)

11) Apply patch

12) Re-run the OPAC search
13) Note that the suppressed record doesn't appear, and that the
not suppressed records are showing (it's important that you are
getting some results...as ZOOM errors are silent in the UI).
14) Set 'UseQueryParser' to 'Do not try'
15) Re-run the search
16) Note that the suppressed record doesn't appear, and that the
not suppressed records are showing

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

Work as described following test plan.
No koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described - hidden records are hidden.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12700 - Capitalization: "Close Help Window" in context help

To test:
- Open help in any page of staff client
- In help popup window, see wrong capitalization in button 'Close Help Window'
- Close the popup window
- Apply patch
- Check again: Button now reads "Close help window'

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

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12623: SQLHelper replacement - Borrower::Modifications

With this patch, the subroutines AddModification and ApproveModifications uses DBIx::Class instead of C4::SQLHelper.
Moreover, the tests has been wrapped in a transaction.

Test plan:
1) Apply the patch

2) Execute the unit tests by launching :
prove t/db_dependent/Koha_borrower_modifications.t

3) The result has to be a success without error or warning :
t/db_dependent/Koha_borrower_modifications.t .. ok
All tests successful.
Files=1, Tests=14,  2 wallclock secs ( 0.03 usr  0.01 sys +  1.60 cusr  0.08 csys =  1.72 CPU)
Result: PASS

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12727 - Patron category filter in batch patron deletion tool is broken

After commit 6973e3b7d50777a147a29f2f3d213a6175c9eb74, patron category
filter in batch patron deletion tool (tools/cleanborrowers.pl) doesn't
work properly any longer. It's still possible to choose a patron
category as selection criterion, but this criterion is being
efectivelly ignored on futhers steps.

As a result, all patrons (with no check-outs and no outstanding
account balance) may get mistakenly deleted when using this tool,
despite their respective categories.

To test:

1/ apply patch
2/ follow the test plan[s] for Bug 11975

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7944 - attribute error could be clearer

If you try to create a patron and enter an extended attribute value
which is required to be unique but exists in another record the error
you receive is not clear. It uses the attribute code instead of the
description. This patch adds description to the output.

To test you must have ExtendedPatronAttributes enabled.

- Edit or create an extended patron attribute and designate it a unique
  identifier.
- Edit a patron and add a value to that attribute.
- Edit another patron and try to add the same value.

You should get an error which includes both the description of the
attribute you tried to modify and the value you submitted.

Signed-off-by: Christopher Brannon <christopher@debian.brannon.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and Qa script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12693 - colspan calculation done by members/statistics.pl should be moved to template

It is not necessary for the patron statistics script to pass a colspan
value to the template. The number can be output using Template::Toolkit
syntax.

To test, view the statistics page for a patron. Confirm that the "Total"
cell in the footer spans the correct number of columns. Test with
various numbers of fields in the StatisticsFields system preference.

Followed test plan. Patch behaves as expected.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 9013 - Cart in staff interface displays location pulled from Description (OPAC)

When the cart in the staff client pulls description data for
items.location and items.ccode it pulls the value designated for the
OPAC--probably a cut-and-paste error when the feature was added to the
staff client.

This patch removes the 'opac' parameter from GetKohaAuthorisedValues.

To test you must have at least one LOC authorized value configured to
have different descriptions for staff and OPAC. Locate or edit an item
with that shelving location and add that record to the cart in the staff
client.

When you view the cart, the shelving location description in the "Items"
column should show the description for the staff client, not the OPAC.

Signed-off-by: Nick Clemens <nick@debian>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 766: Remove CGI::scrolling_list from aqplan.pl

This patch removes 3 occurences on aqplan.pl

To test:
1. You need a budget and a fund
2. Apply the patch
3. Go to Aquisitions, click on your fund
4. Select one of the options on pulldown Planning
e.g. "Plan by months"
5. Now to the left there are two boxes, Filter and Export

a) Filter: (1) pulldown below 'Select planning type'
check that works selecting other values and submit
This pulldown showed originally code types,
untranslatable BTW. Added a TT block to allow translation
and shows legends that match Planning pulldown, but not
the order.

b) Export: pulldowns for filetype (2) and delimiter (3)
Those have originally one value each, and for me Export
does not work, before or after patch, but check that
pulldown exist.

Notes:
A) 5.a) I can change de order of main Planning pulldown,
is harcoded. The values for Filter pulldown are sorted on
aqplan.pl. Is one or the other.
If desired, TT block can be moved to includes/budgets-admin-toolbar.inc
(where hardcoded Planning lives)

B) 5.b) Moved 'Export' legend inside it's box, like Filter.

C) Finally: there is something strange, before or after patch.
There is an empty option 'Planning by " if you select planning
using main pulldown, it disappears if you select planning using
Filter (not a mistery, using Planning fills $auth_cats_loop,
using Filter submit button does not)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Looks like this needs more work, but no regressions found that were
caused by the patch.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 766: Remove CGI::scrollinglist from authorised_values.pl

This patch removes the only instance in this file.
Also fixes array sorting, removes some tabs, removes
an unneeded $dbh handler (there is a global one).
Makes use of C4::Koha::GetAuthorisedValueCategories.

To test:
1. Apply the patch
2. Go to Administration > Authorised values
3. Replaced pulldown next to 'Show category' must
show all (present & system) categories correctly ordered.
4. Select some and check for regressions, e.g. CCODE, Bsort2, YES_NO
no changes must be observed

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 766: Remove CGI::scrollinglist from marctagstructure.pl

This patch removes the only instance in this file.

Don't know if the feature is of some utility, seems
that does not work (no use of auth values as indicators
on MARC editor)

To test:
1. Apply the patch
2. Go to Administration > MARC frameworks
3. Clic on MARC structure of any fw
4. Clic Edit on any tag
5. On tag editor check the pulldown 'Authorised value', that was replaced
6. Check for regressions: select a value, save, verify the value, change
again, etc.

Note: removed a SELECT, using now C4::Koha::GetAuthorisedValueCategories
Do not we need an AuthorisedValues.pm? (on C4 or Koha)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12749 - Better translatability for list module

This patch changes wording of explanations in list module to make them better translatable.
Additionally, it removes explanation for "Open list" from help screen, because this choice is not available.

To test:
Go to Home > Lists > Public lists > Create new list
Verify that the text changed to "Private list:..." rsp. "Public list:..." in right part of screen and on help screen.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12659:Fixing mispelling of the word receive

To test go to:
 acquisitions statistics>subscription history

Find mispelled word
 "recieve"

Change to correct spelling
 "receive"

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

As Katrin suggest:
- check the manual history box in one of your subscriptions
- go to the subscription detail page, on the planning tab is the
link to the manual history (bit hidden)

There is the typo, fixed now.
No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes typo correctly, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>