Thanks for this module. It would be really great if this module had a views integration, so one can list invoices by author (user) and use the views as reports - sales per user, per customer etc?

CommentFileSizeAuthor
#5 views-integration-937800-5.patch27.99 KBsamhassell

Comments

odisei’s picture

anyone?

bloyo’s picture

It would be nice .. for sure. But this probably regurest totaly diferent approch .. cck and stuff

polmaresma’s picture

Views integration will allow us to do calculations, filters... it's a must (IMO).

Thank's for the great work!

samhassell’s picture

Assigned: Unassigned » samhassell
Category: feature » task

Hey guys,

I'm working on a patch for this, I'll make it available in a couple of days.

Everything available on the invoice form and on the /invoices list page will be exposed to views.

The patch probably won't expose line items to views at this point. Though I think it could be done.

Cheers,
Sam.

samhassell’s picture

StatusFileSize
new27.99 KB

Here's a patch that adds basic views integration to the invoice module.

My first patch with Git so let me know if there are any issues :)

pietervogelaar’s picture

Hi Sam,

Thanks for your contribution! Against which version is it patched? Invoice 6.x-1.1?

Greetings,
Pieter

samhassell’s picture

Hi Pieter,

It's against HEAD/master i guess, I checked it out from git without supplying a version number.

I originally did it against 6.x-1.1 but I converted it to git master and changed the _invoice_round_and_format_money() calls to _invoice_round().

Does that help?

pietervogelaar’s picture

Yes, that will help.

Thanks!

ballboy’s picture

asb’s picture

Status: Active » Needs work

Hi,

the patch applies cleanly against 6.x-1.1:

patch < views-integration-937800-5.patch 
patching file invoice_handler_field_invoice_delete.inc
patching file invoice_handler_field_invoice_edit.inc
patching file invoice_handler_field_invoice_number.inc
patching file invoice_handler_field_invoice_paid_toggle.inc
patching file invoice_handler_field_invoice_pay_status.inc
patching file invoice_handler_field_invoice_total.inc
patching file invoice_handler_filter_invoice_company_name.inc
patching file invoice.views.inc
patching file invoice.module
Hunk #1 succeeded at 815 (offset 14 lines).
Hunk #2 succeeded at 974 (offset 18 lines).
patching file invoice_handler_field_invoice_total.inc

It exposes a number of fields to Views; some of them work, others don't (e.g. Error: handler for invoice_invoices > vattotal doesn't exist!). With some fields, I'm getting errors like this:

user warning: Unknown column 'invoice_customers.last_name' in 'field list' query: SELECT node.nid AS nid, invoice_invoices.iid AS invoice_invoices_iid, invoice_customers.vat_number AS invoice_customers_vat_number, invoice_customers.last_name AS invoice_customers_last_name, invoice_invoices.pay_limit AS invoice_invoices_pay_limit FROM node node INNER JOIN invoice_invoices invoice_invoices ON node.nid = invoice_invoices.nid INNER JOIN invoice_customers invoice_customers ON invoice_invoices.iid = invoice_customers.invoice_id LIMIT 0, 10 in /var/www/drupal/sites/all/modules/views/includes/view.inc on line 771.

But it's a start - thanks!

pietervogelaar’s picture

Status: Needs work » Closed (won't fix)

Drupal 6 invoice module will get maintenance fixes only.

Pieter