[open-ils-commits] r17067 - trunk/Open-ILS/src/perlmods/OpenILS/Application (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Aug 3 16:11:27 EDT 2010
Author: erickson
Date: 2010-08-03 16:11:22 -0400 (Tue, 03 Aug 2010)
New Revision: 17067
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
added open-ils.circ.copy.due_date.retrieve API call to return the due date for a given copy if it's circulating. method does not require auth, so only the due date is exposed, not the circ or user, etc.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-08-03 03:14:49 UTC (rev 17066)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm 2010-08-03 20:11:22 UTC (rev 17067)
@@ -1725,8 +1725,49 @@
}
+__PACKAGE__->register_method(
+ method => "get_copy_due_date",
+ api_name => "open-ils.circ.copy.due_date.retrieve",
+ signature => {
+ desc => q/
+ Given a copy ID, returns the due date for the copy if it's
+ currently circulating. Otherwise, returns null. Note, this is a public
+ method requiring no authentication. Only the due date is exposed.
+ /,
+ params => [
+ {desc => 'Copy ID', type => 'number'}
+ ],
+ return => {desc => q/
+ Due date (ISO date stamp) if the copy is circulating, null otherwise.
+ /}
+ }
+);
+sub get_copy_due_date {
+ my($self, $conn, $copy_id) = @_;
+ my $e = new_editor();
+ my $circ = $e->json_query({
+ select => {circ => ['due_date']},
+ from => 'circ',
+ where => {
+ target_copy => $copy_id,
+ checkin_time => undef,
+ '-or' => [
+ {stop_fines => ["MAXFINES","LONGOVERDUE"]},
+ {stop_fines => undef}
+ ],
+ },
+ limit => 1
+ })->[0] or return undef;
+
+ return $circ->{due_date};
+}
+
+
+
+
+
# {"select":{"acp":["id"],"circ":[{"aggregate":true,"transform":"count","alias":"count","column":"id"}]},"from":{"acp":{"circ":{"field":"target_copy","fkey":"id","type":"left"},"acn"{"field":"id","fkey":"call_number"}}},"where":{"+acn":{"record":200057}}
More information about the open-ils-commits
mailing list