############### ### subs.pl ### ############### use Time::Local; use Tie::IxHash; use CGI::Carp qw(fatalsToBrowser set_message); set_message($main::stock_500_msg); use Carp; use CGI; use Pg; use Text::Wrap qw(wrap $columns); our $common_dir; require "$common_dir/constants.common"; require "$common_dir/footer.common"; require "$common_dir/get.common"; require "$common_dir/log_record.common"; require "$common_dir/mailer.common"; require "$common_dir/reply.common"; require "$common_dir/sql.common"; require "$common_dir/sqlnew.common"; require "$common_dir/strings.common"; require "$common_dir/tracking.common"; require "$common_dir/edit.common"; require "$common_dir/view.common"; require "$common_dir/parameters.common"; require("$common_dir/hash.common"); require("$common_dir/templates.common"); $cgi_query = new CGI; $| = 1; # turn on autoflush ################################################# sub url_check_for_aol { # this routine has caused trouble for at least one aol user (ronstoli@aol.com on 12/12/08). # The link tags showed up in his email and the links were not live. Since we are switching # over to templatized emails with text/plain and text/html it doesn't seem that this routine # will be useful for much longer. Kevin changed this routine to just return the unmodified # url for now until references to this routine can be removed and templatized. # usage $url_in_email = &url_check_for_aol($url,$to,$link_text); my ($url, $to, $link_text) = @_; if (lc($to) =~ /aol.com/) { $url_out = "$link_text"; } else { $url_out = $url; } #return $url_out; return $url; } ############################################################################# ## Generate the error message text page ## ############################################################################# sub error_page { my $error_text = shift; print "Content-type: text/html\n\n"; print "Error Message"; print ""; print ''; print '
'; print ' Error Message'; print '
';
    print $error_text;
    print '
'; print ''; } ############################################################################# ## Generate the warning banner for a recoverable error ## ############################################################################# sub warning_block { my $msg = shift; print <
Warning   $msg
END } ############################################################################# ## Read and merge the description information for the property ## ############################################################################# sub read_description { my $property = shift; my @answer; my $stmt = "SELECT description FROM properties WHERE property=" . &sqlnum ($property); sql_select ( $stmt, \@answer ); $temp_checksum = $note_text; # Update the value $cgi_query->param ("d_note", $answer[0][0]); } ############################################################################# ## Read and merge the issue information for the property ## ############################################################################# sub read_issues { my $property = shift; my @answer; my $stmt = "SELECT issues FROM properties WHERE property=" . &sqlnum ($property); sql_select ( $stmt, \@answer ); $temp_checksum = $note_text; # Update the value $cgi_query->param ("i_note", $answer[0][0]); } ############################################################################# ## Read the list of borrowers for the property ## ############################################################################# sub read_borrowers { my $property = shift; my @answer; my $index; my $fields; my $key; $temp_checksum = ""; $fields = "line,name,entity,occupation,income,net_worth,"; $fields .= "credit,credit_score"; my $stmt = "SELECT $fields FROM $tbl_borrowers WHERE property=" . &sqlnum ($property) . " ORDER BY line"; undef @answer; sql_select ( $stmt, \@answer ); for ( $index = 0; $index <= $#answer; $index++ ) { $key = "b_" . $answer[$index][0]; $cgi_query->param ("additional_people", "on") if ($key gt "b_2"); $cgi_query->param ($key . "_name", $answer[$index][1]); $cgi_query->param ($key . "_entity", $answer[$index][2]); $cgi_query->param ($key . "_occupation", $answer[$index][3]); $cgi_query->param ($key . "_income", $answer[$index][4]); $cgi_query->param ($key . "_credit", $answer[$index][6]); $cgi_query->param ($key . "_credit_score", $answer[$index][7]); # Translate the net worth to the appropriate index as needed my $worth_value = $answer[$index][5]; if ( $worth_value > 7 ) { my $worth_index = 1; $worth_index = 2 if ( $worth_value > 250000 ); $worth_index = 3 if ( $worth_value > 500000 ); $worth_index = 4 if ( $worth_value > 1000000 ); $worth_index = 5 if ( $worth_value > 2000000 ); $worth_index = 6 if ( $worth_value > 5000000 ); $worth_index = 7 if ( $worth_value > 10000000 ); $worth_value = $worth_index; } $cgi_query->param ( $key . "_net_worth", $worth_value ); $temp_checksum .= $answer[$index][0]; $temp_checksum .= $answer[$index][1]; $temp_checksum .= $answer[$index][2]; $temp_checksum .= $answer[$index][3]; $temp_checksum .= $answer[$index][4]; $temp_checksum .= $answer[$index][5]; $temp_checksum .= $answer[$index][6]; $temp_checksum .= $answer[$index][7]; } } ############################################################################# ## Read the basic property information table ## ############################################################################# # FIXME HACK XXX CHANGEME: Change this clusterfuck to Class::DBI sub read_property { my $property = shift; my $stmt; my @answer; my $result; my $query; my $fields; $temp_checksum = ""; # This is the list of fields in the proper order for the fetch operation $fields = "person,name,address1,address2,city,state,zipcode,loan_type,"; $fields .= "amount,sale_price,down_payment,property_type,units,"; $fields .= "gross_rentable_area,net_rentable_area,age,last_renovated,"; $fields .= "vacancies,collateral,ltv_ratio,dscr,purpose,"; $fields .= "desired_rate,fee_lender,fee_broker,schedule,term,gpi,"; $fields .= "reserved_pct,area_vacancy_rate,sba,curb_appeal,referrer_sent,bridge,hardmoney,stopemail,other_income,"; $fields .= "land_cost,hard_cost,soft_cost,contingency,total_cost,loan_to_cost,land_explain,"; $fields .= "flender,fbalance,frate,fpayment,fmaturity,"; $fields .= "rural_area,usda,owner_occupied,"; #can you say clusterfuck? This should be converted to CLass::DBI $fields .= "land_purch_pr,land_purch_dt,land_purch_new,land_down,land_balance,land_value,land_detail,checksum"; $stmt = "SELECT $fields FROM $tbl_properties WHERE property=" . &sqlnum ($property); undef @answer; sql_select ( $stmt, \@answer ); die "Missing property $property from database" if ($#answer < 0); # Load the information into the form fields as the default values @ary = split (/,/, $fields); for ($index=0; $index <= $#ary; $index++) { my $item = "x_" . $ary[$index]; $cgi_query->param ( $item, $answer[0][$index] ); #ejp 1/4/2007 - don't repeat the checksum if it's unnecessary. if ($item ne "x_checksum") { $temp_checksum .= $answer[0][$index]; } } # Compute the years since the renovation my $value = $cgi_query->param ( "x_last_renovated" ) || ""; if ($value ne "") { $value = substr ($value, 0, 4); my $year = (localtime)[5] + 1900; $value = $year - $value; $value = 0 if ($value < 0); $cgi_query->param ( "x_last_renovated", $value ); } } ############################################################################# ## Read the persons table ## ## ## read_person($person) ## precondition: $person contains a valid person id ## postcondition: the cgi param fields are over written with the person's data ############################################################################# sub read_person { my $person = shift; my $stmt; my @answer; my $result; my $query; my $fields; # This is the list of fields in the proper order for the fetch operation # $fields = "name,type,email,company,address1,address2,city,"; # $fields .= "state,zipcode,work_ph,work_ph_ext,home_ph,fax,referrer,limit_num,limit_max,fname,lname"; $fields = "name,type,email,company,address1,address2,city,state,zipcode,work_ph,work_ph_ext,home_ph,fax,referrer,limit_num,limit_max,fname,lname,prefix,middle,suffix,flags,cell_ph"; $stmt = "SELECT $fields FROM $tbl_people WHERE person=" . &sqlnum ($person); undef @answer; sql_select ( $stmt, \@answer ); die "Missing property $property from database" if ($#answer < 0); # Load the information into the form fields as the default values @ary = split (/,/, $fields); for ($index=0; $index <= $#ary; $index++) { my $item = "p_" . $ary[$index]; $cgi_query->param ($item, $answer[0][$index]); } } ############################################################################# ## Read the list of expenses for the property ## ############################################################################# sub read_expenses { my $property = shift; my @answer; my $index; $temp_checksum = ""; my $fields = "category,amount"; my $stmt = "SELECT $fields FROM $tbl_expenses WHERE property=" . &sqlnum ($property); undef @answer; sql_select ( $stmt, \@answer ); for ( $index = 0; $index <= $#answer; $index++ ) { my $tag = $reverse_expenses { $answer[$index][0] }; $cgi_query->param ($tag, $answer[$index][1]); $temp_checksum .= $answer[$index][1] } } ############################################################################# ## Generate a form to retrieve the personal data ## ############################################################################# sub person_form { my @ary_states; my $default_value; print ""; print '"; print '"; print ""; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print "
'; print "First Name:'; print $cgi_query->textfield (-name=>"p_fname", -size=>65, -value=>$cookie_first . " " . $cookie_last); print "
'; print "Last Name:'; print $cgi_query->textfield (-name=>"p_lname", -size=>65, -value=>$cookie_first . " " . $cookie_last); print "
'; print "I am'; @ary_states = keys %person_type_labels; $cgi_query->param("p_type", $cgi_query->param ("p_type") || "1" ); print $cgi_query->scrolling_list (-name=>'p_type', -values => \@ary_states, -size => 1, -default=>$cookie_i_am, -labels => \%person_type_labels); print "
'; print "Company Name:'; print $cgi_query->textfield (-name=>"p_company", -size=>65, -value=>$cookie_company); print "
'; print "Mailing Address:'; print $cgi_query->textfield (-name=>"p_address1", -size=>65, -value=>$cookie_smail_1); print "
'; print "Additional address line:'; print $cgi_query->textfield (-name=>"p_address2", -size=>65, -value=>$cookie_smail_2); print "
'; print "City:'; print $cgi_query->textfield (-name=>"p_city", -size=>30, -value=>$cookie_smail_city); print "  "; print "State:"; @ary_states = sort keys %state_labels; $cgi_query->param("p_state", $cgi_query->param ("p_state") || $cookie_smail_state || "CA" ); print $cgi_query->scrolling_list (-name=>'p_state', -values => \@ary_states, -size => 1); print "  "; print "Zipcode:"; print $cgi_query->textfield (-name=>"p_zipcode", -size=>10, -value=>$cookie_smail_zip); print "
'; print "Daytime telephone number:'; undef $default_value; $default_value = $cookie_phone_d if (defined $cookie_phone_d); $default_value = "(" . $cookie_areacd_d . ") " . $default_value if (defined $cookie_areacd_d); print $cgi_query->textfield (-name=>"p_work_ph", -size=>20, -value=>$default_value); print " Extension:"; print $cgi_query->textfield (-name=>"p_work_ph_ext", -size=>10); print "
'; print "Fax telephone number:'; undef $default_value; $default_value = $cookie_phone_fax if (defined $cookie_phone_fax); $default_value = "(" . $cookie_areacd_fax . ") " . $default_value if (defined $cookie_areacd_fax); print $cgi_query->textfield (-name=>"p_fax", -size=>20, -value=>$default_value); print "
'; print "Evening telephone number:'; undef $default_value; $default_value = $cookie_phone_e if (defined $cookie_phone_e); $default_value = "(" . $cookie_areacd_e . ") " . $default_value if (defined $cookie_areacd_e); print $cgi_query->textfield (-name=>"p_home_ph", -size=>20, -value=>$default_value); print "
'; print "Cellphone number:'; undef $default_value; $default_value = $cookie_phone_c if (defined $cookie_phone_c); $default_value = "(" . $cookie_areacd_c . ") " . $default_value if (defined $cookie_areacd_c); print $cgi_query->textfield (-name=>"p_cell_ph", -size=>20, -value=>$default_value); print "
'; print "E-mail address:'; print $cgi_query->textfield (-name=>"p_email", -size=>65, -value=>$cookie_email); $email_address = $cgi_query->param("p_email"); print $cgi_query->hidden (-name=>"p_email_orig", -value=>$email_address); print "
'; print "E-mail address (confirm):'; if (!($p_email_confirm)) { $p_email_confirm = $cgi_query->param("p_email_confirm"); } print $cgi_query->textfield (-name=>"p_email_confirm", -size=>65, -value=>$p_email_confirm); print "
"; } ############################################################################# ## Generate a form to retrieve the personal data ## ############################################################################# sub person_form_new { my @ary_states; my $default_value; print ""; print '"; print '"; print '"; print '"; print '"; print '"; print ""; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print "
'; print "Prefix:'; $cgi_query->param("p_prefix", $cgi_query->param ("p_prefix") || "" ); print $cgi_query->scrolling_list (-name=>'p_prefix', -values => \@prefixes, -size => 1 ); print "
'; print "First Name:'; print $cgi_query->textfield (-name=>"p_fname", -size=>65, -value=>$cookie_first . " " . $cookie_last); print "
'; print "Middle Initial:'; print $cgi_query->textfield (-name=>"p_middle", -size=>1, -maxlength=>1); print "
'; print "Last Name:'; print $cgi_query->textfield (-name=>"p_lname", -size=>65, -value=>$cookie_first . " " . $cookie_last); print "
'; print "Suffix:'; $cgi_query->param("p_suffix", $cgi_query->param ("p_suffix") || "" ); print $cgi_query->scrolling_list (-name=>'p_suffix', -values => \@suffixes, -size => 1 ); print "
'; print "I am'; @ary_states = sort keys %person_type_labels; my @allowed_states; foreach my $state (@ary_states){ unless (grep $state eq $_,@hidden_person_types){ push @allowed_states, $state; } } $cgi_query->param("p_type", $cgi_query->param ("p_type") || "1" ); print $cgi_query->scrolling_list (-name=>'p_type', -values => \@allowed_states, -size => 1, -default=>$cookie_i_am, -labels => \%person_type_labels); print "
'; print "Company Name:'; print $cgi_query->textfield (-name=>"p_company", -size=>65, -value=>$cookie_company); print "
'; print "Mailing Address:'; print $cgi_query->textfield (-name=>"p_address1", -size=>65, -value=>$cookie_smail_1); print "
'; print "Additional address line:'; print $cgi_query->textfield (-name=>"p_address2", -size=>65, -value=>$cookie_smail_2); print "
'; print "City:'; print $cgi_query->textfield (-name=>"p_city", -size=>30, -value=>$cookie_smail_city); print "  "; print "State:"; @ary_states = sort keys %state_labels; $cgi_query->param("p_state", $cgi_query->param ("p_state") || $cookie_smail_state || "CA" ); print $cgi_query->scrolling_list (-name=>'p_state', -values => \@ary_states, -size => 1); print "  "; print "Zipcode:"; print $cgi_query->textfield (-name=>"p_zipcode", -size=>10, -value=>$cookie_smail_zip); print "
'; print "Daytime telephone number:'; undef $default_value; $default_value = $cookie_phone_d if (defined $cookie_phone_d); $default_value = "(" . $cookie_areacd_d . ") " . $default_value if (defined $cookie_areacd_d); print $cgi_query->textfield (-name=>"p_work_ph", -size=>20, -value=>$default_value); print " Extension:"; print $cgi_query->textfield (-name=>"p_work_ph_ext", -size=>10); print "
'; print "Fax telephone number:'; undef $default_value; $default_value = $cookie_phone_fax if (defined $cookie_phone_fax); $default_value = "(" . $cookie_areacd_fax . ") " . $default_value if (defined $cookie_areacd_fax); print $cgi_query->textfield (-name=>"p_fax", -size=>20, -value=>$default_value); print "
'; print "Evening telephone number:'; undef $default_value; $default_value = $cookie_phone_e if (defined $cookie_phone_e); $default_value = "(" . $cookie_areacd_e . ") " . $default_value if (defined $cookie_areacd_e); print $cgi_query->textfield (-name=>"p_home_ph", -size=>20, -value=>$default_value); print "
'; print "Cellphone number:'; undef $default_value; $default_value = $cookie_phone_c if (defined $cookie_phone_c); $default_value = "(" . $cookie_areacd_c . ") " . $default_value if (defined $cookie_areacd_c); print $cgi_query->textfield (-name=>"p_cell_ph", -size=>20, -value=>$default_value); print "
'; print "E-mail address:'; print $cgi_query->textfield (-name=>"p_email", -size=>65, -value=>$cookie_email); $email_address = $cgi_query->param("p_email"); print $cgi_query->hidden (-name=>"p_email_orig", -value=>$email_address); print "
'; print "E-mail address (confirm):'; if (!($p_email_confirm)) { $p_email_confirm = $cgi_query->param("p_email_confirm"); } print $cgi_query->textfield (-name=>"p_email_confirm", -size=>65, -value=>$p_email_confirm); print "
"; } ############################################################################# ## Print out the personal data for a lender ## ############################################################################# sub person_form_new_lender { my @ary_states; my $default_value; print ""; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print '"; print "
'; print "Prefix:'; #$cgi_query->param("p_prefix", $cgi_query->param ("p_prefix") || "" ); #print $cgi_query->scrolling_list (-name=>'p_prefix', # -values => \@prefixes, # -size => 1 # ); print $cgi_query->param("p_prefix", $cgi_query->param ("p_prefix") || "Mr." ); print "
'; print "Name:'; print $cgi_query->param("p_name"); print "
'; print "Suffix:'; print $cgi_query->param("p_suffix", $cgi_query->param ("p_suffix") || "" ); print "
'; print "I am'; print "A Lender"; print "
'; print "Company Name:'; print $cgi_query->param ("p_company"); print "
'; print "Mailing Address:'; print $cgi_query->param ("p_address1"); print "
'; print "Additional address line:'; print $cgi_query->param ("p_address2"); print "
'; print "City:'; print $cgi_query->param ("p_city"); print "       "; print "State: "; print $cgi_query->param ("p_state"); print "       "; print "Zipcode: "; print $cgi_query->param ("p_zipcode"); print "
'; print "Daytime telephone number:'; undef $default_value; $default_value = $cookie_phone_d if (defined $cookie_phone_d); $default_value = "(" . $cookie_areacd_d . ") " . $default_value if (defined $cookie_areacd_d); print $cgi_query->param ("p_work_ph"); print "     Extension:"; print $cgi_query->param ("p_work_ph_ext"); print "
'; print "Fax telephone number:'; undef $default_value; $default_value = $cookie_phone_fax if (defined $cookie_phone_fax); $default_value = "(" . $cookie_areacd_fax . ") " . $default_value if (defined $cookie_areacd_fax); # EJP - see version #861. Kirklin commented this out to prevent lenders from editing these using borrowers interface. # I retained this comment (which disabled the recollection) even though reenabling fax # collection. 11/20/2015. # print $cgi_query->textfield (-name=>"p_fax", -size=>20, -value=>$default_value); print $cgi_query->param ("p_fax"); print "
'; print "Evening telephone number:'; undef $default_value; $default_value = $cookie_phone_e if (defined $cookie_phone_e); $default_value = "(" . $cookie_areacd_e . ") " . $default_value if (defined $cookie_areacd_e); print $cgi_query->param ("p_home_ph"); print "
'; print "Cellphone number:'; undef $default_value; $default_value = $cookie_phone_c if (defined $cookie_phone_c); $default_value = "(" . $cookie_areacd_c . ") " . $default_value if (defined $cookie_areacd_c); print $cgi_query->param ("p_cell_ph"); print "
'; print "E-mail address:'; print $cgi_query->param ("p_email"); print "
"; } ############################################################################# ## Display the person and list of properties ## ############################################################################# sub show_properties { my $p_person = shift; my $stmt; my @answer; my $result; my $query; # Fetch the personal information from the database $strFields = "company,type,name,address1,address2,city,state,zipcode,"; $strFields .= "email,fax,home_ph,work_ph,work_ph_ext, fname, lname,prefix,middle,suffix,flags,cell_ph"; $stmt = "SELECT $strFields FROM $tbl_people WHERE person="; $stmt .= &sqlnum($p_person); undef @answer; &sql_select ( $stmt, \@answer ); # Update the fields in the CGI parameter database $cgi_query->param ("p_company", $answer[0][0] ); $cgi_query->param ("p_type", $answer[0][1] ); $cgi_query->param ("p_name", $answer[0][2] ); $cgi_query->param ("p_address1", $answer[0][3] ); $cgi_query->param ("p_address2", $answer[0][4] ); $cgi_query->param ("p_city", $answer[0][5] ); $cgi_query->param ("p_state", $answer[0][6] ); $cgi_query->param ("p_zipcode", &set_zipcode ($answer[0][7]) ); $cgi_query->param ("p_email", $answer[0][8] ); $cgi_query->param ("p_fax", &set_phone ($answer[0][9]) ); $cgi_query->param ("p_home_ph", &set_phone ($answer[0][10]) ); $cgi_query->param ("p_work_ph", &set_phone ($answer[0][11]) ); $cgi_query->param ("p_work_ph_ext", $answer[0][12] ); $cgi_query->param ("p_fname", $answer[0][13] ); $cgi_query->param ("p_lname", $answer[0][14] ); $cgi_query->param ("p_prefix", $answer[0][15] ); $cgi_query->param ("p_middle", $answer[0][16] ); $cgi_query->param ("p_suffix", $answer[0][17] ); $cgi_query->param ("p_flags", $answer[0][18] ); $cgi_query->param ("p_cell_ph", &set_phone ($answer[0][19]) ); $cgi_query->param ("p_person", $p_person); &display_form3( $p_person ); } ############################################################################# ## Find the lender information from the loan program number ## ############################################################################# #HACK XXX FIXME CHANGEME - setting $lenders is a bad way to do things. Why not just # look up the lender info directly? sub find_lender { my $pgm_id = shift; my $pgm = Cloans::DBI::Program->retrieve($pgm_id); my $lo = $pgm->loan_officer; $lenders{"OLACOMPANY"} = $lo->company; $lenders {"OLANAME"} = $lo->name; $lenders {"OLAADDR1"} = $lo->address1; $lenders {"OLAADDR2"} = $lo->address2; $lenders {"OLACITY"} = $lo->city; $lenders {"OLASTATE"} = $lo->state; $lenders {"OLAZIP"} = $lo->zipcode; $lenders {"OLAPHONE"} = $lo->work_ph; $lenders {"OLAFAX"} = $lo->fax; $lenders {"OLAEMAIL1"} = $lo->email; $lenders {"OLAEMAIL2"} = $lo->email2; return %lenders; } ############################################################################# ## Generates an MD5 hash based on an input string ## ############################################################################# sub generate_hash_simple { #use Digest::Perl::MD5 'md5_hex'; #use Digest::MD5 qw(md5_hex); my $inputString = shift; my $hashString; my $digest; $hashString = "K1rkl1n" . $inputString . "A113n2003"; $digest = md5_hex($hashString); return $digest; } ############################################################################# ## Determines if a property has been revised for a lender ## ############################################################################# sub is_revised { my ($prop, $pgm, $scrub) = @_; my $revised = ""; if ($scrub == 1) { $ttype = [1]; } else { $ttype = [1,7]; } my @tracking_entries = Cloans::DBI::TrackingEvent->search_where({trackingtype => $ttype, #submit loan (1) or sent for scrubbing (7). program => $pgm, property => $prop}, {order_by => "timestamp DESC", limit_dialect => 'LimitOffset', limit => 1 } ); my $one_day = DateTime->from_epoch(epoch => time - (60 * 60 * 24 * 4)); #find the last "change" to this particular property. Either created -1 or updated -2. my @last_change_ary = Cloans::DBI::TrackingEvent->search_where({trackingtype => [-2,-1], property => $prop}, {order_by => "timestamp DESC", limit_dialect => 'LimitOffset', limit => 1 } ); if (!$last_change_ary[0]) { # if the record is so old that it predates our new tracking types of -1 or -2, then just grab # the first tracking record to use as the creation date @last_change_ary = Cloans::DBI::TrackingEvent->search_where({trackingtype => [0,1,2,3,4,5,6], property => $prop}, {order_by => "timestamp ASC", limit_dialect => 'LimitOffset', limit => 1} ); } if (!$last_change_ary[0]) { #no tracking entries on this. E.g. we deleted them for test purposes or super old. return ""; } my $last_change = $last_change_ary[0]->timestamp; #we don't have to find an entry. If we haven't then this is a unique submission. if ($#tracking_entries != -1) { my $te = $tracking_entries[0]->timestamp; #there was an entry. Check to see if: # It was more than a day ago. If so, go ahead and allow resubmit. # else, check if the app was changed. If it was, we can allow resubmit. if ($one_day > $te) { #allow the resubmit. $revised = "*** RESUBMITTED ***" } elsif ($te < $last_change) { $revised = "*** REVISED ***"; #this is a resubmission. } else { # this is a trigger happy user. No changes, so don't resend $revised = "-1"; } } return $revised; } ################################################# sub credit_score_to_type { my ($score) = @_; my $type = 0; if ($score < 410) { $type = 1; } elsif ($score < 429) { $type = 2; } elsif ($score < 450) { $type = 3; } elsif ($score < 499) { $type = 4; } elsif ($score < 540) { $type = 5; } elsif ($score < 599) { $type = 6; } elsif ($score < 649) { $type = 7; } elsif ($score < 699) { $type = 8; } elsif ($score < 730) { $type = 9; } else { $type = 10; } return $type; } 1;