#!/usr/bin/perl BEGIN { use lib '/usr/home/cfg' ; require push_inc ; } use CGI qw( :standard ); use CGI::Carp qw(fatalsToBrowser); use Fcntl qw(:flock); use File::Copy; use File::Basename; require cfg ; print header; # CGI.pm method #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- &today; #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- # unless ($username eq 'rory') { print ">>>>>> APOLOGIES, DOING MAINTENANCE <<<<<<"; exit; } @ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'}); $action = $ARGV[0] ; our ($q) = CGI -> new() ; our $iaction = $q -> param('iaction') || $action ; our $isaved = $q -> param('isaved') || '' ; # our $debug = 1 ; &common_min_restriction_super ; #-------- page opts -------------------------------------------------------------------------------------------------------------------------------------------------- &page_opts ; #--------------------------------------------------------------------------------------------------------------------------------------------------------------------- &common_min_action; exit; #------------------------------------------------------------------------------------------ sub validate { # my $exists = '' ; # &db_min_ro($table,'*',"name = '$i{name}'",'name','') ; # foreach my $id (keys %{$db{$table}}) { if ($db{$table}{$id}{name} eq $i{name}) { $exists = 1 ; } } # if ($exists) { $alert = &common_min_alert('warning',"$ucpage ALREADY EXISTS!",'ok') ; %col_name = (); &common_min_add_screen; &common_min_screen1; } } #------------------------------------------------------------------------------------------ sub insert { &add_db_fields ; $i{id} = &db_min_get_max($table,'id') ; &common_min_upload_files("leave/$i{id}") ; $i{date_time} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ; $i{category} = 'leave' ; &db_min_insert($table) ; } #------------------------------------------------------------------------------------------ sub update { unless ($i{id}) { $error = qq(NO ID) ; return ; } &edit_db_fields ; &common_min_upload_files("leave/$i{id}") ; # unless ($i{block}) { $i{block} = '0' ; } # $i{lastupdate} = "$now_ccyy_mm_dd $now_hour:$now_min:$now_sec" ; &db_min_upd($table,"id='$i{id}'") ; } #------------------------------------------------------------------------------------------ sub list_screen { &db_min_ro('users','*','','','') ; foreach my $id (keys %{$db{users}}) { $user_name{$id} = $db{users}{$id}{name} ; } my $extra_sql = '' ; unless ($useropts{super}{lc $username}) { $extra_sql = " AND `user_id`='$userid'" ; } &db_min_ro($table,'*',"`category`='leave'$extra_sql",'','') ; foreach my $id (keys %{$db{$table}}) { my $leave_type = ucfirst $db{$table}{$id}{type} ; my $attach_butt = '' ; $attach_options = &common_min_get_uploads("leave/$id",'all') ; if ($attach_options) { $attach_butt = qq( ) ; } my $edit_butt = '' ; my $del_butt = '' ; if ($useropts{boss}{lc $username}){ $edit_butt = qq( ) ; $del_butt = qq() ; } $print_tbody .= qq(
Upload file from PC.