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

“jBilling has the features and design needed to address the telecom industry.”
Gavin Sweet
theNetStart Platform Ltd
See all testimonials >

DONE - Payment deletion

Current functionality:
Once you enter a payment, you can not delete it.

Desired functionality:
Show a link on the left side: “Delete” (just like the invoice page), for those payment that are NOT linked to any invoice. This functionality is only for root or clerk user profiles, not for customers.
A confirmation page should be displayed .

Technical overview:
This is a simple change, although it goes through the three tiers, so it is a great learning issue to take on. You can take the invoice deletion as an example on how to display the 'Delete' link on the left and how to manage a confirmation step. This link should be shown only for those users that have the permissions to do it. You can use the current permission for editing payments.

Client tier modifications:
You'll need to modify /view/payment/viewLeftBar.jsp to add the 'delete' link. Note how the request parameters are being used to let know the view page that this is a confirmation of a deletion. As an example, the page /view/invoice/viewBody.jsp picks up the parameter with the use of this line .

Server tier modifications:
We need PaymentSessionBean.delete(id) and PaymentBL.delete(id). The first one interacts with the client tier and calls the second one, which deals with the database tier. There is not much code to write here, just find the payment entity bean and mark is as deleted.

Database tier modifications:
The calls does not delete the actual database row, just 'soft deletes' the row by updating the payment.deleted = 1. Since the setter of this field in the entity bean is not exposed, you need to add the xdoclet tag to it:
/**
* @ejb:interface-method view-type="local"
*/

Changes mostly to be done in these files:
New file for the client tier: viewLeftBar.jsp.
/descriptions/web/tiles-defs.xml
/view/payment/viewBody.jsp
PaymentSessionBean.java
PaymentBL.java
PermissionConstants.java
PaymentEntityBean.java
init.sql (for the new permission)

This feature was completed as revision 37

 
bhowe wrote 5 years 33 weeks ago

Payment Deletion Summary

This is just a summary of the changes and some comments.

view/payment

1. Added view.jsp as part of the confirmation step

2. viewLeft.jsp - Added delete link used the PAYMENT_MODIFY permission.

3. viewBody - Handled the confirmation step

Descriptors

1. tiles-def - added payment.view

2. application resources - Added new delete messages for the
confirmation step

3. struts-config - added payment_deleted forward

Classes

1. client/util/genericmaintainaction - processed the delete request.

2. entity/paymentEntityBean - added local interface to setdeleted()

3. server/paymentSesionBean - added deletepaynemnt method

4. server/PaymentBl - added deletepayment method

Feel free to be brutal. Some of these concepts were new to me.

econde wrote 5 years 33 weeks ago

Blake, the code is

Blake, the code is committed. I've mode a few changes:
- I removed the new tile, I could just reuse an existing one and move the confirmation code from the body to the header of the payment's jsps.
- The logic in the viewLeftBar.jsp needed to be changed so the 'Edit' options keeps working the same way it was.
- Minor things related to working with the latest version (struts_config.xml) and coding standrads.

Good job Blake, this one is a useful feature.
Cheers,

Emiliano Conde
Lead Developer - jbilling

Emiliano Conde
Lead Developer - jBilling

 
bhowe wrote 5 years 33 weeks ago

Thanks

Thanks emil. Ill pay closer attention to coding standands on the next one.

Blake

 
bhowe wrote 5 years 34 weeks ago

Task Update

Im finished with this task. Going to review what Ive done and do some more testing. After that Ill submit it and get everyones comments.

I took a slightly different approach I think and used the delete in the generic maintain action.

Blake

 
bhowe wrote 5 years 35 weeks ago

Task Update

Just posting a quick update. Have the delete link and the confirmation step working. Should finish this one this week.

Blake

econde wrote 5 years 35 weeks ago

Thanks for the update

Thanks for the update Blake.
Cheers,

Emiliano Conde
Lead Developer - jbilling

Emiliano Conde
Lead Developer - jBilling

 
bhowe wrote 5 years 36 weeks ago

Task

Ill take this one if hayward isnt on it anymore. I see it is "available". Will wait a few days before I get started on it to make sure. Seems like a pretty straight forward task to get a intro to struts and tiles :-)

Blake

econde wrote 5 years 36 weeks ago

It´s all yours Blake. This

It´s all yours Blake. This item is now a little bit easier than it was originally, after I added a related feature (payment edition). It helped because it added the left menu bar for the payments page, so you know just need to add another option (delete) to it, intead of creating a new one.
The payment edition I'm talking about are revisions 18 & 19:
http://svn.sourceforge.net/viewcvs.cgi/jbilling?rev=18&view=rev
http://svn.sourceforge.net/viewcvs.cgi/jbilling?rev=19&view=rev

As usual, feel free to ask!

Emiliano Conde
Lead Developer - jbilling

Emiliano Conde
Lead Developer - jBilling

 
hayward wrote 5 years 42 weeks ago

Silly question

I was wondering how I find invoice.view and payment.enter.review. I've been out of the programming loop for a while and this is new to me.

Thanks,
Hayward

econde wrote 5 years 42 weeks ago

The only silly question is

The only silly question is the one not asked. :)
'invoice.view' refers to a tile definition that you can find in the file /descriptions/web/tiles-defs.xml or in the repository :
http://svn.sourceforge.net/viewcvs.cgi/jbilling/trunk/descriptors/web/tiles-defs.xml?view=markup

This kind of configuration file is best edited with a struts editor, for example struts console: http://www.jamesholmes.com/struts/console/

To learn more about struts tiles: http://struts.apache.org/struts-tiles/index.html

Emiliano Conde
Lead Developer - jbilling

Emiliano Conde
Lead Developer - jBilling

 
yangsun wrote 5 years 42 weeks ago

Another good tiles article

Hi,

In addition to Emil's suggestion, I think this article (http://www.onjava.com/pub/a/onjava/excerpt/progjakstruts_14/index1.html) will be some help for you. It gives you a overview on how to use tiles with struts.

Regards

Please register or login to post a comment.