Bug 6536: Add a form for SRU Field mapping

This form allows you to enter the match between the standard names of
the Z3950 search fields and the field names for a specific SRU server.
This patch only adds the form; it will be used in a subsequent patch.

Test plan:
Not needed, but you can call the form by constructing a URL like:
    cgi-bin/koha/admin/sru_modmapping.pl?mapping=title=1,author=2
You should see the form with title and author filled.
Note that you cannot save the information yet.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Dbrev for Z3950 search improvements

Adjusts table z3950servers:
Drops unused columns icon, description and position.
Moves id column to first position.
Renames name to servername, and type to servertype. (This is not only more
clear but may eliminate some problems too with DBIx.)
Changes recordtype from varchar(45) to enumeration with two members. [The
upgrade replaces unknown record types with biblio, although it is very
unlikely to find such records.]
Adds SRU as servertype enumeration member. Removes opensearch, since it is
not used/supported. [The upgrade replaces unknown server types with zed
(z3950) (in exceptional cases).]
Adds new columns: sru_options, sru_fields, add_xslt.

Test plan:
Run database update via webinstaller.
Check your z3950servers table.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Update DBIx schema of z3950servers for testing

This patch adjusts the DBIx schema file for z3950servers table.
This can be used for testing this set of patches.
When the report is pushed, the RM should update the DBIx schema.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: SRU servers administration

This patch makes adjustments in admin/z3950servers in order to insert,
edit and delete SRU server records.

Test plan:
Add, edit, copy and delete SRU server.
Check if adding, editing, copying and deleting Z3950 servers still works.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Adjustments for servername and servertype

Replaces name by servername, type by servertype for running Z3950 search.
Limit search scripts to zed (z3950) servers until sru is supported.

Test plan:
Perform a Z3950 search in Cataloguing and Acquisition.
Verify that it still works as it did.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Include SRU searching in Breeding.pm

This patch makes it possible to include SRU servers in Z3950 search.
It adjusts the Z3950Search routine in Breeding module.
It also replaces SQL code with DBIx statements in Breeding.pm/Z3950Search
and the associated scripts z3950search.pl in cataloguing and acqui.

Test plan:
Verify if a normal Z3950 search still works in cataloging/acqui.
Add a SRU target. (You could just use Koha's port 9998.)
Define sru_options like sru=get.
Use that target in a Z3950 search in cataloging and acqui. (Import.)
Test sru_fields translation by comparing search results between various
settings for some of the fields. For instance, leave title empty and
after that set it to the title field of your SRU target.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Add XSLT transformation on Z3950 search results

Use the stylesheets listed in field add_xslt of z3950servers to transform
search results of Z3950/SRU search.
Additionally, the template has been changed to make more error messages (or
warnings) visible when displaying results. Until now, error message were
shown in the results table and when connection errors occurred, no results
were displayed at all.

Test plan:
Create some stylesheets (or see the sample patch on bug 6536).
Add these stylesheets to some Z3950/SRU servers.
Do Z3950 search and verify the transformations.
Do a search with 2 targets; make one target fail (by manipulating its server
data). Do you see the connection error and the results for the other target?
Generate a XSLT error by modifying one stylesheet. Check search results. You
should see warnings.

Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: [QA Follow-up] Remove surrounding spaces in sru_fields

This patch only removes surrouding spaces at comma and equals-sign while
passing the options in sru_fields to the ZOOM object.

Test plan:
If you add spaces between options in sru_fields, searching should still work.
E.g. sru_fields= sru = get , sru_version = 1.1

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: QA Follow-up for string changes referring to Z39.50

Z39.50 search now includes SRU targets.
This patch only touches strings referring to it.
No changes in behavior.
It replaces Z39.50 with Z39.50/SRU or external.

Deletes obsolete template z3950/searchresult.tt: not in use for some time.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: QA Follow-up: Add some unit tests for Z3950Search in Breeding.pm

This patch may serve as a starting point for more unit tests in this part
of the code.
In this patch most internal subroutines of Z3950Search are covered.
In the XSLT part we reuse a XSL template from the XSLT_Handler.t test.
It needed a little tweaking for namespaces. And added the indicators on
the 990 field.

Test plan:
Run both Breeding.t and XSLT_Handler.t.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: QA Follow-up for removing warnings from QA tools

Resolved:
[1]  FAIL   C4/Breeding.pm
FAIL   critic ControlStructures::ProhibitMutatingListFunctions

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
No warnings anymore.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: QA Follow-up for fixing a unit test under Perl 5.18

The last test on the first series, fails randomly on Perl 5.18:
    not ok 12 - Third query makes no difference
    #   Failed test 'Third query makes no difference'
    #   at t/db_dependent/Breeding.t line 104.
    #          got: ''
    #     expected: '1'
    # Looks like you failed 1 test of 12.
not ok 1 - _build_query

This change makes tests pass. Please consider if this needs to be fixed
(i.e. sort order matters) or the test needs to be rewritten.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
I agree with adding the sort. (The need for doing this in Perl 5.18 is another
topic.)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Follow-up: Updating web installer sql files for z3950servers

Removing icon, description and position from installer sql files.
Not all files contained them.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
I have run all sql files on an empty table by script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: Follow-up: Updating installer sql files for z3950servers (Part 2)

This patch renames name to servername and type to servertype.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested all sql files by script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: DBRev 3.17.00.017

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 6536: (RM followup) make DBIx::Class::Schema::Loader happy

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12674: (regression tests) GetMarcISSN should not return empty ISSN

Proves GetMarcISSN returns empty ISSNs in the results array.

To reproduce:
 - Run $ prove -v t/db_dependent/Biblio.t

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12674: GetMarcISSN should not return empty ISSN

This patch makes GetMarcISSN test for empty subfield before pushing to the
result array.

To test:
- Run the regression test
=> FAILS for all MARC flavours
- Apply the patch
- Run the regression test
=> SUCCESS: tests pass
- Sign off

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10308 - local subjects can use authorities too

This adds entries for 690-699 to the authorities linker, so they get
linked up like everything else.

To Test:
 * make sure your framework doesn't have 690 set up to link to
   authorities (or it'll get linked as part of cataloguing.)
 * add a subject with some term to the 690$a field.
 * add an authority for TOPIC_TERM with the matching term.
 * make sure zebra is up to date.
 * run link_bibs_to_authorities.pl over your system.
 * check that the authority is now linked to your record.
 * repeat with the other 69x fields if you like.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested using 696a (PERSO_NAME). Works as described, no errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This works as described, but linked authorities won't search
correctly when clicking on the link on the detail page,
as the 69x $9 is not indexed.

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