Commit graph

59 commits

Author SHA1 Message Date
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
Lars Wirzenius
7279f55b60 Fix FSF address in directory C4/
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-03-16 20:17:56 -04:00
Paul Poulain
638dfd30e5 fixing overdue checking (today is not late)
NOW() returns minuts and seconds. date_due is just YYYY-MM-DD
Thus date_due < now() is wrong if date_due is today, and the patron is considered as late.
With curdate(), the patron is late only the day after the overdue limit
2009-11-10 22:23:48 +01:00
Michael Hafen
ec5565d356 include grace period when calculating overdue fine
Before the grace period was not included in the number of days overdue when
calculating the fine.  My librarians seem to think the number of days overdue
should include the grace period.

Fine is not assessed before the grace period is up though.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-09-14 22:45:40 -04:00
Joe Atzberger
1d6a840168 Give Overdues a few whacks with perltidy
This was, an in part still is, some of the worst-formatted code in Koha.

Also made a few minor changes:
~ removing sth->finish
~ adding comment
~ removed whitespace error trailing spaces
~ use trinary op, like: return ( $debarredstatus eq '1' ? 1 : 0 );

Note that the logic is the same, even where I condsider it faulty.
(In the exampe case, because $debarredstatus may be undef.)

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-07-22 10:54:35 -04:00
Joe Atzberger
5169a4cb4a checkoverdues should not require $dbh
Passing $dbh around is an ancient style that doesn't know
to use C4::Context.  C4::Context->dbh is efficient, especially
for modules that already use Context, including almost all C4.

I also internalized $today into the SQL using NOW() in the query
and removed sth->finish.  Even though I dislike the return style
that gives the count, then the array, I left it becuase I don't
have time to fix/test all the callers.  However, I did convert
it so it doesn't require a $count variable and its own loop.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-24 09:35:12 -05:00
Joe Atzberger
ba0ae6cd1c Branchoverdues circ report reworking.
branchoverdues.pl
~ Removed unused variables.
~ Use elsif where applicable.
~ Added many FIXMEs.
~ Added help description.
~ Changed link to more accurate description.
~ REFACTORED branchoverdues-specific function in C4 for obvious consolidation.

This report is still of questionable value, since it's dataset has such strange
hardcoded limitations.  It is not clear that "FU" type fines and notifys=0 are
reliable or useful indicators to query on, in hardcoded form.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-06 15:01:41 -06:00
Nahuel ANGELINETTI
f09d0547b1 (bug #2957) import Date_to_Days
This patch import Date_to_Days from Data::Calc, else CalcFine can crash.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-02-12 14:45:47 -06:00
Joe Atzberger
aa4c6ff62f Fines fixes: apparent problems with fines prevent processing.
CalcFine returned values that mismatched expectations in fines.pl.

fines.pl refactored: added debugging, prevent needless recreation of
Calendar objects by storing them in hash by branch.
Still outstanding problems with fines, including the output of a field
that has no other references in Koha (so is always undef) and the
incorrect description of FinesMode.

Calendar exported "new" erroneously.  I also cleaned up the queries to
avoid needlessly compiling additional statement handles.

Please test and consider application to 3.0 maintenance.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-29 20:31:41 -05:00
Andrew Moore
b22044aa97 Bug 2400 [9/18]: fixing pod syntax in C4/Overdues.pm
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-08-12 19:41:05 -05:00
Ryan Higgins
9153e3d425 Update fines cronjob: remove redundant scripts, remove some superfluous code in remaining fines.pl.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-08-10 13:06:52 -05:00
Paul POULAIN
83a6382946 partial fix for #2471, (overdue notice sent twice)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-08-06 14:49:44 -05:00
Ryan Higgins
d431ebff93 Update CalcFine to obey maxFine systempreference.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-25 08:56:11 -05:00
Andrew Moore
8ae66932cd Bug 2274 [3/5]: consolidating overdue notice cronjobs into one
This patch adds the misc/cronjobs/overdue_notices.pl script that is intended to replace
overduenotices.pl, overduenotices-30.pl and overduenotices-csv.pl. It adds messages to
the message_queue to be sent later (by process_message_queue.pl). It also marks borrowers
as debarred if their issues become too overdue.

It is intended to be run from cron nightly with usage something like:
0 2 * * * misc/cronjobs/overdue_notices.pl

C4::Members:
 - improved documentation on ModMember
 - made ModMember return a useful value (the return value of the database call)
 - added a DebarMember method
 - adding t/lib/KohaTest/Members/DebarMember.pm to test ModMember

misc/cronjobs/overdue_notices.pl
 - designed to replace overduenotices.pl, overduenotices-30.pl, and overduenotice-csv

Changes to C4::Letters:
 - EnqueueLetter now lets you pass in to_address and from_address which can override defaults
 - _send_message_by_email pays attention to these defaults.
 - now handles attachments with MIME::Lite

C4::Overdues
 - added GetBranchcodesWithOverdueRules
   - added t/lib/KohaTest/Overdues/GerBranchcodesWithOverdueRules.pm to test that.

circ/overdue.pl
 - replaced call to obsolete overduenotices-csv.pl with call to overdue_notices.pl

KohaTest:
 - added three helper methods: random_phone, random_email, random_ip
   - these can be used to populate example records
 - you can now pass an optional lengh to random_string

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-07-10 09:10:46 -05:00
Andrew Moore
2cae4efa0a Bug 2176 (3/5): adding methods to manage message_queue, new advance_notices.pl, new C4::SMS module
I've added methods to to C4::Letters to manage the database table
message_queue. This will let us keep track of messages sent
via email, sms, and rss to patrons. That way, we can show the history,
deal with failures, and reconstruct an RSS feed when needed.

misc/cronjobs/overduenotics.pl has been added. It prepares advance notices
and item due notices and stages messages to be sent in the message_queue
table.

C4::Overdues::Getoverdues now takes two optional arguments to tell it how
old of overdues to fetch.

Also, a C4::Circualtion::getUpcomingDueIssues method was added that
advance_notices.pl uses.

misc/cronjobs/process_message_queue.pl has been added. It sends the email
or SMS messages out of the message queue.

The C4::SMS module didn't work at all, and it has been rebuilt to use
an external perl module from CPAN, SMS::Send.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-06-20 13:04:52 -05:00
Joe Atzberger
2ba8763bb4 Fines repair. Make fines2.pl work, give feedback, improve comments and perldoc.
Remove $dbh->disconnect statements as counterproductive.
Prevent description field from begining with whitespace.
Added robust debug elements.  Test script behavior with:
    perl misc/cronjobs/fines2.pl -v
and:
	mysql> select * from accountlines;

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-29 07:04:42 -05:00
Ryan Higgins
a9b7e08077 fix error on lastincrement.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-12 09:29:15 -05:00
Ryan Higgins
b54401ac66 C4::Circulation::FixOverduesOnReturn now handles dropbox mode.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-12 09:29:14 -05:00
Ryan Higgins
a315de5281 Alter Overdues::CalcFine to use Dates objects.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-12 09:29:12 -05:00
Ryan Higgins
2eed36a08e Fix calls to CalcFine, and make fines obey CircControl syspref (get homebranch withssue data).
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-08 08:37:01 -05:00
Ryan Higgins
600d479f4e Add a working fines script, some changes to CalcFine and Circulation.pm
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-04-07 15:59:54 -05:00
Galen Charlton
afb36c429e refactor C4::Log::logaction
This fix should resolve in whole or in part several bugs
characterized by the error message 'Can't use string ("0")
as a HASH ref while "strict refs" in use', including
bugs 1101, 1899, and 1910.

There are some possibilities for future work:

[1] Dealing with an operator override, e.g., where
    a circ operator needs to get a supervisor
    to enter a login and password and escalate
    the original operator's privileges for a
    transaction, e.g., to forgive a fine.  This
    is an enhancement, of course.
[2] Creating a dummy operator to represent
    batch job runs; or alternatively, give
    each batch job an option to log its work
    under a specified user ID.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-03-19 06:34:10 -05:00
Galen Charlton
9222f7a6ca created old_issues and old_reserves tables
The new tables have the same structure and constraints
as the tables they archive with the following exceptions:

* borrowernumber and biblionumber in old_reserves can be
  NULL
* the FK constraints (e.g., for itemnumber) on old_reserves
  set the child column to NULL if the parent row is deleted
  instead of deleting the child row.
* there is no FK constraint on old_issues.branchcode, allowing
  a branch to be deleted without changing archived requests.

Some miscellaneous cleanup was done as part of this patch:

* GetMemberIssuesAndFines (C4::Members) now uses bind variables
* fixed POD for GetMemberIssuesAndFines

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-03-15 08:36:31 -05:00
Chris Nighswonger
e9e2200c5f BUGFIX Critical: Correcting misspelling of C4:Context as C4:context
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-02-27 09:02:48 -06:00
Joe Atzberger
ce95144242 Overdues.pm - fix typo ("Context" not "context")
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-07 20:02:57 -06:00
Joe Atzberger
b4fd0dc4fa Overdues.pm - BEGIN block VERSION and vars related to export.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-07 20:02:38 -06:00
Chris Cormack
f077aa6c1f Fix for bug 1730 fixing display for pay.pl
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-07 01:57:50 -06:00
Ryan Higgins
3967fa9c79 further mods to change from ccode to itype at item-level itypes.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-11-11 18:40:20 -06:00