[open-ils-commits] SPAM: r8957 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 10 21:34:22 EDT 2008
Author: erickson
Date: 2008-03-10 21:01:15 -0400 (Mon, 10 Mar 2008)
New Revision: 8957
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
Log:
added lineitem update and retrieve methods
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2008-03-10 15:19:57 UTC (rev 8956)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2008-03-11 01:01:15 UTC (rev 8957)
@@ -758,7 +758,7 @@
Additionally creates the associated fund_debit/,
params => [
{desc => 'Authentication token', type => 'string'},
- {desc => 'purchase order line item to create', type => 'object'},
+ {desc => 'lineitem_detail to create', type => 'object'},
{desc => q/Options hash. fund_id, the fund funding this line item
price, the price we are paying the vendor, in the vendor's currency/, type => 'hash'}
],
@@ -861,5 +861,66 @@
}
=cut
+__PACKAGE__->register_method(
+ method => 'update_lineitem_detail',
+ api_name => 'open-ils.acq.lineitem_detail.update',
+ signature => {
+ desc => q/Updates a lineitem detail/,
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'lineitem_detail to update', type => 'object'},
+ ],
+ return => {desc => '1 on success, Event on failure'}
+ }
+);
+sub update_lineitem_detail {
+ my($self, $conn, $auth, $li_detail) = @_;
+ my $e = new_editor(xact=>1, authtoken=>$auth);
+ return $e->die_event unless $e->checkauth;
+
+ if($li_detail->fund) {
+ my $fund = $e->retrieve_acq_fund($li_detail->fund) or return $e->die_event;
+ return $e->die_event unless
+ $e->allowed('MANAGE_FUND', $fund->org, $fund);
+ }
+
+ # XXX check lineitem perms
+
+ $e->update_acq_lineitem_detail($li_detail) or return $e->die_event;
+ $e->commit;
+ return 1;
+}
+
+
+__PACKAGE__->register_method(
+ method => 'retrieve_lineitem_detail',
+ api_name => 'open-ils.acq.lineitem_detail.retrieve',
+ signature => {
+ desc => q/Updates a lineitem detail/,
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'lineitem_detail to retrieve', type => 'object'},
+ ],
+ return => {desc => '1 on success, Event on failure'}
+ }
+);
+sub retrieve_lineitem_detail {
+ my($self, $conn, $auth, $li_detail_id) = @_;
+ my $e = new_editor(authtoken=>$auth);
+ return $e->event unless $e->checkauth;
+
+ my $li_detail = $e->retrieve_acq_lineitem_detail($li_detail_id)
+ or return $e->event;
+
+ if($li_detail->fund) {
+ my $fund = $e->retrieve_acq_fund($li_detail->fund) or return $e->event;
+ return $e->event unless
+ $e->allowed('MANAGE_FUND', $fund->org, $fund);
+ }
+
+ # XXX check lineitem perms
+ return $li_detail;
+}
1;
+
More information about the open-ils-commits
mailing list