diff --git a/Model/RecoRecoModel.php b/Model/RecoRecoModel.php index 2e61345..a3ce992 100644 --- a/Model/RecoRecoModel.php +++ b/Model/RecoRecoModel.php @@ -121,17 +121,21 @@ class RecoRecoModel extends Base // Default off: only keep the duplicate link when explicitly turned on. $linkCopies = isset($meta['recoreco_link_copies']) && $meta['recoreco_link_copies'] == 1; - // Finite-plan stop. RecoReco caps its own recurrence: either by its own limit (standalone), - // or by following FinanceBuddy's installment total. In follow mode both numbers are read LIVE - // from FinanceBuddy (never copied into RecoReco), so a mid-plan start, a re-purchase, or an - // extend all just work by editing FinanceBuddy. A blank/0 limit means recur forever. The - // spawn loop below stops when counter > limit (1-based; the counter ends on limit+1). + // Finite-plan stop. RecoReco caps its own recurrence, either by its own limit (standalone) or + // by following FinanceBuddy. When follow is on, FinanceBuddy governs: the plan is finite only + // if the card has a numeric installment total, so an ordinary recurring bill (money but no + // installments) recurs forever -- and any stale standalone limit is ignored. In follow mode + // the numbers are read LIVE from FinanceBuddy (never copied), so a mid-plan start, a + // re-purchase, or an extend all just work by editing FinanceBuddy. A blank/0 limit means + // recur forever. The spawn loop below stops when counter > limit (1-based; counter ends on + // limit+1). + $followIntent = isset($meta['recoreco_follow_finance']) && $meta['recoreco_follow_finance'] == 1; $fbTotal = isset($meta['financebuddy_installment_total']) ? (string) $meta['financebuddy_installment_total'] : ''; - $follow = isset($meta['recoreco_follow_finance']) && $meta['recoreco_follow_finance'] == 1 - && $fbTotal !== '' && ctype_digit($fbTotal); + $fbHasTotal = $fbTotal !== '' && ctype_digit($fbTotal); + $follow = $followIntent && $fbHasTotal; - if ($follow) { - $limit = (int) $fbTotal; + if ($followIntent) { + $limit = $fbHasTotal ? (int) $fbTotal : 0; // following FinanceBuddy; no total => forever } else { $limitRaw = isset($meta['recoreco_limit']) ? (string) $meta['recoreco_limit'] : ''; $limit = ($limitRaw !== '' && ctype_digit($limitRaw)) ? (int) $limitRaw : 0; diff --git a/Plugin.php b/Plugin.php index 47d9d8b..4a3e2d7 100644 --- a/Plugin.php +++ b/Plugin.php @@ -62,7 +62,7 @@ class Plugin extends Base public function getPluginVersion() { - return '1.6.1'; + return '1.6.2'; } public function getPluginHomepage() diff --git a/Template/recurrence/edit.php b/Template/recurrence/edit.php index 63392a9..4b8b966 100644 --- a/Template/recurrence/edit.php +++ b/Template/recurrence/edit.php @@ -63,26 +63,29 @@

+ 0 ? (int) $values['recoreco_limit'] : '' ?>
+ data-rr-limit="text->e($limit_display) ?>"> form->checkbox('recoreco_follow_finance', t('Follow FinanceBuddy installments'), 1, $following) ?>

- form->label(t('Current recurrence'), 'recoreco_count') ?> - > - - form->label(t('Stop after this many recurrences (0 = never)'), 'recoreco_limit') ?> - > + form->label(t('Recurrence'), 'recoreco_count') ?> +
+ > + + > +
+

modal->submitButtons() ?> diff --git a/VERSION b/VERSION index 5e2a3cc..a8bed69 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -RecoReco v1.6.1 +RecoReco v1.6.2