Bug 10058 - Fix unapi for NORMARC

This patch uses a lot of MARC21 XSLT to transform NORMARC records
to desired formats. Since NORMARC is mostly a subset of MARC21, I
think this should give passable results. And better results than
no unapi-support at all for NORMARC!

To reproduce:
- Make sure you have marcflavour = NORMARC
- Visit /cgi-bin/koha/unapi in a browser
- Observe the empty <formats></formats> element

To test:
- Apply the patch
- Visit /cgi-bin/koha/unapi in a browser
- Observe the the list of formats in the <formats></formats> element
- Import the provided sample NORMARC record and make a note of its
  biblionumber
- View the record at /cgi-bin/koha/unapi?id=koha:biblionumber:x&format=y
  where x = the biblionumber of the sample record and y = one of the
  formats marcxml, marcxml-full, mods, mods-full, mods3, mods3-full,
  oai_dc, rdfdc, rss2, rss2-full and srw_dc
- Check that the transformed records make some kind of superficial
  sense

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_10058' into 3.14-master
Bug 10074 - Encoding problems at login time

Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded.
(At least) the staff login screen outputs directly to STDOUT (Auth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first.

This patch makes it use output_html_with_http_headers and solves the problem.

Changed 'use' for 'require' as jcamins and marcelr suggested.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10074 - Encoding problems for installer

Bug 6554 patched output_html_with_http_headers to encode utf8 data, and Templates.pm to expect utf8 data to be encoded.
The Installer page login screen outputs directly to STDOUT (InstallAuthAuth.pm does, WHICH IS WRONG!) and wasn't fixed to do the encoding first.

This patch makes it use output_html_with_http_headers and solves the problem.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10074: QA Followup for InstallAuth.pm

Moving use Output.pm to optional require.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_10074' into 3.14-master
Bug 10019: Fix for userid containing UTF8 chars

Decodes userid on two places in checkauth of C4/Auth.pm

Test plan:
Include some non-Latin characters in your userid (loginname). Arab, Chinese?
Login into opac and check user page.
Go to staff (no new login), check your login name at various places.
Logout, login via staff.
Do the same.
Go to opac again (no new login), check user page.
Optionally: Remove all your sessions from table. Do a login. Check sessions.

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

Comment: Works as described. No errors.
This patch fixes this problem, but I wonder if
there is a general solution that handle all as utf8.
Tested in opac and staff.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_10019' into 3.14-master
Bug 10072 - "my suggestions" always says "There are no pending purchase suggestions."

Test Plan:
1) Switch off the IndependantBranches syspref
2) Log into the OPAC
3) Place a suggestions
4) Instead of seeing your suggestion, you will see "There are no pending
   purchase suggestions."
5) Apply this patch
6) Reload the page
7) You should now see your suggestions

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_10072' into 3.14-master
Bug 9951: Followup for Tools

Adds decoding for Patron Cards/Patron Search and Tags (moderation).

Test plan:
Goto Tools. Add accent with diacritics in both areas. Check if you do not see
converted characters.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9951: Followup for tools/viewlog.pl

Adds utf8 cgi parameter decoding.

Test plan: Enter diacritics in librarian field. Submit. Check.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

This is ok in this case, as we are not doing any post/get of binary
data, but I note from the man page

This makes CGI.pm treat all parameters as UTF-8 strings. Use this with
care, as it will interfere
with the processing of binary uploads. It is better to
manually select which fields are expected
to return utf-8 strings and convert them using code like
this:

  use Encode;
  my $arg = decode utf8=>param('foo');
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_9951' into 3.14-master
Bug 8746: rebuild_zebra_sliced.sh now export/index records as MARCXML

This avoid indexing failures due to "bad offset" or "bad length" error
with ISO2709 format

+ minor improvements:
  -  --length parameter is optional. If not given, it will execute the
     right sql query to find the number of records to index
  -  new parameter --reset-index. If set, index is reset before indexing

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

Test: Edit record to make it longer than 9999. Without patch rebuild_sliced
fails. With patches works.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8746: Fix indexation in DOM index mode

When in DOM index mode, files exported by `rebuild_zebra.pl -x` are
wrapped by '<collection></collection>' tag.
This is a problem because splitting files produces invalid files.
This is fixed by adding the missing <collection> tags in each generated
file.
Another problem was that the wrong zebra configuration file was used.
The script now uses C4::Context->zebraconfig($server)->{config} to know
which configuration file has to be used.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8746 [Follow-up] Replace == by eq in string comparison

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_8746' into 3.14-master
Bug 9860 [Alternate] Incorrect box heading 'Cannot check in' when a late document is returned

The fix for Bug 9397 moved the "cannot check in" heading from within the
one conditional where it should have been displayed to the top of all
check-in errors/messages. "Cannot check in" is still only valid if the
item is withdrawn and BlockReturnOfWithdrawnItems is ON.

In order to accomplish the goal of Bug 9397 while fixing Bug 9860 this
patch puts "cannot check in" back into the correct conditional and adds
a generic heading to check in messages for accessibility purposes.

To test, check in items which will trigger a variety of errors
including:

- item must be returned to home library
- item is lost
- item is withdrawn (wtih BlockReturnOfWithdrawnItems on and off)
- item is overdue

...as well as items which should check in normally. Messages should
display correctly.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_9860' into 3.14-master
Bug 10046: Standardize terms used in invoices

Changes are:
budget > where actually fund is meant
branch > library
bookseller, supplier > vendor

To test:

1) Receive a shipment, check the little form where you
   enter your invoice number for correct use of terms.
2) Receive some orders and save finish receiving.
3) Search for your created invoice. Check filters and
   results table for correct use of terms.
4) Look at the details of your invoice, repeat check there.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>