# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.

@@ -41,11 +41,11 @@
     //$IMPORT_UNIQUE_ID_IS_CCK = FALSE;                 // Is the identifier a CCK field?
 
     // CCK field as unique identifier
-    $IMPORT_UNIQUE_ID_NAME   = 'title';  // Import field that holds the unique identifier
-    $IMPORT_UNIQUE_ID_IS_CCK = FALSE;    // Is the identifier a CCK field?
+    $IMPORT_UNIQUE_ID_NAME   = variable_get('niu_id_field', 'title');  // Import field that holds the unique identifier
+    $IMPORT_UNIQUE_ID_IS_CCK = variable_get('niu_id_field_cck', FALSE);    // Is the identifier a CCK field?
 
-    $IMPORT_NTYPE            = 'product';   // Node type to be imported
-    $IMPORT_UPDATE_DATETIME  = TRUE;        // Settting: update date/time value?
+    $IMPORT_NTYPE            = variable_get('niu_content_type', 'page');   // Node type to be imported
+    $IMPORT_UPDATE_DATETIME  = variable_get('niu_update_date', FALSE);        // Settting: update date/time value?
 
 
     // Alter node edit form
@@ -54,9 +54,11 @@
       // Check if item already exists
       if ($IMPORT_UNIQUE_ID_IS_CCK) {
         // get unique id from cck fields
-        $unique_id_value = $form['#post']['cck:field_import_id:value'][0];
+        //$unique_id_value = $form['#post']['cck:field_import_id:value'][0];
+        $unique_id_value = $form['#post']['cck:'.$IMPORT_UNIQUE_ID_NAME.':value'][0];
         // build query
-        $query = 'SELECT c.nid, c.vid FROM {content_type_%s} c WHERE c.%s = "%s"';
+        //$query = 'SELECT c.nid, c.vid FROM {content_type_%s} c WHERE c.%s = "%s"';
+        $query = 'SELECT c.nid, c.vid FROM {content_type_%s} c WHERE c.%s_value = "%s"';
       }
       else {
         // get unique id for node values
@@ -111,12 +113,33 @@
   $form['niu_settings']['general'] = array(
     '#title'       => 'Node Import Update settings',
     '#type'        => 'fieldset',
-    '#collapsible' => TRUE,
-    '#collapsed'   => FALSE,
-    '#description' => 'Settings page not implemented. You have to hack the module, sorry.',
   );
+    $form['niu_settings']['general']['niu_content_type'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Content type'),
+    '#default_value' => variable_get('niu_content_type', 'page'),
+    '#description' => t('Name of the content type to update.'),
+  );
+  $form['niu_settings']['general']['niu_id_field'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Unique ID field'),
+    '#default_value' => variable_get('niu_id_field', 'title'),
+    '#description' => t('Name of the field containing the unique identifier.'),
+  );
+    $form['niu_settings']['general']['niu_id_field_cck'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Unique ID field is CCK'),
+    '#default_value' => variable_get('niu_id_field_cck', FALSE),
+    '#description' => t('Is the unique identifier a CCK field?.'),
+  );
+    $form['niu_settings']['general']['niu_update_date'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Update date/time value'),
+    '#default_value' => variable_get('niu_update_date', FALSE),
+    '#description' => t('Update the date and time values of the nodes updated?'),
+  );
 
-  return $form;
\ No newline at end of file
+  return system_settings_form($form);
\ No newline at end of file
 }
 
 //module below ensures existing nodes are updated, to avoid duplication
