Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
We use check payments and track them in Ubercart, but would like a report or view that shows orders that have outstanding balances.
I'd like to create a view that includes the amount paid and/or the final balance on an order. This is tracked in the database, but is not available in the views interface. I'm thinking the solution is to add some code to hook_views_data to make that field (uc_payment_receipts.amount) visible to Views and joined to the main orders bundle.
Is there a better solution that I'm missing?
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#6 | 1490632-uc_payment-views.patch | 3.23 KB | longwave |
Comments
Comment #1
TR CreditAttribution: TR commentedComment #2
longwaveMarked #1426046: Accessing the payment transaction ID from a vew as duplicate
Comment #3
DanZ CreditAttribution: DanZ commentedSee also #1876496: Calculate additional Ordered Product fields for Views.
Should payment records be entities?
Comment #4
DanZ CreditAttribution: DanZ commentedYes, payment receipts should be entities. They should be fieldable to allow attachment of extra information by other modules, especially payment modules, instead of using the serialized "data" field. That would make those extra fields available in Views, once modules started using them.
The tricky part is converting the assorted code that interacts with payment receipts to use the entity interface without breaking anything.
The question is whether it's a good idea to expose the table to Views before converting it to an entity.
Comment #5
longwaveI don't think it's worth changing payment receipts to be entities now in 7.x - I don't see what benefit this gains us, and we cannot change the underlying data structure now without affecting existing contrib modules. In this issue I think we should just describe {uc_payment_receipts} to Views via a relationship to {uc_orders}, and make a note in the Drupal 8 issue that payment receipts should become entities in the future.
Comment #6
longwaveThis patch describes most of the payment receipt data to Views. Add a relationship to Order: Payments to see the fields.
Comment #7
longwaveCommitted #6.