[open-ils-commits] r8355 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jan 8 16:39:47 EST 2008
Author: erickson
Date: 2008-01-08 16:15:19 -0500 (Tue, 08 Jan 2008)
New Revision: 8355
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
Log:
registering api calls. added docs and doc stubs. added a user_picklist fetcher
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-01-08 20:37:09 UTC (rev 8354)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Picklist.pm 2008-01-08 21:15:19 UTC (rev 8355)
@@ -33,6 +33,17 @@
return $picklist->id;
}
+
+__PACKAGE__->register_method(
+ method => 'update_picklist',
+ api_name => 'open-ils.acq.picklist.update',
+ signature => q/
+ Updates a picklist
+ @param authtoken
+ @pararm picklist
+ /
+);
+
sub update_picklist {
my($self, $conn, $auth, $picklist) = @_;
my $e = new_editor(xact=>1, authtoken=>$auth);
@@ -50,26 +61,71 @@
return 1;
}
+__PACKAGE__->register_method(
+ method => 'retrieve_picklist',
+ api_name => 'open-ils.acq.picklist.retrieve',
+ signature => q/
+ Retrieves a picklist
+ @param authtoken
+ @pararm picklist_id
+ @param flesh Causes the linked picklist_entry objects
+ to be appended to the object
+ /
+);
+
sub retrieve_picklist {
- my($self, $conn, $auth, $picklist_id) = @_;
+ my($self, $conn, $auth, $picklist_id, $options) = @_;
my $e = new_editor(authtoken=>$auth);
return $e->die_event unless $e->checkauth;
- my $picklist = $e->retrieve_acq_picklist($picklist_id)
+ my $args = ($$options{flesh}) ? # XXX
+ { flesh => 1, flesh_fields => {XXX => ['entries']} : undef;
+
+ my $picklist = $e->retrieve_acq_picklist($picklist_id, $args)
or return $e->die_event;
+
return $BAD_PARAMS unless $e->requestor->id == $picklist->owner;
return $picklist;
}
+__PACKAGE__->register_method(
+ method => 'retrieve_user_picklist',
+ api_name => 'open-ils.acq.picklist.user.retrieve',
+ signature => q/
+ Retrieves all the picklists that belong to the requestor
+ @param authtoken
+ @param options A hash of retrieval options. Options include
+ "idlist", which causes the method to return a list of IDs
+ instead of objects;
+ /
+);
+sub retrieve_user_picklist {
+ my($self, $conn, $auth, $options) = @_;
+ my $e = new_editor(authtoken=>$auth);
+ return $e->die_event unless $e->checkauth;
+ return $e->search_acq_picklist({owner=>$e->requestor->id},{idlist=>$$options{idlist}});
+}
+
+
+__PACKAGE__->register_method(
+ method => 'delete_picklist',
+ api_name => 'open-ils.acq.picklist.delete',
+ signature => q/
+ Deletes a picklist
+ @param authtoken
+ @pararm picklist_id
+ /
+);
+
sub delete_picklist {
my($self, $conn, $auth, $picklist_id) = @_;
my $e = new_editor(xact=>1, authtoken=>$auth);
return $e->die_event unless $e->checkauth;
- # don't let them delete someone else's picklist
my $picklist = $e->retrieve_acq_picklist($picklist_id)
or return $e->die_event;
+ # don't let anyone delete someone else's picklist
return $BAD_PARAMS if $picklist->owner != $e->requestor->owner;
$e->delete_acq_picklist($picklist) or return $e->die_event;
@@ -77,11 +133,34 @@
return 1;
}
+
+# ----------------------------------------------------------------
+# Picklist Entries
+# ----------------------------------------------------------------
+
+__PACKAGE__->register_method(
+ method => 'create_picklist_entry',
+ api_name => 'open-ils.acq.picklist_entry.create',
+ signature => q/
+ Creates a new picklist entry. This method extracts the bib
+ data from the provided MARC XML.
+ @param authtoken
+ @pararm picklist_id
+ @pararm marc_xml
+ @pararm bibid ID of the existing bibliio.record_entry if appropriate
+ /
+);
+
sub create_picklist_entry {
my($self, $conn, $auth, $picklist_id, $marc_xml, $bibid) = @_;
my $e = new_editor(xact=>1, authtoken=>$auth);
return $e->die_event unless $e->checkauth;
+ return $e->die_event unless $e->allowed('CREATE_PICKLIST');
+ my $picklist = $e->retrieve_acq_picklist($picklist_id)
+ or return $e->die_event;
+ return $BAD_PARAMS unless $picklist->owner == $e->requestor->id;
+
# XXX data extraction ...
my $entry = Fieldmaper::acq::picklist_entry->new;
More information about the open-ils-commits
mailing list