inline "x of y" recurrence limit fields; Follow-FinanceBuddy governs the stop (v1.6.2)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user