Page 1 of 1

Debtor parent debtor name

PostPosted: Thu Jul 07, 2022 5:07 pm
by DannyC
I have some code that just pops up a message to display who the parent debtor is.
Code: Select all
   private void SalesOrderDebtorPopup(object sender, System.EventArgs e)
   {
      JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder salesOrder  = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
      JiwaFinancials.Jiwa.JiwaDebtors.Debtor debtor = salesOrder.Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaDebtors.Debtor>(null);
      debtor.Read(salesOrder.Debtor.DebtorID);
      
      if (salesOrder.Debtor.DebtorID != debtor.ParentDebtor.DebtorID)
      {
         MessageBox.Show("Parent debtor is " + debtor.ParentDebtor.AccountNo + " - " + debtor.ParentDebtor.Name + ".");
      }
   }


Thing is, this is what is displayed- note that the debtor.ParentDebtor.AccountNo is not displayed and the name has a " - False" at the end of it. Is this a bug?
v 7.2.1 latest SR.
Parent msg.png
Parent msg.png (2.22 KiB) Viewed 301 times


EDIT:
So I tried just displaying each field independently, i.e.
Code: Select all
MessageBox.Show(debtor.ParentDebtor.AccountNo);
MessageBox.Show(debtor.ParentDebtor.Name);


Turns out that AccountNo is displaying name. And Name is displaying the string "False".

Re: Debtor parent debtor name  Topic is solved

PostPosted: Thu Jul 07, 2022 5:38 pm
by Mike.Sheen
'tis a bug.

Logged as DEV-9396.

You could likely work around this by doing this after the debtor.Read:

Code: Select all
debtor.ParentDebtor.ReadRecord(ParentDebtor.DebtorID)