This patch contain:
1. Small correction of syntax errors ensure module don't crashed.
2. I wrote support Views 3 for some fields of transaction and display list of payments with Views. Default view included. Look /admin/reports/payments - VERY useful for personal modifications without programming! Also functions for edit and delete transactions i think better placed in main module (instead pg_showtransactions).

Thanks for commit! Suggestions is welcome!

Comments

andypost’s picture

Status: Active » Needs work

Patch is awesome! but in future please split it to more granular issues to make it easy to review:
- views integration
- bug fixes
- menu reorganization

Also views support should be optional, by default 'pg_showtransactions' could be disabled to disalow data change so please file a separate issue

+++ b/includes/pgapi.forms.incundefined
@@ -0,0 +1,200 @@
+  // $form['service'] = array();
+  // $form['gateway'] = array();
...
+  // $form['#validate'][] = 'pgapi_payment_form_validate';
...
+  // payment->service = $form_state['values']['service'];
+  // payment->gateway = $form_state['values']['gateway'];
...
+  // $content = entity_view('payment', array($ppayment->txnid => $payment));

+++ b/includes/views/pgapi.views.incundefined
@@ -0,0 +1,162 @@
+  // $data['pgapi_transaction']['table']['entity type'] = 'pgapi_transaction';

+++ b/pg_showtransactions/pg_showtransactions.admin.incundefined
@@ -111,11 +111,20 @@ function pg_showtransactions_history() {
+//  $sql = 'SELECT t.*, u.name FROM {pgapi_transaction} t LEFT JOIN {users} u ON u.uid = t.uid ' . $filters['join'] . ' ' . $filters['where'] . tablesort_sql($header);
+//  $result = pager_query($sql, variable_get('pg_showtransactions_default_num', 10), 0, NULL, $filters['args']);
...
+  //$query->limit(variable_get('pg_showtransactions_default_num', 10));
+  //$query->orderByHeader($header);

any reason to store unused code

+++ b/includes/pgapi.forms.incundefined
@@ -0,0 +1,200 @@
+  ¶

trailing whitespace

+++ b/includes/pgapi.forms.incundefined
@@ -0,0 +1,200 @@
\ No newline at end of file

+++ b/includes/pgapi_ui.payments.incundefined
@@ -0,0 +1,46 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_payment_status.incundefined
@@ -0,0 +1,16 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_transaction.incundefined
@@ -0,0 +1,61 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_transaction_link.incundefined
@@ -0,0 +1,42 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_transaction_link_delete.incundefined
@@ -0,0 +1,22 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_transaction_link_edit.incundefined
@@ -0,0 +1,22 @@
\ No newline at end of file

+++ b/includes/views/handlers/pgapi_handler_field_transaction_operations.incundefined
@@ -0,0 +1,54 @@
\ No newline at end of file

+++ b/includes/views/pgapi.views.incundefined
@@ -0,0 +1,162 @@
\ No newline at end of file

+++ b/includes/views/pgapi.views_default.incundefined
@@ -0,0 +1,193 @@
\ No newline at end of file

+++ b/pg_showtransactions/pg_showtransactions.admin.incundefined
@@ -550,9 +555,5 @@ function pg_showtransactions_personal_history_filters() {
\ No newline at end of file

+++ b/pgapi.admin.cssundefined
@@ -0,0 +1,14 @@
\ No newline at end of file

+++ b/pgapi.infoundefined
@@ -2,3 +2,11 @@ name = Payment Gateway API
\ No newline at end of file

Add crfl at the end of the file

+++ b/pg_showtransactions/pg_showtransactions.admin.incundefined
@@ -111,11 +111,20 @@ function pg_showtransactions_history() {
+  $query->extend('PagerDefault')->extend('TableSort');
+  $query->leftJoin('users', 'u', 't.uid = u.uid');
+  $query->fields('t');

use
$query
->extend
-> ....
->execute();
it's more readable

+++ b/pgapi.moduleundefined
@@ -357,14 +415,15 @@ function pgapi_transaction_load($txnid) {
+ * @return

should be blank line before @return

lancee’s picture

any reason to store unused code

I corrected pg_showtransaction only for avoid crash system when it enable.
And i not full implement that query and leave old query for those who need pg_showtransaction.

should be blank line before @return

The syntax of this module is a separate problem (not only me)! :)
Apply the following patch and next i fully dedicate to syntax.

lancee’s picture

I fixed only my syntax and did what I could for separate patches!
I can't divide patch more granular form because will be broken it integrity.

In the next patch I process module through coder and fix all syntax problems of whole module.
I promise!

andypost’s picture

2 and 3 is ok, but 1 needs some love

+++ b/pg_paypal/pg_paypal.module
@@ -16,14 +20,14 @@ function pg_paypal_menu() {
-    'type' => MENU_LOCAL_TASK,
+    'type' => MENU_CALLBACK,

+++ b/pg_webmoney/pg_webmoney.module
@@ -86,7 +86,7 @@ function pg_webmoney_menu() {
-    'type' => MENU_LOCAL_TASK,
+    'type' => MENU_CALLBACK,

Why?

+++ b/pg_showtransactions/pg_showtransactions.admin.inc
@@ -111,11 +111,20 @@ function pg_showtransactions_history() {
+//  $sql = 'SELECT t.*, u.name FROM {pgapi_transaction} t LEFT JOIN {users} u ON u.uid = t.uid ' . $filters['join'] . ' ' . $filters['where'] . tablesort_sql($header);
+//  $result = pager_query($sql, variable_get('pg_showtransactions_default_num', 10), 0, NULL, $filters['args']);

should be removed

+++ b/pg_showtransactions/pg_showtransactions.admin.inc
@@ -111,11 +111,20 @@ function pg_showtransactions_history() {
+        ->extend('TableSort')
+        ->leftJoin('users', 'u', 't.uid = u.uid')
+        ->fields('t')
+        ->fields('u', array('name'))
+        ->execute();

there's a should be a 2 spaces like all over in core

+++ b/pg_showtransactions/pg_showtransactions.admin.inc
@@ -111,11 +111,20 @@ function pg_showtransactions_history() {
+  //$query->limit(variable_get('pg_showtransactions_default_num', 10));
+  //$query->orderByHeader($header);

Why this commented out?

lancee’s picture

Why?

Because in user interface gateways settings was placed in different places.

there's a should be a 2 spaces like all over in core

Don't understand. Like this?:

$query->extend('PagerDefault')
  ->extend('TableSort')
  ->leftJoin('users', 'u', 't.uid = u.uid')
  ->fields('t')
  ->fields('u', array('name'))
  ->execute();
should be removed

Why this commented out?

As I wrote above, I correct pg_showtransaction only for avoid crash system when it enable.
But I don't planing fully support pg_showtransaction, which can be replaced views integration...

In other issue I would suggest to replace pg_showtransaction to pgapi_ui with user interface functionality and Vews integration.
So do not want to touch pg_showtransactions. ;)

lancee’s picture

lancee’s picture

Status: Needs work » Closed (fixed)