[open-ils-commits] r12088 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application/Storage/CDBI src/perlmods/OpenILS/Application/Storage/Publisher src/sql/Pg (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Feb 5 21:07:43 EST 2009
Author: miker
Date: 2009-02-05 21:07:42 -0500 (Thu, 05 Feb 2009)
New Revision: 12088
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
Log:
adding hold-cancel cause and note table and fields; teaching hold targeter how to use the cancel_cause field
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-02-06 00:08:37 UTC (rev 12087)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-02-06 02:07:42 UTC (rev 12088)
@@ -2614,6 +2614,8 @@
<field reporter:label="Eligible Copies" name="eligible_copies" oils_obj:array_position="30" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Currently Frozen" name="frozen" oils_obj:array_position="31" oils_persist:virtual="false" reporter:datatype="bool"/>
<field reporter:label="Thaw Date (if frozen)" name="thaw_date" oils_obj:array_position="32" oils_persist:virtual="false" reporter:datatype="timestamp"/>
+ <field reporter:label="Cancelation cause" name="cancel_cause" oils_obj:array_position="33" oils_persist:virtual="false" reporter:datatype="link" />
+ <field reporter:label="Cancelation note" name="cancel_note" oils_obj:array_position="34" oils_persist:virtual="false" reporter:datatype="text" />
</fields>
<links>
<link field="fulfillment_lib" reltype="has_a" key="id" map="" class="aou"/>
@@ -2628,6 +2630,7 @@
<link field="notifications" reltype="has_many" key="hold" map="" class="ahn"/>
<link field="eligible_copies" reltype="has_many" key="hold" map="target_copy" class="ahcm"/>
<link field="bib_rec" reltype="might_have" key="id" map="" class="rhrr"/>
+ <link field="cancel_cause" reltype="might_have" key="id" map="" class="ahrcc"/>
</links>
</class>
<class id="aou" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit" oils_persist:tablename="actor.org_unit" reporter:label="Organizational Unit" oils_persist:field_safe="true">
@@ -3637,6 +3640,27 @@
<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
</links>
</class>
+
+ <class id="ahrcc" controller="open-ils.cstore open-ils.reporter-store open-ils.pcrud" oils_obj:fieldmapper="action::hold_request_cancel_cause" oils_persist:tablename="action.hold_request_cancel_cause">
+ <fields oils_persist:primary="id" oils_persist:sequence="action.hold_request_cancel_cause_id_seq">
+ <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+ <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+ <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+ <field reporter:label="Cause ID" name="id" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="id" />
+ <field reporter:label="Cause Label" name="label" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="text" oils_persist:i18n="true" />
+ </fields>
+ <links/>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_HOLD_CANCEL_CAUSE" global_required="true"/>
+ <retrieve/>
+ <update permission="ADMIN_HOLD_CANCEL_CAUSE" global_required="true"/>
+ <delete permission="ADMIN_HOLD_CANCEL_CAUSE" global_required="true"/>
+ </actions>
+ </permacrud>
+ </class>
+
+
<class id="ahtc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::hold_transit_copy" oils_persist:tablename="action.hold_transit_copy" reporter:core="true" reporter:label="Hold Transit">
<fields oils_persist:primary="id" oils_persist:sequence="action.transit_copy_id_seq">
<field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm 2009-02-06 00:08:37 UTC (rev 12087)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/action.pm 2009-02-06 02:07:42 UTC (rev 12088)
@@ -93,9 +93,9 @@
__PACKAGE__->table('action_hold_request');
__PACKAGE__->columns(Primary => 'id');
__PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time
- prev_check_time expire_time requestor usr
+ prev_check_time expire_time requestor usr cancel_cause
hold_type holdable_formats target cancel_time
- phone_notify email_notify selection_depth
+ phone_notify email_notify selection_depth cancel_note
pickup_lib current_copy request_lib frozen thaw_date
fulfillment_staff fulfillment_lib selection_ou/);
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2009-02-06 00:08:37 UTC (rev 12087)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm 2009-02-06 02:07:42 UTC (rev 12088)
@@ -890,7 +890,7 @@
if ($hold->expire_time) {
my $ex_time = $parser->parse_datetime( clense_ISO8601( $hold->expire_time ) );
- $hold->update( { cancel_time => 'now' } ) if ( DateTime->compare($ex_time, DateTime->now) < 0 );
+ $hold->update( { cancel_cause => 1, cancel_time => 'now' } ) if ( DateTime->compare($ex_time, DateTime->now) < 0 );
$self->method_lookup('open-ils.storage.transaction.commit')->run;
}
Modified: trunk/Open-ILS/src/sql/Pg/090.schema.action.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-02-06 00:08:37 UTC (rev 12087)
+++ trunk/Open-ILS/src/sql/Pg/090.schema.action.sql 2009-02-06 02:07:42 UTC (rev 12088)
@@ -247,6 +247,15 @@
FOR EACH ROW
EXECUTE PROCEDURE action.circulation_claims_returned ();
+CREATE TABLE action.hold_request_cancel_cause (
+ id SERIAL PRIMARY KEY,
+ label TEXT UNIQUE
+);
+INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Untargeted expiration');
+INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Hold Shelf expiration');
+INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Patron via phone');
+INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Patron in person');
+INSERT INTO action.hold_request_cancel_cause (label) VALUES ('Staff forced');
CREATE TABLE action.hold_request (
id SERIAL PRIMARY KEY,
@@ -258,6 +267,8 @@
prev_check_time TIMESTAMP WITH TIME ZONE,
expire_time TIMESTAMP WITH TIME ZONE,
cancel_time TIMESTAMP WITH TIME ZONE,
+ cancel_cause INT REFERENCES action.hold_request_cancel_cause (id) ON DELETE SET NULL,
+ cancel_note TEXT,
target BIGINT NOT NULL, -- see hold_type
current_copy BIGINT REFERENCES asset.copy (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
fulfillment_staff INT REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
More information about the open-ils-commits
mailing list