This is a feature request to add a logo image and a customized title to the invoice module.

Find attached mockups to clarify. I would be happy to contribute testing.

Comments

francewhoa’s picture

StatusFileSize
new56.22 KB
new35.17 KB
new72.15 KB

The below mockup invoice-html-view.png shows the final expected result. The optional image logo is display at the top and the customized title under it. This would be the invoice HTML view at /storm/invoice/report/*/html/en
rel="nofollow">Only local images are allowed. width="100%">
The mockups before.png and after.png show the invoice configuration screen at /node/*/edit. Looking at below after.png notice the two new sections: Invoice image logo settings and Invoice title:. The Invoice image logo settings is heavily inspired from Drupal core theme settings screen at admin/build/themes/settings/garland. Maybe some of its code could be re-use. What do you thing?

rel="nofollow">Only local images are allowed. width="100%">

Both new features would be optional. So it matches everybody needs. If the ckeck box Use the logo is uncheck then no logo image would not display. Same for the field Invoice title, if empty then it would not display.

squ1rr3l’s picture

+1

francewhoa’s picture

In second thought maybe the invoice configuration screen (after.png) should go under /admin/settings/storm/invoice. For two reasons first this location seems more intuitive to find. I mean all invoice configurations would be on the same page. And second, once this configuration is done it would be done for all invoices. What do you think?

tchurch’s picture

+1

I'm looking for a general way of customising the html and pdf invoice layouts/fields and this sounds good.

juliangb’s picture

Definitely go for the admin settings instead of the node form.

Any volunteers to code it?

fxarte’s picture

One suggestion,
Why not instead using templates. That way it would allow to fully customize the output?

tchurch’s picture

I was thinking about templates too.

1) Convert the html and pdf invoices into standard templates files OR store the code for these pages in the DB.
2) Add admin fields for logo, name, address of company (or take it from the organisation records flagged as "myorg).

I'm going to play with this and see whether a template file or DB variable is better.

tchurch’s picture

OK. I've played with the code and extracted the code for creating the html invoice into a separate file and created a new variable (editable from the admin page) for the location.

I can do the same for the pdf too.

This then means that someone can create their own template file, in their own location in the website (not under the storm directory if required) and change the code.

If this is OK, I'll go ahead and continue.

We can then work on our own invoice templates without editing the main code.

juliangb’s picture

Hang on, i'm sure these are all passed through theme functions anyway?

That means, if you can already override them...

tchurch’s picture

I noticed that (from the names of the functions).
The thinng I'm not sure about is this:

If you create a function called (e.g.) garland_storminvoice_report_html in the theme, it's restricted to that theme only (I think; correct me if wrong).

I was thinking about separating the parts. That way people could develop templates and share them around easily.

I don't mind either way.
I do have a customer who wants be to re-design his invoice layout but I'm waiting on the direction of this issue before I decide how to do it.

juliangb’s picture

We should be able to use something like storminvoice-report-html.tpl.php too.

We might need to make a few changes, but it'd be better to do that way (the "drupal way") than use a setting to control which file to use.

tchurch’s picture

I like the idea although this is moving into an area I haven't really looked at yet (I'm willing to learn and help where I can).

If it was done this way, the current html and pdf templates could be moved into tpl.php files and overwritten by a copy (with the same name) in another directory higher in the Hierarchy.

That way we wouldn't need a variable.

Like you say, it might need a few changes. Like I say, I'm getting a bit out of my current zone of Drupal/Storm knowledge.

francewhoa’s picture

+1 for doing it the Drupal way with template file(s). Being able to override almost everything in Drupal is awesome.

I'm not a coder but would be happy to contribute patch testing. Any volunteer for a patch?

tchurch’s picture

Assigned: Unassigned » tchurch

I will try with this one. I have to make a customised invoice layout anyway and this would be of benefit.

francewhoa’s picture

Great. Thanks tchurch :)

mp’s picture

+1 invoice with template files which can be styled

JGonzalez’s picture

+1 for invoice templates that allow much more customization.

NOTE: Should we change title of request to "Customizable invoice templates" or something similar?

tchurch’s picture

Title: Add logo image and customized title to invoice » Customizable invoice templates

Title changed.

lastdeadmouse’s picture

Exactly what I want! +1

JGonzalez’s picture

This shouldn't be to difficult to do I wouldn't think.

An implementation of hook_theme would allow us to create a base .tpl file within the module, that can be easily overridden in the users theme folder, although we would need to pass the arguments, and also preprocess the vars first.

But don't quote me on this ;-)

hlan’s picture

+1 subscribing

Wolfke2800’s picture

Any updates on the customizable invoices? Looking forward to try it :)

tchurch’s picture

Currently there's no timescale at the moment for this feature. I've been working on other fixes and features and also have been on holiday.
Now I'm back I'll look over all my issues and update them.

NikaDevs’s picture

Category: feature » bug
Issue tags: +theme template preprocess storm

Are somebody has success with using
_preprocess_storm_report(&$variables) for overriding the variables?
I'm tried this way to change the $footer variable, but this PREPROCESS function didn't called!

juliangb’s picture

Category: bug » feature

This is a feature request.

Wolfke2800’s picture

Looking forward to this feature :)
Do you have an idea if/when this will be available?

tchurch’s picture

Sorry, I've been working on other things.
At the moment there's no real timescale for this one. I still need to look at the hook_theme function (mentioned in #20) as I'm not too familiar with this yet.

I will try.

tchurch’s picture

Just an update...
I might be getting somewhere. I think I've got the html invoice split.
I'll upload a 1st patch (html only) soon.

Now working on the PDF.

tchurch’s picture

Status: Active » Needs review
StatusFileSize
new7.43 KB
new1.82 KB

I've uploaded 2 files:
A patch and a new tpl file.
The tpl file goes into the storminvoice directory. If you want to overwrite it, you can copy it into your theme directory and change it (then flush cache).

This is not the final patch. I still have to remove old code and comments but I'll do that after people are happy with it.
I'm working on the PDF side now.

Can someone look at it and give feedback before I get too far?

Thanks.

juliangb’s picture

Looks like the right approach, but we need to separate the html in the template from php processing in a separate function. Really, the only php we want in the template is print(), although we may also need a couple of loops.

juliangb’s picture

Also, to make it easier for yourself, I suggest you commit a blank .tpl.php file to make it easier to diff it all at once.

tchurch’s picture

StatusFileSize
new11.47 KB

I'm not sure if this is what you were talking about in #30 but I've split the variable setting into the main file, leaving only the main variables for the page in the tpl file.

This isn't a final patch as I still need to sort out the PDF file template and also remove any old code (currently just commented out).

Comments?

juliangb’s picture

Yes almost, just perhaps the variable setting could be in a non-theme function (I realise this is different to how it is at the moment).

juliangb’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

Moving this to 2.x branch.

juliangb’s picture

#32: 735418_2.patch queued for re-testing.

JoshuaM’s picture

Can this be tested yet by non-programmers yet? The 2.x-dev has an empty tpl file that I'm not sure what to do with. I see where there are populated versions in this thread... This is my only hold-up from moving to this invoicing system.

Thanks for the wonderful work everyone :)

juliangb’s picture

#32: 735418_2.patch queued for re-testing.

juliangb’s picture

juliangb’s picture

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

Won't fix for this as an individual issue - but I intend to work on #1159022: Reimplement pdf invoices using Print module, which should enable this functionality.

Andrwryn’s picture