Bug 7055 - NORMARC: Fix 008 position 15-17 and 35-37

This patch does several things:
- Set the default for 008/15-17 to "no " (yes, there is space at the end)
- Link from 008/15-17 in the value builder to NORMARC country codes
- Set the default for 008/35-37 to "nor" (by setting the
  DefaultLanguageField008 syspref)
- Link from 008/35-37 in the value builder to NORMARC language codes
- Fix a missing <tr> around field 35-37

To reproduce:
- Run through the Web-installer in Norwegian and choose NORMARC as
  the MARC flavour
- Go to Home > Cataloging > Add MARC record and add a new record
- Click in the field for 008. The default should look like:
  130415t        xxu||||| |||| 00| 0 eng d
                 ^^^                 ^^^
- Reload the page and open the value builder for 008. Problems:
  - The text for 15-17 links to MARC21 country codes
  - The default for 15-17 is xxu
  - The text for 35-37 links to MARC21 language codes
  - The default for 35-37 is eng
  - If you choose e.g. "Monografier" in the top dropdown then click
    on "OK" the window does not close

To test:
- Apply the patch and run through the Web-installer again, selecting
  Norwegian and NORMARC
- Go to Home > Cataloging > Add MARC record and add a new record
- Click in the field for 008. The default should look like:
  130415t        no ||||| |||| 00| 0 nor d
                 ^^^                 ^^^
- Reload the page and open the value builder for 008.
- Check that...
  - The default for 15-17 is "no " (with a space at the end)
  - The link goes to NORMARC country codes
  - The default for 35-37 is "nor"
  - The link goes to NORMARC language codes
- Select something from the top dropdown and click "OK". Check that the
  window closes and that the values that are entered into the 008 field
  matches what you chose in the popup window.

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

Trusing Magnus is right, so testing for any regressions mainly, all good

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Only changes NORMARC specific plugin and system preferences
files. Changes all seem logical to me.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_7055' into 3.14-master
Bug 7054 - NORMARC: Fix default for 000 position 17

Someone at the library education in Oslo told me that it would be
better to have the default for 000/17 set to 1, instead of 2 as it
is today.

To reproduce:
- Run through the Web-installer in Norwegian and choose NORMARC as
  the MARC dialect
- Go to Home > Cataloging > Add MARC record and start to add a new
  record
- Click in the 000 field and it should be filled with:
  "     nam a22     2  4500"
- Reload the page, then open the value builder for 000 and click on OK
- 000 should get filled with the same string as above

To test:
- Apply the patch and repeat the steps from above. The default value
  for 000 should now be:
  "     nam a22     1  4500"

(Don't be confused by the 1s and the 2s. A value of 1 in position 17
means "level 2", and a value of 2 means "level 1" - that is how it
is defined in the "standard":
1 = Nivå 2, iflg. Katalogiseringsregler
2 = Nivå 1, iflg. Katalogiseringsregler)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Small changes. Didn't test in a NORMARC installaton, but
trusting Magnus with this and seeing no reason why it
shouldn't work.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_7054' into 3.14-master
Bug 8300: Add mechanized unit test for batch import

This new unit test confirms that importing records via the Stage
MARC import tool still works by connecting to a Koha instance and
importing a record then reverting the import, checking at each step
of the way that everything is as it should be.

To test:
1. Install Test::WWW::Mechanize
> sudo apt-get install libtest-www-mechanize-perl
2. Set environment variables to reflect your Koha instance:
> export KOHA_USER=kohaadmin
> export KOHA_PASS=katikoan
> export KOHA_INTRANET_URL=http://localhost:8080
> export KOHA_OPAC_URL=http://localhost
3. Run the test:
> prove t/db_dependent/www/batch.t

This updated patch now handles both MARC21 and UNIMARC installations.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
All tests pass with marcflavour = MARC21 and NORMARC. Test #15 fails
when marcflavour = UNIMARC, but from what I can see, that is because
I'm testing on a MARC21 setup, missing the UNIMARC frameworks etc.
I'm signing off - QA folks, please ask for a proper UNIMARC signoff
if you feel it is needed.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Amended patch: Load the POSIX module (for the floor routine).
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 8300 - Add Test::WWW::Mechanize as an optional dependency

This patch replaces an earlier patch by Marcel de Rooy, which
had become outdated because lots of new dependencies were
added since the patch was made.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_8300' into 3.14-master
Bug 7368: Small typo in history.txt

beomes becomes becomes :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes a typo in a text file, no problems found.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_7368' into 3.14-master
Bug 8419 - Suspended holds appear on the daily holds queue

This bug was reintroduced by the patch for bu 5911: Transport Cost Matrix

Test Plan:
1) Place a hold on a record
2) Run build_holds_queue.pl
3) Verify the hold is showing in the holds queue
4) Suspend the hold
5) Re-run build_holds_queue.pl
6) Note the hold is still in the holds queue
7) Apply patch
8) Re-run build_holds_queue.pl
9) Note the hold is no longer in the holds queue

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes test plan and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_8419' into 3.14-master
Bug 10033 - dangerous query in _koha_modify_item

The SQL query build in C4::Items::_koha_modify_item performs an update on a row of items table identified by itemnumber.
Actually the query is build using a hash of datas :
    for my $key ( keys %$item ) {
        $query.="$key=?,";
        push @bind, $item->{$key};
    }
But this hash contains 'itemnumber' key, so you get an update including the primary key.
It is actually harmless but may be dangerous.

This patch simply skips itemnumber key in above loop.

Test plan :
Check you can create and modify items.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_10033' into 3.14-master
Bug 7228: can't add items in an order with Modify

We have a message if we want to add items and we can't add, substract only.
It's ok if we choose to create items on ordering, in this case koha can't add items, just substract
and in this case we have to delete manually the items(s) in the catalog.
But if via the syspref AcqCreateItem we choose to create items when receiving this limitation is not usefull
The patch just checks if the syspref AcqCreateItem is on 'ordering'
if not the message is not shown and we can add items

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
Here is the test I made for signing off :
after applying the patch
- syspref AcqCreateItem  : create items on RECEIVING
- in a basket, create an order (quantity = 1)
- save the order
- reopen the order
- change the quantity (2 instead of 1)
- save the order
=> changing quantity was not possible before the patch

- syspref AcqCreateItem  : create items on CATALOGING
- in a basket, create an order (quantity = 1)
- save the order
- reopen the order
- change the quantity (2 instead of 1)
- save the order
=> changing quantity was not possible before the patch

- syspref AcqCreateItem  : create items on ORDERING
- in a basket, create an order (click on "add" to add an item => quantity = 1)
- save the order
- reopen the order
- try to change the quantity (2 instead of 1), without clicking on "add" to create a new item => you cannot (alert message)
=> the behavior is the same as before the patch

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Copied test plan from bug report.
Template only change deactivating the Javascript that blocks
you from changing the quantity when AcqCreateItem is set to
something else than 'ordering'.
Passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_7228' into 3.14-master
Bug 6506: Followup add warning in the system information tab.

Add a warning in the system information tab of the about page.

Test plan:
Set OPACPrivacy = 1 and AnonymousPatron = 0 and go on the about page,
tab 'system information'. Check that the warning appears.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>

http://bugs.koha-community.org/show_bug.cgi?id=6509
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 6506: When AnonymousPatron not set, deletion of issue history silently failed.

Remedied by:
- in Circulation.pm changing AnonymiseIssueHistory so that it returns ($rows, $err_history_not_deleted) instead of $rows
- consequential change to misc/cronjobs/batch_anonymise.pl to handle updated return value, and fail if there is an error
- consequential change to tools/cleanborrowers.pl although this still fails silently (raised as bug 9944)
- update of opac-privacy.pl to check return value and pass on error
- update of opac-privacy.tt to display error if appropriate

Note bug 9942 remains unfixed, which is a similar issue upon issue return.

To test:
1. OPAC
- enable privacy mode (preference OpacPrivacy)
- leave anonymous patron set to zero (preference AnonymousPatron)
- attempt to delete user history
- observe error
- check history - still there
- change anonymous patron to a valid user
- attempt to delete user history
- observe success message
- check history - gone

2. cleanborrowers.pl
- test it functions as before.  bug 9944 has been raised for it continuing to silently fail.

3. batch_anonymise.pl
- enable privacy mode (preference OpacPrivacy)
- leave anonymous patron set to zero (preference AnonymousPatron)
- run script (I use --days -1 for testing)
- script should fail with a Carp message
- change anonymous patron to a valid user
- run script as before
- script returns quietly
- check history - gone

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 6506: Correct CSS class name.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>

http://bugs.koha-community.org/show_bug.cgi?id=6509
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Merge branch 'bug_6506' into 3.14-master