OS: Debian 8
Database: MySQL 5.5.44-0+deb8u1
Web Server: Apache/2.4.10
PHP: 5.6.9-0+deb8u1
Drupal: 7.38
Ubercart: 7.x-3.8
The problem
I've noticed, that order status stays the same when using Views Bulk Operations (VBO) without notifying via email (checkbox). I think, that it was working before (I dont know what changed). I've even debugged the function and the uc_order_update_status(xxx) is working correctly, but there is probably another update of the database records.
What are the steps required to reproduce the bug?
- Edit the admin/store/orders/view view and add Views Bulk Operation "update order status" (or create another view)
- Select multiple orders and update their status WITHOUT notifying via email (checkbox)
What behavior were you expecting?
The order status should be updated to the chosen one.
What happened instead?
The order status stays the same.
Comments
Comment #1
tr commentedSo $update contains FALSE, which is why the notification doesn't happen? Or does it contain TRUE? There has been no change to that code for a very long time - are you sure it used to work? As far as I can tell, what your patch suggests is that it never worked correctly.
uc_order_update_status() returns "TRUE or FALSE depending on the success of the update."
If it returns FALSE, we *do not* want to set $order->order_status, but that's what your patch does, regardless of the $update variable.
Perhaps you have a contributed module which implements hook_uc_order() and which is vetoing that status change? Or perhaps you're trying to set the order to a status defined by a disabled/uninstalled module?
Comment #2
iki_cz commented@TR: Yes, I'm still missing something. But the $update is TRUE.
I've tested it on 2 Ubercart instances and it was the same. There will be something else (common).
And yes, I'm wrong with the condition, maybe there should be a second "if". I don't know why $order->order_status = $context['status']; is so important.
AFAIK it was working like a month ago. I will dig deeper :)
Comment #3
typehost commentedConfirmed this error:
Step 1: select "Set Order Status" and checkbox for an order in views list (admin/store/orders/view)
Step 2: Set order status & choose "Send email notification on update"
Step 3: if no email is sent / no updated order status - status is updated when order email is checked
NOTE: On the third splash screen, there is a title: "Are you sure you want to perform Set order status on the selected items?" - beneath this..."You selected the following item:" --> but the list element is blank and there is no order ID being passed as a variable - nevertheless it will work if the email is sent
Comment #4
ericwongcm commentedI believe this is related to https://www.drupal.org/node/2537244
and https://www.drupal.org/node/1834208
I have tried the patch attached in this issue, it works but VBO failed to display the order number selected during batch processing.
VBO 7.x-3.2 is able to display the order number during batch processing.
I know this problem is due to the security fix for VBO 7.x-3.3 and it would be great if this final last bit can be fixed too before someone commit this to the next Ubercart release.
https://www.drupal.org/node/2516688
Comment #5
anrikun commentedHere's an updated patch.
Comment #6
tr commentedOK, the patch in #5 looks good and makes sense.
But a question: Perhaps we should be passing $order into the action functions instead of $order->order_id? That way any changes made by uc_order_action_set_status() *would* show up in the $order object, so we wouldn't have to do the special case
$order->order_status = $context['status'];in the action function.Or perhaps it's too late in the 7.x-3.x development cycle to mess with that ...
I've verified this isn't a problem in 8.x-4.x because of the OO structure of D8. The $order entity is passed around instead of the id, and all the methods operate on that entity directly.
Comment #7
anrikun commentedPatch at #5 prevents a user to bulk update orders' statuses if he does not have the permission to edit orders.
But the way Ubercart works, any user who has permission "view all orders" may update orders' statuses no matter if he can edit orders or not.
Here an updated patch that respects this policy.
Comment #8
graham leach commentedI implemented the code in the patch, but maybe I'm missing something.
Using VBO on my Ubercart (D7U3) implementation, I am able to check an arbitrary number of orders and select the bulk operation (set order status) but then I get a confirmation screen that says:
You selected the following 2 items
-
-
(CONFIRM)
The item details are BLANK, but the operation is successful.
This happens *regardless* of whether email confirmation is checked or not.
The line that generates this confirmation is in:
views_bulk_operations.module
At:
line 677
As:
$output = theme('item_list', array('items' => $items, 'title' => t('You selected the following %count:', array('%count' => $count))));
The parent function is:
function theme_views_bulk_operations_confirmation($variables) {
Apparently, $variables does not contain the information the screen output command needs to identify the rows being affected.
Here's the .info file for the version of VBO I am running:
# cat views_bulk_operations.info
name = Views Bulk Operations
description = Provides a way of selecting multiple rows and applying operations to them.
dependencies[] = entity
dependencies[] = views (>=3.12)
package = Views
core = 7.x
php = 5.2.9
files[] = plugins/operation_types/base.class.php
files[] = views/views_bulk_operations_handler_field_operations.inc
; Information added by Drupal.org packaging script on 2022-10-19
version = "7.x-3.7"
core = "7.x"
project = "views_bulk_operations"
datestamp = "1666149180"