[ic] Bug: Admin UI - Update the Order - Ship per status above - FIX

Peter peter at pajamian.dhs.org
Mon May 9 18:12:46 EDT 2005


Reposting this, since it's been a couple of days ...

Actually I'm not sure if this is a bug or if it's intended behavior, but
it doesn't make much sense to me if it is intended behavior...

Steps to reproduce:
1.  View an order in the admin UI, preferebly one with several items.
2.  Click the Order Status tab to view/edit the order status.
3.  Change the status of various items to different things, say shipped
for one, leave one at pending, change one to cancelled, etc.
4.  Select Ship per status above from the Action drop down.
5.  Click the Update the order button.

Expected result:
The status of the various different items should be set the way you set
them in step 3 above.

Actual result:
Items set to status shipped are properly set to shipped.  Everything
else is set to back ordered status.

This behavior is especially frustrating if you add additional status
choices to the cart.  For example, since we manufacture some of our own
stock we have an added status of In Production which indicates that the
item is currently being custom manufactured for the order.

I have created a patch for the update-order-status UI tag which corrects
the behavior to match the expected behavior above (note the following
patch may suffer from word-wrap):

--- update_order_status.tag.orig        Wed May  5 06:53:36 2004
+++ update_order_status.tag     Sat May  7 01:19:58 2005
@@ -184,6 +184,17 @@
                 $need_shiplines = 1;
         }

+#::logDebug("CGI:\n". join("\n", map { my $v = $CGI::values{$_}; $v =~
s/\0/ /g; "$_=$v"; } keys %CGI::values));
+       my %linestatus;
+       {
+               my @keys = grep /code__1$/, keys %CGI::values;
+               foreach (@keys) {
+                       my $k = /^(\d+_)/ ? $1 : '';
+                       $linestatus{$CGI::values{$_}} =
$CGI::values{$k.'status__1'};
+#::logDebug("key=$_ code=$CGI::values{$_}
status=$CGI::values{$k.'status__1'}");
+               }
+       }
+
         if(! @shiplines and ! $opt->{ship_all}) {
                 my @keys = grep /status__1/, keys %CGI::values;
  #::logDebug("keys to ship: " . join(',', @keys));
@@ -273,7 +284,8 @@
                 my $line = $code;
                 $line =~ s/.*\D//;
                 next if $already{$line};
-               my $status = $shipping{$line} ? $target_status :
'backorder';
+               my $status = $shipping{$line} ? $target_status :
$linestatus{$code};
+#::logDebug("Setting $code to $status");
                 $odb->set_field($code, 'status', $status)
                         or do {
                                 $::Scratch->{ui_message} = "Orderline
$code ship status update failed.";



Peter



More information about the interchange-users mailing list