How Can jBilling Help You?
Who’s Using jBilling?

“We have been using jBilling for years with great results.”
Maurizio Degioanni
Bitmovers SRL
See all testimonials >

DONE - Logo upload

Current functionality:
The PDF version of an invoice picks up the logo from a file in the 'resources/logos' directory (see the property 'base_dir' of the file jbilling.properties), called 'entity-X.jpg' where X is the number of the company. The only way to change or create this file is through the operating system.

Desired functionality:
Allow to change this file from the web-based user interface. Add a sub-menu to 'Invoices' named 'Logo'.The logo page shows the current logo and allows to upload a new one. This applies only to the root user profile.

Technical overview:
To learn how the menu system works, and add a new menu option, read the menu section of the document 'more details: client tier'.
The rest is pretty straight forward, the 'logo' page shows the current logo and has one field to put the name of a file from the local directory to be uploaded to the web server. Take a look to jakarta commons file upload. We most probably want to use this library instead of doing everything from scratch, but I'm not sure about this, it requires some analysis of the pros/cons of using it.
We also need to validate that the file to be uploaded is not bigger than a reasonable size. How big can a logo be? You'll have to come up with a reasonable number.

Client tier modifications:
You need to add the new menu, as mentioned above, plus the new screen that allows the file upload. A new screen also means a new tile (tiles-defs.xml). This is a very simple screen that just shows the current logo for the entity (company) that the logged user belongs to, and has a form with just one field for the file name and a 'upload' button. The new tile doesn't have many 'sections': it only extends 'main' and uses directly a jsp page for the 'body' section.
To summarize, there is a new tile and a new jsp page that is going to be the body of the new tile and where you'll put the content of the new page.

Server tier modifications:
The server tier do not have to be modified for this feature. You do have to handle the request in an new struts Action class, but that is still logically the client tier because it is served by the web server (tomcat). The new Action will do the validation (correct file type, file name length, file size...) and the n the file uploading itself.

Database tier modifications:
You need to insert the rows to add the menu option and its permissions.

Changes mostly to be done in these files:
init.sql (for the menu option)
a new jsp page.
tiles-defs.xml (to show the new page)
a new class file (struts Action) to handle the request and file uploading
strust-config.xml (to configure the new Action)

--------
This feature is completed under SVN revision 97.

 
Lucas wrote 5 years 6 days ago

I'd like to help

Hi Emiliano,

I'd like to help with this. I've been eyeing this TODO for some weeks. I have quite limited experience with Struts, but have done some JSP/servlet stuff at uni last year and happened to use Jakarta Commons FileUpload.

FileUpload's use with Struts appears rather straight forward: http://wiki.apache.org/struts/StrutsFileUpload

When you say, "validate that the file to be uploaded is not bigger than a reasonable size", do you mean just the file size, or the dimensions of the image also?

Thanks for the opportunity to help with this project. I've found the developer documentation to be very informative. As a third year Comp Sci student, it's great to be able to get some experience in real life projects.

Lucas

econde wrote 5 years 5 days ago

Hi Lucas and welcome,

Hi Lucas and welcome,

Sure, you can give this to-do list a try. The validation I'm mentioning is only for the file size (total KB). The actual dimensions in pixels we leave unvalidated. The reason for this is that the file size could be a security issue: upload something really big and deprive the system from disk space.

Cheers,

Emiliano Conde
Lead Developer - jbilling
Find answers and help jbilling: buy docs

Emiliano Conde
Lead Developer - jBilling

 
Lucas wrote 5 years 5 days ago

Thanks Emiliano,

Thanks Emiliano,

Would 250KB be a reasonable maximum file size?

I've almost finished this to-do. Is it possible to scan and email the Individual Contributor License Agreement, as it's faster/cheaper than posting or faxing (I'm in Australia)?

Lucas

econde wrote 5 years 3 days ago

Hi Luca,

Hi Luca,

Yes to both. 250 is reasonable and emailing a scanned image is fine.

Cheers,

Emiliano Conde
Lead Developer - jbilling
Find answers and help jbilling: buy docs

Emiliano Conde
Lead Developer - jBilling

 
Lucas wrote 5 years 2 days ago

Sent files

Hi Emiliano,

I've emailed the files I've changed/added to the developer list. Should I also send the Individual Contributor License Agreement to the list, or do you have another email address you would prefer for this?

Thanks,
Lucas

Please register or login to post a comment.