Problem/Motivation

The ubercart order status migration is done using the static_map process plugin. The current map does not have a mapping for the ubercart status 'post_checkout', which in the text fixture has two labels, 'Pending' and 'Processing'.

Are there other statuses? Do we know if other modules add others?

The defaults, from the test fixture are:

Title State
Canceled canceled
Completed competed
In checkout in_checkout
Payment payment_received
Pending post_checkout
Processing post_checkout

Proposed resolution

Because of the default value in the static_map process plugin, 'processing' is being converted to 'draft'. let's pull that out and make it explicit, which is in line with the other value that is being converted to draft. It may just save someone a moment wondering why 'processing' is not in the list.

Yes, it could just be commented and both values removed from the static map. It just seems clearer to add all the standard order statuses to the map.

There is more detail in #6

Remaining tasks

Write a patch
review
commit

CommentFileSizeAuthor
#6 2886644-6.patch475 bytesquietone
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

quietone’s picture

Issue summary: View changes
quietone’s picture

Title: [Ubercart] Migrate order statuses » [Ubercart] Migrate post_checkout order status
Issue summary: View changes

It seems I left the IS half finished. This is really about what to do for the 'post_checkout' status.

swickham’s picture

It looks like like they're already mapped to be set to the Validation status which makes sense as that status is meant for any orders still waiting on some admin approval or whatever other kind of verification needs to be met. I'm looking at the d6_ubercart_order.yml file though, where are you looking?

quietone’s picture

Issue summary: View changes

Been a while since I looked at this, so starting at the beginning.

The test db has the following order_status_ids and states:

MariaDB [cm_dump]> select * from uc_order_statuses;
+-------------------+------------------+------------------+--------+--------+
| order_status_id   | title            | state            | weight | locked |
+-------------------+------------------+------------------+--------+--------+
| canceled          | Canceled         | canceled         |    -20 |      1 |
| completed         | Completed        | completed        |     20 |      1 |
| in_checkout       | In checkout      | in_checkout      |    -10 |      1 |
| payment_received  | Payment received | payment_received |     10 |      1 |
| pending           | Pending          | post_checkout    |      0 |      1 |
| processing        | Processing       | post_checkout    |      5 |      1 |
| testing           | Testing          | post_checkout    |      0 |      0 |
| testing-completed | Testing          | completed        |      0 |      0 |

The current process for the state is:

  state:
    plugin: static_map
    source: order_status
    default_value: draft
    map:
      # These are the equivalent order states I was able to gather from the
      # documentation.
      in_checkout: draft
      pending: validation
      payment_received: completed
      completed: completed
      canceled: canceled

From this it is clear that the static_map is using the order_status_id as the source information and ignoring the value of the state.

Then there is the order table which uses the order_status_id. The state values as given in the first table, uc_order_status, do not appear in any field of the order table. Again, it seems that only the order_status_id is to be migrated.

MariaDB [cm_dump]> select order_id,order_status from uc_orders;
+----------+------------------+
| order_id | order_status     |
+----------+------------------+
|        3 | completed        |
|        2 | payment_received |
|        1 | pending          |
|        4 | processing       |
+----------+------------------+
4 rows in set (0.13 sec)

However, uc_order_statuses has 6 non testing status ids and the static map only has 5. The value 'processing' is ignored. But the process has a default value of 'draft'. Therefore a Ubercart order_status_id of 'processing' will be converted to 'draft'. That seems reasonable. Is that correct?

If it is, or it should be a different value, it would be better to have it explicit in the map and remove any confusion about why it is being treated differently than the other order_status_ids.

quietone’s picture

Status: Active » Needs review
FileSize
475 bytes

So a simple one line fix to make it explicit that 'processing' is migrated to 'draft'.

quietone’s picture

Issue summary: View changes

There is an existing test for an order with an order_status_id of 'processing' that is converted to 'draft'. It is order_id 4, see here http://cgit.drupalcode.org/commerce_migrate/tree/modules/ubercart/tests/...

So this wee fix is good to go.

Update the IS

heddn’s picture

Status: Needs review » Reviewed & tested by the community

IS is clear. Fix makes sense.

  • heddn committed f996eca on 8.x-2.x authored by quietone
    Issue #2886644 by quietone, swickham, heddn: [Ubercart] Migrate...
heddn’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.