Closed infinity-webdesigns closed 6 years ago
@inifinity-webdesigns it means the $aDebtor
array is empty. It's possible that the $this->debtor->list([])
command returns no results. You might want replace line 29 with a section like:
$this->debtors = $this->debtor->list([])
if(empty($this->debtors)) {
throw new \Exception('No debtors returned by API');
}
to detect such an event, before you start processing the array. No such detection exists within the current implementation, as in many cases it's perfectly legit to have no results returned (like, in the case where there are in fact no Debtors)
@hyperized I do have debtors in my wefact administration. I had the same problem with invoices before but that got fixed once i loaded the invoices in the construct.
@inifinity-webdesigns I'm not sure how I can help you, I will need some more information about this issue to debug, such as the output of the $this->debtor->list([])
when this issue occurs. Can you provide me with that?
@hyperized That is going to be difficult as the error doesn't always occur. It looks like it only occurs when the CMS is idle for a while.
@inifinity-webdesigns It's going to be even more difficult for me to help you in this case.
I suggest you go ahead and log all the objects so when it does occur I can help you further.
@hyperized It's very difficult. sometimes it looks like the page is loading faster then the handling of the API call and therefor the array is empty.
@inifinity-webdesigns Ok, so: I understand it's difficult, but I cannot help you without further information. I'm no magician. The only thing you could try is to increase the timeout from 20 to 30 seconds to give Wefact a little more time to reply (it might be slow!). If that doesn't work, please don't reply unless you have additional information, because I will then continue to close this issue :).
@hyperized setting the timeout to 15 instead of 10 seems to have fixed the problem. Thnx!
Sometimes when i go to my page i get the message undefined index debtor. Once i refresh the page the error is gone..
I get the error for line 46. Can you tell me what i do wrong?