VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: AmStaF on December 22, 2011, 10:13:17 AM

Title: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: AmStaF on December 22, 2011, 10:13:17 AM
FF/IE (no matter)
JS is active
J1.7.3
VM1.98, M, pre- or VM2.0 stable (no matter, everywhere is the same)

BE, Orders (list)
http://... /administrator/index.php?option=com_virtuemart&view=orders

It seems that checkbox "Update status for all lines?" (BE) doesn`t work. Is it checked or not, when you change the order status, it changes (overwrites) status of ALL items in this order.
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: AmStaF on December 25, 2011, 15:17:16 PM
Hey, am I alone? Have anybody met the same?
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: Milbo on December 25, 2011, 17:29:53 PM
It is the day of saint nights :-) (hehe day of nights) not a lot people around
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: AmStaF on December 25, 2011, 21:27:40 PM
Ok, as for me, I switch off the function calling in model (orders.php):

public function updateOrderStatus (...) {
   ...
   foreach ($order_items as $order_item) {
      // $this->updateSingleItem (
            $order_item->virtuemart_order_item_id,
            $order['order_status'],
            $order['comments'],
            $virtuemart_order_id);
   }
   ...
}

so it is possible now to manage order status and items status separately. It suits me, but it is palliative.
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: AmStaF on December 27, 2011, 09:01:48 AM
Ok, nobody cares. So catch one more :)

If there are customfields:

- order`s print-view is corrupted (see attach.),
- order`s details are also corrupted (see attch.)

[attachment cleanup by admin]
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: gboul on May 18, 2012, 07:52:19 AM
I am using the VM 2.0.6 and the problem still exists.
Calling the updateOrderStatus or the updateStatusForOneOrder overwrites the status of the order items.
I have developed an new payment plugin for a local payment service that requires to send one by one the items of the order.
Each for each order item the payment can be either succesfull or cancelled. I use the updateSingleItem to update the status of the order items.
At the end I  call either the updateOrderStatus or the updateStatusForOneOrder, but both overwritten the status of the items.
The following is my latest attempt to emulate the form in the orders details that exist in the administrator.

      $virtuemart_order_id = $payments[0]->virtuemart_order_id;
      $_dataorder = array();
      $_dataorder['order_status'] = $order_status;
      $_dataorder['comments'] = "Update by Payment Service";      
      $_dataorder['customer_notified'] = 1;
      $_dataorder['include_comment'] = 1;
      $_dataorder['update_lines'] = 0;
      $_dataorder['current_order_status'] = 'P';      
      $_dataorder['virtuemart_order_id'] = $virtuemart_order_id;
      
      $dataorder = array();
      $dataorder[$virtuemart_order_id] = $_dataorder;
      $ordermodel->updateOrderStatus($dataorder);   
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: gboul on May 18, 2012, 08:18:13 AM
My solution to this issue is to change the function updateStatusForOneOrder in the models/orders.php.

I change the part of the code from this:
if ($data->store()) {
$q = 'SELECT virtuemart_order_item_id
FROM #__virtuemart_order_items
WHERE virtuemart_order_id="'.$virtuemart_order_id.'"';
$db = JFactory::getDBO();
$db->setQuery($q);
$order_items = $db->loadObjectList();
if ($order_items) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}


to this: (I added a check for update_lines and hope this does not break some other functionality)
if ($data->store()) {
$q = 'SELECT virtuemart_order_item_id
FROM #__virtuemart_order_items
WHERE virtuemart_order_id="'.$virtuemart_order_id.'"';
$db = JFactory::getDBO();
$db->setQuery($q);
$order_items = $db->loadObjectList();
if ($order_items  && ($data->update_lines==1)) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: gboul on May 18, 2012, 09:16:50 AM
With further investigation, I found out that my previous solution does break the normal payment scenario (update_lines is not set, thus the default is 0).
I had to change the logic to negative, so now the update_lines is not_update_lines. Only when the not_update_lines is defined and it is set to true the order items status are not changed.

This requires to change the code in 3 places.
models/orders.php

$update_lines=true;
if (isset($data->not_update_lines)){
if ($data->not_update_lines==1) {
$update_lines=false;
}
}

if ($order_items && $update_lines) {
// vmdebug('updateStatusForOneOrder',$data);
foreach ($order_items as $order_item) {

//$this->updateSingleItem($order_item->virtuemart_order_item_id, $data->order_status, $order['comments'] , $virtuemart_order_id, $data->order_pass);
$this->updateSingleItem($order_item->virtuemart_order_item_id, $data);
}
}


administrator/components/com_virtuemart/orders/tmpl/orders.php (changed from update_lines to not_update_lines)

<?php echo VmHTML::checkbox('orders['.$order->virtuemart_order_id.'][not_update_lines]') . JText::_('COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS'); ?>


administrator/components/com_virtuemart/orders/tmpl/order_editstatus.php (changed from update_lines to not_update_lines)
<td class="key"><?php echo JText::_('COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS'?></td>
<td><br />
<?php echo VmHTML::checkbox('not_update_lines'false); ?>
</td>


I also added a new constant: COM_VIRTUEMART_ORDER_NOT_UPDATE_LINESTATUS
and i added in the laguage ini files

If any of the admins can confirm that this is solution to this bug, it would be nice.
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: frogybella on February 13, 2013, 17:10:40 PM
Hi,

Maybe I missed someting but the bug remaims in VM2.0.18a... Has it been reproduced by dev team?

I also noticed that the "include this comment" checkbox was not operative. The comment is always included in the user mail whaterver its state is.

Thanks in advance for dev team feedback,
Best

Fred
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: frogybella on February 20, 2013, 14:38:39 PM
Hi,

I am surprised that nobody seems to care about this... Maybe there is a workaround? Or I should start a new thread?

Thanks in adavance,
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: frogybella on March 29, 2013, 18:05:27 PM
Hi

Still not fixed in 2.0.20a...

I am getting scared... It seems to me that it's difficult to manage orders with several lines with this bug.

Any advices?

Thanks in advance,
Regards
Fred
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: Milbo on April 12, 2013, 21:54:53 PM
Quote from: frogybella on February 20, 2013, 14:38:39 PM
Hi,

I am surprised that nobody seems to care about this... Maybe there is a workaround? Or I should start a new thread?

Thanks in adavance,


Nobody seems to care, because it is fixed for everybody. Maybe your update went wrong somehow and you use an old version?
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: frogybella on April 16, 2013, 18:23:02 PM
Hi Milbo,

Thank you for answering.

Discovering the bug was solved for everybody but me, we have made a clean install of Joomla 2.5.9 and VM2.0.20b from scratch.

We still have the bug in the orderpage and in the order list page.

What should I check?

Thanks in advance,

Fred
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: joophilverink on May 13, 2013, 09:01:44 AM
Hi Fred,
For me the same. I have placed this on this forum a long time ago. And the same happened, no reaction. So I'm clad to find someone who care's.

Virtuemart version 2.0.20a.

Joop.
Title: Re: Checkbox "Update status for all lines?" (BE) doesn`t work
Post by: frogybella on May 13, 2013, 15:57:37 PM
Hi Joop,

As Milbo was writting that this bug is solved for everybody you might be another exception... ;)

Best,

Fred