[open-ils-commits] r16098 - in trunk/Open-ILS/src/perlmods/OpenILS/Application: . Circ Storage/Publisher (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 1 17:00:17 EDT 2010


Author: erickson
Date: 2010-04-01 17:00:12 -0400 (Thu, 01 Apr 2010)
New Revision: 16098

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Search.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
Log:
Patch from Joe Atzberger: Last batch of method reg docs and perltidy.

Note spellcheck now returns [] immediately if no term is given.
No point initalizing and fetching stuff with no term.

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-04-01 19:56:17 UTC (rev 16097)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2010-04-01 21:00:12 UTC (rev 16098)
@@ -842,8 +842,19 @@
 }
 
 __PACKAGE__->register_method(
-    method   => "hold_note_CUD",
-    api_name => "open-ils.circ.hold_request.note.cud"
+    method    => "hold_note_CUD",
+    api_name  => "open-ils.circ.hold_request.note.cud",
+    signature => {
+        desc   => 'Create, update or delete a hold request note.  If the operator (from Auth. token) '
+                . 'is not the owner of the hold, the UPDATE_HOLD permission is required',
+        params => [
+            { desc => 'Authentication token', type => 'string' },
+            { desc => 'Hold note object',     type => 'object' }
+        ],
+        return => {
+            desc => 'Returns the note ID, event on error'
+        },
+    }
 );
 
 sub hold_note_CUD {
@@ -2277,27 +2288,24 @@
     method    => 'hold_has_copy_at',
     api_name  => 'open-ils.circ.hold.has_copy_at',
     signature => {
-        desc => q/
-            Returns the ID of the found copy and name of the shelving location if there is
-            an available copy at the specified org unit.  Returns empty hash otherwise.
-            The anticipated use for this method is to determine whether an item is
-            available at the library where the user is placing the hold (or, alternatively, 
-            at the pickup library) to encourage bypassing the hold placement and just 
-            checking out the item.
-        /,
+        desc   => 
+                'Returns the ID of the found copy and name of the shelving location if there is ' .
+                'an available copy at the specified org unit.  Returns empty hash otherwise.  '   .
+                'The anticipated use for this method is to determine whether an item is '         .
+                'available at the library where the user is placing the hold (or, alternatively, '.
+                'at the pickup library) to encourage bypassing the hold placement and just '      .
+                'checking out the item.' ,
         params => {
             { desc => 'Authentication Token', type => 'string' },
-            { desc => q/
-                    Method Arguments.  Options include:
-                    hold_type  : the hold type code (T, V, C, M, ...)
-                    hold_target : the identifier of the hold target object
-                    org_unit : org unit ID
-                /, 
-                type => 'object' 
+            { desc => 'Method Arguments.  Options include: hold_type, hold_target, org_unit.  ' 
+                    . 'hold_type is the hold type code (T, V, C, M, ...).  '
+                    . 'hold_target is the identifier of the hold target object.  ' 
+                    . 'org_unit is org unit ID.', 
+              type => 'object' 
             },
         },
         return => { 
-            desc => q/{ "copy" : copy_id, "location" : location_name }/,
+            desc => q/Result hash like { "copy" : copy_id, "location" : location_name }, empty hash on misses, event on error./,
             type => 'object' 
         }
     }

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2010-04-01 19:56:17 UTC (rev 16097)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm	2010-04-01 21:00:12 UTC (rev 16098)
@@ -447,7 +447,7 @@
 }
 
 __PACKAGE__->register_method(
-    method => 'fetch_grocery',
+    method   => 'fetch_grocery',
     api_name => 'open-ils.circ.money.grocery.retrieve'
 );
 sub fetch_grocery {
@@ -462,13 +462,21 @@
 
 
 __PACKAGE__->register_method(
-    method    => "billing_items",
+    method        => "billing_items",
+    api_name      => "open-ils.circ.money.billing.retrieve.all",
     authoritative => 1,
-    api_name    => "open-ils.circ.money.billing.retrieve.all",
-    notes        =><<"    NOTE");
-    Returns a list of billing items for the given transaction.
-    PARAMS( login, transaction_id )
-    NOTE
+    signature     => {
+        desc   => 'Returns a list of billing items for the given transaction ID.  ' .
+                  'If the operator is not the owner of the transaction, the VIEW_TRANSACTION permission is required.',
+        params => [
+            { desc => 'Authentication token', type => 'string'},
+            { desc => 'Transaction ID',       type => 'number'}
+        ],
+        return => {
+            desc => 'Transaction object, event on error'
+        },
+    }
+);
 
 sub billing_items {
     my( $self, $client, $login, $transid ) = @_;
@@ -491,9 +499,9 @@
 
 
 __PACKAGE__->register_method(
-    method    => "billing_items_create",
-    api_name    => "open-ils.circ.money.billing.create",
-    notes        =><<"    NOTE");
+    method   => "billing_items_create",
+    api_name => "open-ils.circ.money.billing.create",
+    notes    => <<"    NOTE");
     Creates a new billing line item
     PARAMS( login, bill_object (mb) )
     NOTE

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm	2010-04-01 19:56:17 UTC (rev 16097)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm	2010-04-01 21:00:12 UTC (rev 16098)
@@ -57,16 +57,17 @@
 
 
 __PACKAGE__->register_method(
-	method	=> "create_noncat_type",
-	api_name	=> "open-ils.circ.non_cat_type.create",
-	notes		=> q/
+    method   => "create_noncat_type",
+    api_name => "open-ils.circ.non_cat_type.create",
+    notes    => q/
 		Creates a new non cataloged item type
 		@param authtoken The login session key
 		@param name The name of the new type
 		@param orgId The location where the type will live
 		@return The type object on success and the corresponding
 		event on failure
-	/);
+	/
+);
 
 sub create_noncat_type {
 	my( $self, $client, $authtoken, $name, $orgId, $interval, $inhouse ) = @_;
@@ -97,17 +98,17 @@
 }
 
 
-
 __PACKAGE__->register_method(
-	method	=> "update_noncat_type",
-	api_name	=> "open-ils.circ.non_cat_type.update",
-	notes		=> q/
+    method   => "update_noncat_type",
+    api_name => "open-ils.circ.non_cat_type.update",
+    notes    => q/
 		Updates a non-cataloged type object
 		@param authtoken The login session key
 		@param type The updated type object
 		@return The result of the DB update call unless a preceeding event occurs, 
 			in which case the event will be returned
-	/);
+	/
+);
 
 sub update_noncat_type {
 	my( $self, $client, $authtoken, $type ) = @_;
@@ -128,34 +129,46 @@
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_noncat_types_all",
-	api_name	=> "open-ils.circ.non_cat_types.retrieve.all",
-	notes		=> q/
-		Retrieves the non-cat types at the requested location as well
-		as those above and below the requested location in the org tree
-		@param orgId The base location at which to retrieve the type objects
-		@param depth Optional parameter to limit the depth of the tree
-		@return An array of non cat type objects or an event if an error occurs
-	/);
+    method    => "retrieve_noncat_types_all",
+    api_name  => "open-ils.circ.non_cat_types.retrieve.all",
+    signature => {
+        desc   => 'Retrieves the non-cat types at the requested location as well '
+                . 'as those above and below it in the org tree',
+        params => [
+            { name => 'orgId', desc => 'Org unit ID of the base location',   type => 'number' },
+            { name => 'depth', desc => 'Depth limit of the tree (optional)', type => 'number' }
+        ],
+        return => {
+            desc => 'Array of non-cat objects, event on error'
+        },
+    }
+);
 
 sub retrieve_noncat_types_all {
-	my( $self, $client, $orgId, $depth ) = @_;
-	my $meth = 'open-ils.storage.ranged.config.non_cataloged_type.retrieve.atomic';
-	my $svc = 'open-ils.storage';
-	return $U->simplereq($svc, $meth, $orgId, $depth) if defined($depth);
-	return $U->simplereq($svc, $meth, $orgId);
+    my( $self, $client, $orgId, $depth ) = @_;
+    my $meth = 'open-ils.storage.ranged.config.non_cataloged_type.retrieve.atomic';
+    my $svc  = 'open-ils.storage';
+    return $U->simplereq($svc, $meth, $orgId, $depth) if defined($depth);
+    return $U->simplereq($svc, $meth, $orgId);
 }
 
 
-
 __PACKAGE__->register_method(
-	method		=> 'fetch_noncat',
-	api_name		=> 'open-ils.circ.non_cataloged_circulation.retrieve',
-	signature	=> q/
-	/
+    method    => 'fetch_noncat',
+    api_name  => 'open-ils.circ.non_cataloged_circulation.retrieve',
+    signature => {
+        desc   => 'Retrieve a circulation on a non cataloged item for a given Circ ID.  If the operator is not the '
+                . 'patron owner of the circ, the VIEW_CIRCULATIONS permission is required',
+        params => [
+            { desc => 'Authentication token', type => 'string' },
+            { desc => 'Circulation ID',       type => 'number' }
+        ],
+        return => {
+            desc => 'Circulation object, event on error',
+        },
+    }
 );
 
-
 sub fetch_noncat {
 	my( $self, $conn, $auth, $circid ) = @_;
 	my $e = new_editor( authtoken => $auth );
@@ -194,17 +207,21 @@
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_open_noncats',
+    method        => 'fetch_open_noncats',
     authoritative => 1,
-	api_name	=> 'open-ils.circ.open_non_cataloged_circulation.user',
-	signature => q/
-		Returns an id-list of non-cataloged circulations that are considered
-		open as of now.  a circ is open if circ time + circ duration 
-		(based on type) is > than now.
-		@param auth auth key
-		@param userid user to retrieve non-cat circs for 
-			defaults to the session user
-	/
+    api_name      => 'open-ils.circ.open_non_cataloged_circulation.user',
+    signature     => {
+        desca   => 'For a given user, returns an id-list of non-cataloged circulations that are considered open as of now.  ' .
+		           'A circ is open if circ time + circ duration (based on type) is > than now.  If trying to view the circs ' .
+                   'of another user, the VIEW_CIRCULATIONS permission is required',
+		params => [
+            { desc => 'Authentication token',                            type => 'string' },
+            { desc => 'UserID (optional: defaults to the session user)', type => 'number' }
+		],
+        return => {
+            desc => 'Array of non-cataloged circ IDs, event on error'
+        },
+    }
 );
 
 sub fetch_open_noncats {
@@ -221,8 +238,8 @@
 
 
 __PACKAGE__->register_method(
-	method	=> 'delete_noncat',
-	api_name	=> 'open-ils.circ.non_cataloged_type.delete',
+    method   => 'delete_noncat',
+    api_name => 'open-ils.circ.non_cataloged_type.delete',
 );
 sub delete_noncat {
 	my( $self, $conn, $auth, $typeid ) = @_;
@@ -243,5 +260,4 @@
 }
 
 
-
 1;

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search.pm	2010-04-01 19:56:17 UTC (rev 16097)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search.pm	2010-04-01 21:00:12 UTC (rev 16098)
@@ -46,20 +46,27 @@
 # ------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method	=> "spellcheck",
-	api_name	=> "open-ils.search.spellcheck",
+    method    => "spellcheck",
+    api_name  => "open-ils.search.spellcheck",
     signature => {
-        desc   => 'Returns alternate spelling suggestions',
-        param  => [
-            {name => 'phrase', desc => 'Word or phrase to return alternate spelling suggestions for', type => 'string'},
-            {name => 'Dictionary class', desc => 'Used to specify an alternate configured dictiony to use for suggestions', type => 'string'},
+        desc  => 'Returns alternate spelling suggestions',
+        param => [
+            {
+                name => 'phrase',
+                desc => 'Word or phrase to return alternate spelling suggestions for',
+                type => 'string'
+            },
+            {
+                name => 'Dictionary class',
+                desc => 'Alternate configured dictionary to use (optional)',
+                type => 'string'
+            },
         ],
         return => {
-            desc => q/
-                Suggestions for each word in the phrase.  
-                [ { word : original_word, suggestions : [sug1, sug2, ...], found : 1 if the word was found in the dictionary, 0 otherwise }, ... ]
-            /,
-            type => 'array', 
+            desc => 'Array with a suggestions hash for each word in the phrase, like: '
+                  . q# [{ word: original_word, suggestions: [sug1, sug2, ...], found: 1 }, ... ] #
+                  . 'The "found" value will be 1 if the word was found in the dictionary, 0 otherwise.',
+            type => 'array',
         }
     }
 );
@@ -69,6 +76,8 @@
 sub spellcheck {
 	my( $self, $client, $phrase, $class ) = @_;
 
+    return [] unless $phrase;   # nothing to check, abort.
+
 	my $conf = OpenSRF::Utils::SettingsClient->new;
     $class ||= 'default';
 
@@ -80,7 +89,6 @@
 	}
 
 	my @resp;
-	return \@resp unless $phrase;
 
 	for my $word (split(/\s+/,$phrase) ) {
 

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2010-04-01 19:56:17 UTC (rev 16097)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm	2010-04-01 21:00:12 UTC (rev 16098)
@@ -40,10 +40,10 @@
 	return action::non_cataloged_circulation->db_Main->selectcol_arrayref($sql, {}, $user);
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.open_non_cataloged_circulation.user',
-	api_level       => 1,
-	argc		=> 1,
-	method          => 'open_noncat_circs',
+    api_name  => 'open-ils.storage.action.open_non_cataloged_circulation.user',
+    method    => 'open_noncat_circs',
+    api_level => 1,
+    argc      => 1,
 );
 
 



More information about the open-ils-commits mailing list