Hi, I just made a view and the "view link" for transactions appear not be working. I also discovered that the menu path for view a transaction throw a http error 500.

Comments

gdoteof’s picture

I am having this same problem.

The issue is that in pay's implementation of hook_menu it defines the call back like

    'pay/transaction/pay/%pay_transaction' => array(
      'title' => 'Transaction details',
      'page callback' => 'theme',
      'page arguments' => array('pay_transaction', 3),
      'access arguments' => array('administer payments for any form'),
    ),

and theme() expects an array.

gdoteof’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
StatusFileSize
new3.36 KB

This patch should solve this issue.

We add a helper function to convert the pay_transaction object into an array for theme.

We also manually load the pay_transaction in the preprocessor.

There is a small typo fix

And, $pay_transaction->balance() was causing a 500, and since I am not using balance at this point, I just commented the column out from the table display.

gdoteof’s picture

Status: Active » Needs review
quicksketch’s picture

Status: Needs review » Needs work

@gdoteof is right that the use of 'theme' directly in the menu callback needs to be changed. In D7, all theme functions need to be formatted as an array, so we can't just use hook_menu() directly to theme() like this any more.

+/**
+ * Helper function to convert a $pay_transaction to an array for theme()
+ * Callback for pay/transaction/%pay_transaction
+ */
+function pay_transaction_page($hook, $pay_transaction){
+  return theme($hook, (array)$pay_transaction);
+}

This patch gets the basics set up, but this call isn't quite right. The calls to theme() need to use named keys, such as theme('something', array('key' => $value)). This code is using an unnamed key, like theme('something', array(0 => $value)). This may also be why $activity->balance() is throwing a new 500 error, because $activity may not be getting the values it needs.

quicksketch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.54 KB

Here we are. This patch corrects the call to theme('pay_transaction') and additionally fixes a call to theme('links') that was causing a bunch of notices when viewing a pay transaction. You can now view a payment at the URL "pay/transaction/pay/x" without it throwing any errors or notices.

quicksketch’s picture

StatusFileSize
new3.29 KB

Oops, still didn't get the call to theme('links') quite right. And classes should always be an array in D7 (even though strings work some of the time).

quicksketch’s picture

StatusFileSize
new2.58 KB

Doh, and I included the JS fix *again*. I need to make a separate issue for that problem.