From 17c84eb58a57191d6a893ddb667958d004ce945d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=F8rgen=20G.=20Nielsen?= <jgn@dbc.dk>
Date: Thu, 17 Mar 2011 15:39:24 +0100
Subject: [PATCH] Porting to Drupal 7

---
 dibs.admin.inc                 |   45 +++++++++++----
 dibs.frontend.inc              |   37 +++++++++----
 dibs.info                      |    6 ++-
 dibs.install                   |   50 ++++++++++++----
 dibs.module                    |  122 +++++++++++++++++++++++++++++-----------
 dibs_example/dibs_example.info |    4 +-
 6 files changed, 195 insertions(+), 69 deletions(-)

diff --git a/dibs.admin.inc b/dibs.admin.inc
index 2f137c4..dabee23 100644
--- a/dibs.admin.inc
+++ b/dibs.admin.inc
@@ -14,6 +14,7 @@ function dibs_admin_settings_list() {
   drupal_add_css(drupal_get_path('module', 'dibs') .'/dibs.admin.css');
 
   // Looping through all modules that implement the hook_dibsapi.
+  $attributes['class'][] = 'dibs-admin-settings-list';
   $output = '<br />';
   $i = 0;
   foreach ((array)module_implements('dibsapi') as $module) {
@@ -37,7 +38,7 @@ function dibs_admin_settings_list() {
       );
       $rows[] = $row;
     }
-    $output .= theme('table', $header, $rows, array('class' => 'dibs-admin-settings-list'));
+    $output .= theme('table', array('header'=>$header, 'rows'=>$rows, 'attributes'=>$attributes));
   }
 
   return $output;
@@ -54,7 +55,7 @@ function dibs_admin_settings_list() {
  * @see dibs_admin_settings_form_validate()
  * @see dibs_admin_settings_form_submit()
  */
-function dibs_admin_settings_form($form_state = array(), $module = NULL, $delta = NULL) {
+function dibs_admin_settings_form($node, &$form_state = array(), $module = NULL, $delta = NULL) {
   // Checking if the module and delta exists
   $info = module_invoke($module, 'dibsapi', 'info', $delta);
   if (empty($info) || !is_array($info)) {
@@ -66,7 +67,7 @@ function dibs_admin_settings_form($form_state = array(), $module = NULL, $delta
   $default = dibs_is_default($module, $delta);
 
   // Setting page title
-  drupal_set_title(t('Change DIBS implementation settings: %module > %delta', array('%module' => t($module), '%delta' => $info['info'])));
+  drupal_set_title(t('Change DIBS implementation settings: %module > %delta', array('%module' => t($module), '%delta' => $info['info'])), PASS_THROUGH);
 
   // Loading settings
   $settings = dibs_load_settings($module, $delta, FALSE);
@@ -273,7 +274,7 @@ function dibs_admin_settings_form($form_state = array(), $module = NULL, $delta
     '#maxlength' => 10,
     '#legnth' => 10,
     '#required' => FALSE,
-    '#default_value' => !empty($settings['orderid']['order_id']) ? $settings['orderid']['order_id'] : '',
+    '#default_value' => !empty($settings['orderid']['order_id']) ? $settings['orderid']['order_id'] : '0',
     '#description' => t('The next order ID value. Only numeric values are allowed. Please besure that the range used does not conflict with order IDs on existing payments in DIBS, and other implementations of the DIBS module.')
   );
   $form['orderid']['order_id_prefix'] = array(
@@ -369,7 +370,7 @@ function dibs_admin_settings_form_validate($form, &$form_state) {
   }
 
   // Checking order ID settings
-  if ($default && empty($form_state['values']['orderid']['order_id'])) {
+  if ($form_state['values']['orderid']['order_id'] == '') {
     form_set_error('orderid][order_id', t('Please, fill in the next order ID.'));
   }
   elseif (!empty($form_state['values']['orderid']['order_id']) && !is_numeric($form_state['values']['orderid']['order_id'])) {
@@ -417,15 +418,37 @@ function dibs_admin_settings_form_submit($form, &$form_state) {
   variable_set('dibs_settings_' . $module . '_' . $delta, $settings);
 
   // Saving order ID settings
-  $result = db_result(db_query("SELECT api_module FROM {dibs_order_id_settings} WHERE api_module = '%s' AND api_delta = '%s'", $module, $delta));
+  $result = db_query('
+    SELECT api_module 
+    FROM {dibs_order_id_settings}
+    WHERE api_module = :api_module
+    AND api_delta = :api_delta',
+    array(':api_module' => $module, ':api_delta' => $delta,)
+  );
 
-  if (!empty($result)) {
-    db_query("UPDATE {dibs_order_id_settings} SET order_id = %d, order_id_suffix = '%s', order_id_prefix = '%s' WHERE api_module = '%s' AND api_delta = '%s'",
-      $orderid['order_id'], $orderid['order_id_suffix'], $orderid['order_id_prefix'], $module, $delta);
+  if ($result->rowCount()) {
+    //  $orderid['order_id'], $orderid['order_id_suffix'], $orderid['order_id_prefix'], $module, $delta);
+    $updated = db_update('dibs_order_id_settings')
+      ->fields(array(
+        'order_id' => $orderid['order_id'],
+        'order_id_suffix' => $orderid['order_id_suffix'],
+        'order_id_prefix' => $orderid['order_id_prefix'],
+      ))
+      ->condition('api_module', $module)
+      ->condition('api_delta', $delta)
+      ->execute();
   }
   else {
-    db_query("INSERT INTO {dibs_order_id_settings} (api_module, api_delta, order_id, order_id_prefix, order_id_suffix) VALUES ('%s', '%s', %d, '%s', '%s')",
-      $module, $delta, $orderid['order_id'], $orderid['order_id_prefix'], $orderid['order_id_suffix']);
+    //  $module, $delta, $orderid['order_id'], $orderid['order_id_prefix'], $orderid['order_id_suffix']);
+    $nid = db_insert('dibs_order_id_settings')
+    ->fields(array(
+      'api_module' => $module,
+      'api_delta' => $delta,
+      'order_id' => $orderid['order_id'],
+      'order_id_prefix' => $orderid['order_id_prefix'],
+      'order_id_suffix' => $orderid['order_id_suffix'],
+      ))
+    ->execute();
   }
 
   drupal_get_messages();
diff --git a/dibs.frontend.inc b/dibs.frontend.inc
index dfc31af..8c5dd5b 100644
--- a/dibs.frontend.inc
+++ b/dibs.frontend.inc
@@ -44,6 +44,7 @@ function dibs_frontend_redirect_page($hash) {
 
   // Getting redirect form
   $form = drupal_get_form('dibs_frontend_redirect_form', $settings, $data);
+  $form = drupal_render($form);
 
   // We are forcing the accept-charset to be ISO-8859-1, else will the order and delivery
   // info sent to DIBS be shown with wrong characters in the payment window and in their
@@ -54,12 +55,13 @@ function dibs_frontend_redirect_page($hash) {
 
   // Adding autosubmit javascript
   drupal_add_js("
-    if (Drupal.jsEnabled) {
+    // Drupal.jsEnabled not in Drupal 7
+    // if (Drupal.jsEnabled) {
       $(document).ready($('#dibs-frontend-redirect-form').submit());
-    }
+    // }
   ", 'inline', 'footer');
 
-  return theme('dibs_redirect_page', $form, $settings, $data);
+  return theme('dibs_redirect_page', array('form'=>$form, 'settings'=>$settings, 'transaction'=>$data));
 }
 
 /**
@@ -72,8 +74,8 @@ function dibs_frontend_redirect_page($hash) {
  *
  * @return array
  */
-function dibs_frontend_redirect_form($form_state = array(), $settings, $data) {
-  if ($data['payment_retry_count']) {
+function dibs_frontend_redirect_form($node, &$form_state = array(), $settings, $data) {
+  if (isset($data['payment_retry_count']) && $data['payment_retry_count']) {
     $data['payment_order_id'] .= '-' . $data['payment_retry_count'];
   }
 
@@ -273,8 +275,9 @@ function dibs_frontend_cancel_page($hash) {
 
   // Getting redirect form
   $form = drupal_get_form('dibs_frontend_cancel_form', $settings, $data);
+  $form = drupal_render($form);
 
-  return theme('dibs_cancel_page', $form, $settings, $data);
+  return theme('dibs_cancel_page', array('form'=>$form, 'settings'=>$settings, 'data'=>$data));
 }
 
 /**
@@ -289,8 +292,8 @@ function dibs_frontend_cancel_page($hash) {
  * @ingroup forms
  * @see dibs_frontend_cancel_form_submit()
  */
-function dibs_frontend_cancel_form($form_state = array(), $settings, $data) {
-  $form['hash'] = array('#type' => 'value', '#value' => $data['api_hash']);
+function dibs_frontend_cancel_form($node, &$form_state = array(), $settings, $data) {
+  $form['hash'] = array('#type' => 'hidden', '#value' => $data['api_hash']);
   $form['submit'] = array('#type' => 'submit', '#value' => t('Return to DIBS payment'));
   return $form;
 }
@@ -318,7 +321,12 @@ function dibs_frontend_cancel_form_submit($form, &$form_state) {
       // Generating order id
       $order_id = dibs_get_next_order_id($data['api_module'], $data['api_delta']);
       // Updating transaction
-      db_query("UPDATE {dibs_transactions} SET payment_order_id = '%s' WHERE api_hash = '%s'", $order_id, $hash);
+      $updated = db_update('dibs_transactions')
+        ->fields(array(
+          'payment_order_id' => $order_id,
+          ))
+        ->condition('api_hash', $hash)
+        ->execute();
       break;
     case 'add_retry_suffix':
       $suffixed = array(
@@ -351,7 +359,14 @@ function dibs_frontend_dibs_callback_ok($hash) {
       $md5_key = md5($settings['general']['md5_key2'] . md5($settings['general']['md5_key1'] . 'transact='. $transact .'&amount='. ($data['payment_price'] * 100) .'&currency='. $settings['general']['currency']));
       if (($md5_key == $authkey) || empty($settings['md5'])) {
         // Updating transaction record with payment transaction id
-        db_query("UPDATE {dibs_transactions} SET payment_transaction_id = %d, payment_status = 1, payment_type = '%s' WHERE tid = %d", $transact, $paytype, $transaction['tid']);
+        $updated = db_update('dibs_transactions')
+          ->fields(array(
+            'payment_transaction_id' => $transact,
+            'payment_status' => 1,
+            'payment_type' => $paytype,
+            ))
+          ->condition('tid', $transaction['tid'])
+          ->execute();
 
         // We are unsetting the transaction and loading it again to get the updated one.
         unset($transaction);
@@ -389,7 +404,7 @@ function dibs_frontend_accept_page($hash) {
   $settings = dibs_load_settings($transaction['api_module'], $transaction['api_delta']);
 
   // Returning the themed output
-  return theme('dibs_accept_page', $settings, $transaction);
+  return theme('dibs_accept_page', array('settings'=>$settings, 'transaction'=>$transaction));
 }
 
 
diff --git a/dibs.info b/dibs.info
index d678e2c..be97d22 100644
--- a/dibs.info
+++ b/dibs.info
@@ -1,3 +1,7 @@
 name = DIBS
 description = An API module that makes it possible for other modules to receive payments via DIBS Payment Gateway
-core = 6.x
+core = 7.x
+project = "dibs"
+version = "7.x-1.x-dev"
+files[] = dibs.admin.inc
+files[] = dibs.frontend.inc
diff --git a/dibs.install b/dibs.install
index 8b50c29..98a8f27 100644
--- a/dibs.install
+++ b/dibs.install
@@ -10,10 +10,21 @@
  */
 function dibs_install() {
   // Create tables.
-  drupal_install_schema('dibs');
+  // Database table is automatically created based on schema during 
+  // module installation so no need to call drupal_install_schema() 
+  // from hook_install() any more.
 
   // Inserting default order id setting
-  db_query("INSERT INTO {dibs_order_id_settings} VALUES ('dibs', 'default', 10000, '', '')");
+  $db_id = db_insert('dibs_order_id_settings')
+    ->fields(array(
+      'api_module' => 'dibs',
+      'api_delta' => 'dibs',
+      'order_id' => 10000,
+      'order_id_prefix' => '',
+      'order_id_suffix' => '',
+    ))
+    ->execute();
+
 }
 
 /**
@@ -21,11 +32,16 @@ function dibs_install() {
  */
 function dibs_uninstall() {
   // Delete menu links.
-  db_query("DELETE FROM {menu_links} WHERE module = 'dibs'");
+  $deleted = db_delete('menu_links')
+    ->condition('module', 'dibs')
+    ->execute();
   menu_cache_clear_all();
-
   // Remove tables.
-  drupal_uninstall_schema('dibs');
+  // As of Drupal 7, a call to drupal_uninstall_schema() is no longer necessary. 
+  // See http://drupal.org/update/modules/6/7: "A module no longer should 
+  // explicitly install or uninstall its database schema in hook_install() 
+  // or hook_uninstall()."
+  // drupal_uninstall_schema('dibs');
 }
 
 /**
@@ -73,17 +89,22 @@ function dibs_schema() {
       'order_info_long' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
-        'description' => t('Order info long. Serialized'),
+        // 'default' => '',
+        // BLOB/TEXT column 'order_info_long' can't have a default value
+        'description' => 'Order info long. Serialized',
       ),
       'order_price_info' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
+        // 'default' => '',
+        // BLOB/TEXT column 'order_price_info' can't have a default value
         'description' => t('Order price info. Serialized'),
       ),
       'payment_time' => array(
-        'type' => 'datetime',
+        'type' => 'datetime', // empty 'type' generates PHP notice
+        // 'mysql_type', 'pgsql_type', 'sqlite_type', etc.: If you need to use a record type not included in the officially supported list of types above, you can specify a type for each database backend. In this case, you can leave out the type parameter, but be advised that your schema will fail to load on backends that do not have a type specified.
+        // jfr. http://api.drupal.org/api/drupal/includes--database--schema.inc/group/schemaapi/7
+        'mysql_type' => 'datetime',
         'description' => t('Payment time'),
         'not null' => FALSE,
       ),
@@ -205,7 +226,8 @@ function dibs_schema() {
       'params' => array(
         'type' => 'text',
         'not null' => TRUE,
-        'default' => '',
+        // 'default' => '',
+        // BLOB/TEXT column 'params' can't have a default value
         'description' => t('Storage of extra parameters from the module which implements the DIBS API. The data is stored serialized.'),  
       ),      
     ),
@@ -261,7 +283,10 @@ function dibs_schema() {
         'description' => t('Log value. Used in combination with subtype.'),
       ),
       'time' => array(
-        'type' => 'datetime',
+        'type' => 'datetime', // empty 'type' generates PHP notice
+        // 'mysql_type', 'pgsql_type', 'sqlite_type', etc.: If you need to use a record type not included in the officially supported list of types above, you can specify a type for each database backend. In this case, you can leave out the type parameter, but be advised that your schema will fail to load on backends that do not have a type specified.
+        // jfr. http://api.drupal.org/api/drupal/includes--database--schema.inc/group/schemaapi/7
+        'mysql_type' => 'datetime',
         'description' => t('Log time'),
         'not null' => FALSE,
       ),
@@ -340,7 +365,8 @@ function dibs_update_6002() {
   db_add_field($ret, 'dibs_transactions', 'params', array(
     'type' => 'text',
     'not null' => TRUE,
-    'default' => '',
+    // 'default' => '',
+    // BLOB/TEXT column 'params' can't have a default value
     'description' => t('Storage of extra parameters from the module which implements the DIBS API. The data is stored serialized.'),  
   ));
 
diff --git a/dibs.module b/dibs.module
index 899eecf..27d9d49 100644
--- a/dibs.module
+++ b/dibs.module
@@ -32,31 +32,56 @@ function dibs_help($path, $arg) {
 }
 
 /**
- * Implementation of hook_perm().
+ * Implementation of hook_permission().
  */
-function dibs_perm() {
-  return array('pay using dibs', 'administer dibs settings', 'administer dibs transactions');
+function dibs_permission() {
+  return array(
+    'pay using dibs' => array(
+      'title' => t('Pay using dibs'),
+      'description' => t('Pay using dibs.'),
+    ),
+    'administer dibs settings' => array(
+      'title' => t('Administer dibs settings'),
+      'description' => t('Administer dibs settings.'),
+    ),
+    'administer dibs transactions' => array(
+      'title' => t('Administer dibs transactions'),
+      'description' => t('Administer dibs transactions.'),
+    ),
+  );
 }
 
+
 /**
  * Implementation of hook_theme().
  */
 function dibs_theme() {
   $themes = array();
   $themes['dibs_redirect_page'] = array(
-    'arguments' => array('form' => NULL, 'settings' => NULL, 'transaction' => NULL),
+    'variables' => array(
+        'form' => NULL,
+        'settings' => NULL,
+        'transaction' => NULL
+    ),
     'template' => 'dibs-redirect-page',
   );
   $themes['dibs_cancel_page'] = array(
-    'arguments' => array('form' => NULL, 'settings' => NULL, 'transaction' => NULL),
+    'variables' => array(
+      'form' => NULL,
+      'settings' => NULL,
+      'transaction' => NULL
+    ),
     'template' => 'dibs-cancel-page',
   );
   $themes['dibs_accept_page'] = array(
-    'arguments' => array('settings' => NULL, 'transaction' => NULL),
+    'variables' => array(
+      'settings' => NULL,
+      'transaction' => NULL
+    ),
     'template' => 'dibs-accept-page',
   );
   $themes['dibs_redirect_form'] = array(
-    'arguments' => array('element' => NULL),
+    'variables' => array('element' => NULL),
   );
   return $themes;
 }
@@ -232,12 +257,21 @@ function dibs_get_settings_value($module, $delta, $group, $key, $default_value =
  * @return multi
  */
 function dibs_get_next_order_id($module, $delta, $update_table = TRUE, $add_prefix_suffix = TRUE, $fallback = TRUE) {
-  db_lock_table('dibs_order_id_settings');
-  $settings = db_fetch_array(db_query("SELECT * FROM {dibs_order_id_settings} WHERE api_module = '%s' AND api_delta = '%s'", $module, $delta));
-  if (empty($settings) && $fallback) {
-    // Unlocking tables
-    db_unlock_tables();
+  $txn = db_transaction();
+
+  $result = db_query("
+    SELECT *
+    FROM {dibs_order_id_settings}
+    WHERE api_module = :module
+    AND api_delta = :delta",
+    array(
+      ':module' => $module,
+      ':delta' => $delta,
+    )
+  );
+  $settings = $result->fetchAssoc();
 
+  if (empty($settings) && $fallback) {
     // We try to get the data from the default setting instead
     return dibs_get_next_order_id(DIBS_DEFAULT_MODULE, DIBS_DEFAULT_DELTA, $update_table, $add_prefix_suffix, FALSE);
   }
@@ -246,19 +280,17 @@ function dibs_get_next_order_id($module, $delta, $update_table = TRUE, $add_pref
 
     // Updating value in table
     if ($update_table) {
-      db_query("UPDATE {dibs_order_id_settings} SET order_id = %d WHERE api_module = '%s' AND api_delta = '%s'", $next_order_id, $module, $delta);
+      db_update('dibs_order_id_settings')
+        ->fields(array('order_id' => $next_order_id))
+        ->condition('api_module', $module)
+        ->condition('api_delta', $delta)
+        ->execute();
     }
 
-    // Unlocking tables
-    db_unlock_tables();
-
     // Returns the found value
     return $add_prefix_suffix ? $settings['order_id_prefix'] . $next_order_id . $settings['order_id_suffix'] : $next_order_id;
   }
   else {
-    // Unlocking tables
-    db_unlock_tables();
-
     return NULL;
   }
 }
@@ -273,7 +305,7 @@ function dibs_get_next_order_id($module, $delta, $update_table = TRUE, $add_pref
  */
 function dibs_load_settings($module, $delta, $fallback = TRUE) {
   $settings = (array) variable_get('dibs_settings_' . $module . '_' . $delta, array());
-  
+
   // Merge in default settings.
   if ($fallback && ($module != DIBS_DEFAULT_MODULE || $delta != DIBS_DEFAULT_DELTA)) {
     $default_settings = variable_get('dibs_settings_' . DIBS_DEFAULT_MODULE . '_' . DIBS_DEFAULT_DELTA, array());
@@ -299,7 +331,17 @@ function dibs_load_settings($module, $delta, $fallback = TRUE) {
     $return = $settings;
 
     // Loading order id settings
-    $orderid = db_fetch_array(db_query("SELECT * FROM {dibs_order_id_settings} WHERE api_module = '%s' AND api_delta = '%s'", $module, $delta));
+    $result = db_query("
+      SELECT *
+      FROM {dibs_order_id_settings}
+      WHERE api_module = :module
+      AND api_delta = :delta",
+      array(
+        ':module' => $module,
+        ':delta' => $delta,
+      )
+    );
+    $orderid = $result->fetchAssoc();
 
     // Mergning arrays and returns them
     return array_merge($return, array('orderid' => $orderid));
@@ -320,15 +362,25 @@ function dibs_load_settings($module, $delta, $fallback = TRUE) {
  */
 function dibs_load_transaction($key = NULL, $op = 'tid') {
   if ($op == 'tid' && is_numeric($key)) {
-    $result = db_query('SELECT * FROM {dibs_transactions} WHERE tid = %d', $key);
+    $result = db_query('
+      SELECT *
+      FROM {dibs_transactions}
+      WHERE tid = :tid',
+      array(':tid' => $key)
+    );
   }
   elseif ($op == 'hash' && !empty($key)) {
-    $result = db_query("SELECT * FROM {dibs_transactions} WHERE api_hash = '%s'", $key);
+    $result = db_query('
+      SELECT *
+      FROM {dibs_transactions}
+      WHERE api_hash = :api_hash',
+      array(':api_hash' => $key)
+    );
   }
   else {
     return FALSE;
   }
-  if ($transaction = db_fetch_array($result)) {
+  if ($transaction = $result->fetchAssoc()) {
     $transaction['order_info_long'] = unserialize($transaction['order_info_long']);
     $transaction['order_price_info'] = unserialize($transaction['order_price_info']);
     $transaction['params'] = !empty($transaction['params']) ? unserialize($transaction['params']) : array();
@@ -348,7 +400,7 @@ function dibs_load_transaction($key = NULL, $op = 'tid') {
  * @param bool $redirect
  * - If set to FALSE will the function not automatically
  *   redirect the user to the DIBS form.
- * 
+ *
  * @return
  * - If $redirect is set to FALSE, will the api_hash value
  *   be returned.
@@ -379,7 +431,10 @@ function dibs_payment_prepare($data, $redirect = TRUE) {
   if (!empty($hash) && is_string($hash)) {
     // We are forcing the system to use a new transaction id for every load of this page,
     // therefore are we deleting the old transaction record
-    db_query("DELETE FROM {dibs_transactions} WHERE payment_status < 1 AND api_hash = '%s'", $hash);
+    $num_deleted = db_delete('dibs_transactions')
+      ->condition('payment_status', 1, '<')
+      ->condition('api_hash', $hash)
+      ->execute();
     $hash = NULL;
   }
 
@@ -405,11 +460,11 @@ function dibs_payment_prepare($data, $redirect = TRUE) {
   );
 
   // Generating order id
-  $order_id = is_numeric($data['payment_order_id']) ? $data['payment_order_id'] : dibs_get_next_order_id($data['api_module'], $data['api_delta']);
+  $order_id = (isset($data['payment_order_id']) && is_numeric($data['payment_order_id'])) ? $data['payment_order_id'] : dibs_get_next_order_id($data['api_module'], $data['api_delta']);
 
   // Creating new api_hash
   $hash = sha1(time() . $order_id . drupal_get_private_key());
-  
+
   // Creating dibs transaction
   $transaction = array(
     'api_module' => $data['api_module'],
@@ -424,6 +479,7 @@ function dibs_payment_prepare($data, $redirect = TRUE) {
     'payment_currency' => $settings['general']['currency'],
     'payment_price' => $data['payment_price'],
     'payment_transaction_type' => $data['payment_transaction_type'],
+    'payment_transaction_id' => NULL,
     'customer_uid' => $data['customer_uid'],
     'customer_name' => $data['customer_name'],
     'customer_address' => $data['customer_address'],
@@ -436,7 +492,7 @@ function dibs_payment_prepare($data, $redirect = TRUE) {
     'params' => serialize($data['params']),
   );
   drupal_write_record('dibs_transactions', $transaction);
-  
+
   // Saving new api_hash in session
   $_SESSION['dibs'][$data['api_module']][$data['api_delta']]['hash'] = $hash;
 
@@ -445,7 +501,7 @@ function dibs_payment_prepare($data, $redirect = TRUE) {
     drupal_goto('payment/dibs/redirect/'.$hash);
     exit;
   }
-  
+
   return $hash;
 }
 
@@ -480,7 +536,7 @@ function dibs_create_order_line_fields($data) {
       $form['ordlinesy'] = array(
         '#type' => 'hidden',
         '#value' => $j-1,
-      );            
+      );
     }
   }
   return $form;
@@ -498,10 +554,10 @@ function dibs_create_price_line_fields($data) {
   $form = array();
   if (is_array($data)) {
     $i = 1;
-    $keys = array(); 
+    $keys = array();
     foreach ($data as $key => $value) {
       $field = 'priceinfo' . $i . '.' . drupal_ucfirst($key);
-      $keys[] = $field;      
+      $keys[] = $field;
       $form[$field] = array(
         '#type' => 'hidden',
         '#value' => $value
diff --git a/dibs_example/dibs_example.info b/dibs_example/dibs_example.info
index a8bd749..ed73124 100644
--- a/dibs_example/dibs_example.info
+++ b/dibs_example/dibs_example.info
@@ -1,4 +1,6 @@
 name = DIBS example
 description = An example implementation of the DIBS API
-core = 6.x
+core = 7.x
 dependencies[] = dibs
+project = "dibs"
+version = "7.x-1.x-dev"
-- 
1.7.1

