[open-ils-commits] r8391 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 16 12:41:42 EST 2008
Author: erickson
Date: 2008-01-16 12:16:04 -0500 (Wed, 16 Jan 2008)
New Revision: 8391
Added:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm
Log:
adding initial provider CRUD
Added: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm (rev 0)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Provider.pm 2008-01-16 17:16:04 UTC (rev 8391)
@@ -0,0 +1,64 @@
+package OpenILS::Application::Acq::Provider;
+use base qw/OpenILS::Application::Acq/;
+use strict; use warnings;
+
+use OpenILS::Event;
+use OpenILS::Const qw/:const/;
+use OpenSRF::Utils::Logger qw(:logger);
+use OpenILS::Utils::Fieldmapper;
+use OpenILS::Utils::CStoreEditor q/:funcs/;
+use OpenSRF::Utils::SettingsClient;
+use OpenILS::Application::AppUtils;
+
+my $U = 'OpenILS::Application::AppUtils';
+my $BAD_PARAMS = OpenILS::Event->new('BAD_PARAMS');
+
+
+__PACKAGE__->register_method(
+ method => 'create_provider',
+ api_name => 'open-ils.acq.provider.create',
+ signature => {
+ desc => 'Creates a new provider',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'provider object to create', type => 'object'}
+ ],
+ return => {desc => 'The ID of the new provider'}
+ }
+);
+
+sub create_provider {
+ my($self, $conn, $auth, $provider) = @_;
+ return $e->die_event unless $e->checkauth;
+ return $e->die_event unless $e->allowed('CREATE_PROVIDER', $provider->owner);
+ $e->create_acq_provider($provider) or return $e->die_event;
+ $e->commit;
+ return $provider->id;
+}
+
+
+
+__PACKAGE__->register_method(
+ method => 'retrieve_provider',
+ api_name => 'open-ils.acq.provider.retrieve',
+ signature => {
+ desc => 'Retrieves a new provider',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'provider ID', type => 'number'}
+ ],
+ return => {desc => 'The provider object on success, Event on failure'}
+ }
+);
+
+sub retrieve_provider {
+ my($self, $conn, $auth, $provider_id) = @_;
+ my $e = new_editor(authtoken=>$auth);
+ return $e->event unless $e->checkauth;
+ my $provider = $e->retrieve_acq_provider($provider_id) or return $e->event;
+ return $e->event unless $e->allowed('VIEW_PROVIDER', $provider->owner);
+ return $provider;
+}
+
+
+
More information about the open-ils-commits
mailing list