Commit graph

86 commits

Author SHA1 Message Date
742f3c0335 Bug 15675 - Fix some missed tab characters, remove old FIXMEs
Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-03-02 03:24:46 +00:00
2398bfafc6 Bug 15675 - Add issue_id column to accountlines and use it for updating fines
Right now, fines are updated based on the fine description. There are a
number of areas where this can go wrong ( date or time format changing,
title being modified, etc ). Now that issues has a unique
identifier, we should use that for selection and updating of fines.

Test Plan:
1) Apply this patch
2) Test creating and updating fines via fines.pl
   and checking in overdue items. No changes should be noted.
3) prove t/db_dependent/Circulation.t

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-03-02 03:24:45 +00:00
Natasha
f1bbc3d2a1 Bug 14538: editing perl doc for CalcFine
To Test:
Read perldoc C4/Overdues.pm
Confirm that it says CalcFine returns four values and that rest of the documentation is correct

NOTE: only a little visual ugliness, but definitely an improvement.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
2016-01-19 15:41:44 -07:00
c42de7460b Bug 9129 - Add the ability to set the maximum fine for an item to its replacement price
This patch adds the ability to set the maximum fine for a given item to
its replacement price ( assuming the replacement price is set ). If
overduefinescap is also set, the fine will be the lesser of the two, if
both apply to the given overdue checkout.

To enable this new limit, create or edit your circulation rules and
check the checkbox for "Cap fines at replacement price"

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Pick an item, and set it's replacement price to 3.99
4) Edit the circulation rule that would apply to this item
   and the patron you will check it out to.
5) Check out the item to the patron, and backdate the due date
   such that the fine generated would be more than 3.99
6) Enable CalculateFinesOnReturn
7) Return the item, and view the fine generated, it should be 3.99

Signed-off-by: Cindy Murdock Ames <cmurdock@ccfls.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-12-31 15:29:36 +00:00
Blou
7628c4a854 Bug 13624 - Remove columns branchcode, categorytype from table overduerules_transport_types
This patch is a _requirement_ to Bug #12771, and will be necessary once we start managing more than 3 levels of overdue notice

TEST PLAN
1) Create or improve on overduerules data
  .1) Intranet -> tools -> overdue notices
  .2) Make sure to have data in first, second and third tabs
  .3) Make sure to have checked mixes of Email/Phone/Print/SMS (depending on availability)
  .4) Make sure to have different letters and delay on first/second/third tab for at least one category
  .5) Remember it all.
2) Apply patch
3) run installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl
4) run t/db_dependant/Overdues.t
5) Validate Overdue Notice page
  .1) validate data entered previously is still there
  .2) Add some more, save changes, validate

In installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl
    - A new column and primary key, 'overduerules_id', is added to the table 'overduerules'
    - A new column referencing a foreign key, 'overduerules_id', is added to the table 'overduerules_transport_types'
    - The columns 'branchcode' and 'categorytype' are removed from the table 'overduerules_transport_types'
    - Data is migrated from the old tables to the new ones

In installer/data/mysql/kohastructure.sql :
    - Table 'overduerules'
    - Added a primary key named 'overduerules_id'
    - Table 'overduerules_transport_types'
    - Added a foreign key named 'overduerules_id'
    - Dropped columns 'branchcode', 'categorycode' since we now have them referenced through 'overduerules_id'

In tools/overduerules.pl
    - INSERT and DELETE queries on 'overduerules_transport_types' were changed to reflect the new schema

In C4/Overdues.pm :
    - The SQL query of the function 'GetOverdueMessageTransportTypes' is changed to take into account the new design of 'overduerules_transport

In t/db_dependent/Overdues.t :
    - The INSERT calls before the tests were changed to take into account the new design of 'overduerules' and 'overduerules_transport_types'

Sponsored by : Halland County Library

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Martin Persson <xarragon@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2015-12-31 12:47:16 +00:00
Marc Véron
b8b0b1370f Bug 14985: Remove C4::Dates from files in folder C4/*.pm (part one)
This patch removes C4::Dates from following files in folder C4:

- C4/Members.pm
- C4/Reserves.pm
- C4/Search.pm
- C4/Utils/DataTables.pm
- C4/Utils/DataTables/Members.pm
- C4/VirtualShelves/Page.pm

To test:
 -run tests as appropriate,
- have a close look at the code changes
- try to find regressions

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

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

Bug 14985: (followup) Remove eval if dates come from database

This patch removes some evals from date-formatting where the dates come
from the database.

See comments #7 - #9

Additionaly, C4/VirtualShelves/Page.pm is removed from the patches (obsolete).

Bug 14985: (followup) Remove C4::Dates from C4/Overdues.pm

Ths patch removes a stray C4::Dates from C4/Overdues.pm

- To test got to a patron who has overdues
  (Home > Circulation > Checkouts > [Patron])
- Print overdues

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-13 11:24:54 -03:00
78db3adda2 Bug 12933: (QA followup) Rename parse_letter to parse_overdues_letter
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
e6127b1bc0 Bug 12933: Add ability to print overdue slip from staff intranet
Some librarians would like to be able to print an overdues slip from the
staff intranet. This slip would be defined as the print transport
version of the ODUE slip.

Test Plan:
1) Apply this patch
2) Locate a patron with overdues
3) Define a print version of the OVERDUES_SLIP slip
4) Try Print > Print overdues

Signed-off-by: Amy Purvis <APurvis@galencollege.edu>
Signed-off-by: Laurie McKee <lmckee@littleelm.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-04 12:41:29 -03:00
f86816220e Bug 13590: Add ability to charge fines at start of charge period
Right now, Koha only charges fines at the end of a given charge period.
For example, let us assume a circulation rule has a charge period of one
week ( 7 days ) and a fine of $5. This means that an item can be overdue
for 6 days without accruing a fine. Koha should allow circulation rules
to be configured to place the charge at the start of the end of the
charge period so the library can decide when the fine should accrue.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) prove t/db_dependent/Circulation_Issuingrule.t
4) prove t/db_dependent/Circulation.t
5) prove t/db_dependent/Fines.t
6) Ensure you can still create/edit circulation rules

Edit: I removed the DBIx changes after a couple minutes fighting with them.
Will regenerate as usual in a RM followup / Tomas

Signed-off-by: Daniel Grobani <dgrobani@samuelmerritt.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-22 14:51:24 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -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
faab00b88a Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0
Due to the way AddReturn and UpdateFine work, if you pass in a return
date to AddReturn, and that item has a calculated fine of 0, Koha will
insert the 0 amount fine into accountlines.

This is good behavior when we want to update an existing fine, but bad
behavior if there was no fine to begin with!

Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/Circulation.t
3) Note the test fails
4) Apply this patch
5) prove t/db_dependent/Circulation.t
6) Note the test passes

Signed-off-by: Jen DeMuth <jdemuth@roseville.ca.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Confirmed the problem in the staff interface and that the patch
fixes it. Also tested that fines still get calculated.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-31 11:36:07 -03:00
53923cbd02 Bug 11872 - Lost overdue items should not generate fines
An item can be marked as lost by longoverdue.pl, but left checked out to
the patron. In this case, the item will continue to accrue fines.

Test Plan:
1) Check out an item and back date it so it is overdue and should
   generate fines.
2) Mark the item as lost by either using longoverdue.pl, or just
   by setting itemlost to 1 by directly accessing the database
3) Run fines.pl
4) Note the overdue generated a fine
5) Repeat steps 1-2
6) Apply this patch
7) Run fines.pl
8) Note a fine was not generated

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-07 20:15:55 -03:00
Sophie Meynieux
40ece625bb 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>
2014-11-11 09:44:01 -03:00
Jonathan Druart
4daaf80678 Bug 9180: All branches should be returned if a default rule exists
The C4::Overdues::GetBranchcodesWithOverdueRules routine has a bug.
If a default rule *and* a specific rule exist, only the branchcode for
the specific rule is returned.

Test plan:
prove t/db_dependent/Overdues.t
and verify the unit tests are consistent.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-19 09:29:51 -03:00
07dad6bb83 Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
When using the backdating of returns feature, an item that is not
overdue is treated as being as many days overdue as it is *not* overdue.
This is due to the fact that _get_chargeable_units appears to return the
difference between the return date and the due date without
consideration the return date being earlier than the due date.

Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/Circulation.t
3) Note the failure
4) Apply the second patch
5) prove t/db_dependent/Circulation.t
6) Note there are no failures

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Fixes some badly named variables also

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
In order to test this, you need to activate SpecifyReturnDate.
I confirmed the problem and verified that the bug fixes it
by running the tests, but also by testing in staff.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-25 09:57:50 -03:00
Jonathan Druart
7ca4f590ac Bug 11696: ensure that print overdue notices use the print template
This reordering avoids the case where a print notice is sent with an
email or sms template is no email or SMS is defined.

Test plan:
Check print, sms and email for an overdue rule
Don't define an email address and generate an overdue for a user
Define 3 templates for the notice used
Launch the cronjob script and verify the print notice is generated using
the print template.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:21 +00:00
Jonathan Druart
9ac4591de9 Bug 9016: (follow-up) fix tab characters and POD.
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:17 +00:00
Jonathan Druart
f7537bc938 Bug 9016: (follow-up) fix unit tests
The unit tests should insert overdue rules.
+ Fix the doc for GetOverdueMessageTransportTypes

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:17 +00:00
Jonathan Druart
e421ec4925 Bug 9016: Define different transport types for overdues
This patch adds:
- a new routine C4::Overdues::GetOverdueMessageTransportTypes.
- the ability to define one or more transport types for an overdue
  level.

Test plan:
- go on tools/overduerules.pl.
- verify that previous rules still exist and that the 'email' checkboxes
  is checked if a rule is defined.
- redefined rules at different levels and check the transport type
  needed. Currently, only email, sms and print are relevant
- Save the changes.

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-02 20:29:16 +00:00
Frédérick
54a17d97dc Bug 11359: Add the borrower's cardnumber and phonenumber to the branch overdues report
The report also known as "Overdues with fines"

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

All tests pass, this adds data to the Patron column on the
overdues with fines report to show the patron's cardnumber
and phone number.

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

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-10 20:25:26 +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
8f20b248e7 Bug 10256: Remove some unused subs from Overdues module
Removes the following exported but unused subs from Overdues.pm:
CreateItemAccountLine
UpdateAccountLines
CheckAccountLineLevelInfo
CheckAccountLineItemInfo
CheckExistantNotifyid
GetNextIdNotify
GetNotifyId
ReplacementCost
ReplacementCost2
GetOverdueDelays
GetOverduerules

Test plan:
It is hard to test the removal of something that was not used :) Try this:
Do a recursive grep on these routine names in the Koha codebase.
Compile some scripts that use the Overdues module.
And just to be sure we do not break something:
Go to Circulation: Do a checkout, checkin, place and confirm a hold.
Go to Patrons: Goto Check out. Goto Fines.
Run the command line scripts: fines.pl and overdue_notices.pl.
Go to opac-user.pl.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-06-17 09:08:50 -07:00
656aba3e1f Bug 10030: QA Followup for trivial false warning detected while testing
Moving the warn line below the line that returns if amount<=0.
If amount<=0, a false warn is now raised because of the return after it.
We should only warn here if we do not return.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with fines.pl on overdue.
Before this patch:
Reducing fine for item 199709 borrower 23 from 44 to -1 - MaxFine reached.
This did not happen however because of the return.
After this change: no false warning.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 21:51:16 -04:00
9fc4c64140 Bug 10030 - MaxFines checks against amount, not amount outstanding
If a patron has over time accumulated fines greater than the amount
defined in MaxFine, the patron will never get more fines even if they
have previously paid off those fines.

This bug was introduced by the patch for Bug 7420.

Test Plan:
1) Create a patron
2) Create a fine of 10.00 for that patron
3) Pay off the fine
4) Set MaxFines to 5.00
5) Check out an item to the patron, backdate the due date
   so the item should generate fines.
6) Run fines.pl, observe that no fine was created
7) Apply the patch
8) Rerun fines.pl
9) Observe that the fine was created correctly

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 21:51:15 -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
aba4f05b80 Bug 4906: Allow fine calculation to exclude grace period
This patch adds the system preference FinesIncludeGracePeriod which
allows the library the choice to include the grace period when calculating
a fine ( Koha's current behavior ) or to ignore the grace period for
the purposes of fines calculation. It is set by default to preserve the
current behavior.

Signed-off-by: Srikanth Dhondi <srikanth@catalyst.net.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Rebased March 8, 2013. Included renaming pref.
Works as advertised. Renamed the bug title and opened a new report for the
original bug.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-16 21:47:21 -04:00
Robert Williams
95b5e2f94e Bug 8939 : Fines being charged during the grace period
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-10-26 17:26:07 +02:00
Elliott Davis
381794ff4e [PATCH] bug_7420: Added overduefinescap to issuingrules
Replaced existing MaxFine syspref logic with overduefinescap.
Repurposed MaxFine to be the overall overdue limit for all items
overdue. Implemented new MaxFine logic in UpdateFine().

Signed-off-by: Elliott Davis <elliott@bywatersolutions.com>
Tested according to Srdjan's test plan and everything worked like he said it would.  I set fined equal to $2 and max fine equal to $1.      When I ran the fines script for overdue items fines assessed were only $1.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-07-25 18:33:20 +02:00
Chris Cormack
509d673f10 Bug 7941 : Fix version numbers in modules
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-11 17:29:38 +02:00
Elliott Davis
d06c231982 bug 7849 Instant Fine Calculation\n Adds functionality of calculate fines instantly. This is very important for Hourly loans becuase of a loophole from the cron.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-04-19 17:52:18 +02:00
Colin Campbell
32c5ef613d Use hour or day deltas to calculate overdue durations
If durations are calculated by subtraction they will use units
larger than those we care about and these are not convertable
to the smaller units we are attempting to enumerate
Use the appropriate delta methods to calculate theee fines

Adds a separate hours_between method to calendar
This should strictly be checking opening hours (of which
closed days are a special case) of the relevant branch
These need adding to branches

http://bugs.koha-community.org/show_bug.cgi?id=7852
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Ian Walls <koha.sekjal@gmail.com>

QA comment: renamed "days_minus_grace" variable to "units_minus_grace"
Also added POD to _get_chargeable_units

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-04-03 17:59:56 +02:00
Colin Campbell
4612eeddf7 Bug 5549 : CalcFine was corrupting due date
Clone the passed duedate as the addition of days was
corrupting it in calling context causing new account recs
to be written rather than updating the existing
2012-03-20 13:27:46 +13:00
Colin Campbell
624edf3dba Bug 5549 : Refactor fines.pl
Clean code in fines to remove unnecessary complexity
remove constructs now thought suspect or
not good pracrice
2012-03-20 13:27:12 +13:00
Colin Campbell
39d1b7e61b Bug 5549 : Overdues : Handle some date comparison and display issues 2012-03-20 13:21:19 +13:00
Colin Campbell
d55405047b Bug 5549 : Fix calculation of duedates in fines.pl and advance_notices.pl
Cleaned up some no longer used parameters in
Overdues::CalcFine
2012-03-20 13:20:01 +13:00
Colin Campbell
cb170fe4ff Bug 5549 : Cannot use CUR_DATE on date_due column
Comparison of CUR_TIME() & datetime gives
table corrupted error in mysql
Plus we want to see hourly loans
2012-03-20 12:34:20 +13:00
Colin Campbell
d39262e61d Bug 6987 Make return from Overdues::GetFine consistent
If there is not a fine amount return zero not
undefined or other undefined behaviour

Use more meaningful var names for readability

Signed-off-by: Sophie Meynieux <sophie.meynieux@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2011-12-08 11:19:10 +01:00
Ian Walls
d059079caf Bug 2346: Remove C4::Overdues::UpdateBorrowerDebarred in favour of C4::Members::DebarMember
Removes now-unused subroutine from C4::Overdues, as well as the db_dependent unit test

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-12-06 19:12:20 +01:00
Paul Poulain
1fe3514c3c Bug 6328 fine in days does not work
Some code coming from BibLibre has been lost in the process of inclusion in
3.4. The result is that fine in days does not work at all (you can setup rules,
but it does nothing)

Step to reproduce:

- Koha > Admin > circ rules > set 1 day fine every day of overdue for default
  rule
- Issue a book return date last week
- check-in the book => no debarment is set

The following patch will fix all of those problems by :

* updating borrowers.debarred to a date field (instead of tinyint). It contains
  the limit of the debarment
* changing API of DebarMember and UpdateBorrowerDebarred to pass a date
* display debarrdate where applicable. Note that a debarrdate of 31/12/9999 is
  considered as unlimited and not displayed
* added a debarrcomment, usefull to explain why a patron is debarred (this is
  independant from debarrdate changes and can be used when placing an unlimited
  debarment too)

[2011-05-12] F. Demians. It works as described. And I can confirm this
functionality is impatiently awaited by French libraries since one year. Thanks
BibLibre for the good work and for contributing this code.

Bug 6328 Followup--update DB structure

Thanks Katrin.

Bug 6328: make comment a textbox / fix debar by notice trigger

Debarring by notice triggers was broken, because the new function
expects a date as second parameter.

The comment field in patron account details was a very long text field.
Patch changes it to be a textbox instead.

Bug 6328: Lift debarment leaves patron account

'Lift debarment' redirects to an empty circulation page.

BZ6328 follow-up 3

Fixes comment 23 from Fernando L. Canizo : when the patron was debarred and debar removed
he still could not check-out.

The changes in the IsMemberBlocked (that were on biblibre/master) were lost somewhere
The sub was still checking for old_issues instead of calling CheckBorrowerDebarred
to get a debardate if applicable

Note : this bug was appearing only is you had issuing rules defined for itemtype/categorycode/branch.
Seemed to work if you had only default rules. That's probably why it hadn't been spotted before

BZ6328 follow-up 4
Comments fron Zeno Tajoli: The patch is OK and I sign-off it. Two little changes done on
installer/data/mysql/kohastructure.sql and installer/data/mysql/updatedatabase.pl

Signed-off-by: koha <koha@kohabase.localdomain>
2011-11-25 14:00:47 +01:00
Liz Rea
085de44ebd Bug 6927-- Typo in C4::Overdues.pm
Corrected a small typo in overdues.pm to fix a "Undefined subroutine &C4::Members::checkoverdues called at /home/koha/kohaclone/C4/Members.pm line 511." when making calls to GetMemberDetails

This fix suggested by Elliot Davis of UT Tyler, and he did the testing -- I'm just submitting the fix to master for him.  :)

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-09-28 09:24:17 +13:00
Ian Walls
26acaf3dfa Bug 6801: checkoverdues returns unnecessary fields, causing slowness
Explicitly specifies which fields to return in C4::Overdues::checkoverdues
SQL:  all of biblio, items, and issues, and everything in biblioitems
EXCEPT marc, marcxml and timestamp.

Bug 6801: member details page taking long time to load when many checkouts present

This patch removes the call to GetMemberDetails in build_issue_data; this heavy-weight
subroutine was being run for every single item a patron (or their relatives) have checked out.
Instead, the borrowers first name, surname and cardnumber are added to the GetPendingIssues query.
I believe this is reasonable since GetPendingIssues can now return issues for multiple borrowers.

Also corrects the $borrowernumber used for GetIssuesCharges and CanItemBeRenewed; was using the borrower whose
page we were on, NOT the borrower of that specific item (which would be different in the Relatives Checkouts tab).

Template calls to [% scope.borrowername %] are now broken up into [% scope.firstname %] [% scope.surname %].

Signed-off-by: Liz Rea <lrea@nekls.org>
On my test data, a patron with 180 checkouts (without this patch) would take more than a minute to bring back the circulation.pl and moremember.pl pages.
With this patch, the time is reduced to 5 or so seconds.

Big ups to Ian for tenaciously hunting this one down.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-09-27 09:43:25 +13:00
Sophie Meynieux
141a52ac30 Bug #6064 Improvement of default value usage in overdue
Change default value in overduerules table for delayn (NULL instead of 0) and fix GetBranchcodesWithOverdueRules function

Signed-off-by: Stéphane Delaune <stephane.delaune@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-07 21:33:40 +12:00
Paul Poulain
ddbedbfc2f Bug 4330 : Adding some copyright BibLibre statements 2011-03-21 10:57:20 +13:00
Frédérick Capovilla
dbe3780fc0 Bug 3341: Fines calculation erroneous when a repeatable holiday is added
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-03-06 08:15:44 +13:00
50c0ae09a1 Partial fix for Bug 5745, Overdues with fines report not showing titles
- Adding title, subtitle, and author to output
- Reworking display of shelving location selection

Patch does not address the contents of 'overdue status' and 'notified by'

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-02-15 10:12:36 +13:00
7c0e441d50 replace references to defunct info email address
Now links to Koha project website.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-25 05:18:44 -04:00
Andrew Elwell
546a0244bb More POD cleanups
Signed-off-by: Andrew Elwell <Andrew.Elwell@gmail.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-09 08:38:58 -04:00
64daee5495 fix a common "developement" typo
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-05-25 14:38:38 -04:00
Donovan Jones
593a7d8e6a Bug 2505 - Add commented use warnings where missing in *.pm 2010-04-21 20:28:51 +12:00