Below is the message I get (Drupal 7.10).

At least it shows that there are no updates pending but at the same time I get this DB error that stops the whole process. I just updated the rules module from 2.0-rc2 to 2.0 for this so I ran update.php and that's when the error occurred.

No pending updates.

Error message

PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: 
INSERT INTO {rules_config} (name, status, module) 
VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); 

Array ( [:db_insert_placeholder_0] => commerce_recurring_initialise_order_master [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => commerce_recurring ) in drupal_write_record() (line 6888 of common.inc).

The website encountered an unexpected error. Please try again later. 

Comments

larowlan’s picture

Project: Commerce Recurring Framework » Rules
Component: Code » Feature module support

Hi Wolfgang
Any idea what's wrong with this default config?
All four default rules nominate a plugin, yet we get the 'missing value for plugin' error.
Anything change with exports between rc2 and 2.0?
Lee

/**
 * Implementation of hook_default_rules_configuration().
 */
function commerce_recurring_default_rules_configuration() {
  $items = array();
  $items['commerce_recurring_process_orders'] = entity_import('rules_config', '{ "commerce_recurring_process_orders" : {
      "LABEL" : "Generate Recurring Orders",
      "PLUGIN" : "reaction rule",
      "TAGS" : [ "Commerce Recurring" ],
      "REQUIRES" : [ "commerce_recurring", "rules" ],
      "ON" : [ "cron" ],
      "DO" : [
        { "commerce_recurring_load_recurring" : { "PROVIDE" : { "orders" : { "orders" : "Recurring Orders" } } } },
        { "LOOP" : {
            "USING" : { "list" : [ "orders" ] },
            "ITEM" : { "order" : "Order" },
            "DO" : [
              { "component_commerce_recurring_generate_orders" : { "order" : [ "order" ] } }
            ]
          }
        }
      ]
    }
  }');
  $items['commerce_recurring_generate_orders'] = entity_import('rules_config', '{ "commerce_recurring_generate_orders" : {
      "LABEL" : "Generate Recurring Order if Appropriate",
      "PLUGIN" : "rule",
      "REQUIRES" : [ "commerce_recurring" ],
      "USES VARIABLES" : { "order" : { "label" : "Order", "type" : "commerce_order" } },
      "IF" : [
        { "commerce_recurring_rules_order_contains_recurring" : { "commerce_order" : [ "order" ] } },
        { "commerce_recurring_rules_order_is_master" : { "commerce_order" : [ "order" ] } }
      ],
      "DO" : [
        { "commerce_recurring_process_recurring" : {
            "USING" : { "commerce_order" : [ "order" ] },
            "PROVIDE" : { "recurring_order" : { "recurring_order" : "New Order" } }
          }
        }
      ]
    }
  }');
  $items['commerce_recurring_initialise_order_master'] = entity_import('rules_config', '{ "commerce_recurring_initialise_order_master" : {
      "LABEL" : "Set First Repeat date of Recurring Order",
      "PLUGIN" : "reaction rule",
      "TAGS" : [ "Commerce Recurring" ],
      "REQUIRES" : [ "commerce_recurring", "rules", "commerce_checkout" ],
      "ON" : [ "commerce_checkout_complete" ],
      "IF" : [
        { "commerce_recurring_rules_order_contains_recurring" : { "commerce_order" : [ "commerce_order" ] } }
      ],
      "DO" : [
        { "commerce_recurring_initialise_recurring" : {
            "USING" : { "commerce_order" : [ "commerce_order" ] }
          }
        }
      ]
    }
  }');
  
  $items['commerce_recurring_trigger_payments'] = entity_import('rules_config', '{ "commerce_recurring_trigger_payments" : {
      "LABEL" : "Trigger Payments against recurring orders",
      "PLUGIN" : "reaction rule",
      "REQUIRES" : [ "commerce_recurring", "rules" ],
      "ON" : [ "cron" ],
      "DO" : [
        { "commerce_recurring_load_payments_due" : { "PROVIDE" : { "orders" : { "orders" : "Recurring Orders" } } } },
        { "LOOP" : {
            "USING" : { "list" : [ "orders" ] },
            "ITEM" : { "order" : "Current Order" },
            "DO" : [
              { "commerce_recurring_process_payment" : { "commerce_order" : [ "order" ] } }
            ]
          }
        }
      ]
    }
  }');
  return $items;
}
fluffy’s picture

Got the same problem, when I add the default value to the schema for the plugin field the problem goes away. The thing I don't understand is all the configs have PLUGIN value and after installing the plugin field in rules_config table has correct values.

SolomonGifford’s picture

I had to allow null to get past this error (on the rules_config table, plugin field).

SolomonGifford’s picture

Project: Rules » Commerce Recurring Framework
Component: Feature module support » Code

After getting past this, there was a blank rule:

name: commerce_recurring_initialise_order_master
label: unlabeled
plugin:
etc...

jpstrikesback’s picture

Project: Commerce Recurring Framework » Rules
Version: 7.x-1.x-dev » 7.x-2.x-dev
Component: Code » Rules Core

Seeing this as well, sending back into rules queue

jpstrikesback’s picture

Project: Rules » Commerce Recurring Framework
Version: 7.x-2.x-dev » 7.x-1.x-dev
Component: Rules Core » Code

Apologies, the issue is that the info file needs to list "commerce_checkout" as a dependancy:

michfuer’s picture

I was having the same issue, and confirmed that the fix in comment #7 did the trick. Thanks jpstrikesback!

rooby’s picture

Status: Active » Needs review
StatusFileSize
new420 bytes

That appears to fix the issue.

Here is a patch.

bendikrb’s picture

#9 resolved the issue for me (which was not during update, but install).

Thanks!

bendikrb’s picture

Issue summary: View changes

added information

pcambra’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

At this point there are 6 sites using the 1.x branch of recurring framework, I'm dropping support for that version recommending to use and contribute to the 2.x

scott shipman’s picture

I had this issue but it was resolved when I enabled commerce_rules_extra. I created the the rules and exported with features on a development environment where I had this module enabled (its required for the rules I created). But on the test server, I had forgotten to enable that module. Once I did, everything worked. So, maybe the issue is to make sure the feature dependencies are correct?