Custom Collection Items  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Custom Collection Items

Postby SBarnes » Wed Nov 11, 2020 8:07 am

I need to have a custom collection and custom collection item that will get displayed in Debtor Maintenance and updated when debtor saves, the additional table that is being added to hold this data will have foreign keys to debtor, inventory classification and an inventory category, I am aware of the following things:

1. Makes sure the table is setup with cascading deletes so the database will still allow Jiwa to delete debtors for example and clean up my table as well
2. The collection Item save should not start a transaction nor should it perform a commit or rollback, where a rollback is concerned or would normally occur throw an exception.
3. Check in the save start of the debtor that everything is valid in the collection for the save and then in the save end of the debtor save the collection
4. In the create, read and copy of the debtor take appropriate action for custom collection namely clear, read and clear respectively

Are there any other gotchas I should be aware of beside these to make it work?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Custom Collection Items  Topic is solved

Postby Mike.Sheen » Thu Dec 17, 2020 8:41 pm

SBarnes wrote:3. Check in the save start of the debtor that everything is valid in the collection for the save and then in the save end of the debtor save the collection


The SaveEnd event is too late - you want to perform your database operations in the SaveEnding.

It will work, but you're no longer riding the same transaction we created and used for our save operation - so if your SaveEnd handler throws an exception, it won't cause our save to rollback - and that's not what you want.

Everything else is spot-on, though!
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Custom Collection Items

Postby SBarnes » Fri Dec 18, 2020 8:00 am

ok I'll have a look at the save ending as I am currently using the the save end but have it all working at present but I get your point about being inside the same transaction will make sure its an all or nothing result.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175


Return to Technical and or Programming

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron