We're returning issue information when available,
not just item information. Fixes problem where
circ/returns.pl wasn't displaying the due date
and patron when returning a loan.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Required for SIP checkin implementation, but also for internal correctness.
AddReturn had too many things going on, with no guarantee of data being
available for the later calls. At some point we started tacking on all the
branch transfer logic without testing edge cases. In particular, $borrower
is not checked to be sure it is defined, considering the item may not have been
checked out so no borrower would be associated. That means that CircControl
of "PatronLibrary" would be inaccurate, Circ Alerts will be totally confused
(untargeted), and the Fix... subs would fail.
Note that *many* errors are still present in _FixAccountForLostAndReturned, including
those where comments are added, such that it might behave strangely even with $borrower.
Renamed the internal subs with leading underscore, per convention. Changed
the arguments to be scalars when only scalars are needed, not entire objects.
Added depth to WrongBranch message that includes Rightbranch.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Updated POD for correctness.
Replaced strftime + regexp w/ C4::Dates->today.
Also removed some sth->finish statements.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Also prevents infinite-length renewals by returning undef
if passed an invalid date instead of renewing with no due date.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Code cannot rely on issueinformation being populated.
Note there is room for better efficiency to have AddReturn also provide the
itemnumber (where existing) so that GetItemnumberFromBarcode is not called
at both levels. Unfortunately there is discrepancy between this idea (for
efficiency) and the stated purpose of the $iteminformation object returned,
since $iteminformation is specifically the info from the issues table and
MUST be empty when the item was not in fact issued.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Prior to this patch, turning AllowNotForLoanOverride on
allowed the circ operator to permit the loan of an
item who's individual not-for-loan flag was set, but did
not allow the loan of an item whose item type's not-for-loan
flag was set. This patch extends the definition of the
system preference so that both cases are covered.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
When renewing a loan from the patron details page, setting
the renewal due date now works again. Broken by patch
for bug 2770.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Before this patch, we used to test for flags == 1, which was wrong when patron had all privileges.
This patch just adds a %2 to check that patron has superlibrarian privilege, and maybe something else we don't care.
I think I fixed it everywhere except in acquisition, that will be addressed by BibLibre new acquisition module.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Note to Chris Cormack: I suspect the current ability
to override most circulation conditions is sufficient,
but if HLT still needs to establish a patron category
that can ignore issuingimpossible limitations, needs
to be done in a more flexible way.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Bail out if item does not exist - otherwise
subsequent checks can fail for lack of an
item branchcode.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch just check the syspref and use it as base date of renew.
Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
At the moment when you renew a document the date_due calculated is now+loanlength, but it's a bad thing, It should be
date_due+loanlength.
This patch do change Circulation.pm to use the date_due as renew base and add the loanlength to get the new date_due after
renewal.
Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
When a borrower can't issue any book (issuingrules=0), the message should be
"this user can't issue book" and not "too many books already issued"wrong message
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch moves ceilingDueDate and ReturnBeforeExpiry checking into
CalcDateDue(), so the renewal due date is also calculated with those.
Also restores a check in CanBookBeIssued. If the due date isn't given
call CalcDateDue and make sure it's not in the past.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
The code was modified to change the holding branch ONLY if the return to the right branch is done. If you set IndependantBranch to on, you must return the document to the HomeBranch.
And verify the return is done before show the message that allow to transfert the document to another branch.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
If the syspref 'AllowNotForLoanOverride'(YESNO) is set to YES, the librarian is able to force a loan on an item set as "not for
loan".
If the item is not for loan and the syspref is set to YES, koha will ask to the librarian if he really want to check-out it, else
do nothing.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This adds a feature and system preference: ceilingDueDate. If this is
set to a valid ( according to dateformat syspref ) date, then calculated
due dates will be less than this date.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
The intranet item display provided by moredetail.pl
would display the original due date of the item, and
would thus be incorrect if the item had been renewed
and got a different due date.
The incorrect date was coming from items.onloan,
which AddIssue() sets to the due date. This patch
fixes the bug in two ways:
[1] AddRenewal() now updates items.onloan with the
correct due date.
[2] Two templates were updated to display the
due date from (indirectly) issues.date_due
instead of items.onloan, thus making it less
likely that the wrong value will be displayed.
This patch does *not* update items.onloan to reflect
the correct due date.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
When sending circulation alerts, use the branch that the
event happened on instead of $item->{homebranch}.
Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
- Enqueue the messages with a to_address.
Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
- C4::Letters:EnqueueLetter() is aware of new fields in message_queue table
- C4::Circulation::SendCirculationAlert() actually works
- C4::Category cleanup
- C4::ItemType cleanup
- C4::Message is a new module.
It presents yet another way to interact with the message_queue.
You can now take messages that have already been queued and modify
their contents before they're sent out.
Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
- Added code to AddIssue to send an alert when appropriate.
- Added code to AddReturn to send an alert when appropriate.
- Added a sub called SendCirculationAlert() that DOESN'T ACTUALLY WORK YET.
Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This adds holds policy creation support to smart rules and read support to
C4/Circulation.pm, and the two reservation pages. It also adds a system
preference, AllowHoldPolicyOverride, to control whether the staff can override
these policies.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This patch amends the function to return barcode, in particular when
filter is not defined. It also adds an optional 2nd argument to
allow the filter to be specified by caller, enabling testing.
Non-DB-dependent test script included. Note: T-prefix style
barcode filter is not documented, and drops the first nonzero
digit after the T. This seems mistaken, but is not corrected here
to avoid any surprises.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Added syspref to updatedatabase.
Updated kohastructure.sql with the limits table.
Signed-off-by: Andrew Moore <andrew.moore@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Fixes problem where if the IssuingInProcess preference is ON,
the operator is always required to confirm a checkout if
the patron has had any fine transactions at all, even if
the patron's balance is 0.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Originally by Jesse Weaver <jesse.weaver@liblime.com>
This patch creates a new system preference, AllowRenewalLimitOverride,
that, if YES, allows the renewal limit to be manually overridden. It
updates C4::Circulation and reserve/renewscript.pl to obey this.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This is a pre-requisite to continued SIP processing, dealing with some
arcana related to recursive dependencies and UNIVERSAL. The reason this
is separate from other SIP patches is that it is expected patched in other
submissions already.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
SIP actually relied on the AddIssue return that was not reliable.
AddRenew also updated to return C4::Dates object for datedue.
Please note, any running SIPServer will have to be restarted
*immediately* after applying this patch, because although Koha
C4 behaves as normal, the SIP server runs as a Net::Server with
components cached. Changes will not be applied until SIPServer
restarts, and so checkout actions may fail until then.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
Changed so that issues.issuedate is never modified
during a renewal, since that column records the original
date of the loan. Changed the name and interpretation
of the $issuedate parameter of AddRenewal() to
$lastreneweddate, allowing (e.g.) offline circulation
to set the date of the renewal without changing the
issue date.
As a result of the original bug, issues.issuedate can be
set to NULL for loans that were renewed via the OPAC,
self checkout, or the staff interface when explicitly
renewing a loan. Loans that were renewed by checking
the item out to the same patron will have the issue date
changed to the date of the last renewal.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
The loan history for a bib can be incorrect if the bib's
biblioitemnumber is not the same as its biblionumber.
This was due to a bad join in GetBiblioIssues().
Credit to Michael Hafen for patching a similar bug,
which inspired me to check for other bad joins.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
The offline circulation file processor originally used its own methods to
insert circulation data. This patch takes advantage of the updated
C4::Circulation methods that allow us to specify dates in the past.
This makes the offline circulation file processor use C4::Circulation
functions instead of its own and removes the deprecated subs.
moving from ForceIssue to AddIssue
replacing ForceRenewal with AddRenewal
moving from ForceReturn to MarkIssueReturned
removing deprecated Force* subs
fixing a few bugs in process_koc.pl
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
When uploading an offline circulation file, some actions may need to take place
in the past. This patch adds date parameters to some C4::Circulation methods
to allow us to set dates on them
added issuedate to C4::Circulation::AddIssue
adding issuedate to C4::Circulation::AddRenewal
adding returdate to C4::Circulation::MarkIssueReturned
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
These are some documentation changes that I made to C4::Circulation as
I was writing tests for it.
moved around the docs for CanBookBeIssued. It was in the wrong spot in the file.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
AddIssue does not use the results of the lookup
of the patron whose hold request was preempted
by the issue. This patch now leaves a no-op in
the '$restype eq "Waiting"' test, but I'm not going to
refactor the hold cancellation logic now.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This makes C4::Circulation::AddRenewal update lastreneweddate, then has circulation.pl check today's date against issuedate or lastreneweddate. It also cl
eans up a little parenthesis spacing.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
ILS::Patron is where most of the intelligence for SIP's representation
is lodged. Currently there is difficulty with C4::Members functions.
GetMemberDetails is required for the needed flags, but it returns
empty structure on bad barcodes, where it should be undef.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
GetMemberDetails() returns only one hashref now,
not two. In all cases where the caller was
expecting two output values, the $flags return
was ignored anyway.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
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>
The C4::Circulation::TooMany() function, which determines
if a patron is at the maximum loan limit, has been
changed to work as follows:
1. Checks the issuing rule that would apply to the
prospective loan to see if a loan limit (maxissueqty)
has been set.
2. Counts the number of loans that the patron has
that would fall under that loan rule.
IMPORTANT: that means that if a specific loan rule
exists for the branch, patron category, and item type
in question, *only* that rule's maxissueqty will be
checked here - it will not go on to check whether
a less specific rule has a lower loan limit.
3. If adding one more loan would bring that count
over the limit, returns a "too many" error.
4. If the loan hasn't exceeded a specific limit, checks
whether a branch/patron category circ rule has
specified a loan limit, regardless of item type.
If the patron has already reached *that* limit, returns
the "too many" error.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This routine retrieves the branch/patron category circulation
rules for a given branch and patron category. The return
value is a hashref containing the following key:
maxissueqty - maximum number of loans across all item types
This will first check for a specific branch and
category match from branch_borrower_circ_rules.
If no rule is found, it will then check default_branch_circ_rules
(same branch, default category). If no rule is found,
it will then check default_borrower_circ_rules (default
branch, same category), then failing that, default_circ_rules
(default branch, default category).
If no rule has been found in the database, it will default to
the built in rule:
maxissueqty - undef
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Extended help on the alternate circulation rules
form to list the order of issuingrules lookup as
follows:
same library, same patron type, same item type</li>
same library, same patron type, default item type</li>
same library, default patron type, same item type</li>
same library, default patron type, default item type</li>
default library, same patron type, same item type</li>
default library, same patron type, default item type</li>
default library, default patron type, same item type</li>
default library, default patron type, default item type</li>
This includes modifying two routines in C4::Circulation to
follow this order: GetLoanLength() and GetIssuingRule().
The reason for this change is to have Koha exhaust all issuingrules
possibilities for a branch before checking the rules for
the default branch - this is consistent with what an admin
might expect from looking at the issuingrules forms, which display
settings a branch at a time, and is more consistent with how
circulation rules should work for indepdendent branches.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
in fact, i'm not 100% sure of this bugfix : I don't see the case where a return should be done directly to homebranch, when the check out has been done at holdingbranch
so maybe we could hardcode 'holdingbranch' instead of using HomeOrHoldingBranch
the patch as written won't break anything existing.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
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>
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>
Also implementing useDaysMode syspref 3 modes:
Calendar: every 'closed' day increments loan length by one.
Days: ignore the calendar when calculating loan length.
Datedue: increase loan length only to prevent due date from falling on 'closed' date.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
For some reason currently unclear to me, a use 'C4::XXX' does
not seem to guarantee that the contents of C4::XXX's
@EXPORT gets imported into C4::Circulation's symbol table.
Added an INIT block to ensure that this gets done as
part of runtime initialization.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
* Moved exported ModItemInMarc from C4::Biblio to
C4::Items and renamed to _replace_item_field_in_biblio.
Function is now private and is not exported, as
ModItem is now the sole entry point for updating
an item record.
* Replaced calls to ModItemInMarc in C4::Circulation
with appropriate ModItem calls.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Introduced C4::Items module to separate items API
from biblio API. Details on changes will be
put in later commit messages.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Major bugfixes:
* Circulation status in moredetail.pl now correctly displays On loan
status and Date due
* Bugfixes on Status column in detail.pl
* Removed hard-coded English strings from status column in detail.pl
* Added missing auth values for lost and damaged statuses, sane
defaults if those auth
values don't exist
* Added missing 'On hold' status and 'Hold waiting' status
display
Medium bugfixes:
* Now correctly shows itemtype at level specified in systempreference
* Uses itemtypeimage for display, image title is full itemtype
description
* Fixed Location column concatenation between branchname location and
itemcallnumber
* broke out Location (branch), Collection (items.location)
Call Number (itemcallnumber) into their own columns
* Added auth value display for items.location
Minor fixes:
* detail.pl didn't show dates correctly
* nomenclature s/Checked out/On loan/ in opac-detail.tmpl
* s/Book/Item/ in my $desc="Item Returned
".$iteminfo->{'barcode'}; in Circulation.pm
* request.tmpl: s/date_due/onloan/ to display date due
* Fixed SimilarItems, XISBNSimilarItems
NOTE: Needs to be ported to OPAC
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
When attempting to return an item that was not actually
on loan, would crash because GetItemIssue did not return
biblionumber in hash. Add call to get biblionumber
directly.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Changing GanBookBeIssued to use this systempreference
Set to homebranch by default Paul and others you might want to switch this to holdingbranch to get the behaviour you are used to
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
based on syspref 'item-level_itypes', add an itype col to items table
for 3.2 itype's type will change from varchar(10) to int to allow
circ type definitions per agency.
Note that updatedatabase doesn't populate items.itype, just creates column.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
Adding itemnumber to issuehistory.pl API
so that one could search for issuehistory of a specific item.
(Useful for IndependantBranches)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
issuing rules are working as expeced with this commit.
working on finesrules now
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
lot of bugs to fix...
- a foreign key on patron category is stupid as we have a wildcard
- having a wildcard on itemtype is useless, removing it in template
- reindenting & removing some commented lines
- fixing some SQL bugs (insert/update lines)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
lot of bugs to fix...
- a foreign key on patron category is stupid as we have a wildcard
- having a wildcard on itemtype is useless, removing it in template
- reindenting & removing some commented lines
- fixing some SQL bugs (insert/update lines)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
The reserve was cancelled only under certain circumstances (depending on reserve status)
cancelling everytime.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
if dateexpiry is empty, set issuingimpossible without any calculation
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
this is a workaround, and could hide another problem.
However, I haven't found ModReserveStatus problem or duplicate definition.
Signed-off-by: Chris Cormack <crc@liblime.com>
- updating templates to have tmpl_process3.pl running without any errors
- adding a drupal-like css for prog templates (with 3 small images)
- fixing some bugs in circulation & other scripts
- updating french translation
- fixing some typos in templates