When people think about "vestigial" organs, they think that we're toting around these useless lumps of flesh that just take up space in our bodies. Nothing could be further from the truth, of course- vestigial organs are organs whose original function has become redundant or superfluous, but generally have adopted some sort of secondary function. Our appendix does nothing to help us digest (its original purpose), but it does some tasks for our immune system and occasionally explodes and kills us.

So it is with our software. As any project evolves, sometimes code becomes vestigial, serving only some minor function and occasionally exploding. Randy discovered this block of code when he was tracing through a production issue.

 
lsSQL = " SELECT pim.n_contract_template_id  " & _
        " FROM OP_LOC_ITEM_CTXT_XREF pim" & _
        " WHERE pim.N_LOCATION = " & psLoc & " " & _
        " AND pim.N_ITEM = " & piItem & " " & _
        " AND pim.D_EFF < sysdate AND pim.D_INEFF > sysdate " 
        Set rs = lconConnection.Execute(lsSQL) 
        
        ''' BEGIN - 5/27/2004 - regardless of whether the item is in the bid or not
        '''If IsNull(rs("n_contract_template_id")) Then
          'if pim.n_contract_template_id is null
            lsSQL = " SELECT pim.N_COST, b.n_cost_uom N_COST_UOM, pim.N_COST_CURRENCY , pim.N_MASTER_ITEM_ID" & _
                    " FROM OP_LOC_ITEM_CTXT_XREF pim, OS_LOC_ITEM_UOM_XREF b " & _
                    " Where pim.N_LOCATION = " & psLoc & " " & _
                    " AND pim.N_ITEM = " & piItem & " " & _
                    " and pim.n_item=b.n_item " 
        '''Else
            'if pim.n_contract_template_id is not null
            'Abdul 07/10/2003 N_COST is being picked from OP_LOC_ITEM_CTXT_XREF instead of OS_LOC_ITEM_UOM_XREF
            '12-Jan-2004 - GB - Add Container UOM to select
        '''    lsSQL = " SELECT N_COST, b.n_purchase_uom N_COST_UOM, N_COST_CURRENCY  , pim.N_MASTER_ITEM_ID" & _
        '''            " FROM OP_LOC_ITEM_CTXT_XREF pim, contract_template b  " & _
        '''            " WHERE pim.N_LOCATION = " & psLoc & " " & _
        '''            " AND pim.N_ITEM = " & piItem & " " & _
        '''            " and pim.n_context=" & piContext & _
        '''            " AND pim.n_cont_uom = " & piContUOM & _
        '''            " and b.n_template=pim.n_contract_template_id AND  pim.D_EFF < sysdate AND pim.D_INEFF > sysdate"
        '''End If
        ''' END - 5/27/2004 - regardless of whether the item is in the bid or not
        '''             get the cost uom from OS_LOC_ITEM_UOM_XREF
        rs.Close