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.

CommentFileSizeAuthor
#2 salesforce-queue_operations-1468152-1.patch987 bytesaethr

Comments

aethr’s picture

Assigned: Unassigned » aethr

I'm working on a patch for this today against 6.x-2.x-dev. Hopefully will have it submitted soon.

aethr’s picture

Assigned: aethr » Unassigned
Status: Active » Needs review
Issue tags: +6.x-2.0
StatusFileSize
new987 bytes

I'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).

kostajh’s picture

Hi 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?

aethr’s picture

I 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!

kostajh’s picture

Status: Needs review » Closed (won't fix)
kostajh’s picture

Issue summary: View changes

Added example settings array.