Here's a patch that adds views integration (with simple_payment as base table). The patch to add the 'payer_email' column (http://drupal.org/node/839952) was applied before writing this patch.

(Patch to follow in first comment.)

Comments

adamdicarlo’s picture

StatusFileSize
new6.07 KB

Here's the patch.

jbrown’s picture

Title: Patch: Add views integration » Add views integration
Status: Needs review » Needs work

Nice!

Can we have a patch that works with the current db schema?

It would be cool to have default views that add tabs to node and user pages.

seanberto’s picture

Yo, anything I can do to help this along? I'm about to roll out views integration for Simple Donations but my integrations are contingent on this patch. JBrown, it looks like you're about to approve JHedstrom's per email schema changes. We close here?

Thanks - and again, let me know what you all need on this.

-s

seanberto’s picture

Priority: Normal » Major

It looks like the Views integration does not account for the fact that Amount is stored as an integer that has been multiplied by 100 (ie, $1 is stored as 100 cents in the DB), as a result, the View's handler is off in this patch. You can obviously theme this issue away - but that doesn't work with certain display types, such as Views Bonus Export, which provides an excel dump of the data.

So, either the patch needs to be rerolled, or better yet, we should consider storing amount as a float...

adamdicarlo’s picture

StatusFileSize
new6.59 KB

I've rerolled this patch to work with the latest version of http://drupal.org/node/839952 (which changes payer_email to payer_reference, and adds payee_refererence).

I have not yet accounted for amounts being stored as cents in the database.

@seanberto, yes, I think the module should be refactored to store amounts as DECIMAL or NUMERIC fields. We'd need an upgrade script to convert the old values. Would you be up to doing that refactoring?

seanberto’s picture

@Adam, did you see the patch that I wrote to convert the amount to a decimal - #960616: Store amount as a decimal?

I've tested my decimal patch against your previous views integration patch and it "works" - though decimal places are not fixed. $1.50 displays as $1.5, etc.

seanberto’s picture

Oh, and my patch does update values in the DB. It will likely break any one-off views display customizations that have been written for other projects that try to correct for the current storage in SP. For example, not sure if this will break some displays for Donor Rally...

adamdicarlo’s picture

Status: Needs work » Needs review

@Sean, great, hadn't seen that.

@jbrown, some feedback?

jbrown’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Category: task » feature
Status: Needs review » Needs work

Can I get a re-roll?

Also, it should go in simple_payments.views.inc - http://drupalcontrib.org/api/function/hook_views_data/6

seanberto’s picture

Adam, do you want to take the first crack at this or me?

adamdicarlo’s picture

Sean, if you want to get to it before Thursday, go ahead... or I'll tackle it then.

adamdicarlo’s picture

StatusFileSize
new0 bytes

Here's a new patch rolled off the current version from git. This puts the hook_views_data() function simple_payments.views.inc.

adamdicarlo’s picture

StatusFileSize
new6.96 KB

Let's try that again....

jhedstrom’s picture

Status: Needs work » Needs review

Changing status.

adamdicarlo’s picture

@jbrown, have you had a chance to try out the latest patch?

adamdicarlo’s picture

Hmmm... might be time to get this module marked unmaintained/abandoned.

seanberto’s picture

Agreed. I'd love to see this module get cleaned up!