소스 검색

[Administration] Mes factures : label en rouge avec nombre de factures impayées

feature/souke
Guillaume Bourgeois 9 달 전
부모
커밋
7472ae8974
2개의 변경된 파일22개의 추가작업 그리고 0개의 파일을 삭제
  1. +9
    -0
      backend/views/layouts/left.php
  2. +13
    -0
      common/logic/Producer/Producer/Service/DolibarrProducerUtils.php

+ 9
- 0
backend/views/layouts/left.php 파일 보기

@@ -113,6 +113,14 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
$countUsersOnlineLabel .= '</span>';
}

$countProducerInvoicesUnpaidLabel = '';
$countProducerInvoicesUnpaid = $this->getProducerModule()->getDolibarrUtils()
->countDolibarrProducerInvoicesUnpaid($producer);
if($countProducerInvoicesUnpaid > 1) {
$countProducerInvoicesUnpaidLabelColor = ($countProducerInvoicesUnpaid > 2) ? 'red' : 'orange';
$countProducerInvoicesUnpaidLabel = '<span class="pull-right-container"><small class="label pull-right bg-'.$countProducerInvoicesUnpaidLabelColor.'">' . $countProducerInvoicesUnpaid . '</small></span>';
}

?>

<?= dmstr\widgets\Menu::widget(
@@ -200,6 +208,7 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
'url' => ['/producer-invoice/index'],
'visible' => $isUserCurrentGrantedAsProducer && Yii::$app->parameterBag->get('dolibarrApiKey'),
'active' => Yii::$app->controller->id == 'producer-invoice',
'template' => '<a href="{url}">{icon} {label}' . $countProducerInvoicesUnpaidLabel . '</a>'
],
['label' => 'Tarifs & modules', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $isUserCurrentGrantedAsProducer],
[

+ 13
- 0
common/logic/Producer/Producer/Service/DolibarrProducerUtils.php 파일 보기

@@ -32,6 +32,19 @@ class DolibarrProducerUtils extends AbstractManager
return $invoicesArray;
}

public function countDolibarrProducerInvoicesUnpaid(Producer $producer): int
{
$count = 0;
$invoicesArray = $this->getDolibarrProducerInvoices($producer);
foreach($invoicesArray as $invoice) {
if($invoice['remaintopay'] > 0) {
$count ++;
}
}

return $count;
}

public function generateDolibarrProducerInvoice(Producer $producer)
{
$idProduct = $this->getDolibarrProductId($producer);

Loading…
취소
저장