Add more copy-status changing methods to open-ils.circ - with documentation.
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 3 Mar 2009 18:57:24 +0000 (18:57 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 3 Mar 2009 18:57:24 +0000 (18:57 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12383 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql

index f33f5c6..9762db9 100644 (file)
@@ -105,7 +105,7 @@ __PACKAGE__->register_method(
        method  => "checkouts_by_user",
        api_name        => "open-ils.circ.actor.user.checked_out",
        NOTES           => <<"  NOTES");
-       Returns a list of open circulations as a pile of objects.  each object
+       Returns a list of open circulations as a pile of objects.  Each object
        contains the relevant copy, circ, and record
        NOTES
 
@@ -927,10 +927,82 @@ sub copy_details {
 __PACKAGE__->register_method(
        method => 'mark_item',
        api_name => 'open-ils.circ.mark_item_damaged',
+       signature       => q/
+               Changes the status of a copy to "damaged". Requires MARK_ITEM_DAMAGED permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as damaged
+               @return 1 on success - Event otherwise.
+               /
 );
 __PACKAGE__->register_method(
        method => 'mark_item',
        api_name => 'open-ils.circ.mark_item_missing',
+       signature       => q/
+               Changes the status of a copy to "missing". Requires MARK_ITEM_MISSING permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as missing 
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_bindery',
+       signature       => q/
+               Changes the status of a copy to "bindery". Requires MARK_ITEM_BINDERY permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as bindery
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_on_order',
+       signature       => q/
+               Changes the status of a copy to "on order". Requires MARK_ITEM_ON_ORDER permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as on order 
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_ill',
+       signature       => q/
+               Changes the status of a copy to "inter-library loan". Requires MARK_ITEM_ILL permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as inter-library loan
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_cataloging',
+       signature       => q/
+               Changes the status of a copy to "cataloging". Requires MARK_ITEM_CATALOGING permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as cataloging 
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_reserves',
+       signature       => q/
+               Changes the status of a copy to "reserves". Requires MARK_ITEM_RESERVES permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as reserves
+               @return 1 on success - Event otherwise.
+               /
+);
+__PACKAGE__->register_method(
+       method => 'mark_item',
+       api_name => 'open-ils.circ.mark_item_discard',
+       signature       => q/
+               Changes the status of a copy to "discard". Requires MARK_ITEM_DISCARD permission.
+               @param authtoken The login session key
+               @param copy_id The ID of the copy to mark as discard
+               @return 1 on success - Event otherwise.
+               /
 );
 
 sub mark_item {
@@ -944,6 +1016,24 @@ sub mark_item {
        if( $self->api_name =~ /damaged/ ) {
                $perm = 'MARK_ITEM_DAMAGED';
                $stat = OILS_COPY_STATUS_DAMAGED;
+       } elsif ( $self->api_name =~ /bindery/ ) {
+               $perm = 'MARK_ITEM_BINDERY';
+               $stat = OILS_COPY_STATUS_BINDERY;
+       } elsif ( $self->api_name =~ /on_order/ ) {
+               $perm = 'MARK_ITEM_ON_ORDER';
+               $stat = OILS_COPY_STATUS_ON_ORDER;
+       } elsif ( $self->api_name =~ /ill/ ) {
+               $perm = 'MARK_ITEM_ILL';
+               $stat = OILS_COPY_STATUS_ILL;
+       } elsif ( $self->api_name =~ /cataloging/ ) {
+               $perm = 'MARK_ITEM_CATALOGING';
+               $stat = OILS_COPY_STATUS_CATALOGING;
+       } elsif ( $self->api_name =~ /reserves/ ) {
+               $perm = 'MARK_ITEM_RESERVES';
+               $stat = OILS_COPY_STATUS_RESERVES;
+       } elsif ( $self->api_name =~ /discard/ ) {
+               $perm = 'MARK_ITEM_DISCARD';
+               $stat = OILS_COPY_STATUS_DISCARD;
        }
 
        my $copy = $e->retrieve_asset_copy($copy_id)
@@ -965,7 +1055,7 @@ sub mark_item {
 
        $e->commit;
 
-       $logger->debug("reseting holds that target the marked copy");
+       $logger->debug("resetting holds that target the marked copy");
        OpenILS::Application::Circ::Holds->_reset_hold($e->requestor, $_) for @$holds;
 
        return 1;
@@ -995,7 +1085,7 @@ sub magic_fetch {
        # Is the call allowed to fetch this type of object?
        return undef unless grep { $_ eq $hint } @FETCH_ALLOWED;
 
-       # Find the class the iplements the given hint
+       # Find the class the implements the given hint
        my ($class) = grep { 
                $Fieldmapper::fieldmap->{$_}{hint} eq $hint } Fieldmapper->classes;
 
index 4f5166d..8e9188b 100644 (file)
@@ -1169,7 +1169,18 @@ INSERT INTO permission.perm_list VALUES
     (178, 'DELETE_RECORD', oils_i18n_gettext(178, 'Allow a staff member to directly remove a bibliographic record', 'ppl', 'description')),
     (179, 'ADMIN_CURRENCY_TYPE', oils_i18n_gettext(179, 'Allow a user to create/view/update/delete a currency_type', 'ppl', 'description')),
     (180, 'MARK_BAD_DEBT', oils_i18n_gettext(180, 'Allow a user to mark a transaction as bad (unrecoverable) debt', 'ppl', 'description')),
-    (181, 'VIEW_BILLING_TYPE', oils_i18n_gettext(181, 'Allow a user to view billing types', 'ppl', 'description'));
+    (181, 'VIEW_BILLING_TYPE', oils_i18n_gettext(181, 'Allow a user to view billing types', 'ppl', 'description')),
+    (182, 'MARK_ITEM_AVAILABLE', oils_i18n_gettext(182, 'Allow a user to mark an item status as ''available''', 'ppl', 'description')),
+    (183, 'MARK_ITEM_CHECKED_OUT', oils_i18n_gettext(183, 'Allow a user to mark an item status as ''checked out''', 'ppl', 'description')),
+    (184, 'MARK_ITEM_BINDERY', oils_i18n_gettext(184, 'Allow a user to mark an item status as ''bindery''', 'ppl', 'description')),
+    (185, 'MARK_ITEM_LOST', oils_i18n_gettext(185, 'Allow a user to mark an item status as ''lost''', 'ppl', 'description')),
+    (186, 'MARK_ITEM_MISSING', oils_i18n_gettext(186, 'Allow a user to mark an item status as ''missing''', 'ppl', 'description')),
+    (187, 'MARK_ITEM_IN_PROCESS', oils_i18n_gettext(187, 'Allow a user to mark an item status as ''in process''', 'ppl', 'description')),
+    (188, 'MARK_ITEM_IN_TRANSIT', oils_i18n_gettext(188, 'Allow a user to mark an item status as ''in transit''', 'ppl', 'description')),
+    (189, 'MARK_ITEM_RESHELVING', oils_i18n_gettext(189, 'Allow a user to mark an item status as ''reshelving''', 'ppl', 'description')),
+    (190, 'MARK_ITEM_ON_HOLDS_SHELF', oils_i18n_gettext(190, 'Allow a user to mark an item status as ''on holds shelf''', 'ppl', 'description')),
+    (191, 'MARK_ITEM_ON_ORDER', oils_i18n_gettext(191, 'Allow a user to mark an item status as ''on order''', 'ppl', 'description')),
+    (192, 'MARK_ITEM_ILL', oils_i18n_gettext(192, 'Allow a user to mark an item status as ''inter-library loan''', 'ppl', 'description'));
 
 SELECT SETVAL('permission.perm_list_id_seq'::TEXT, (SELECT MAX(id) FROM permission.perm_list));