Subversion Repositories PEEPS

Rev

Rev 16 | Rev 29 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 22
Line 605... Line 605...
605
}
605
}
Line 606... Line 606...
606
 
606
 
607
sub getPolicyByID {
607
sub getPolicyByID {
Line 608... Line 608...
608
  my $pid = shift // "";
608
  my $pid = shift // "";
Line 609... Line 609...
609
  
609
  
Line 610... Line 610...
610
  (warn "ERROR: No PolicyID passed to getPolicyByID()" and return) unless $pid =~ /^\d+$/;
610
  (warn "ERROR: No PolicyID passed to getPolicyByID()" and return {}) unless $pid =~ /^\d+$/;
Line 611... Line 611...
611
  
611
  
612
  my $policy = $dbh->selectrow_hashref ("select * from policy where id = ?", undef, $pid);
612
  my $policy = $dbh->selectrow_hashref ("select * from policy where id = ?", undef, $pid);
Line 613... Line 613...
613
  
613
  
Line 1395... Line 1395...
1395
  return "" unless $pid =~ /^\d+$/;
1395
  return "" unless $pid =~ /^\d+$/;
1396
  return "" unless !$date or $date =~ /^\d{4}-\d{2}-\d{2}$/;
1396
  return "" unless !$date or $date =~ /^\d{4}-\d{2}-\d{2}$/;
Line 1397... Line 1397...
1397
  
1397
  
1398
  my $policy_id;
1398
  my $policy_id;
1399
  if ($date) {
1399
  if ($date) {
1400
    ($policy_id) = $dbh->selectrow_array ("select id from coverage where person_id = ? and datediff(start, ?) <= 1 and datediff(end, ?) >= 0 and isnull(coverage.terminated) = 1", undef, $pid, $date, $date);
1400
    ($policy_id) = $dbh->selectrow_array ("select id from coverage where person_id = ? and datediff(start, ?) <= 1 and datediff(end, ?) >= 0 and isnull(coverage.terminated) = 1 and policy_id = 1", undef, $pid, $date, $date);
1401
  } else {
1401
  } else {
1402
    ($policy_id) = $dbh->selectrow_array ("select id from coverage where person_id = ? and datediff(start, now()) < 1 and datediff(end, now()) >= 0 and isnull(coverage.terminated) = 1", undef, $pid);
1402
    ($policy_id) = $dbh->selectrow_array ("select id from coverage where person_id = ? and datediff(start, now()) < 1 and datediff(end, now()) >= 0 and isnull(coverage.terminated) = 1 and policy_id = 1", undef, $pid);
Line 1403... Line 1403...
1403
  }
1403
  }
1404
  
1404