lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 23dc54c 1/4: Explicitly forbid group quotes o


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 23dc54c 1/4: Explicitly forbid group quotes on products no longer issued
Date: Sat, 3 Aug 2019 08:47:52 -0400 (EDT)

branch: master
commit 23dc54cae0452814281b4964576e1b5b3161e1ee
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Explicitly forbid group quotes on products no longer issued
    
    This change is logically redundant--the scenario it blocks is already
    impossible, because distributed product files are consistent in this
    respect--but it seems good to make assurance doubly sure.
---
 group_quote_pdf_gen_wx.cpp | 29 ++++++++++++++++-------------
 ledger_evaluator.cpp       |  1 +
 ledger_invariant.cpp       |  3 +++
 ledger_invariant.hpp       |  1 +
 ledger_invariant_init.cpp  |  1 +
 5 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index ac896b4..0d8c227 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -347,9 +347,10 @@ void assert_nonblank(std::string const& value, std::string 
const& name)
 
 /// Copy global report data from ledger.
 ///
-/// All ledger data used here must be checked for consistency upstream
-/// by assert_okay_to_run_group_quote(); therefore, any changes in the
-/// set of data used here should be reflected there.
+/// Member data from class Input that are used here are checked for
+/// consistency upstream by assert_okay_to_run_group_quote().
+/// Therefore, any changes in the set of data used here should be
+/// reflected there if possible.
 
 void group_quote_pdf_generator_wx::global_report_data::fill_global_report_data
     (Ledger      const& ledger
@@ -468,19 +469,21 @@ void group_quote_pdf_generator_wx::add_ledger(Ledger 
const& ledger)
 
     LedgerInvariant const& invar = ledger.GetLedgerInvariant();
 
-    // 'AllowGroupQuote' isn't an input field, so it cannot be
-    // checked by assert_okay_to_run_group_quote().
-    if(!static_cast<bool>(invar.AllowGroupQuote))
+    // Function assert_okay_to_run_group_quote() takes arguments only
+    // of class Input, so it can't check ledger variables such as
+    //   AllowGroupQuote
+    //   NoLongerIssued
+    //   GroupIndivSelection
+    // which are checked only here.
+    if
+        (  !static_cast<bool>(invar.AllowGroupQuote)
+        ||  static_cast<bool>(invar.NoLongerIssued)
+        )
         {
-        alarum()
-            << "Group quotes not allowed on this plan."
-            << LMI_FLUSH
-            ;
+        alarum() << "Group quotes not allowed on this plan." << LMI_FLUSH;
         }
 
-    // 'GroupIndivSelection' isn't an input field, so it cannot be
-    // checked by assert_okay_to_run_group_quote(). It must be tested
-    // (here) because some legacy products unfortunately combined
+    // Needed only because some legacy products unfortunately combined
     // mandatory (unismoke) and voluntary (smoker-distinct) rates in
     // the same plancode, when they should have used distinct subplans
     // because they serve different market segments.
diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index a3bf44f..0a747d2 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -533,6 +533,7 @@ format_map_t static_formats()
     ,{"AllowExperienceRating"           , f1}
     ,{"UseExperienceRating"             , f1}
     ,{"GroupIndivSelection"             , f1}
+    ,{"NoLongerIssued"                  , f1}
     ,{"AllowGroupQuote"                 , f1}
     ,{"TxCallsGuarUwSubstd"             , f1}
     ,{"UsePartialMort"                  , f1}
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index f3a65a6..b2e62e4 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -142,6 +142,7 @@ void LedgerInvariant::Alloc(int len)
     OtherScalars    ["RetAge"                ] = &RetAge                 ;
     OtherScalars    ["EndtAge"               ] = &EndtAge                ;
     OtherScalars    ["GroupIndivSelection"   ] = &GroupIndivSelection    ;
+    OtherScalars    ["NoLongerIssued"        ] = &NoLongerIssued         ;
     OtherScalars    ["AllowGroupQuote"       ] = &AllowGroupQuote        ;
     OtherScalars    ["TxCallsGuarUwSubstd"   ] = &TxCallsGuarUwSubstd    ;
     OtherScalars    ["AllowExperienceRating" ] = &AllowExperienceRating  ;
@@ -448,6 +449,7 @@ void LedgerInvariant::Init()
 
     WriteTsvFile        = false;
     SupplementalReport  = true;
+    NoLongerIssued      = false;
     AllowGroupQuote     = true;
 
     irr_precision_      = 0;
@@ -678,6 +680,7 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
     StateOfJurisdiction           = a_Addend.StateOfJurisdiction;
     PremiumTaxState               = a_Addend.PremiumTaxState;
     GroupIndivSelection           = GroupIndivSelection   || 
a_Addend.GroupIndivSelection;
+    NoLongerIssued                = NoLongerIssued        || 
a_Addend.NoLongerIssued;
     AllowGroupQuote               = AllowGroupQuote       && 
a_Addend.AllowGroupQuote;
     TxCallsGuarUwSubstd           = TxCallsGuarUwSubstd   || 
a_Addend.TxCallsGuarUwSubstd;
     AllowExperienceRating         = AllowExperienceRating || 
a_Addend.AllowExperienceRating;
diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
index 8888e4c..24302be 100644
--- a/ledger_invariant.hpp
+++ b/ledger_invariant.hpp
@@ -166,6 +166,7 @@ class LMI_SO LedgerInvariant final
     double          RetAge;
     double          EndtAge;
     double          GroupIndivSelection;
+    double          NoLongerIssued;
     double          AllowGroupQuote;
     double          TxCallsGuarUwSubstd;
     double          AllowExperienceRating;
diff --git a/ledger_invariant_init.cpp b/ledger_invariant_init.cpp
index f74486f..b25ff79 100644
--- a/ledger_invariant_init.cpp
+++ b/ledger_invariant_init.cpp
@@ -257,6 +257,7 @@ void LedgerInvariant::Init(BasicValues const* b)
     RetAge                  = b->yare_input_.RetirementAge;
     EndtAge                 = b->yare_input_.IssueAge + b->GetLength();
     b->database().query_into(DB_GroupIndivSelection, GroupIndivSelection);
+    NoLongerIssued          = b->database().query<bool>(DB_NoLongerIssued);
     AllowGroupQuote         = b->database().query<bool>(DB_AllowGroupQuote);
     b->database().query_into(DB_TxCallsGuarUwSubstd, TxCallsGuarUwSubstd);
     AllowExperienceRating   = b->database().query<bool>(DB_AllowExpRating);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]