[open-ils-commits] r10057 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 16 17:03:34 EDT 2008
Author: erickson
Date: 2008-07-16 17:03:30 -0400 (Wed, 16 Jul 2008)
New Revision: 10057
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
added method for setting lineitem usr attrs
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-16 19:11:31 UTC (rev 10056)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-16 21:03:30 UTC (rev 10057)
@@ -661,4 +661,50 @@
return undef;
}
+
+__PACKAGE__->register_method(
+ method => 'set_lineitem_usr_attr',
+ api_name => 'open-ils.acq.lineitem_usr_attr.set',
+ signature => {
+ desc => 'Sets a lineitem_usr_attr value',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'Lineitem ID', type => 'number'},
+ {desc => 'Attr name', type => 'string'},
+ {desc => 'Attr value', type => 'string'}
+ ],
+ return => {desc => '1 on success, Event on error'}
+ }
+);
+
+sub set_lineitem_usr_attr {
+ my($self, $conn, $auth, $li_id, $attr_name, $attr_value) = @_;
+ my $e = new_editor(xact=>1, authtoken=>$auth);
+ return $e->die_event unless $e->checkauth;
+
+ # XXX perm
+
+ my $attr = $e->search_acq_lineitem_attr({
+ lineitem => $li_id,
+ attr_type => 'lineitem_usr_attr_definition',
+ attr_name => $attr_name})->[0];
+
+ if($attr) {
+ $attr->attr_value($attr_value);
+ $e->update_acq_lineitem_attr($attr) or return $e->die_event;
+ } else {
+ $attr = Fieldmapper::acq::lineitem_attr->new;
+ $attr->lineitem($li_id);
+ $attr->attr_type('lineitem_usr_attr_definition');
+ $attr->attr_name($attr_name);
+ $attr->attr_value($attr_value);
+ $e->create_acq_lineitem_attr($attr) or return $e->die_event;
+ }
+
+ $e->commit;
+ return 1;
+}
+
+
+
1;
More information about the open-ils-commits
mailing list