Page 1 of 1

Plugin error after upg from 7.0.78 to 7.0.97

PostPosted: Tue Dec 02, 2014 6:15 pm
by DannyC
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

Re: Plugin error after upg from 7.0.78 to 7.0.97

PostPosted: Wed Dec 03, 2014 7:53 am
by Scott.Pearce
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.

Re: Plugin error after upg from 7.0.78 to 7.0.97

PostPosted: Wed Dec 03, 2014 2:08 pm
by DannyC
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   

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

PostPosted: Wed Dec 03, 2014 2:48 pm
by Scott.Pearce
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)

Re: Plugin error after upg from 7.0.78 to 7.0.97

PostPosted: Wed Dec 03, 2014 6:22 pm
by Mike.Sheen
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