[open-ils-commits] r19259 - in branches/rel_2_0/Open-ILS: src/perlmods/OpenILS/Application/Acq web/js/ui/default/acq/common (gmc)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat Jan 22 00:49:47 EST 2011
Author: gmc
Date: 2011-01-22 00:49:43 -0500 (Sat, 22 Jan 2011)
New Revision: 19259
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
branches/rel_2_0/Open-ILS/web/js/ui/default/acq/common/li_table.js
Log:
handle deleting line item from selection list more carefully
Once a line item is attached to a purchase order, removing it
from a selection list should mean detaching it from the list,
not deleting it outright.
The open-ils.acq.lineitem.delete method can be removed
once the old jubgrid code is finally purged.
Signed-off-by: Galen Charlton <gmc at esilibrary.com>
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2011-01-22 05:49:10 UTC (rev 19258)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2011-01-22 05:49:43 UTC (rev 19259)
@@ -186,6 +186,32 @@
}
);
+__PACKAGE__->register_method(
+ method => 'delete_lineitem',
+ api_name => 'open-ils.acq.purchase_order.lineitem.delete',
+ signature => {
+ desc => 'Deletes a lineitem from a purchase order',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'lineitem ID to delete', type => 'number'},
+ ],
+ return => {desc => '1 on success, Event on error'}
+ }
+);
+
+__PACKAGE__->register_method(
+ method => 'delete_lineitem',
+ api_name => 'open-ils.acq.picklist.lineitem.delete',
+ signature => {
+ desc => 'Deletes a lineitem from a picklist',
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'lineitem ID to delete', type => 'number'},
+ ],
+ return => {desc => '1 on success, Event on error'}
+ }
+);
+
sub delete_lineitem {
my($self, $conn, $auth, $li_id) = @_;
my $e = new_editor(xact=>1, authtoken=>$auth);
@@ -205,6 +231,16 @@
# check PO perms
}
+ # once a LI is attached to a PO, deleting it
+ # from a picklist means *detaching* it from the picklist
+ if ($self->api_name =~ /picklist/ && $li->purchase_order) {
+ $li->clear_picklist;
+ my $evt = update_lineitem_impl($e, $li);
+ return $evt if $evt;
+ $e->commit;
+ return 1;
+ }
+
# delete the attached lineitem_details
my $lid_ids = $e->search_acq_lineitem_detail(
{lineitem => $li_id}, {idlist=>1});
Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/acq/common/li_table.js 2011-01-22 05:49:10 UTC (rev 19258)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/acq/common/li_table.js 2011-01-22 05:49:43 UTC (rev 19259)
@@ -2310,7 +2310,8 @@
if(idx >= list.length) return;
var liId = list[idx].id();
fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.lineitem.delete'],
+ ['open-ils.acq',
+ this.isPO ? 'open-ils.acq.purchase_order.lineitem.delete' : 'open-ils.acq.picklist.lineitem.delete'],
{ async: true,
params: [openils.User.authtoken, liId],
oncomplete: function(r) {
More information about the open-ils-commits
mailing list