Subversion Repositories VORC

Rev

Rev 202 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
202 - 1
#!/usr/bin/perl
2
 
3
# Redirect error messages to a log of my choosing. (it's annoying to filter for errors in the shared env)
4
my $error_log_path = $ENV{SERVER_NAME} eq "volunteers.rollercon.com" ? "/home3/rollerco/logs/" : "/tmp/";
5
close STDERR;
6
open STDERR, '>>', $error_log_path.'vorc_error.log' or warn "Failed to open redirected logfile ($0): $!";
7
#warn "Redirecting errors to ${error_log_path}vorc_error.log";
8
 
9
#if ($ENV{SHELL}) { die "This script shouldn't be executed from the command line!\n"; }
10
 
11
use strict;
12
use cPanelUserConfig;
13
use CGI qw/param cookie header start_html url/;
14
use HTML::Tiny;
15
use tableViewer;
16
use RollerCon;
17
our $h = HTML::Tiny->new( mode => 'html' );
18
 
19
my $cookie_string = authenticate (3) || die;
20
our ($EML, $PWD, $LVL) = split /&/, $cookie_string;
21
my $RCAUTH_cookie = CGI::Cookie->new(-name=>'RCAUTH',-value=>"$cookie_string",-expires=>"+30m");
22
 
23
my $pageTitle = "Coach Pay";
24
our $DBTABLE = 'v_coach_pay_pivot';
25
my %COLUMNS = (
26
# colname   =>  [qw(DisplayName       N    type     status)],   status ->  static | default | <blank>
27
  year        => [qw(Year         10    select      static  )],
28
  RCid        => [qw(RCID         15    number      static  )],
29
  derby_name  => [qw(DerbyName    20    select      static  )],
30
  full_name   => [qw(FullName     25    text        static  )],
31
  Coach       => [qw(Coach        35    number      static  )],
32
  Seminar     => [qw(Seminar      40    number      static  )],
33
  Host        => [qw(Host         45    number      static  )],
34
  TA          => [qw(TA           50    number      static  )],
35
  Other       => [qw(Other        55    number      static  )],
36
  pay         => [qw(Pay          60    number      static  )],
37
);
38
 
39
# Set any custom "where" DB filters here...
40
my @whereClause;
41
 
42
# If we need to modify line item values, create a subroutine named "modify_$columnname"
43
#    It will receive a hashref to the object lineitem
44
 
45
sub modify_pay {
46
  my $thing = shift;
205 - 47
  $thing->{pay} = sprintf ("%.2f", $thing->{pay});
48
  $thing->{pay} =~ s/\.00$//;
202 - 49
  return $thing->{pay} ? '$'.$thing->{pay} : "";
50
}
51
# If we need to modify how a filter works, create a subroutine named "filter_$columnname"
52
#    It will receive two fields, the field name and the current filter value (if any)
53
 
54
# Uncomment and update if we want to enable clicking on a row to open a new page.
55
#
56
#sub addRowClick {
57
#  my $t = shift;
58
#  return "location.href='view_shift.pl?id=$t->{id}&choice=View'";
59
#}
60
 
61
# Call the function to print the table view page (with available options)
62
printTablePage ({ Title   => $pageTitle,
63
#                  Prefs   => $prefscookie,
64
                  Table   => $DBTABLE,
65
                  Columns => \%COLUMNS,
66
                  RCAuth  => $RCAUTH_cookie,
67
                  Where   => join (" and ", @whereClause),
68
                  DisplayYearSelect  => 0,
69
#                  ShowMyShifts       => 1,
70
#                  PersonalTimeButton => 1,
71
#                  HighlightShifts    => 1,
72
#                  HeaderButton       => { field  => "id",
73
#                                          button => $h->input ({ type=>"button", value=>"Add", onClick=>"window.location.href='view_game.pl'" }) }
74
               });