Commit c3fb3ab0 authored by Jake Bell's avatar Jake Bell
Browse files

- Adding node ID to everything that looks for cid.

parent a4b0e6f8
......@@ -7,6 +7,12 @@ function webform_encrypt_schema() {
$schema['webform_encrypt'] = array(
'description' => 'Form metadata',
'fields' => array(
'nid' => array(
'description' => 'The node ID from webform',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'cid' => array(
'description' => 'The component ID from webform',
'type' => 'int',
......@@ -21,9 +27,6 @@ function webform_encrypt_schema() {
'not null' => TRUE,
),
),
'unique keys' => array(
'cid' => array('cid'),
),
);
return $schema;
}
......@@ -34,3 +37,4 @@ function webform_encrypt_schema() {
function webform_encrypt_uninstall() {
drupal_uninstall_schema('webform_encrypt');
}
......@@ -36,7 +36,7 @@ function webform_encrypt_form_alter(&$form, $form_state, $form_id) {
);
// Add new submit handler to save our config data.
array_unshift($form['#submit'], '_webform_encrypt_component_save');
$form['#submit'][] = '_webform_encrypt_component_save';
}
}
......@@ -46,11 +46,12 @@ function webform_encrypt_form_alter(&$form, $form_state, $form_id) {
*/
function _webform_encrypt_component_save($form, $form_state) {
$record = new StdClass();
$record->nid = $form_state['values']['nid'];
$record->cid = $form_state['values']['cid'];
foreach ($form_state['values']['encryption'] as $key => $value) {
$record->$key = $value;
}
drupal_write_record('webform_encrypt', $record, 'cid');
drupal_write_record('webform_encrypt', $record);
}
/**
......@@ -68,7 +69,8 @@ function webform_encrypt_node_load($nodes, $types) {
$component_ids = array_keys($node->webform['components']);
$encrypt = db_select('webform_encrypt', 'we')
->fields('we', array('cid', 'encrypt'))
->condition('cid', $component_ids, 'IN')
->condition('we.nid', $node->nid)
->condition('we.cid', $component_ids, 'IN')
->execute()
->fetchAllKeyed();
foreach ($node->webform['components'] as $cid => $component) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment