Bug 11216: fix bug where editing patron creates indefinite manual restriction

Editing partron data results in unintended adding of indefinite manual
restriction to it. Reason for it is hidden field add_debarment which
is wrongly initialized to 1 instead of 0. Also JavaScript code seems
to want to toggle checkbox, and since this field is hidden correct
approach would be to change its value to 1.

Test scenario:

1. edit patron data
2. verify that debarrment is wrongly added
3. remove debarrment
3. apply this patch
4. edit patron again
5. verify that debarrment wasn't added
6. intentionally add debarrment and verify that it's saved
7. add debarment, enter something in comment but press cancel
   and verify that debarment isn't added

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

This fixes this blocker, however, with or without the patch, the date
is not saved correctly. I will file a new bug for that

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug11216' into 3.14.x
Bug 11137: regression tests for QP search field alias bug

This patch adds regression tests to verify that
Boolean searches using QueryParser function correctly.

This patch also ensures that QP is correctly initalized
when Search.t is run.

To test:

[1] Apply this patch and the following patch.
[2] Verify that prove -v t/QueryParser.t works
[3] Verify that prove -v t/db_dependent/Search.t works
[4] (optional) instead of applying both patches at the same
    time, apply only the regression test patch and run the
    tests listed in steps 2 and 3.  The following tests
    should fail:

t/db_dependent/Search.t (Wstat: 512 Tests: 198 Failed: 2)
  Failed tests:  42, 71
  Non-zero exit status: 2
t/QueryParser.t (Wstat: 256 Tests: 28 Failed: 1)
  Failed test:  12
  Non-zero exit status: 1

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11137: fix certain types of searches run using QueryParser

QueryParser was loading redundant search aliases, which in turn resulted
in certain queries involving two or more clauses joined by a Boolean
operator getting parsed in correctly.

To test:

[1] Enable QueryParser.
[2] Arrange your database so that some some bib records contain
    the keyword 'history' while a smaller subset contain
    both 'history' and 'earth'.  (The exact words used don't
    matter.)
[3] Run the following search from the OPAC global search bar:

    kw:history && kw:earth

[4] Observe that the records that are returned include *all* bibs
    in the database with the keyword 'history'.  In other words, the
    restriction  that the records must also contain 'earth' is not
    observed.
[5] Apply the patch and rerun the search.
[6] This time, the results that are returned should include only those
    that contain both 'history' and 'earth'.
[7] Verify that prove -v t/QueryParser.t passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plans, all tests and QA script.
Also checked the db_dependent/Search.t tests.
Tried some other searches, all seems to be working correctly.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I reproduce the bug and I confirm this patch fixes it.
Without the patch, kw:history && kw:earth, I got:
  Search biblios OK 4 1 1+0 RPN @attrset Bib-1 @attr 4=6 @attr 1=1016 history
With the path, I get:
   Search biblios OK 2 1 1+0 RPN @attrset Bib-1 @and @attr 4=6 @attr 1=1016 history @attr 4=6 @attr 1=1016 earth

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug11137' into 3.14.x
Bug 10684: add regression test

This patch adds a regression test for Koha's ability
to gracefully handle records that Zebra will index but
which MARC::Record won't parse.  In particular, MARC::File::USMARC
croaks on records that contain non-alphanumeric characters in the
tag name.

To test:

[1] After applying this test, run prove -v t/db_dependent/Search.t
    The test script will die when it gets to the regression test.
[2] After applying the main patches that fix the bug, the test
    script should pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10684: make sure that Koha search does not dies on undecodable records

When a record fails to decode during a search, Koha dies with an error.
Koha should ignore bad records and continue on ( and log the error ).

An example of a record that Zebra will happily ingest but which MARC::Record
doesn't like is one that contains a punctuation character in a tag label.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 10684: (follow-up) adjust how undecodable records are logged

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug10684_take2' into 3.14.x
bug 11196: put SearchEngine to sysprefs.sql

To test:

Check that sysprefs.sql runs correctly.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11196: Add SearchEngine syspref in the DB if missing

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Bug 11196: DBrev 3.13.00.043

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug11196' into 3.14.x
Bug 11240: ensure that date of restriction is saved when using patron edit screen

To test:

1/ Edit a patron
2/ Add a restriction with a date (in any format other than iso)
3/ Note the date is not saved
4/ Apply patch
5/ Add restriction again, note it is saved

The problem is output_pref was being called with the wrong parameters

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Note: The issue in on the memberentry form only (not the restriction
form on the check out page).

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug11240' into 3.14.x
Bug 10670: ensure koha-start-zebra sets problem permissions for logs

If koha-common is started when Zebra log files are owned by root
it will fail to start without any useful message (since Zebra can't
write errors in log files because it lacks permissions to do so).

This patch creates empty log files and ensure they have correct
permissions.

I can't pin-point why log files gets owned root, but I suspect it
has something to do with Zebra crashing and logrotate, but this is
just theory. We have seen this behaviour since koha 3.1 every
few months, and every time it happends we have root owned logs and
crashed Zebra so this patch will at least help sites which have
some kind of automatic koha-common start if it's not running.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug10670' into 3.14.x
Bug 10671: Update Circ Help Files

This patch updates the existing help files and
adds the missing offline circ help file.

To test:

* Visit all circ pages and check the manual links
* Visit the new offline circulation page and confirm text
and link are there (link will work after 10/25)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Merge branch 'new/bug10671' into 3.14.x