open-ended installments when only the current is set (v1.0.2)

This commit is contained in:
2026-07-07 18:16:51 -03:00
parent d463faf134
commit 7fde8cb3d9
4 changed files with 11 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ class Plugin extends Base
public function getPluginVersion()
{
return '1.0.1';
return '1.0.2';
}
public function getPluginHomepage()

View File

@@ -15,13 +15,18 @@ if ($fb['amount'] === '' || (float) $fb['amount'] <= 0) {
$credit = $fb['direction'] === 'credit';
$sign = $credit ? '+' : '-';
$total = $fb['installment_total'];
$current = $fb['installment_current'] !== '' ? $fb['installment_current'] : '1';
$current = $fb['installment_current'];
// Installments: "p2/10" when a total is set; "p2" (open-ended) when only the current is set;
// nothing when neither is set. Default the current to 1 if only a total was entered.
$show_installments = $current !== '' || $total !== '';
$current_display = $current !== '' ? $current : '1';
?>
<div class="fb-line">
<span class="fb-badge <?= $credit ? 'fb-badge-credit' : 'fb-badge-debit' ?>">
<?= $sign ?>R$<?= \Kanboard\Plugin\FinanceBuddy\Helper\FinanceHelper::money($fb['amount']) ?>
</span>
<?php if ($total !== ''): ?>
<span class="fb-installments">p<?= $this->text->e($current) ?>/<?= $this->text->e($total) ?></span>
<?php if ($show_installments): ?>
<span class="fb-installments">p<?= $this->text->e($current_display) ?><?= $total !== '' ? '/'.$this->text->e($total) : '' ?></span>
<?php endif ?>
</div>

View File

@@ -24,6 +24,6 @@
<span><?= t('of') ?></span>
<input type="number" min="1" name="financebuddy_installment_total" value="<?= $this->text->e($fb['installment_total']) ?>" class="fb-form-num">
</div>
<p class="form-help"><?= t('Leave the total blank for an open-ended recurring bill.') ?></p>
<p class="form-help"><?= t('Set a total for a finite plan (shows p2/10); leave it blank for an open-ended count (shows p2).') ?></p>
</div>
<?php endif ?>

View File

@@ -1 +1 @@
FinanceBuddy v1.0.1
FinanceBuddy v1.0.2