[open-ils-commits] r9607 - in branches/acq-experiment/Open-ILS/src:
extras perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 14 17:40:07 EDT 2008
Author: erickson
Date: 2008-05-14 17:40:03 -0400 (Wed, 14 May 2008)
New Revision: 9607
Modified:
branches/acq-experiment/Open-ILS/src/extras/ils_events.xml
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm
Log:
added lineitem_provider_attr_def retrieve and create calls, more to come
Modified: branches/acq-experiment/Open-ILS/src/extras/ils_events.xml
===================================================================
--- branches/acq-experiment/Open-ILS/src/extras/ils_events.xml 2008-05-14 20:31:48 UTC (rev 9606)
+++ branches/acq-experiment/Open-ILS/src/extras/ils_events.xml 2008-05-14 21:40:03 UTC (rev 9607)
@@ -610,9 +610,11 @@
<event code='1671' textcode='PERMISSION_USR_OBJECT_PERM_MAP_NOT_FOUND'>
<desc xml:lang='en-US'>The requested permission.usr_object_perm_map was not found</desc>
</event>
+ <event code='1672' textcode='ACQ_LINEITEM_PROVIDER_ATTR_DEFINITION_NOT_FOUND'>
+ <desc xml:lang='en-US'>The requested acq.lineitem_provider_attr_definition was not found</desc>
+ </event>
-
<event code='1700' textcode='NON_CAT_TYPE_EXISTS'>
<desc xml:lang="en-US"> The non-cataloged type object already exists </desc>
</event>
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm 2008-05-14 20:31:48 UTC (rev 9606)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm 2008-05-14 21:40:03 UTC (rev 9607)
@@ -98,5 +98,58 @@
return undef;
}
+__PACKAGE__->register_method(
+ method => 'retrieve_provider_attr_def',
+ api_name => 'open-ils.acq.lineitem_provider_attr_definition.provider.retrieve',
+ stream => 1,
+ signature => {
+ desc => 'Retrieves all of the lineitem_provider_attr_definition for a given provider',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'Provider ID', type => 'number'}
+ ],
+ return => {desc => 'Streams a of lineitem_provider_attr_definition objects'}
+ }
+);
+sub retrieve_provider_attr_def {
+ my($self, $conn, $auth, $prov_id) = @_;
+ my $e = new_editor(authtoken=>$auth);
+ return $e->event unless $e->checkauth;
+ my $provider = $e->retrieve_acq_provider($prov_id)
+ or return $e->event;
+ return $e->event unless $e->allowed('ADMIN_PROVIDER', $provider->owner);
+ for my $id (@{$e->search_acq_lineitem_provider_attr_definition({provider=>$prov_id},{idlist=>1})}) {
+ $conn->respond($e->retrieve_acq_lineitem_provider_attr_definition($id));
+ }
+
+ return undef;
+}
+
+__PACKAGE__->register_method(
+ method => 'create_provider_attr_def',
+ api_name => 'open-ils.acq.lineitem_provider_attr_definition.create',
+ signature => {
+ desc => 'Retrieves all of the lineitem_provider_attr_definition for a given provider',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'Provider ID', type => 'number'}
+ ],
+ return => {desc => 'Streams a of lineitem_provider_attr_definition objects'}
+ }
+);
+
+sub create_provider_attr_def {
+ my($self, $conn, $auth, $attr_def) = @_;
+ my $e = new_editor(authtoken=>$auth, xact=>1);
+ return $e->die_event unless $e->checkauth;
+ my $provider = $e->retrieve_acq_provider($attr_def->provider)
+ or return $e->die_event;
+ return $e->event unless $e->allowed('ADMIN_PROVIDER', $provider->owner);
+ $e->create_acq_lineitem_provider_attr_definition($attr_def)
+ or return $e->die_event;
+ $e->commit;
+ return $attr_def->id;
+}
+
1;
More information about the open-ils-commits
mailing list