Bug 12234 - dependency updates for master

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13230: t/Biblio.t should run without a DB

This patch makes t/Biblio.t mock the DB connexion setting
a void one. All tests in this file currently call the C4::Biblio
functions with invalid (absent) parameters, so they are expected to
raise warnings and return undef values.

If someone writes mocked tests for the rest of the functionality,
it is expected to mock the DB calls to match the desired scenario.

To test:
- Turn of MySQL
- Run
  $ prove t/Biblio.t
=> FAIL: Tests fail because of missing MySQL server
- Apply the patch
- Run
  $ prove t/Biblio.t
=> SUCCESS: Tests now pass
- Start MySQL
- Run
  $ prove t/Biblio.t
=> SUCCESS: Tests still pass
- Sign off

Regards
Tomas

Sponsored-by: The will to procrastinate
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Sponsored-by: Wanting the darn packages to build
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Sponsored-by: Not wanting to read in my maths book
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13018 : Static fine should be charged only once

Test plan (see Bug 6858 for using staticfine.pl) :

For a user (of a given category and library) with several overdues, launch the script :

staticfines.pl --category CAT,AMOUNT --library LIB --delay DELAY

Then, check that the user has been charged of AMOUNT if the due date of the most late item plus the delay is *before* today.

One day later, re-execute the script with the same parameters and check that the fine has not been charged twice.

Without patch, the fine is charged twice, with patch the user already charged is skipped (see output in debug mode)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Without the patch, the fine will be applied every time the script is run.
With the patch the fine will only be applied once.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12987: Update table footer with the visible rows

This patch is the preparation step for others.

On acqui/acqui-home.pl and admin/aqbudgets.pl, it will be possible to
see the totals in the footer updated with the filtered rows.

Test plan:
This cannot be tested alone, you have to apply it with others (see the
"Blocked" bug reports).

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 12987: The new format_price include file should be include on using datatables

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13176 - Add links "My account" and "My checkouts" for logged in user to drop down in staff client header

This patch adds links to "My account" and "My checkouts" to drop down in staff client header.

To test:
Apply patch
Got to drop down of logged in user (top right)
See new links to "My account" and "My checkout" (above "Log out")
Test the links.

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Works as advertised. The options are not displayed when you are logged
in as the db/admin user.

Added classes "toplinks-myaccount" and "toplink-mycheckouts" to li tags to make it possible to hide them (per Kyle M $
Switching back to "Signd-off" (Hope this is OK becuause it is a tiny string addition)

Marc

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13106 - Encapsulate Circulation::GetAgeRestriction() and modify it to check borrowers age as well.

This patch moves the logic of deciding whether or not a borrower is old enough to access this material
to its own function GetAgeRestriction.

This makes it easier to use AgeRestriction elsewhere, like with placing holds.

This feature adds a new function C4::Members::SetAge() to make testing ages a lot easier.
A ton of Unit tests included.

C4::Circulate::CanBookBeIssued() fixed and issue with undefined $daysToAgeRestriction per Marc Véron's
suggestion.

Test plan:
(See comment #10 for screenshots about using age restriction)

1) Without patch

Configure Age Restricition (see Syspref AgeRestrictionMarker) and have a biblio record with e.g. PEGI 99 in age restriction field
Try to check out to a patron with age < 99
Check out should be blocked
Change entry in age restriction field to PEGI99
Check out schould now be blocked

2) With patch
Try checkouts again, behaviour should be th same.

Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13113 - Prevent juvenile/children from reserving ageRestricted material

There is no reason for underage borrowers to reserve ageRestricted material and
then be denied it's check-out due to ageRestriction.

This patch prevents reserving material for borrowers not suitably aged.

 # # # # # #
 # A PRIORI #
 # # # # # #
BOTH THE STAFF CLIENT AND THE OPAC
1. Find a Record with Items, update the MARC Subfield 521a to "PEGI 16".
2. Get a Borrower who is younger than 16 years.
3. Place a hold for the underage Borrower for the ageRestricted Record.
4. You can reserve an ageRestricted Record with ease.
STAFF CLIENT ONLY
5. Check-in an Item from the ageRestricted Record and catch the reservation.
6. Check-out the ageRestricted Item for this underage Borrower.
7. You get a notification about being unable to check-out due to age restriction.
   How lame is that for a 12 year old?

 # # # # # # # #
 # A POSTERIORI #
 # # # # # # # #
STAFF CLIENT
1. Find a Record with Items, update the MARC Subfield 521a to "PEGI 16".
2. Get a Borrower who is younger than 16 years.
3. Check-out an ageRestricted Item for this underage Borrower.
4. You get a notification about having the maximum amount of reserves.
5. Place a hold for the underage Borrower for the ageRestricted Record.
6. You get a notification, that placing a hold on ageRestricted material is
   forbidden.

Includes Unit tests.

Followed test plan. Patch behaves as expected. (Note: Propagating error messages to template will be handled in Bug 13116 or 11999)

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 13113 [QA Followup] - Fix unit test

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: New patron permissions

    This patch adds the following permissions:

     - editcatalogue.limited_item_edition: Limit item modification to barcode, status and note
     - editcatalogue.delete_all_items: Delete all items at once
     - tools.items_limited_batchmod: Limit batch item modification to item status

    The SubfieldsToAllowForLimitedEdition syspref is used to define which subfields can be edited
    when the editcatalogue.limited_item_edition permission is enabled.

    In the same way, the SubfieldsToAllowForLimitedBatchmod is used to define which subfields
    can be edited when the tools.items_limited_batchmod permission is enabled.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: QA Followup: trailing whitespace and perlcritic issues

This patch fixes the following qa issues:

 FAIL   cataloguing/additem.pl
   FAIL   forbidden patterns
        forbidden pattern: trailing space char (line 833)
   FAIL   critic
        # Variables::ProhibitConditionalDeclarations: Got 2 violation(s).

 FAIL   tools/batchMod.pl
   FAIL   critic
        # Variables::ProhibitConditionalDeclarations: Got 2 violation(s).

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: The delete all items link should only be displayed if delete_all_items is set

This test had been lost in a rebase.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: the limitation on editing an item does not affect FA framework

The pref SubfieldsToAllowForLimitedEdition should not affect Fast
cataloguing framework (FA).

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: Update syspref names in script

The both syspref names have been changed since the first patch.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: Update permission names in script

Two permission names have been changed since the first patch.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: Change the superlibrarian check

To know if the user is a superlibrarian, we have to call
C4::Context->IsSuperLibrarian

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: DB changes - Add permissions

This patch adds:
3 permissions:
- edit_items_restricted
- delete_all_items
- items_batchmod_restricted

2 system preferences:
- SubfieldsToAllowForRestrictedEdition
- SubfieldsToAllowForRestrictedBatchmod.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: Assume that all fields can be edited if the pref is empty

If the sysprefs are empty, we assume that the librarian can edit all
subfields, even if s/he has the restricted permission.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673: add syspref in sysprefs.pl

Also fix a typo in the permission description

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patches pass QA script and tests.

Copying the test plan from the bug report:
Test plan:
1/ add the following permissions to the logged in patron:
edit_item, edit_items_restricted, delete_all_items,
items_batchmod, items_batchmod_restricted

2/ Fill the prefs SubfieldsToAllowForRestrictedEdition
and SubfieldsToAllowForRestrictedBatchmod with some
subfield (for instance "995$f 995$o" and "995$o")

3/ Verify you are allowed to edit the item fields defined
in the pref SubfieldsToAllowForRestrictedEdition.

4/ Try to edit item in a batch and verify you are allowed
to edit the item fields defined in the pref
SubfieldsToAllowForRestrictedBatchmod.

5/ Try to delete all items of a record

Play with the pref/permissions and verify they are
correctly taken into account.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7673 [Terminology follow-up] New patron permissions to manage items

This bug adds a new preference, "SubfieldsToAllowForRestrictedEdition,"
but the use of the term "Edition" in this context is incorrect. I think
it would be more clear to change the preference name to
"SubfieldsToAllowForRestrictedEditing." This patch makes this change.

I realize this isn't a big issue since the preference has a good
description, but I thought that if we were going to make this as clear
as possible now would be the time to do it.

To test, start with a database which hasn't previously been used to test
Bug 7673. Apply all patches and run the database update. Follow the test
plan as described in the bug.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, change appears complete.
All tests and QA script still pass.

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