Plugin error after upg from 7.0.78 to 7.0.97  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Plugin error after upg from 7.0.78 to 7.0.97

Postby DannyC » Tue Dec 02, 2014 6:15 pm

Hi,

I wrote a plugin which was working fine in 7.00.78 but is now giving this error when logging into same database after upgrade to 7.00.97. See image attached.

Thanks
Attachments
PlugInError.PNG
PlugInError.PNG (12.95 KiB) Viewed 2978 times
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Plugin error after upg from 7.0.78 to 7.0.97

Postby Scott.Pearce » Wed Dec 03, 2014 7:53 am

Check the line in your plugin that is making the call to "CreateBusinessLogic". It appears as though there has been a change to the parameters you must pass to that function.

I'm suspecting that we now require you pass a "client" object (IJiwaForm) when calling that function. In your case, you can probably just pass "nothing" instead of a client object and it will work fine.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Plugin error after upg from 7.0.78 to 7.0.97

Postby DannyC » Wed Dec 03, 2014 2:08 pm

Scott,
This is the section of code I have. What would I need to change?

Code: Select all
   Private Sub SalesOrderAddLine(item As JiwaSales.SalesOrder.SalesOrderLine)
      Dim inventory As JiwaInventory.Inventory = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaInventory.Inventory)
      inventory.Read(item.InventoryID)
      If inventory.Status = 4 Then
         'Check if any alternatives
         If inventory.AlternateChildren.Count = 0 Then
            messagebox.show(inventory.PartNo & " is obsolete and has no alternatives.")
         End If
      End If
   End Sub   
User avatar
DannyC
Senpai
Senpai
 
Posts: 635
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 29

Re: Plugin error after upg from 7.0.78 to 7.0.97  Topic is solved

Postby Scott.Pearce » Wed Dec 03, 2014 2:48 pm

Like I said, you need to pass a ClientForm object, or "nothing" to CreateBusinessLogic:

Code: Select all
Dim inventory As JiwaInventory.Inventory = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaInventory.Inventory)(Nothing)
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Plugin error after upg from 7.0.78 to 7.0.97

Postby Mike.Sheen » Wed Dec 03, 2014 6:22 pm

This is unrelated, but If I may, I'd like to give some advice regarding coding conventions - I see this line in your code:

Code: Select all
If inventory.Status = 4 Then


The Status property is an enumeration, and you should always use the enumeration constant rather than the literal - that way, if we ever change the meaning of Status 4, then your code would still work as expected.

So, I'd rather see:

Code: Select all
If inventory.Status = JiwaInventory.Inventory.InventoryStatuses.e_InventoryStatusObsolete Then


Mike
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron