-
Notifications
You must be signed in to change notification settings - Fork 4
Description
This is somewhat vague issue as we haven't yet figured out how it can be replicated, but I've decided to report it anyway in case someone else is experiencing the same problem.
The issue is that every now and then pickup_point_* fields in sales_order table do not get populated. When store staff attempt to create a new shipment, such order dies with an error "Error: 533, Unsupported product code: empty"
Since we don't know how the bug occurs, we've placed following SQL query in a cronjob to populate the missing fields when ever necessary. It helps the store staff by giving them the ability to reliably process shipments, but of course does not fix the root cause of this issue.
update sales_order set
pickup_point_id=regexp_replace(shipping_method, '^pktkppickuppoint_', ''),
paketikauppa_smc=(case when shipping_description like '%Posti -%' then 2103 when shipping_description like '%Matkahuolto -%' then 90080 when shipping_description like '%DB -%' then 80010 end),
pickup_point_provider=(case when shipping_description like '%Posti -%' then "Posti" when shipping_description like '%Matkahuolto -%' then "Matkahuolto" when shipping_description like '%DB -%' then "DB Schenker" end),
pickup_point_name=shipping_description,
pickup_point_street_address=regexp_replace(regexp_replace(shipping_description, '^.*: ', ''), ',.*' ,''),
pickup_point_postcode=regexp_substr(shipping_description, '([0-9]){5}'),
pickup_point_city=regexp_replace(regexp_replace(shipping_description, '^.*,', ''), ' -.*', ''),
pickup_point_country="FI"
where shipping_method like 'pktkppickuppoint_%' and pickup_point_id is NULL
The empty fields in sales_order are
pickuppoint_zip | home_delivery_service_provider | pickup_point_provider | pickup_point_location | pickup_point_id | pickup_point_name | pickup_point_street_address | pickup_point_postcode | pickup_point_city | pickup_point_country | pickup_point_description | paketikauppa_smc
The following fields do get populated (these are what our SQL query uses for populating the missing fields)
shipping_description | shipping_method
Any idea what could be causing this bug?