[open-ils-commits] r10099 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 23 13:38:51 EDT 2008
Author: erickson
Date: 2008-07-23 13:38:43 -0400 (Wed, 23 Jul 2008)
New Revision: 10099
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
added companion method for setting local_attr values on a lineitem
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-23 17:28:57 UTC (rev 10098)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-23 17:38:43 UTC (rev 10099)
@@ -663,7 +663,7 @@
__PACKAGE__->register_method(
- method => 'set_lineitem_usr_attr',
+ method => 'set_lineitem_attr',
api_name => 'open-ils.acq.lineitem_usr_attr.set',
signature => {
desc => 'Sets a lineitem_usr_attr value',
@@ -677,16 +677,35 @@
}
);
-sub set_lineitem_usr_attr {
+__PACKAGE__->register_method(
+ method => 'set_lineitem_attr',
+ api_name => 'open-ils.acq.lineitem_local_attr.set',
+ signature => {
+ desc => 'Sets a lineitem_local_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_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_type = $self->api_name =~ /local_attr/ ?
+ 'lineitem_local_attr_definition' : 'lineitem_usr_attr_definition';
+
my $attr = $e->search_acq_lineitem_attr({
lineitem => $li_id,
- attr_type => 'lineitem_usr_attr_definition',
+ attr_type => $attr_type,
attr_name => $attr_name})->[0];
if($attr) {
@@ -695,7 +714,7 @@
} else {
$attr = Fieldmapper::acq::lineitem_attr->new;
$attr->lineitem($li_id);
- $attr->attr_type('lineitem_usr_attr_definition');
+ $attr->attr_type($attr_type);
$attr->attr_name($attr_name);
$attr->attr_value($attr_value);
$e->create_acq_lineitem_attr($attr) or return $e->die_event;
More information about the open-ils-commits
mailing list