Index: uc_turkish_banks.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_turkish_banks/uc_turkish_banks.module,v retrieving revision 1.6 diff -u -r1.6 uc_turkish_banks.module --- uc_turkish_banks.module 22 Jun 2008 20:39:58 -0000 1.6 +++ uc_turkish_banks.module 22 Jun 2008 21:01:46 -0000 @@ -3,13 +3,17 @@ /** * @file - * A module used for Bank payment gateway . + * A module used for Bank payment gateway. * - * A module used to process payments using Banks in Turkey. Currently uses the EST e-secure payment service. This module currently supports instalments and as a paymant method uses 3D Secure OOS PAY. + * A module used to process payments using Banks in Turkey. Currently uses the + * EST e-secure payment service. This module currently supports instalments and + * as a paymant method uses 3D Secure OOS PAY. * - * Türk Bankaları için ödeme eklentisidir. EST Güvenli e-ödeme servisi kullanmaktadır. Taksitli satışı desteklemektedir. Satış yöntemi olarak 3D Secure OOS PAY metodunu kullanmaktadır. + * Türk Bankaları için ödeme eklentisidir. EST Güvenli e-ödeme servisi + * kullanmaktadır. Taksitli satışı desteklemektedir. Satış yöntemi olarak + * 3D Secure OOS PAY metodunu kullanmaktadır. * - * Support the following banks / Asagidaki bankalar desteklenmektedir. + * Supports the following banks / Asagidaki bankalar desteklenmektedir. * * 1. İş Bankası * 2. Akbank @@ -116,12 +120,15 @@ return $items; } +/** + * Implementation of hook_perm(). + */ function uc_turkish_banks_perm() { - return array('1' => 'view banks', '1' => 'manage banks'); + return array('view banks', 'manage banks'); } function uc_turkish_banks_instalments_display() { - $cid=arg(5); + $cid = arg(5); $result = db_query("SELECT cid, instalment, instalment_ratio, valid_until FROM {uc_turkish_banks_instalments} where cid = %d ORDER BY instalment", $cid); $rows = array(); while ($row = db_fetch_object($result)) { @@ -132,16 +139,17 @@ $value = '$'. $row->value; } $rows[] = array( - $row->cid, - $row->instalment, - $row->instalment_ratio, - format_date($row->valid_until, 'custom', 'd/m/Y'), - l(t('delete'), "admin/store/settings/banks/instalments/$row->cid/$row->instalment/delete")); + $row->cid, + $row->instalment, + $row->instalment_ratio, + format_date($row->valid_until, 'custom', 'd/m/Y'), + l(t('delete'), "admin/store/settings/banks/instalments/$row->cid/$row->instalment/delete") + ); } $header = array(array('data' => 'Instalment', 'width' => '10'), 'Ratio', 'Valid Until', 'Ops'); $output .= theme('table', $header, $rows, array('width' => '100%')); - if ($output == null) { + if ($output == NULL) { $output = "
There are currently no instalments in the system.
"; } $output .= l(t('Add a new instalment'), "admin/store/settings/banks/instalments/add/$cid"); @@ -215,9 +223,9 @@ */ function uc_turkish_banks_instalments_add_form_submit($form_id, $form) { $valid_until = mktime(23, 59, 59, - $form['valid_until']['month'], - $form['valid_until']['day'], - $form['valid_until']['year'] + $form['valid_until']['month'], + $form['valid_until']['day'], + $form['valid_until']['year'] ); $result = db_query("INSERT INTO {uc_turkish_banks_instalments} (cid, instalment, instalment_ratio, valid_until) VALUES (%d, %d, %f, %d)", $form['cid'], $form['instalment'], $form['instalment_ratio'], $valid_until); @@ -238,11 +246,11 @@ $form['cid'] = array('#type' => 'value', '#value' => $cid); $form['instalment'] = array('#type' => 'value', '#value' => $instalment); return confirm_form($form, - t('Confirm Deletion of instalment %instalment', array('%instalment' => $instalment)), + t('Confirm Deletion of instalment %instalment', array('%instalment' => $instalment)), 'admin/store/settings/banks/instalments/'. $cid, - t('Are you sure?'), - t('Delete'), - t('Cancel') + t('Are you sure?'), + t('Delete'), + t('Cancel') ); } @@ -364,7 +372,7 @@ '#options' => array( 'Auth' => t('Auth'), 'PreAuth' => t('PreAuth'), - ), + ), '#weight' => 1, '#required' => true, ); @@ -412,17 +420,16 @@ */ function uc_turkish_banks_add_form_submit($form_id, $form) { $valid_until = mktime(23, 59, 59, - $form['valid_until']['month'], - $form['valid_until']['day'], - $form['valid_until']['year'] + $form['valid_until']['month'], + $form['valid_until']['day'], + $form['valid_until']['year'] ); if (!isset($form['cid'])) { - - if (db_query("INSERT INTO {uc_turkish_banks} (bankname,clientid,username,password,bankurl,storekey,processtype,cardname,valid_until) - VALUES ('%s','%s','%s','%s','%s','%s','%s','%s', '%d')", - $form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until - )) { + if (db_query("INSERT INTO {uc_turkish_banks} (bankname, clientid, username, password, bankurl, storekey, processtype, cardname, valid_until) + VALUES ('%s','%s','%s','%s','%s','%s','%s','%s', '%d')", + $form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until)) + { $message = "New bank {$form['name']} added succesfully"; } else { @@ -431,8 +438,9 @@ } else { // Otherwise we try to update the coupon with matching coupon id - if (db_query("UPDATE {uc_turkish_banks} SET bankname = '%s', clientid = '%s',username = '%s',password = '%s',bankurl = '%s',storekey = '%s',processtype = '%s',cardname = '%s',valid_until = %d WHERE cid = %d", - $form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until, $form['cid'])) { + if (db_query("UPDATE {uc_turkish_banks} SET bankname = '%s', clientid = '%s', username = '%s', password = '%s', bankurl = '%s', storekey = '%s', processtype = '%s', cardname = '%s', valid_until = %d WHERE cid = %d", + $form['bankname'], $form['clientid'], $form['username'], $form['password'], $form['bankurl'], $form['storekey'], $form['processtype'], $form['cardname'], $valid_until, $form['cid'])) + { $message = "Bank updated succssfully"; } else { @@ -461,11 +469,11 @@ function uc_turkish_banks_delete_confirm($cid) { $form['cid'] = array('#type' => 'value', '#value' => $cid); return confirm_form($form, - t('Confirm Deletion of Bank %cid', array('%cid' => $cid)), + t('Confirm Deletion of Bank %cid', array('%cid' => $cid)), 'admin/store/settings/banks', - t('Are you sure ?'), - t('Delete'), - t('Cancel') + t('Are you sure ?'), + t('Delete'), + t('Cancel') ); } @@ -489,7 +497,7 @@ case 'save': list($bank_temp, $amount_temp, $bank_cid, $taksit)=explode('|', $_SESSION['taksit']); //print "TEST:".$_SESSION['bank_cid'].' '. $bank.' '.$amount ; - db_query("UPDATE {uc_order_line_items} SET title = '%s', amount = %f, weight = 0 WHERE order_id = %d AND type ='instalment'", $bank_temp, $amount_temp, $arg1->order_id); + db_query("UPDATE {uc_order_line_items} SET title = '%s', amount = %f, weight = 0 WHERE order_id = %d AND type = 'instalment'", $bank_temp, $amount_temp, $arg1->order_id); if (db_affected_rows() == 0) { db_query("INSERT INTO {uc_order_line_items} (order_id, type, title, amount, weight) VALUES (%d, 'instalment', '%s', %f, 0)", $arg1->order_id, $bank_temp, $amount_temp); } @@ -609,25 +617,25 @@ $result = db_query("SELECT * FROM {uc_turkish_banks} where valid_until > CURDATE() ORDER BY bankname"); if (db_affected_rows() > 0) { $options = array(); - $select2='