In sf_queue.module, the sf_queue_salesforce_api_pre_export performs a check to see if the current operation (create, update, delete) is in the list of 'cron_operations' using an in_array call.
However, when options are unticked in the salesforce/fieldmap/%id settings page, they are still in the array, but with a value of '0'. For this reason, the in_array call will always return true, even if an operation is unchecked.
Just for illustration's sake, here is an example structure of the variable 'sf_queue_settings':
Array
(
[cron_operations] => Array
(
[update] => update
[delete] => delete
[create] => 0
)
[cron_frequency] => 0
[cron_period] => .25
[cron_num_objects] => 200
[cron_min_threshold] => 0
[retry_num_attempts] => 0
)
As you can see in 'cron_operations', the 'create' key still exists, and thus will return true for an in_array() check.
Comments
Comment #1
aethr commentedI'm working on a patch for this today against 6.x-2.x-dev. Hopefully will have it submitted soon.
Comment #2
aethr commentedI've committed a patch for this (attached). My sincerest apologies if I've done this incorrectly, this is my first contribution back to a Drupal project (and my first time using git).
Comment #3
kostajh commentedHi aethr, thanks for the patch!
I don't use sf_queue so I'm unable to test this. It looks fine to me though. Can you confirm that by applying this patch the problem is fixed?
Comment #4
aethr commentedI applied the patch to my dev environment (6.x-2.0-beta1), afterwards "update" operations were put in the queue and "create" operations were executed immediately with the 'sf_queue_settings' values in the example.
Works for me!
Comment #5
kostajh commentedComment #5.0
kostajh commentedAdded example settings array.