Commit graph

434 commits

Author SHA1 Message Date
653686cee9 Bug 13909: (QA followup) fix references to get_chargeable_units
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-12 10:54:50 -03:00
4094a235de Bug 13909: Suspension days calculation should respect finesCalendar
This patch make _debar_user_on_return respect the finesCalendar syspref.

It does so, by replacing the ad-hoc overdue days calculation in favor of
C4::Overdues::_get_chargeable_units (which is renamed C4::Overdues::get_chargeable_units
and exported). There's no behaviour change besides making the calculation simpler
and correct.

To test:
- Set finesCalendar = "directly"
- Have a circulation rule stating:
  interval for calculating fines = 1
  suspension days = 3
- Have the calendar set for sunday and saturday as holidays.
- Checkout an item with a branch/itype/borrower category that matches the defined circ rule with a hand-writen due date to (say) last friday.
- Check the item in
=> FAIL: Notice that the user is debarred using the calendar (skipping saturday and sunday).
- Apply the patch
- Repeat the previous steps
=> SUCCESS: calculation is correct (counting saturday and sunday as overdue days, i.e. 'directly').
- Set finesCalendar = "calendar"
- Repeat the test
=> SUCCESS: calculation is correct (skipping holidays).
- Sign off.

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-10 10:19:24 -03:00
Jonathan Druart
9871417d44 Bug 11201: Display overdues in red
On the pending on-site checkout list, the date for overdues are now
displayed in red.

Test plan:
Make sure you have on-site checkouts created today and before.
The date for the ones created before today should be displayed in red.

Signed-off-by: Nicole <nicole@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 11:30:55 -03:00
Jonathan Druart
e887ae544d Bug 11201: Add a in-house use list pages
The circulation page has a new entry: a link to a list of the pending
in-house use.

Bug 10860 introduces a new way for managing in-house uses.
This patch adds a new page (from the circulation home page) to list all
pending in-house uses.

Test plan:
Go on the circulation home page and click on the in-house use link.
Verify all your in-house uses are listed and information are consistent.

Bug 11201: Display lib instead of AV code

This patch assumes that items.location is linked the the LOC
authorised values.

Signed-off-by: Nicole <nicole@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 11:30:55 -03:00
Benjamin Rokseth
e4d88bcf43 Bug 12344: QA followup: use next instead of return
Use next instead of return when generating templates.
In case patron has enabled a message type that misses a template,
next message type will be attempted instead of returning at once.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:38:35 -03:00
Koha instance knakk-koha
2ab4a4287b Bug 12344 - Multi transport types for issues and checkins
This small patch corrects the order of generating notices for issues and returns (checkout/checkin) so that borrower's notices are rendered correctly (for sms,email,etc.)

Test plan:

1) Edit SMSSendDriver syspref to use driver 'Test'
2) Edit CHECKOUT template for sms to 'SMS test'
3) select SMS for test patron's messaging prefs for item checkout
4) checkout an item
5) check the table message_queue, verify that template sms is
   not used (message content is not 'SMS test')

6) apply patch, make new checkout
7) check that message_queue table now has a correctly generated
   notice with 'SMS test'

For a real world test use a real SMS::Send driver and run the
cronjob process-message-queue.pl to send messages immediately.

Signed-off-by: Sophie Meynieux <sophie.meynieux@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 13:38:31 -03:00
92dd223c3c Revert "Bug 10606: Remove MySQLism in GetUpcomingDueIssues"
This patch reverts a commit that breaks GetUpcomingDueIssues-related
tests.

This reverts commit 5ee0293ed6.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-30 12:13:05 -03:00
Srdjan
1802aa9153 Bug 5786 - Move AllowOnShelfHolds and OPACItemHolds system prefs to the Circulation Matrix
C4::Reserves:
* Added OnShelfHoldsAllowed() to check issuingrules
* Added OPACItemHoldsAllowed() to check issuingrules
* IsAvailableForItemLevelRequest() changed interface, now takes
  $item_record,$borrower_record; calls OnShelfHoldsAllowed()

opac/opac-reserve.pl and opac/opac-search.pl:
* rewrote hold allowed rule to use OPACItemHoldsAllowed()
* also use OnShelfHoldsAllowed() through
* IsAvailableForItemLevelRequest()

templates:
* Removed AllowOnShelfHolds and OPACItemHolds global flags, they now
  only have meaning per item type

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>

I have tested this patch left, right and upside down for the last
several months. All tests have passed.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-25 10:33:14 -03:00
Benjamin Rokseth
7ba06aad68 Bug 12122: TransferSlip should accept both itemnumber and barcode
Added small patch to allow barcode as input in TransferSlip routine, mostly
to allow generating transfer slips where only barcode is present (aka.
javascript).

Test plan:
1) find book with <barcode> and <itemnumber>
2) generate transferslips with both:
  transfer-slip.pl?transferitem=<itemnumber>3967925&amp;branchcode=MPL&amp;op=slip
  transfer-slip.pl?barcode=<barcode>&amp;branchcode=MPL&amp;op=slip
and verify that the generated slips match.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Edit:
 - Added tests in t/db_dependent/Circulation_transfers.t

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Passes tests and QA script.
Works with both itemnumber or barcode as described.
Tested printing transfer slips with the URL examples given
and in the UI.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-05 11:47:12 +01:00
5ee0293ed6 Bug 10606: Remove MySQLism in GetUpcomingDueIssues
To test:

[1] Arrange to have at least one loan in your test database due
    one day from now.
[2] Run misc/cronjobs/advance_notices.pl -c -n -v -m=2
    and note the number of loans reported.
[3] Apply the patch.
[4] Run misc/cronjobs/advance_notices.pl -c -n -v -m=2 again
    and verify that the number of loans reported remains the same.

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Also tested with unit tests from bug 10719.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-21 11:06:24 -03:00
Olli-Antti Kivilahti
84064ae4e4 Bug 13025 - Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925
This error only appears when using the SIPServer, it doesn't manifest when using the SIP unit tests
or when using the staff client.

--------------------
 ------------------
  PREPARE THE TEST
 ------------------
--------------------

0a. Find a borrower.
0b. Find an Item (cardnumber 'debar123') and check-out to the borrower
0c. Find a borrower and add a manual debarrment to it, indefinetely in effect.
    This is the default behaviour.
0d. Configure and start a SIP-server which you can access with telnet.
    See http://wiki.koha-community.org/wiki/Koha_SIP2_server_setup
    In this example, the Borrower defined as the Check-out/in machine has the following credentials:
    username: herkules password: palautathan branchcode: JOE_JOE
    but you are free to use your own, it doesn't affect this test plan.
0e. access your server with telnet

-----------------------
 ---------------------
  REPLICATE THE ISSUE
 ---------------------
-----------------------
1. Paste the following SIP-command to login:
9300CNherkules|COpalautathan|CPJOE_JOE|
2. Paste the following SIP-command to check-in the Item of the debarred Borrower:
09N20140721    07501620140721    075016AP|AO|ABdebar123|AC|BIN|
3. The connection should die and in the SIP Server's error log you can find the following error:
Software error: Undefined subroutine &C4::Circulation::HasOverdues called at /home/koha/kohaclone/C4/Circulation.pm line 1925

--------------------
 ------------------
  AFTER THIS PATCH
 ------------------
--------------------

Redo steps 1-2.
3. No error is given and the connection doesn't die.

No unit tests included and never will, because setting up the test environment would be very tedious.
It is entirely possible but the scaffolding required is beyond the scope of this patch.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Note: I did not test this patch with SIP, but I did not find any
regression on checking or renewing an item.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-21 11:02:08 -03:00
Lyon3 Team
c1621de8a5 Bug 12895 repair dropbox mode
One day late patrons were restricted even with dropbox mode activated

1) Check in the calendar (Tools/Calendar), that the
   previous days you are about to use as date due are
   really entered as opening day (never know).
2) Add a suspension in the suspension days parameter
   of the circulation rules (Administration/Circulation
   and fine rules) to the MOST specific category of
   borrower and MOST specific type of document among the
   existing rules of the LOGGED IN Site(cf explications
   in the circ-rules page).
3) Choose a borrower using the search by category and an
   item through the advanced search using the limit by type.
4) Checkout the item selecting the previous opening date
   in the Specify-due-date box.
5) Click on Circulation in the upper menu, then on Checkin
   and check the Book drop mode. The Book drop date showed
   should be the previous opening date.
6) Check in the item : you can see that the patron is restricted
7) apply the patch
8) Redo 1 to 5 : Now, you can see that the patron is not restricted.
9) If you redo the test with two day late, you will see that
   the patron is not restricted : that's ok because his
   restriction of one day is already finished.
10) If you redo the test with more than two day late, you see
    that the patron restriction is, as expected, one day shorter
    than it were if the item had been returned without dropbox mode.

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-28 20:35:30 -03:00
Katrin Fischer
22b8d559f9 Bug 13461 - Circ always asking for confirmation if RentalFeesCheckoutConfirmation is used
To test:
- Check RentalFeesCheckoutConfirmation is activated
- Try to check out an item without rental fine
- Verify confirmation message without explanation
  is shown
- Apply patch
- Verify confirmation message is no longer shown
- Configure itemtype to have rental fee
- Veirfy now the confirmation message appears as
  it should

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-19 17:04:06 -03:00
4c1ae53d86 Bug 13297 - Shelving location PROC does not work according to manual
According to the manual, "Items will stay in the PROC location until
they are checked in".

This is not the actual behavior. Right now items will only change from
PROC to CART, and that is only if InProcessingToShelvingCart is enabled.
Some libraries want to use the PROC to permanent location feature,
without using the CART.

Additionally, the location is only removed if using returns.pl, but
that is not what the manual says either. What if the library uses
SIP2 devices for handling returns? This should be taken into
account.

Test Plan:
1) Apply this patch
2) Set an item's current location to PROC, and it's permananet location
   to a different location.
3) Check the item in any way you wish
4) Note the shelving location is updated to the permanent location
5) prove t/db_dependent/Circulation/Returns.t

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I tested this with items which had items.location set to 'PROC' and
items.permanent_location set to NULL, '', and a real value, and it
worked correctly in all cases. I tested with check-ins from returns.pl
and from the table of checkouts in circulation and the PROC location was
correctly removed in both cases.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-23 10:11:28 -03:00
Marc Véron
955e836c9b Bug 13261 - Better check in message for patrons with indefinite restricition
This patch adds a better check in message for patrons with indefinite restriction.

To test:
Check out an item to a patron.
Add a manual restriction without expiry date to that patron.
Check in the item.

Without patch, the checkin message reads:
Reminder: Patron was earlier restricted until 9999-12-31

Apply patch and repeat steps above.
The message should now read:
Reminder: Patron has a restriction (no expiry date)

NOTE: Changed wording at two places following Owen's  suggestion.  New: "Patron
has an indefinite restriction"

Signed-off-by: Frederic Demians <f.demians@tamil.fr>

Thanks Marc for catching this case. I was thinking like you that the wording
sounded strange while playing with bug 13242. Merge the original patch and the
followup, containing a better wording, thanks to Owen comment.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-19 21:41:24 -03:00
Olli-Antti Kivilahti
15613a0294 Bug 13168 - "Today's checkouts" sort improperly because issuedate lacks seconds.
TO REPLICATE:

Prepare a bunch of Items (6+) for checking out, or have a set of barcodes ready for copy-pasting.
Check-out those items quickly within one minute and observe that the sorting order is not always from the first checkout to the last.

This is because the issuedate doesn't have seconds defined.

AFTER THIS

The bunch of Items is sorted properly.

Tiny patch, works as expected. Passed QA script.
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>
2014-11-16 21:24:28 -03:00
3b300146b2 Bug 11634 [QA Followup 3] - Found holds should be considered unavailable
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:27:42 -03:00
a935e23d3d Bug 11634 [QA Followup 2] - Implement check for IsAvailableForItemLevelRequest
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:27:36 -03:00
ebf4350735 Bug 11634 - Allow renewal of item with unfilled holds if other available items can fill those holds
The current holds behavior in Koha allows a situation like this:
- Patron A has an item currently checked out.
- Patron B places a hold on the next available copy of that title.
- Then Patron A will not be able to renew his item, even if there are
  other available copies of that title that could potentially fill Patron
  B's hold.

Since this seems unfair to Patron A, we should allow renewal of items
even if there are unfilled holds, but those holds could all be filled
with currently available items.

Test Plan:
1) Apply this patch
2) Create a record with two items
3) Check out the item to a patron
4) Place a hold on the record
5) Note you cannot renew the item for the patron
6) Enable the new system preference AllowRenewalIfOtherItemsAvailable
7) Note you can now renew the item, as all the holds can be satisfied
   by available items.
8) Place a second hold on the record
9) Note you can no longer renew the item, as all the holds *cannot*
   be filled by currently available items

Signed-off-by: Holger Meissner <h.meissner.82@web.de>
Signed-off-by: Chris Rohde <crohde@roseville.ca.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-12 11:27:31 -03:00
Olli-Antti Kivilahti
ae7d5fd11b 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>
2014-11-11 09:52:59 -03:00
mbeaulieu
1aab0ff3e3 Bug 12448: Ask for confirmation when checking out an item with rental fees
Sponsored-by: Ville de Victoriaville, QC

Confirmation box contents:

"Please confirm checkout"
"-Rental charge for this item: n"
[Yes, check out (Y)] [No, Don't Check Out (N)]

Test case A: Confirm checkout
1) Go to checkout user "X"'s checkout page.
2) Enter barcode for an item with rental fees.
3) Click the "Check out" button.
4) Confirmation box appears.
5) Click on the "Yes" button.
6) Item is added to checkout list.
7) Fees are added to the patron's account.

Test case B: Decline checkout
1) Go to checkout user "X"'s checkout page.
2) Enter barcode for an item with rental fees.
3) Click the "Check out" button.
4) Confirmation box appears.
5) Click the "No" button.
6) Checkout page goes back to its initial state.
7) Patron has no item checked out and no fees to pay.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
With the system preference RentalFeesCheckoutConfirmation
set to "don't ask" there is no change in behaviour.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-07 11:33:43 -03:00
c4d3f57279 Bug 8836 [QA Followup 2]
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2014-11-06 15:12:19 -03:00
d14a0cf5be Bug 8836 - Resurrect Rotating Collections
Test Plan:
In "Tools" -> "Rotating Collections" -> "Add/Remove items":
When adding item barcodes to the collection, the input field
  <input type="text" id="barcode" name="barcode">
should become active
automatically so it is easy to add multiple barcodes rapidly without touching the
mouse or keyboard.
Enter-press is dealt by the barcode reader so automatic form submittal should be handled
by the barcode reader.

In "Rotating collections" -> "Transfer Collection":
When the collection is initially transferred, items are set to trasfer correctly.
When the collection is transferred while items are still being transferred, the transfer
destination library doesn't change from the original one.
The holding library changes for all items in the collection to the destination library on
retransfers as well.
This is tricky if a user accidentally places the wrong destination.
When I try to checkin these items to their new retransfer location, I get the following messages:
-"This item is part of a rotating collection and needs to be transferred to <original transfer destination>"
-"Please return Valkoinen ihmissyj / to <original transfer destination>"
-"Print slip or Cancel transfer"

When I checkin a Item to a arbitrary branch, I get the following messages:
"This item is part of a rotating collection and needs to be transferred to <retransfer destination>"
"Please return Valkoinen ihmissyj / to <original trasfer destination>"

Bug 8836 - Resurrect Rotating Collections - QA Followup

Bug 8836 - Resurrect Rotating Collections - Followup 2 - Perltidy rotating collections scripts

Bug 8836 - Resurrect Rotating Collections - Followup 3

* Fix bad TT Tag
* Fix bad sql query
* Fix capitalization ( HTML4 )
* Allow a rotating collection's location to keep AutomaticItemReturn
  from sending it back to the branch of origin
* Fix bad query

Bug 8836 - Resurrect Rotating Collections - Followup 4 - Autofocus on barcode field

Bug 8836 - Resurrect Rotating Collections - Followup 5 - Don't transfer issued and waiting items

Items in a rotating collection are automatcially transferred when a
collection is transferred. This is a problem for currently checked out
items and items on hold marked as "Waiting".

This patch resolves this issue by skipping the transfer for those items.
When the items are then returned, the librarian will be alerted to
transfer the item to the library currently holding that rotating
collection.

Bug 8836 - Resurrect Rotating Collections - Followup 5 - Link collections.colBranchcode to branches.branchcode

Signed-off-by: jmbroust <jean-manuel.broust@univ-lyon2.fr>
Signed-off-by: Cindy Murdock Ames <cmurdock@ccfls.org>

http://bugs.koha-community.org/show_bug.cgi?id=8835

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2014-11-06 15:12:19 -03:00
33d285599f Bug 10860 [QA Followup] - Fix misc issues
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:25 -03:00
ca13806073 Bug 10860 - Change "in-house use" to "on-site checkout"
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:22 -03:00
Jonathan Druart
2e72eb8880 Bug 10860: In-House Use
This patch implements the In-House Use feature for Koha.

It adds:
- 2 new sysprefs:
  'In-House Use' to enable/disable this feature
  'In-House Use Forced' to enable/disable the feature for *all* users.
- 2 new columns issues.inhouse_use and old_issues.inhouse_use
- Datatable on the circulation history pages (readingrec) at the OPAC
  and the intranet.

A new checkbox in the Circulation tab. If checked, the issue become a
in-house use (in the statistics and issues tables).
When you check it, the due date changes to the today date.

The syspref "In-House Use Force" allows to force the in-house use to
permit the checkout even if the borrower is debarred or others problems.

In the issue table, a new string (in red) marks the issue as "in-house use".

The circulation history contains 3 tabs : "all", "checkout" and
"in-house use" (OPAC and intranet).

The cronjob script:
If AutomaticItemReturn if off, a library would like not to do a transit
operation manually. This script (to launch each night) do returns
for a specific branches.

Test plan:
1/ Execute the updatedatabase entry
2/ Enable the 'In-House Use' pref.
3/ Checkout a biblio for a patron and check the 'in-house use' checkbox.
4/ Check that the due date is the today date (with 23:59) and is not modifiable.
5/ Click on the check out button and check that the new check out
appears in the table bellow with the "(In-house use)" string.
6/ Go on the circulation history pages (readingrec and opac-readingrec)
and try the 3 tabs. In the last one, your last checkout should appear.
7/ Check in.
8/ Check readingrec pages.
9/ Choose a debarred patron and check that you cannot checkout a biblio
for him.
10/ Switch on the 'In-House Use Forced' pref
11/ You are now allowed to checkout a biblio for the debarred patron.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-03 10:26:19 -03:00
Marc Véron
b47e0360d8 Bug 12914 - Wrong message 'Patron(..) is blocked for 2014-09-30 day(s).
The message in circulation.tt assumed to get days but date is given. Updated comments and message depending on expiration date or no expiration of restriction.

The message shows up on top of Bug 643 Allow override of 'debarred' status if a patron has a restriction.

Replaced date_format with date template (see comment #6)

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-21 16:13:28 -03:00
Holger Meißner
b49bcfef09 Bug 11577: Code and intranet template changes
This patch adds a checkbox for "Automatic renewal" to the checkout page.
CanBookBeRenewed is modified to include two new errors:
- auto_renew (renewal shouldn't be done manually)
- auto_too_soon (renewal is premature and shouldn't be done manually)

To test:

1) Add or edit an issuing rule with "Automatic renewal" and another
   one without it.
2) Issue at least three items:
   - automatic renewal by issuing rule
   - automatic renewal by Checkbox on the checkout page
   - no automatic renewal
3) Test the following steps for both:
   Home > Circulation > Checkouts
   Home > Patrons > Patron details
4) Confirm that issues with automatic renewal cannot be renewed manually,
   even if there are still renewals left and it's not too soon to renew.
5) Confirm that "Scheduled for automatic renewal" and the remaining
   renewals are displayed. If no renewals are left "Not renewable" should
   be displayed.
6) Confirm that issues without automatic renewal behave as usual.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-17 19:23:14 -03:00
b0e5e2c749 Bug 12467 - Lost items marked as not on loan even if they are!
The cronjob longoverdue.pl does not require that an item marked as lost
be returned automatically, but there is a line in ModItem that
automatically marks the item's onloan as false if itemlost is set!

Test Plan:
1) Mark an item as lost with longoverdue.pl, without --mark-returned
2) Inspect the db, note that items.onloan is now 0
3) Apply this patch
4) Mark repeat step 1
5) Inspect the db, noe that items.onloan is still 1
6) Test marking an item as lost from staff interface,
   ensure there are no regressions.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch works according to test plan and fixes a data loss bug.

Some notes:
- This patch would be nicer with a regression test.
- Also checked that returning the item removes lost status and onloan still.
- Tried to test with --mark-returned, but couldn't get it to
  return my item neither with nor without the patch. (see comment on
  bug report)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-08 11:34:01 -03:00
Mathieu Saby
8a02608a47 Bug 11230 - Refactor C4::Stats::UpdateStats and add UT
This patch
- refactors C4::Stats::UpdateStats (it now takes a hashref as unique parameter, instead of a list of parameters)
- add UT for it
- change the calls made to this sub in C4::Accounts and C4::Circulation

Additionnaly it also
- adds POD to C4::Stats::TotalPaid
- adds some comments to C4::Stats::TotalPaid (I think I found some errors in it)

To test :
1. run "prove t/db_dependant/Stats.t -v"
2. make some circulation operations (checkout, checkin, renew, localuse)
check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november)
3. make some fine payments operations (writeoff, payment)
check the operations are rightly recorded in Statistics table (with a SQL query like "SELECT * FROM statistics WHERE datetime LIKE "2013-11-15%", if you run your test on the 15th november)

Note that there is probably an issue to fix in Accounts.pm : the user is saved instead of the branch. But this is not the purpose of this patch, so I kept the previous behavior for the moment.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work, test pass, isse/return/writeoff recorded on statistics
Removed a "=back" to make happy koha-qa
No other errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-27 11:29:28 -03:00
dea4ddb5bd Bug 11629: (follow-up) Add message for librarian that status was updated
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-26 03:23:37 +00:00
8967427ee2 Bug 11629 - Add ability to update not for loan status on checkin
Some libraries would like to streamline the cataloging process my
automatically updating notforloan values on checkin. For example, an
item is set to notforloan of -1 ( ordered ). The item, is received,
processed, and checked in for the first time before being shelved.
The checkin automatically changes the nfl value from -1 to 0. The
same workflow could be used for damaged items as well.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Set the new system preference UpdateNotForLoanStatusOnCheckin
   to the following:
-1: 0
0: 1
4) Create an item, set its notforloan value to -1
5) Check in the item, note its not for loan value is now 0
6) Check in the item again, note its not for loan value is now 1
7) Check in the item again, note its not for loan value reamins 1

Signed-off-by: Havilah Lyon <havilah@aflibrary.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-26 03:21:53 +00:00
Jonathan Druart
aa6117da36 Bug 12230: Set a maximum suspension days as a new issuing rule
This patch adds a new issuing rule: maxsuspensiondays.

A new column "Max. suspension duration (day)" appears in the main table
of the issuing rules.

If this value is filled, on returning an item, a patron won't be
suspended longer than this cap.

Test plan:
1/ Set "suspension in days" to 2.
2/ Check an item out to a patron and specify a due date to today - 10
days.
3/ Check the item in and verify the patron is suspended until today + 10
* 2 days.
4/ Remove the suspension.
5/ Set "Max. suspension duration" to 10.
6/ Check an item out to a patron and specify a due date to today - 10
days.
7/ Check the item in and verify the patron is suspended until today + 10
days.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-26 01:39:19 +00:00
0423b43b17 Bug 8769: (follow-up) undo change to value of $today
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 15:05:51 +00:00
Kyle M Hall
42678f3abf Bug 8769: Allow SIP2 return backdating
Currently Koha's SIP server ignores the return date part of an 09 ( aka
CHECKIN ) message. Koha should backdate a return, and remove
fines accordingly.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>

Works as notified, second date field in SIP checkin (return date) is
used as return date. Return shows up in history with correct date.

Comments:
 - patron is fined if return date is before issue date, but that
   is largely irrelevant anyway.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 15:04:38 +00:00
Lyon3 Team
16cd2996a4 Bug 8231: display warning at check in if borrower is restricted
Display, at check in, a reminder of an already existing suspension date
even if the returned document is not late.

Test plan :
1) Apply the patch
2) Go to a borrower checkout page and checkout some documents with
   different passed duedate using "Specify due date" function. Checkout out
   one with the default duedate.
3) Check in the document with the bigger delay :
   You will get the message : 'X is now restricted until ...'
4) Check in one of the document with a smaller delay :
   You'll get a different message : 'Reminder : Patron was earlier
   restricted until...'.
5) Check in the document which is not late :
   You 'll get the same message as the previous one

Signed-off-by: JMBroust <jean-manuel.broust@univ-lyon2.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 00:41:32 +00:00
0b2e9dbf62 Bug 10694: (follow-up) add unit tests, improve AddReturn POD
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 21:46:41 +00:00
1b618cac3d Bug 10694 - Allow arbitrary backdating of returns
Sometimes libraries need to backdate returns further back in time than
Koha's dropbox mode will allow. The returns backdating will check in an
item as if it had been returned on the specified date, and will reduce
any fine accordingly.

This feature is activated by a new system preference, SpecifyReturnDate.

Test Plan:
1) Apply this patch
2) Check out an item, and backdate the due date by 1 month or so
   * This issue needs to generate a fine
3) Run fines.pl to generate the fine
4) Browse to returns.pl
5) Specify a return date of the day after the specified due date
6) Check the borrowers issue history, you should see the backdated
   return date, rather than today's date
7) Check the fine, it should be reduced to a fine for a single day
   overdue, rather than the previous larger fine.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Barbara Knibbs <BKnibbs@farmingtonlibraries.org>
Signed-off-by: Petter Goksoyr Asen <boutrosboutrosboutros@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 21:42:39 +00:00
Galen Charlton
b4838a3d3a Bug 10859: (follow-up) clarify logic on multiple loans on same bib
This patch clarifies the logic for determining if a given item to be
checked out would be the second (or third, etc.) loan on the same bib.

As a conseqence, if the item is already on loan to the patron, the
circ staffer won't see the multiple-loans-on-a-bib warning, just
the confirmation to renew the loan or the warning that no more
renewals are lest.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:51:58 +00:00
Jonathan Druart
b7d47ac66b Bug 10859: Alert if a borrower already has an issue for the same biblio
This patch adds a new system preference, AllowMultipleIssuesOnABiblio.

If this system preference is OFF, an alert is raised if a patron
tries to check out an item even when they already have a different
item checked out from that bib.

The librarian can force the checkout anyway.

It doesn't alert the librarian if the biblio is a subscription

Test plan:
1. Create a biblio with at least 2 items
2. Checkout the first item for a borrower
3. Set syspref AllowMultipleIssuesOnABiblio to OFF.
4. Try to checkout the second item with the same borrower. A message
should appear telling you that this borrower already borrowed an item
from this biblio.
If you have the permission 'force_checkout' You should also see two
buttons to confirm (or not) the checkout
5. Click on 'No'. The checkout is not done
6. Repeat step 4 and click 'Yes', the checkout is done.
7. Return the second item.
8. Set syspref AllowMultipleIssuesOnABiblio to ON
9. Try to checkout the second item with the same borrower. This time
the checkout is done without warnings.

Followed test plan. Works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass, works well. Tested:

* Permission to override
  * check out a second item from a record with subscriptions works
  * check out a second item from a 'normal' record is warned about,
  but can be done

* No permission to override
  * subscription item: can be checked out
  * normal item: can't be checked out

* Feature turned off
  * Check out never warns/blocks

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-21 05:28:05 +00:00
Galen Charlton
b324e893e8 Bug 11630: (follow-up) tighten up code
This patch tightens up the initialization of the $restriction_age
variable and uses $bibvalues throughout.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 15:32:29 +00:00
31995cbcd1 Bug 11630: (QA Followup) Move code to subroutine, add unit tests
Patch behaves as expected.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 14:55:08 +00:00
Pasi Kallinen
19badb2db4 Bug 11630: improve parsing of age restriction markers
This patch makes the parsing of AgeRestrictionMarker values consider
the case where the marker is immediately followed by the age, e.g.
"K16" in Finland.

How I tested:

[1] Configure Age Restricition (see Syspref AgeRestrictionMarker) and
have a biblio record with e.g. PEGI 99 in age restriction field.
[2] Try to check out to a patron with age < 99
[3] Check out should be blocked
[4] Change entry in age restriction field to PEGI99
[5] Checkout should be possible
[6] Apply patch
[7] Checkout schould now be blocked

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 14:43:30 +00:00
Jonathan Druart
9132f9befb Bug 11960: replace unnecessary call of GetMemberDetails by CanBookBeRenewed
C4::Circulation::CanBookBeRenewed called C4::Members::GetMemberDetails to
retrieve categorycode and branchcode.

- categorycode is used to retrieve the issuing rule
- the borrower information is passed to
  C4::Circulation::_GetCircControlBranch. Which only uses the branchcode
  parameter.

GetMemberDetails does a lot of calls/queries (patronflags,
account, etc.) that are not needed by CanBookBeRenewed.

This patch replaces it with a call to C4::Members::GetMember.

Note: I presented this small optimisation during a quick introduction to
NYTProf (hackfest 14 in Marseille).

Test plan:
- launch member unit tests
- check the code

Checking the code resulted in the following:
CanBookBeRenewed builds a hash reference from the borrowernumber
(2482). Note it is only used in this function and not passed in.

_GetCircControlBranch (2485) requires that hashreference to
have a branchcode key. As stated above.

The following line (2486) requires it have a categorycode key.

As such, C4::Members::GetMemberDetails is confirmed to be
overkill, and C4::Members::GetMember is sufficient.

Testing Done
------------
0) Back up DB
1) Make sure MPL is in the list of libraries.
2) Apply the patch.
3) run the koha qa test tool
4) prove -v t/db_dependent/Circulation.t

Patch applies cleanly. QA Test tool was all OK. All tests ran successfully.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-11 16:22:43 +00:00
Galen Charlton
f4efda5bc5 Bug 7413: (follow-up) improve return of GetSoonestRenewDate()
This patch modifies GetSoonestRenewDate() so that it returns
undef if the patron, item, or loan cannot be found.  This
better reflects the usage of this routine GetSoonestRenewDate(),
as none of its callers tried to check the second return
value containing an error code.

This patch also updates the POD to match.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-08 22:52:01 +00:00
Holger Meißner
065926d224 Bug 7413: Code and intranet template changes
This patch modifies CanBookBeRenewed, so that based on
issuingrules.norenewalbefore a new error "too_soon" can be returned.
Also adds a new subroutine GetSoonestRenewDate.

To test:
1) Create an issuing rule with "No renewal before" set to value X
   and "Unit" set to days.
2) Test the following steps for both:
   Home > Patron > Patron details
   Home > Circulation > Checkouts
3) On the checkout page, test for today's issues as well as previous
   issues. (Check something out on one day and something else on the
   next day, then do the testing.)
4) Confirm that items can't be renewed if current date is more than
   X days before due date.
5) Confirm that the date and time of the soonest possible renewal are
   displayed in the format specified by global sysprefs "dateformat"
   and "TimeFormat".
6) Confirm that items can be renewed if "No renewal before" is
   undefined or current date is X or less days before due date.
7) Confirm that if the number of allowed renewals is exceeded
   "Not renewable" is displayed, no matter what "No renewal before"
   is set to.
8) Test the same things with "Unit" set to hours.

Sponsored-by: Hochschule für Gesundheit (hsg), Germany
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
2014-04-07 18:28:57 +00:00
fb4025b67b Bug 10277 - Add C4::Context->IsSuperLibrarian()
The method of checking the logged in user for superlibrarian privileges
is obtuse ( $userenv && $userenv->{flags} % 2 != 1 ) to say the least.
The codebase is littered with these lines, with no explanation given. It
would be much better if we had one subroutine that returned a boolean
value to tell us if the logged in user is a superlibrarian or not.

Test Plan:
1) Apply this patch
2) Verify superlibrarian behavior remains unchanged

Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comments on second patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:47:23 +00:00
Katrin Fischer
a8bc7c9ef8 Bug 11218: fix Item Due notices not being generated
To test:
- Check out at least 3 items, due dates should be today, sometime in
  the past and one day after tomorrow.
- Edit the message options - activate DUE and PREDUE notices with
  days in advance = 2
- Run the advance_notices.pl script with -v -c
  Result: Only a PREDUE notice is generated
- Run the advance_notices.pl script with -v -c -m 2
  Result: Only the PREDUE message is generated correctly.
- Run t/db_dependent/Circulation.t
  - without first patch: all tests pass.
  - with first patch: some tests will fail.
- Apply patch.
- Rerun script, now PREDUE and DUE notices should be
  generated.
- Run t/db_dependent/Circulation.t again, all tests should pass.

Add more items with different due dates, rerun and check results.

Run t/Circulation.t to confirm all tests pass.
- Apply the patch

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Passes functional tests and automated tests.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-08 16:22:14 +00:00
80897930b7 Bug 2720 - Overdues which debar automatically should undebar automatically when returned
This patch adds a more extensible and flexible debarments system to Koha. The fields
borrowers.debarred and borrowers.debarredcomment are retained for compatibility and
speed.

This system supports having debarments for multiple reasons. There are currently
three types of debarments:
OVERDUES    - Generated by overdue_notices.pl if the notice should debar a patron
SUSPENSION  - A punative debarment generated on checkin via an issuing rule
MANUAL      - A debarment created manually by a librarian

OVERDUE debarments are cleared automatically when all overdue items have been returned,
if the new system preference AutoRemoveOverduesRestrictions is enabled. It is disabled
by default to retain current default functionality.

Whenever a borrowers debarments are modified, the system updates the borrowers debarment
fields with the highest expiration from all the borrowers debarments, and concatenates
the comments from the debarments together.

Test plan:
 1) Apply patch
 2) Run updatedatabase.pl
 3) Verify the borrower_debarments table has been created and
    populated with the pre-existing debarments
 4) Run t/db_dependent/Borrower_Debarments.t
 5) Manually debar a patron, with an expiration date
 6) Verify the patron cannot be issued to
 7) Add another manual debarment with a different expiration date
 8) Verify the 'restricted' message lists the date farthest into the future
 9) Add another manual debarment with no expiration date
10) Verify the borrower is now debarred indefinitely
11) Delete the indefinite debarment
12) Verify the debarment message lists an expiration date dagain
13) Enable the new system preference AutoRemoveOverduesRestrictions
14) Set an overdue notice to debar after 1 day of being overdue
15) Check out an item to a patron and backdate the due date to yesterday
16) Run overdue_notices.pl
17) Verify the OVERDUES debarment was created
18) Return the item
19) Verify the OVERDUES debarment was removed
20) Disable AutoRemoveOverduesRestrictions
21) Repeat steps 15 though 18, verify the OVERDUES debarment was *not* removed
22) Add issuing rules so that an overdue item causes a temporary debarment
23) Check out an item to a patron and backdate the due date by a year
24) Return the item
25) Verify the SUSPENSION debarment was added to the patron

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 01:53:22 +00:00
Galen Charlton
b67654ecc2 Bug 10493: (follow-up) fix test errors
[1] Fix regression on bug 10663

Looks like the regression was introduced by a glitch during rebasing.

[2] Fix errors in Circulation_issue.t

The change in AddRenewal() turned up an issue with how the test
script issued one of the test items.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-23 04:25:34 +00:00
2e4411e77f Bug 10493: Add renewal script
This patch adds a renewal tool that functions similar to the returns where a
librarian can continuously scan items for renewal. This script blocks
renewals that are impossible, and allow the same renewal overrides
as circulation.pl

Test plan:
 1) Apply the patches for bug 8798
 2) Apply this patch
 3) Browse to /cgi-bin/koha/circ/renew.pl
 4) Enter an invalid barcode, you should get an error message
 5) Enter a valid, but not checked out barcode, you should get an error
    message.
 6) Enter a valid barcode that is checkout out and should be renewable,
    you should get a success message.
 7) Enable AllowRenewalLimitOverride
 8) Enter a barcode for an item that has been renewed too many times
 9) You should get a warning which you can override.
10) Disable AllowRenewalLimitOverride
11) Repeat steap 8
12) You should get a blocking error message
11) Enter a barcode for an item with unfilled holds on it,
    you should get an overridable warning

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Passes all tests and QA script, some issues have been
addressed in follow-ups.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-22 17:04:03 +00:00
Kenza Zaki
b8dbff0283 Bug 10795: Improvements for GetOpenIssue in C4::Circulation
This patch adds some improvements for the routine GetOpenIssue().
Now, it verifies if the parameter is given (if not it returns undef)
and it returns $sth->fetchrow_hashref() instead of a $issue.

To test:
prove t/db_dependent/Circulation_issue.t
t/db_dependent/Circulation_issue.t .. ok
All tests successful.
Files=1, Tests=16,  2 wallclock secs ( 0.06 usr  0.01 sys +  1.09 cusr  0.07 csys =  1.23 CPU)
Result: PASS

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

Comment: Same situation as the one noted in comment of
Bug 10683, test fails unless there is an issuingrule
All, All with 1 as renewals allowed.

With that condition, it succeeds

No koha-qa errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:54:51 +00:00
Kenza Zaki
924c4f69e0 Bug 10698: give C4::Circulation::DeleteTransfer() a return value
This patch adds return values to DeleteTransfer:
Undef if no parameters are given
1 if a Transfer is deleted
0E0 if a wrong parameter is given

It also fixes some unit tests in t/db_dependent/Circulation_transfers.t

To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 20 wallclock secs ( 0.03 usr  0.00 sys +  0.39 cusr  0.02 csys =  0.44 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Applied 10681 and 10692 before 10698
Run prove t/db_dependent/Circulation_transfers.t without errors
No koha-qa errors on all 3 patches

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:46:53 +00:00
Bernardo Gonzalez Kriegel
24984fcb7b Bug 10711: (follow-up) removing tabs
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:43:42 +00:00
Kenza Zaki
c93e5b12f8 Bug 10711: make GetOfflineOperation() return $sth->fetchrow_hashref instead of $result
To test :
prove t/db_dependent/Circulation_OfflineOperation.t
t/db_dependent/Circulation_OfflineOperation.t .. ok
All tests successful.
Files=1, Tests=7, 19 wallclock secs ( 0.02 usr  0.01 sys +  0.24 cusr  0.02 csys =  0.29 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: applied 10681 and 10710 before 10711
prove t/db_dependent/Circulation_OfflineOperation.t run without errors
koha-qa reports only 2 tabulations, fixed in a follow-up

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:43:03 +00:00
Kenza Zaki
e738f991b0 Bug 10681: remove inappropriate uses of finish() from C4::Circulation
This patch gets rid of finish().

From the man page

finish()
Indicate that no more data will be fetched from this statement handle
before it is either executed again or destroyed.
You almost certainly do not need to call this method.

Adding calls to "finish" after loop that fetches all rows is a common
mistake, don't do it, it can mask genuine problems like uncaught fetch errors.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-09 03:40:36 +00:00
ded520afdc Bug 9761: Make it possible to confirm future hold requests at checkin time
Description:

A new pref ConfirmFutureHolds is added. When confirming a hold at checkin time,
the number of days in this pref is taken into account when looking for reserves.
Note that this pref does not interfere with renewing, issuing or transferring
a book. For report Holds to pull, the default end date is calculated with this
new preference.
The use of ConfirmFutureHolds is useful only when future holds are allowed.

Test plan:
1) Enable future holds. Add a number of days into ConfirmFutureHolds.
2) Place a future hold within this number of days.
3) Run holds to pull report. Check default startdate and enddate.
4) Check this book in. Can you confirm the hold? Do not confirm.
5) Issue the book to another patron. You should not see a warning.
6) Renew the book for this patron via opac or staff. No warning either.
7) Check in again. Warning pops up again.
8) Transfer book. Switch branch. Check in. Hold found pops up. Do not confirm.
9) Back to first branch. Check in (with popup). Remove the hold. Add new future
hold past the number of days. Check in (no warn).

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-25 00:26:34 +00:00
Jonathan Druart
5ed940b18e Bug 10599: add option to unselect on loan items on the batch item modification tool
Sometimes when using the batch item modification tool, we would like to
automatically uncheck on loan items.

This patch also adds a new routine in C4::Circulation, IsItemIssued(),
which, when passed an itemnumber, returns whether the item is
currently on loan.

Test plan:
1/ Go to tools/batchMod.pl.
2/ Enter some barcode (at least 1 should be on loan).
3/ Click on the Continue button.
4/ Click on the "Clear on loan" link.
5/ Check that on loan items are unchecked.

Launch the unit test file:
prove t/db_dependent/Circulation/IsItemIssued.t

http://bugs.koha-community.org/show_bug.cgi?id=10572
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Works as expected, only modifies items that are checked (still). No regression noted.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-18 16:45:24 +00:00
Paul Poulain
013726fda2 Bug 7639: tiny QA follow-up
no need to create a variable just to call to send it as parameter the line after

Signed off by: Alex Hatley <alexh@cctexas.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-17 15:21:23 +00:00
Meenakshi.R
0005f6bad3 Bug 7639: add option to forgive overdue fines when declaring items lost
This patch adds functionality to forgive overdue fine when an item is
set to lost status.  Fines are forgiven only when the syspref
WhenLostForgiveFine is set to yes. Item can be set to lost status from:

- catalogue/moredetail.pl
- cataloguing/additem.pl
- tools/batchMod.pl
- misc/cronjobs/longoverdue.pl

Changed subroutine C4::Circulation::LostItem to forgive fines on the
item depending on the value of syspref WhenLostForgiveFine. This
routine is currently used to return an item and charge a replacement
cost.

Also added a new syspref in C4::Circulation::LostItem -
WhenLostChargeReplacementFee.  The replacement fee will now be charged
only if this syspref is set to yes.  The default value of the
WhenLostChargeReplacementFee is yes, meaning that current behavior
will not change during upgrade.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Alex Hatley <alexh@cctexas.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch in series.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-17 15:10:46 +00:00
dbaefb626c Bug 10550: Fix database typo wthdrawn
This patch updates the wthdrawn field in items and deleteditems to be
withdrawn instead. No functional changes are made.

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

Comment: Save for translation files (that will be fixed on next release),
only occurrence of wthdrawn is on updatedatabase.pl
No koha-qa errors.

This touch many files, and I did not test everything,
but all seems normal. I think that any problem could
be fixed later.

Perhaps both entries in updatedatabase.pl could be joined
into one, but thats for QA.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-08 01:58:41 +00:00
Galen Charlton
ac11a5d9ff Bug 10699: (follow-up) fix parameter test in DeleteBranchTransferLimits()
Need to check for definedness, not Perl truth.

Also adds description of the return value to the POD.

To test:

Run prove -v t/db_dependent/Circulation_transfers.t and verify that
the tests pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-28 15:34:47 +00:00
Kenza Zaki
88f15db30a Bug 10699: add explicit return value for DeleteBranchTransferLimits()
This patch adds return values to DeleteBranchTransferLimits:
1 if a Transfer Limit is deleted
undef if no parameters is given
0E0 if a wrong parameter is given

More, it fixes and adds some tests in t/db_dependent/Circulation_transfers.t

To test :
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=14, 19 wallclock secs ( 0.02 usr  0.01 sys +  0.39 cusr  0.02 csys =  0.44 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested with patch for bug 10692 applied.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-28 15:23:51 +00:00
Galen Charlton
6751c5dc7c Bug 10693: (follow-up) fix parameter checking in CreateBranchTransferLimit()
There is nothing prevent '0' from being used as a library code.

To test:

Run prove -v t/db_dependent/Circulation_transfers.t and verify that
the tests pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-28 15:16:28 +00:00
Kenza Zaki
3c61f95fb4 Bug 10693: CreateBranchTransferLimit's return value in C4::Circulation.pm should be more explicit
This patch test if the parameters $toBranch and $fromBranch are given.
If not, CreateBranchTransferLimit now returns undef.
This patch also fixes and adds some regression tests in
t/db_dependent/Circulation_transfers.t

NOTE:
Currently, we can add a transferlimit to nonexistent branches because
in the database branch_transfer_limits.toBranch
and branch_transfer_limits.fromBranch aren't foreign keys.

To test:
prove t/db_dependent/Circulation_transfers.t
t/db_dependent/Circulation_transfers.t .. ok
All tests successful.
Files=1, Tests=15, 18 wallclock secs ( 0.02 usr  0.01 sys +  0.42 cusr  0.00 csys =  0.45 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
2013-08-28 15:15:10 +00:00
50ff4f4a94 Bug 10081: add library name to IndependentBranches error message
With IndependentBranches turned on, if you try to check out an item
which belongs to another library you will get an error message which is
missing the library name. This patch corrects the problem by passing the
necessary variable to the template and outputting the library name using
the KohaBranchName TT plugin.

To test, turn on IndependentBranches and try to check out an item
belonging to another library (note that you must test with a staff user
who is not a superlibrarian). The error message you see should include
the name of the library to which the item belongs:

"This item belongs to Nelsonville and cannot be checked out from this
location."

Checkouts of items belonging to the library should be unaffected.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-20 14:26:25 +00:00
3e387f72a3 Bug 10663: restore ability of active hold requests to block renewal
Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This reverts changes made to CanBookBeRenewed by
patches from bug 9367.
GetReserveStatus is not suitable to recognize if an item
can fild a hold on return and CheckReserves is restored.

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

This patch includes a squash of a follow-up authored by
Katrin Fischer <Katrin.Fischer.83@web.de>:

  CheckReserves returns '' when no reserve is found,
  so $resfound will always be defined and we need to
  check if it's true.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-15 22:31:52 +00:00
Fridolyn SOMERS
ff7f372029 Bug 9362: fix query that finds upcoming due loans
C4:Circulation:GetUpcomingDueIssues is used in the advance_notices.pl
script.  This patch corrects an error in its handling of the maxdays
parameter that resulted in it picking up *all* upcoming due loans and
recently overdue loans.

Test plan :
- Create an issue with a date due in the paste
- Create an issue with a date due in two days
- Launch advance notices with due date in max 2 days : perl misc/cronjobs/advance_notices.pl -c -n -v -m=2
=> You get a warn "found 0 issues"
- Launch advance notices with due date in max 3 days : perl misc/cronjobs/advance_notices.pl -c -n -v -m=3
=> You get a warn "found 1 issues"

Signed-off-by: Mathieu Saby <mathieu.saby@univ-rennes2.fr>
I did the following test :

- 1 book to check in 2 days
- 2 books to check in in the past

before applying the patch :

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=2
getting upcoming due issues at ../misc/cronjobs/advance_notices.pl line 203.
found 1 issues at ../misc/cronjobs/advance_notices.pl line 205.

I changed the value of "-m" : 0, 1, 2, 3, 4
=> always 1 issue found (the book to check in in 2 days)

after applying the patch :

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=2
found 0 issues
for m = 0, 1, 2 => 0 issues

$perl ../misc/cronjobs/advance_notices.pl -c -n -v -m=3
found 1 issues
for m = 3,4,5 => 1 issues (the book to check in in 2 days)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-17 15:45:47 +00:00
835f745b55 Bug 9576: can now control whether max loans limit can be overriden
Adds a new system preference AllowTooManyOverride to control whether
a librarian can override the 'Too many checked out' message which is
currently always overridable.

Test Plan:
1) Apply patch
2) Run updatedatabase.pl
3) Attempt to check out 1 more item to a patron than the max issues
4) You should be allowed to override by default ( current behavior )
5) Set AllowTooManyOverride to "Don't allow"
6) Repeat step 3
7) You should be blocked from being able to issue the item

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

The new system preference is activated by default, which mean there
will be no change in behaviour on update.

The system preference is correctly added to the database and .pref
files.

Test plan and QA script passes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-17 15:07:42 +00:00
040eb4016f Bug 10262 - fine calculation at checkin not respecting CircControl
The fines.pl script uses the system preference CircControl to decide
what branches circ rules to use for fine generation.

Recently, code was added to the returns system to recalculate the fine
at checkin time ( to support hourly loans ). The problem is that this
code does not respect CircControl.

Test Plan:
1) Set circ control to "the library you are logged in at"
2) Set different fines rules for two different librarys
3) Check an item out at library A, backdate the due date so it's overdue
   and will have fines.
4) Check the item in at library B
5) Observe that the fines should be generated based on library A's rules,
   but the fines will be based on library B's rules instead!
5) Apply the patch
6) Repeat steps 3 and 4.
7) Observe now that the fines should reflect the fines rules for Library A

Note: it seems counter-intuitive for the fines system to behave this way
based on the preference being set to "the library you are logged in at"
but it does make sense. The rules used are from "the library you are
logged in at" when the item is first checked out.

If the fines system really did use the rules for the library the item was
returned to, it would be easy to exploit the library system. Some Koha
using systems have branches that charge fines, and others that don't, so
a patron could just return any overdue items to a non-charging branch
to avoid ever paying fines!

Furthermore, it would mean that the fines.pl script would be using one
set of rules to charge fines, and the returns system could possibly be
using another. Since fines.pl has been around far longer, it makes sense
to assume the fines.pl behavior is canonical.

Signed-off-by: Mickey Coalwell <mcoalwell@nekls.org>
Signed-off-by: George Williams <georgew@latahlibrary.org>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

Merged with reservations; see comment on bug report for details.
2013-05-28 08:31:34 -07:00
fc61bd3018 Bug 10120: Adding a syspref to control if overdue charges are updated on return
On by default.

To Test

1/ Create an overdue item, that should get fines
2/ Return the item
3/ Check the borrowers record to see if the fine has been added/updated

Apply patch
1/ Make sure preference is set to do
Repeat steps 1-3 above

2/ Switch the preference to don't
Repeat stes 1-2
3/ Check the fine hasn't been added/updated

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass, works as described.
I would categorize this a bug fix for libraries that don't want
the new changed  behaviour that was introduced by recalculating
fines on return.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-24 08:47:12 -07:00
b00ec06968 Bug 10080 - Change system pref IndependantBranches to IndependentBranches
Test Plan:
1) Enable IndependantBranches
2) Apply this patch
3) Run updatedatabase.pl
4) Verify that the system preference still functions correctly

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-22 07:58:23 -07:00
Peter Crellan Kelly
571dab9c7c 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>
2013-05-01 08:44:11 -04:00
93f6053694 Bug 8770 - amount does not equal amountoutstanding on a fine with no payments or credits
If a lost item fee is owed and partially paid off when an item is
returned and a refund is processed, Koha tries to pay off existing
fees before adding any leftover balance as a credit on the account.

However, those fee payments aren't actually processed, due to a bug
where the accountnumber was quoted as a string literal, and thus the
for the fee payment would fail. This did not result in an DB error,
as the query was still valid SQL. Checking the return value of the
query would have revealed that the accountline had not been updated.

History:
This bug was introduced on April 23, 2007 with the commit
'reintroducing fixaccountforlostandreturned as requested by rosalie'.
Commit id 111d590e9c

On July 30, 2009 the error was flagged with a FIXME and remained
in that state until now.
Commit id 51e8fc2cb6

Test plan:
1) Create a test patron
2) Check out an item to that patron and give it a due date in the past
3) Run fines.pl to generate the fine for the item
4) Mark the item long overdue on the item tab (not in edit items)
5) Pay for the lost item
6) Check the item back in
7) Note the incorrect fines. Only the lost fee balance  due is refunded,
   not the entire lost fee, but no other fees are paid off.
8) Apply the patch
9) Repeat steps 1-6, then not the fines are paid correctly

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Totel due is correct after applying the patch.
All tests and QA script pass.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-04-07 19:56:03 -07:00
Jonathan Druart
5b4752e027 Bug 8365: FIX Return issue values instead of item values
Before this patch, the GetItemIssue routine returns items.renewals
instead of issues.renewals

Signed-off-by: Broust <jean-manuel.broust@univ-lyon2.fr>
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>
2013-03-22 07:57:02 -04:00
Jonathan Druart
574e2f9d60 Bug 8365: Followup Force DateTime type for the datedue variable
Signed-off-by: Broust <jean-manuel.broust@univ-lyon2.fr>
I tested one more time on a sandbox but I confirm the problem:
the due date doesn't change when you renew more than one time
with syspref renewalperiodbase turned on: "the old due date of
the checkout". The due date should change any time.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Added signed-off line and problem description from bugzilla.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-22 07:57:02 -04:00
Jonathan Druart
f35dbbf42e Bug 8365: Add unit tests and fix QA issues
This patch adds some unit tests for CalcDateDue and GetLoanLength

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.

Tests done:
- Checked update works correctly for existing circulation rules.
- Adding, deleting and overwriting circulation rules works.
- Renewals work for different circulation rules and changes
  to the holiday calendar.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-22 07:57:02 -04:00
Jonathan Druart
8ad00bc02f Bug 8365: Add a renewal duration in the issuing rules
Renew an issue for a number of days (filled in the issuing rules).

Test if rules work for any i[item]types and if there is no regression.

- new column issuingrules.renewalperiod
- remove all occurrences of an already removed syspref (globalDueDate)
- remove an unused routine (Overdues::GetIssuingRules)

How it works:
- On existing installations, the issuingrules.renewalperiod =
  issuingrules.loanlength. So the behaviour is the same before and after
  this patch.
- when you add a rule, you can choose a renewal period (the unit value
  is the issuingrules.unit). So you can have a renewal period in hours
  or days.
- The default value for the renewal period is 21 days (same as
  loanlength)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Test comments on second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-22 07:56:59 -04:00
7224e47dfe Bug 8220 - Allow koc uploads to go to process queue instead of being applied directly.
The primary advantage to the Firefox offline cirulation plugin when compared
to the offline circulation desktop application, is the ability to add offline
circulation actions to a queue so that multiple machines running offline
circ can have their circ actions combined and ordered chronologically before
being executed. This commit adds the ability to put actions from uploaded
KOC files into this queue. In this way, both the FF plugina and the desktop
application can be run side by side with no ill effects.

Signed-off-by: Bob Birchall <bob@calyx.net.au>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-21 20:35:37 -04:00
Adrien Saurat
7ceb9988e9 Bug 7241: circulation action logs record biblionumber instead of item number
Issue log and and circulation logs are incorrectly recording biblionumber instead of item number, creating incorrect logs.
This patch corrects this, and modifies the action_logs table in two ways:
- the timestamp is not updated anymore with UPDATES (but still automatically filled when INSERTing)
- to partially correct the broken logs, the log history is filled with the first found item for each biblio

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>
2013-03-21 11:42:56 -04:00
Fridolyn SOMERS
6cec57901a Bug 9423: Add notforloan value to issue confirmation or blocking message
When trying to checkout an item that is not for loan (due to
items.notforloan value or because itemtype is not for loan), you get a
confirmation or blocking message (depending on AllowNotForLoanOverride
syspref).

This message tells "Item is normally not for loan".

This patch adds some informations :
if itemtype is not for loan, tells "Item type is normally not for loan".
if item is not for loan due to items.notforloan value, adds notforloan
description to message.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Works as advertised: Not for loan authorized value is correctly shown.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-19 22:22:23 -04:00
Jonathan Druart
37b6ac0b14 Bug 9367: Followup: Code optimization: CheckReserves is too often called
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-16 11:49:43 -04:00
Jonathan Druart
fad1f44d42 Bug 9367: Code optimization: CheckReserves is too often called
This patch rewrites the GetReserveStatus routine in order to take in
parameter the itemnumber and/or the biblionumber.

In some places, the C4::Reserves::CheckReserves routine is called when
we just want to get the status of the reserve. In these cases, the
C4::Reserves::GetReserveStatus is now called.
This routine executes 1 sql query (or 2 max).

Test plan:
Check that there is no regression on the different pages where reserves
are used. The different status will be the same than before applying
this patch.

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>
2013-03-16 11:49:43 -04:00
Fridolyn SOMERS
755decfd89 Bug 9392: confirmation does not appear for negative notforloan items issues
When checking-out an item marked "not for loan" with a positive value,
you get a message to forbid or confirm issue (depending on
AllowNotForLoanOverride syspref).  For an item with a negative value
(usually during acquisition process), the issue is made without forbid
or confirm message.

This patch simply changes the test notforloan > 0 into notforloan != 0.

Test plan :
- Checkout an item with items.notforloan = 0
=> The item is issued without message
- Checkout an item with items.notforloan > 0
=> A message forbids or asks confirmation to override
- Checkout an item with items.notforloan < 0 (e.g., on order)
=> A message forbids or asks confirmation to override

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Checked with AllowNotForLoanOverride on and off.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-02-08 21:38:49 -05:00
Srdjan
95077493bd Bug 7243: Rewording and renaming
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passed-QA-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-01-24 09:17:12 -05:00
Srdjan
1b4a266915 Bug 7243: Be selective when summing up charges for blocking issues
Added RentalsInNoissueCharges and ManInvlsInNoissueCharges sys prefs

Created C4::Members::cwGetMemberAccountBallance()
* A wrapper for GetMemberAccountRecords that gives info on non-issue and
  other charges
* Other charges are:
  'Res'
  'Rent' if RentalsInNoissueCharges is Mo
  authorised_values MANUAL_INV if ManInvlsInNoissueCharges is No

C4::Members::GetMemberAccountRecords() changes:
* Dropped input param $date, it is not used

Use split charges in C4::Circulation::CanBookBeIssued() and
C4::Members::patronflags(). That way only fines decide whether an item
can be issued, and not other non-fine charges

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

Rebased (updatedatabase.pl)

ManInvInNoissueCharges and RentalsInNoissueCharges ar both included by default (= behaviour as before)

All variants tested: Both included, none included, manual invoice included, rentals included.
Works fine, blocks/does not blok as appropirate, messages appear as expected.

[Oct 12, 2012 marcelr:] Amended for updatedatabase.pl
Signed-off-by: M. de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-01-24 09:12:59 -05:00
Jonathan Druart
7fc4be502d Bug 9206: Followup QA FIX
- Fix indentation
- It is useless to loop on all items. If at least 1 item is already
  issued, we want to return 1.
2012-12-27 09:48:03 -05:00
e3f6a74660 Bug 9206 - Only allow place holds in records that the patron don't have in his possession - QA Followup
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
2012-12-27 09:48:03 -05:00
Vitor FERNANDES
63f2ceb603 Bug 9206 - Only allow place holds in records that the patron don't have in his possession
Added a system preference to turn on/off this feature.
By default the system allow the patron to place holds even if it is in his possession.
Script to place holds check if the system preference is off and if patron has at least one item to block holds.
Messages to say that are already in patron possession added to templates.
Method to check if patron has one issue from one record added to C4::Circulation

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>
2012-12-27 09:48:03 -05:00
Vitor FERNANDES
8048ba3201 BUG 9151 - Renewal notice according to patron alert preferences (Patch 2)
Added a system preferences (RenewalSendNotice - default no) to controll the renewal notice sending.
Added to installer languages the renewal notice template.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-12-21 07:41:25 -05:00
Vitor FERNANDES
a478c52e09 BUG 9151 - Renewal notice according to patron alert preferences
Modifications on AddRenewals and SendCirculationAlert in order to send a renewal notice to the patron according to the patron checkout alert preference.
Added a new notice template for renewals notices.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-12-21 07:41:24 -05:00
ca11d0ba29 Bug 7189 - preference to control if returning lost items gives refund
Right now when you return an item that was lost the patron's card is
credited with the lost fee, but not all libraries refund lost fees
and sometimes the fee is refunded after the patron has paid for it,
causing all kinds of financial issues.

Adds the syspref RefundLostItemFeeOnReturn to control whether
returning a lost item refunds the fee charged for losing that
item. Enabled by default to maintain Koha's current functionality.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Passed-QA-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-11-30 08:01:41 -05:00
7b18e2146c Bug 8800 - useDaysMode=Datedue wrong behaviour (revisited)
useDaysMode=Datedue wasn't used as advertised in the docs. Added
next_open_day and prev_open_day subs to Koha::Calendar and some tests for them.

- Koha::Calendar->addDate was rewritten in a more sane way (also split into
  addHours and addDays for convenience).
- Fixed a bug introduced in Bug 8966 regarding dt truncation and dtSets->contains
- Minor docs typos
- Use the passed Calendar mode or default to 'Calendar' in Koha::Calendar->_mockinit.
- Tests

I'm writing some db-dependent tests for is_holiday, and hopefully for CalcDateDue so any
rewrite/followup doesn't break things.

Regards
To+

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passed-QA-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-11-22 09:11:19 -05:00
Mark Tompsett
c66270c02f Bug 8834 - Call to C4::Context::preference fails to pass $self in Circulation.pm
Changed:
    my $circcontrol = C4::Context::preference('CircControl');
To:
    my $circcontrol = C4::Context->preference('CircControl');
This will pass $self and 'CircControl' which will then prevent
a "Use of uninitialized value" error log entry.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-10-24 18:21:23 +02:00
Colin Campbell
1c4125cd0e Bug 8841 Duedate should be set to end of expiry day
When reducing duedate to patron's expiry date
it should be set to end of that day not 00:00
take account of the fact that the borrower
expiry date will have no hours/minutes

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-10-24 18:17:06 +02:00
Paul Poulain
f58a6f4e10 Bug 3387 follow-up: fix perlcritic error 2012-10-01 17:35:45 +02:00
7a7e018ed3 Bug 3387 - WITHDRAWN items shouldn't check in
Adds a system preference BlockReturnOfWithdrawnItems to control
whether or not Koha should allow a withdrawn item to be returned
or not.

Also fixes the behavior where Koha will attempt to use a withdrawn
item to fill a hold.

Test Plan:
1) Set BlockReturnOfWithdrawnItems to "Block" ( this is the default )
2) Check an item out to a patron
3) Mark item as withdrawn
4) Attempt to return the item, you should still see the item on the
   borrower's record
5) Set BlockReturnOfWithdrawnItems to "Don't Block"
6) Attempt to return the item, you should see the item is no longer
   on the borrower's record.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
2012-10-01 17:07:53 +02:00
5da1298ac1 Bug 6679 - [SIGNED-OFF] fix 8 perlcritic violations in C4/Circulation.pm
- "return" statement with explicit "undef" at line 994, column 39.  See page 199 of PBP.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-09-20 12:01:35 +02:00
Colin Campbell
537c746dc4 Bug 7751: Decrease Loans for Items in Demand for Holds
Rebase and merge based on Mark Gavillet's patch to reduce
the loan period given to items on renewal when they are
in high demand for holds

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
2012-09-18 19:01:14 +02:00
Paul Poulain
c7eadd8b62 Bug 6151 follow-up fix POD
Fixing POD, problem detected by jenkins (thanks jenkins !)
2012-09-18 15:14:00 +02:00