|
|
|
|
|
|
|
|
$this->producerRepository = $this->loadService(ProducerRepository::class); |
|
|
$this->producerRepository = $this->loadService(ProducerRepository::class); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function getDolibarrProducerInvoices(Producer $producer): array |
|
|
|
|
|
|
|
|
public function getDolibarrProducerInvoices(Producer $producer) |
|
|
{ |
|
|
{ |
|
|
$invoicesArray = []; |
|
|
$invoicesArray = []; |
|
|
if($producer->dolibarr_socid) { |
|
|
if($producer->dolibarr_socid) { |
|
|
|
|
|
|
|
|
$unpaidInvoicesArray = []; |
|
|
$unpaidInvoicesArray = []; |
|
|
$invoicesArray = $this->getDolibarrProducerInvoices($producer); |
|
|
$invoicesArray = $this->getDolibarrProducerInvoices($producer); |
|
|
|
|
|
|
|
|
foreach($invoicesArray as $invoice) { |
|
|
|
|
|
if(isset($invoice['remaintopay']) && $invoice['remaintopay'] > 0) { |
|
|
|
|
|
$unpaidInvoicesArray[] = $invoice; |
|
|
|
|
|
|
|
|
if($invoicesArray) { |
|
|
|
|
|
foreach ($invoicesArray as $invoice) { |
|
|
|
|
|
if (isset($invoice['remaintopay']) && $invoice['remaintopay'] > 0) { |
|
|
|
|
|
$unpaidInvoicesArray[] = $invoice; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|