2025-11-26 09:31:54 +00:00
#!/usr/bin/perl
BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
require cfg ;
# unless ($username eq 'handre') { print "<<<<<<<<<<<< MAINTENANCE IN PROGRESS >>>>>>>>>" ; exit ; }
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
use CGI::Carp qw( fatalsToBrowser ) ;
use CGI ;
use Crypt::PasswdMD5 ;
use Date::Calc qw( :all ) ;
use Excel::Writer::XLSX ;
& today ;
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ 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 ;
our $ event_id = 0 ;
our $ changed_by = 0 ;
our $ open_new_tab = qq~target="_blank"~ ;
if ( $ action eq 'view' ) {
$ event_id = $ ARGV [ 1 ] ;
$ changed_by = $ ARGV [ 2 ] ;
}
#-------- page opts --------------------------------------------------------------------------------------------------------------------------------------------------
& page_opts ;
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
print "Content-type: text/html\n\n" ;
if ( $ iaction eq 'view' ) {
& list_screen ;
& screen2 ;
} elsif ( $ iaction eq 'report' ) {
& common_min_load_params ;
& report_ifields ;
& list_screen ;
& screen3 ;
}
& common_min_action ;
exit ;
#------------------------------------------------------------------------------------------
sub validate {
# &users_validate;
} #------------------------------------------------------------------------------------------
sub insert {
# &users_insert ;
} #------------------------------------------------------------------------------------------
sub update {
# &users_update ;
} #------------------------------------------------------------------------------------------
sub process_multi_select {
# &users_process_multi_select ;
} #------------------------------------------------------------------------------------------
sub report_screen {
# &filter_screen if $ENV{QUERY_STRING} eq 'filter' ;
our $ lcol = 2 ;
our $ fcol = 5 ;
# my ($set_year,$set_month,$set_day) = Add_Delta_Days($now_year,$now_mm,$now_dd,-42) ; # 6 weeks back
# $set_month = sprintf("%02s", $set_month) ;
# $set_day = sprintf("%02s", $set_day) ;
# my $set_ccyy_dd_mm = $set_year . '-' . $set_month . '-' . $set_day ;
$ print_box_content_rows . = & common_min_forms_start ( 'report' ) ;
$ allow_deselect { event } = 1 ;
$ allow_deselect { changed_by } = 1 ;
$ preferred_title { event_from } = 'Event Date From' ;
$ print_box_content_rows . = & common_min_form_datetimepicker ( 'event_from' , "$now_year-$now_mm-$now_dd 00:00:00" , 720 ) ;
$ preferred_title { event_to } = 'Event Date To' ;
$ print_box_content_rows . = & common_min_form_datetimepicker ( 'event_to' , "$now_year-$now_mm-$now_dd 23:59:59" , 0 ) ;
& common_min_select_opts ( 'changed_by' , 'users' , 'name' , '' , '' , '' , "`user_type` <> 'casual_a' AND `user_type` <> 'casual_calibrator' AND `user_type` <> 'installation_partner' AND `username` NOT LIKE 'handre%' AND `username` NOT LIKE 'rory%'" , '' , '' , '' , 'name' ) ;
& common_min_select_opts ( 'event' , 'event_quotes' , 'ref' , '' , '' , 'id' , "" , '' , '' , '' , 'ref' ) ;
# $preferred_title{region_id} = "Region" ;
# $print_box_content_rows .= &common_min_form_select('system_id','') ;
$ print_box_content_rows . = & common_min_form_select ( 'event' , '' ) ;
$ print_box_content_rows . = & common_min_form_select ( 'changed_by' , '' ) ;
$ print_box_content_rows . = & common_min_forms_end ( '' , '' , 'report' ) ;
local $ all_select_ids_string = join ( "," , @ all_select_ids ) ;
$ trigger_jquery_raw . = qq~\$("$all_select_ids_string").chosen({ allow_single_deselect:true });~ ;
& common_min_search_screen ;
} #-------------------------------------------------------------------------------
sub report_ifields {
} #-------------------------------------------------------------------------------
sub list_screen {
# my $file_path = "$cgipath/data/logs/events/changes.dat" ;
# open(my $fh, '<', $file_path) or die "Could not open file '$file_path' $!";
my $ prev_line = qq~~ ; my $ line_cnt = 0 ; my % audit_data = ( ) ; my % leng = ( ) ;
my $ event_from_val = $ i { event_from } ;
my $ event_to_val = $ i { event_to } ;
$ event_from_val =~ s/[:\- ]//g ;
$ event_to_val =~ s/[:\- ]//g ;
& db_min_ro ( 'event_quotes_changes' , 'id,changes' , '' , '' , '' ) ;
foreach my $ id ( sort { $ b <=> $ a } keys % { $ db { event_quotes_changes } } ) {
my $ line = $ db { event_quotes_changes } { $ id } { changes } ;
# while (my $line = <$fh>) {
2026-02-03 12:35:43 +00:00
$ event_quotes_categories = 1 if $ line =~ /category_id_1=/ || $ line =~ /category_id_2=/ ;
$ countries = 1 if $ line =~ /country_id=/ ;
$ users = 1 if $ line =~ /operator_ids=/ ;
$ sport_types = 1 if $ line =~ /sport_type_ids=/ ;
$ customers = 1 if $ line =~ /quote_to=/ ;
$ organisations = 1 if $ line =~ /organisation_ids=/ ;
$ cities = 1 if $ line =~ /city_id=/ ;
$ event_types = 1 if $ line =~ /type=/ ;
$ event_type_details = 1 if $ line =~ /type_details_id=/ ;
$ event_cost_items = 1 if $ line =~ /description_workings_event=/ || $ line =~ /description_costing_event=/ || $ line =~ /item_costing_event=/ ;
$ clubs = 1 if $ line =~ /club_ids=/ ;
$ event_systems = 1 if $ line =~ /event_system_id_multiple=/ ;
$ poc_exists = 1 if $ line =~ /poc_id=/ && $ line !~ /poc_id='0'/ && $ line !~ /poc_id=''/ ;
$ recipient_exists = 1 if $ line =~ /recipient_id=/ && $ line !~ /recipient_id='0'/ && $ line !~ /recipient_id=''/ ;
$ region_id_exists = 1 if $ line =~ /region_id=/ && $ line !~ /region_id='0'/ && $ line !~ /region_id=''/ ;
2025-11-26 09:31:54 +00:00
my @ line_split = split ( /\|/ , $ line ) ;
$ line_split [ 0 ] = substr ( $ line_split [ 0 ] , 4 ) ;
# print "\n $line_split[3]" ;
next if $ i { event_from } && $ event_from_val > $ line_split [ 0 ] ;
next if $ i { event_to } && $ event_to_val < $ line_split [ 0 ] ;
next if $ line_split [ 2 ] =~ /camera_system_id/ ;
my @ user_s = split ( /\=/ , $ line_split [ 3 ] ) ;
my @ event_id_s = split ( /\=/ , $ line_split [ 2 ] ) ;
my $ user_changed = $ user_s [ 1 ] ;
$ user_changed =~ s/\'//g ;
my $ event_id = $ event_id_s [ 1 ] ;
$ event_id =~ s/\'//g ;
next if $ i { event } && $ i { event } ne $ event_id ;
next if $ i { changed_by } && $ i { changed_by } ne $ user_changed ;
my $ nr_of_splits = scalar @ line_split ;
my $ line_of_changes = qq~~ ;
if ( $ nr_of_splits == 6 ) {
$ line_of_changes = $ line_split [ - 1 ] ;
} elsif ( $ line_split [ 4 ] =~ /changed_from/ || $ line_split [ 4 ] =~ /action='Edit'/ || $ line_split [ 4 ] =~ /action='Add'/ ) {
for ( 5 .. $ nr_of_splits - 1 ) {
$ line_of_changes . = qq~$line_split[$_]|~ ;
}
chop $ line_of_changes if $ line_of_changes ;
} else {
for ( 4 .. $ nr_of_splits - 1 ) {
$ line_of_changes . = qq~$line_split[$_]|~ ;
}
chop $ line_of_changes if $ line_of_changes ;
}
$ audit_data { data } { $ event_id } { $ line_split [ 1 ] } = $ line_of_changes ;
$ audit_data { user } { $ event_id } { $ line_split [ 1 ] } = $ user_changed ;
if ( $ line_split [ 4 ] eq 'changed_from' ) {
$ audit_data { changed_from } { $ event_id } { $ line_split [ 1 ] } = 1 ;
}
}
& db_open_ro ;
$ db_ignore_open_close = 1 ;
& load_vars ;
$ db_ignore_open_close = 0 ;
& db_close_conn ;
close ( $ fh ) ;
foreach my $ event_id ( sort { $ b <=> $ a } keys % { $ audit_data { data } } ) {
# next if $db{event_quotes}{$event_id}{id} ;
foreach my $ date_updated ( sort { $ b cmp $ a } keys % { $ audit_data { data } { $ event_id } } ) {
foreach my $ changed_field ( split ( /,/ , $ audit_data { data } { $ event_id } { $ date_updated } ) ) {
chomp $ changed_field ;
2026-02-03 12:35:43 +00:00
2025-11-26 09:31:54 +00:00
my @ field_split = split ( /\=/ , $ changed_field ) ;
# next if ((!$prev_field_val{$field_split[0]} || $prev_field_val{$field_split[0]} eq "''" || $prev_field_val{$field_split[0]} eq "'0'") && ($field_split[1] eq "''" || $field_split[1] eq "'0'")) || $field_split[0] eq 'last_update' || $field_split[0] eq 'id' || $field_split[0] eq 'quote_nr' ;
2026-02-03 12:35:43 +00:00
next if $ field_split [ 1 ] eq "''" || ( $ field_split [ 1 ] eq "'0'" && $ field_split [ 0 ] ne 'custom_set' ) || $ field_split [ 0 ] eq 'last_update' || $ field_split [ 0 ] eq 'id' || $ field_split [ 0 ] eq 'quote_nr' ; # $field_split[0] eq 'sub_total' || $field_split[0] eq 'grand_total' || $field_split[0] eq 'vat_total' || $field_split[0] eq 'total_amount_workings_event' || $field_split[0] eq 'total_grand_amount_workings_event' || $field_split[0] eq 'total_vat_amount_workings_event' || $field_split[0] eq 'total_grand_amount_workings_event' ;
2025-11-26 09:31:54 +00:00
if ( $ changed_field =~ /=/ && ( $ seen_data_field { $ event_id } { $ field_split [ 0 ] } || $ audit_data { changed_from } { $ event_id } { $ date_updated } ) ) {
$ field_split [ 1 ] =~ s/\'//g ;
2026-02-03 12:35:43 +00:00
# print "\n 1 field_split : $field_split[0] = $field_split[1]" if $field_split[0] eq 'ref' ;
2025-11-26 09:31:54 +00:00
if ( $ field_split [ 0 ] eq 'custom_set' ) {
$ field_split [ 1 ] = ( $ field_split [ 1 ] eq "1" ) ? "Yes" : "No" ;
} elsif ( $ field_split [ 0 ] eq 'club_ids' ) {
$ field_split [ 1 ] = join ";" , map { "$db{clubs}{$_}{name}" } split ";" , $ field_split [ 1 ] ;
} elsif ( $ field_split [ 0 ] eq 'event_system_id_multiple' ) {
$ field_split [ 1 ] = join ";" , map { "$db{event_systems}{$_}{name} [$db{event_systems}{$_}{description}]" } split ";" , $ field_split [ 1 ] ;
$ field_split [ 0 ] = 'event_systems'
} elsif ( $ field_split [ 0 ] eq 'operator_ids' ) {
while ( $ field_split [ 1 ] =~ /(\d+)/g ) {
my $ op_id = $ 1 ;
$ field_split [ 1 ] =~ s/\d+/$db{users}{$op_id}{name}/g ;
last ;
}
} elsif ( $ field_split [ 0 ] eq 'sport_type_ids' ) {
while ( $ field_split [ 1 ] =~ /(\d+)/g ) {
my $ op_id = $ 1 ;
$ field_split [ 1 ] =~ s/\d+/$db{sport_types}{$op_id}{name}/g ;
last ;
}
} elsif ( $ field_split [ 0 ] eq 'city_id' ) {
while ( $ field_split [ 1 ] =~ /(\d+)/g ) {
my $ op_id = $ 1 ;
$ field_split [ 1 ] =~ s/\d+/$db{cities}{$op_id}{city}/g ;
last ;
}
} elsif ( $ field_split [ 0 ] eq 'organisation_ids' ) {
while ( $ field_split [ 1 ] =~ /(\d+)/g ) {
my $ op_id = $ 1 ;
$ field_split [ 1 ] =~ s/\d+/$db{organisations}{$op_id}{name}/g ;
last ;
}
} elsif ( $ field_split [ 0 ] eq 'type_details_id' ) {
while ( $ field_split [ 1 ] =~ /(\d+)/g ) {
my $ op_id = $ 1 ;
$ field_split [ 1 ] =~ s/\d+/$db{event_type_details}{$op_id}{name}/g ;
last ;
}
} elsif ( $ field_split [ 0 ] eq 'description_workings_event' || $ field_split [ 0 ] eq 'description_costing_event' ) {
$ field_split [ 1 ] = join ";" , map { "$db{event_cost_items}{$_}{name}" } split ";" , $ field_split [ 1 ] ;
} elsif ( $ field_split [ 0 ] eq 'daily_operator_ids' ) {
my $ new_string = qq~~ ; my $ system_cnt = 0 ;
foreach my $ system_ops ( split ( "|" , $ field_split [ 1 ] ) ) {
$ system_cnt + + ;
next if $ system_ops !~ /(\d+)/g ;
my $ sys_string = qq~~ ; my $ day_cnt = 0 ;
$ new_string . = qq~System $system_cnt : [~ ;
foreach my $ system_op_id ( split ( ";" , $ system_ops ) ) {
$ day_cnt + + ;
$ sys_string . = qq~Day $day_cnt : $db{users}{$system_op_id}{name};~ if $ system_op_id ; ;
}
chop $ sys_string if $ sys_string ;
$ sys_string . = qq~];~ ;
}
chop $ sys_string if $ sys_string ;
$ field_split [ 1 ] = qq~$sys_string~ ;
} elsif ( $ field_split [ 0 ] eq 'qty' ) {
$ field_split [ 0 ] = "Actual Days" ;
} elsif ( $ field_split [ 0 ] eq 'type' ) {
$ field_split [ 1 ] = $ db { event_types } { $ field_split [ 1 ] } { name } ;
} elsif ( $ field_split [ 0 ] eq 'operator_workings_event' ) {
$ field_split [ 1 ] = join ";" , map { "$db{users}{$_}{name}" } split ";" , $ field_split [ 1 ] ;
} elsif ( $ field_split [ 0 ] eq 'days_active' ) {
my $ days_active_str = qq~~ ; my $ day_cnt = 0 ;
foreach my $ days_active ( split ( ";" , $ field_split [ 1 ] ) ) {
$ day_cnt + + ;
$ days_active_str . = qq~Day $day_cnt;~ if $ days_active ;
}
chop $ days_active_str if $ days_active_str ;
$ field_split [ 1 ] = $ days_active_str ;
} elsif ( $ field_split [ 0 ] eq 'event_length' ) {
$ full_half_day { 1 } = "Full Day" ;
$ full_half_day { 2 } = "Half Day" ;
my $ day_cnt = 1 ;
$ field_split [ 1 ] = join ";" , map { "$full_half_day{$_}" } split ";" , $ field_split [ 1 ] ;
} elsif ( $ field_split [ 0 ] eq 'quote_to' ) {
$ field_split [ 1 ] = $ db { customers } { $ field_split [ 1 ] } { name } ;
} elsif ( $ field_split [ 0 ] eq 'country_id' ) {
$ field_split [ 1 ] = $ db { countries } { $ field_split [ 1 ] } { name } ;
} elsif ( $ field_split [ 0 ] eq 'quote_completed' || $ field_split [ 0 ] eq 'quote_accepted' || $ field_split [ 0 ] eq 'quote_pending' || $ field_split [ 0 ] eq 'quote_cancelled' || $ field_split [ 0 ] eq 'quote_rejected' ) {
$ field_split [ 1 ] =~ s/1/Yes/g ;
} elsif ( $ field_split [ 0 ] eq 'vat_workings_event' || $ field_split [ 0 ] eq 'excl_workings_event' || $ field_split [ 0 ] eq 'vat_costing_event' || $ field_split [ 0 ] eq 'excl_costing_event' ) {
$ field_split [ 1 ] =~ s/1/Yes/g ;
$ field_split [ 1 ] =~ s/0/No/g ;
} elsif ( $ field_split [ 0 ] eq 'category_id_1' || $ field_split [ 0 ] eq 'category_id_2' ) {
$ field_split [ 1 ] = $ db { event_quotes_categories } { $ field_split [ 1 ] } { category } ;
2026-02-03 12:35:43 +00:00
} elsif ( $ field_split [ 0 ] eq 'ref' ) {
$ field_split [ 0 ] = "Event Name" ;
} elsif ( $ field_split [ 0 ] eq 'poc_id' ) {
$ field_split [ 1 ] = "$db{event_quotes_poc}{$field_split[1]}{name} [$db{event_quotes_poc}{$field_split[1]}{contact_nr}]" ;
} elsif ( $ field_split [ 0 ] eq 'recipient_id' ) {
$ field_split [ 1 ] = "$db{event_quotes_recipient}{$field_split[1]}{name} [$db{event_quotes_recipient}{$field_split[1]}{contact_nr}]" ;
} elsif ( $ field_split [ 0 ] eq 'region_id' ) {
$ field_split [ 1 ] = $ db { regions } { $ field_split [ 1 ] } { name } ;
} elsif ( $ field_split [ 0 ] eq 'item_costing_event' ) {
$ field_split [ 1 ] = join ";" , map { "$db{event_cost_items}{$_}{name}" } split ";" , $ field_split [ 1 ] ;
2025-11-26 09:31:54 +00:00
} else {
next if $ field_split [ 1 ] !~ /\b\d+\b/ ;
}
# '502;713;620;621;614;612
$ field_split [ 0 ] =~ s/amount_usd_workings_event/Amount Expenses Tab/g ;
$ field_split [ 0 ] =~ s/amount_workings_event/Tot Amount Expenses Tab/g ;
# $field_split[0] =~ s/_costing_event/Costings Tab/g ;
$ field_split [ 0 ] =~ s/_workings_event/_expenses_tab/g ;
$ field_split [ 0 ] =~ s/_id//g ;
$ field_split [ 0 ] = join ' ' , map { ucfirst $ _ } split /_/ , $ field_split [ 0 ] ;
2026-02-03 12:35:43 +00:00
2025-11-26 09:31:54 +00:00
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~'<br>$field_split[0]='$field_split[1]~ ;
} elsif ( ( ! $ field_split [ 1 ] && $ changed_field !~ /=/ ) && $ seen_data_field { $ event_id } { $ prev_field } ) {
$ field_split [ 0 ] =~ s/\'//g ;
if ( $ prev_field eq 'Operators' ) {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~;$db{users}{$field_split[0]}{name}~ ;
} elsif ( $ prev_field eq 'Sport Types' ) {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~;$db{sport_types}{$field_split[0]}{name}~ ;
} elsif ( $ prev_field eq 'City' ) {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~;$db{cities}{$field_split[0]}{city}~ ;
} elsif ( $ prev_field eq 'Organisations' ) {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~;$db{organisations}{$field_split[0]}{name}~ ;
} elsif ( $ prev_field eq 'Type Details' ) {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~;$db{event_type_details}{$field_split[0]}{name}~ ;
} else {
$ audit_data { refined_data } { $ event_id } { $ date_updated } . = qq~,$field_split[0]~ ;
}
}
$ seen_data_field { $ event_id } { $ field_split [ 0 ] } = 1 if $ changed_field =~ /=/ ;
$ prev_field = $ field_split [ 0 ] if $ changed_field =~ /=/ ;
$ prev_field_val { $ field_split [ 0 ] } = $ field_split [ 1 ] if $ changed_field =~ /=/ ;
}
}
}
2026-02-03 12:35:43 +00:00
our $ xlsx_title_heading = "Audit Trail Report" ;
our $ xlsxdir = "audit_trail" ;
our $ xlsxreportname = "Audit_Trail_Report" ;
2025-11-26 09:31:54 +00:00
our @ sql_col_display = ( "nr" , "event" , "date_changed" , "changed_by" , "changed_from" ) ;
& report_xlsx_export_header ( "$xlsxreportname" , $ xlsxdir , '' , $ xlsx_title_heading ) ;
$ xlsxrow - - ;
my $ formatting = $ format84 ;
foreach my $ event_id ( sort { $ b <=> $ a } keys % { $ audit_data { refined_data } } ) {
my $ button = & common_min_get_event_quote_button ( $ event_id ) ;
foreach my $ date_updated ( sort { $ b cmp $ a } keys % { $ audit_data { refined_data } { $ event_id } } ) {
# chop $audit_data{refined_data}{$event_id}{$date_updated} if $audit_data{refined_data}{$event_id}{$date_updated} ;
$ audit_data { refined_data } { $ event_id } { $ date_updated } = substr ( $ audit_data { refined_data } { $ event_id } { $ date_updated } , 5 ) . "'" ;
next unless $ audit_data { refined_data } { $ event_id } { $ date_updated } ;
my $ blanks_excluded = qq~~ ;
foreach ( split ( "<br>" , $ audit_data { refined_data } { $ event_id } { $ date_updated } ) ) {
my @ split = split ( "=" , $ _ ) ;
$ blanks_excluded . = qq~$_<br>~ if $ split [ 1 ] =~ /\b\d+\b/ || $ split [ 1 ] =~ /[a-zA-Z]/ ;
}
$ blanks_excluded = substr ( $ blanks_excluded , 0 , - 4 ) ;
next unless $ blanks_excluded ;
$ print_tbody . = qq ~
< tr id = "$event_id" >
<td> $ button </td>
<td> $ db { event_quotes } { $ event_id } { ref } </td>
< td nowrap > $ date_updated </td>
<td> $ db { users } { $ audit_data { user } { $ event_id } { $ date_updated } } { name } </td>
<td> $ blanks_excluded </td>
</tr>
~ ;
& xlsxcreator_write_xlsx ( $ ws , $ xlsxrow , 0 , $ event_id , $ formatting ) ;
& xlsxcreator_write_xlsx ( $ ws , $ xlsxrow , 1 , $ db { event_quotes } { $ event_id } { ref } , $ formatting ) ;
& xlsxcreator_write_xlsx ( $ ws , $ xlsxrow , 2 , $ date_updated , $ formatting ) ;
& xlsxcreator_write_xlsx ( $ ws , $ xlsxrow , 3 , $ db { users } { $ audit_data { user } { $ event_id } { $ date_updated } } { name } , $ formatting ) ;
foreach ( split ( "<br>" , $ blanks_excluded ) ) {
& xlsxcreator_write_xlsx ( $ ws , $ xlsxrow , 4 , $ _ , $ formatting ) ;
$ xlsxrow + + ;
}
# $xlsxrow++ ;
}
#
}
& report_xlsx_export_footer ( 'E' , 15 , $ xlsxdir ) ;
} #------------------------------------------------------------------------------------------
sub load_vars {
& db_min_ro ( 'event_quotes_categories' , '*' , '' , '' , '' ) if $ event_quotes_categories ;
& db_min_ro ( 'countries' , 'id,name' , '' , '' , '' ) if $ countries ;
& db_min_ro ( 'users' , 'id,name' , '' , '' , '' ) if $ users ;
& db_min_ro ( 'sport_types' , 'id,name' , '' , '' , '' ) if $ sport_types ;
& db_min_ro ( 'customers' , 'id,name' , '' , '' , '' ) if $ customers ;
& db_min_ro ( 'organisations' , 'id,name' , '' , '' , '' ) if $ organisations ;
& db_min_ro ( 'cities' , 'id,city' , '' , '' , '' ) if $ cities ;
& db_min_ro ( 'event_types' , 'id,name' , '' , '' , '' ) if $ event_types ;
& db_min_ro ( 'event_type_details' , 'id,name' , '' , '' , '' ) if $ event_type_details ;
& db_min_ro ( 'event_cost_items' , 'id,name' , '' , '' , '' ) if $ event_cost_items ;
& db_min_ro ( 'clubs' , 'id,name' , '' , '' , '' ) if $ clubs ;
& db_min_ro ( 'event_systems' , 'id,name,description' , '' , '' , '' ) if $ event_systems ;
2026-02-03 12:35:43 +00:00
& db_min_ro ( 'event_quotes_poc' , '*' , '' , '' , '' ) if $ poc_exists ;
& db_min_ro ( 'event_quotes_recipient' , '*' , '' , '' , '' ) if $ recipient_exists ;
& db_min_ro ( 'regions' , 'id,name' , '' , '' , '' ) if $ region_id_exists ;
2025-11-26 09:31:54 +00:00
& db_min_ro ( 'event_quotes' , 'id,ref,quote_completed,quote_accepted,quote_rejected,quote_cancelled,quote_created,quote_pending,event_system_id_multiple,fixed_system_overall_status' , "" , '' , '' ) ;
# &db_min_ro('event_quotes','id',"ref LIKE '% test %' OR ref LIKE 'test %' OR ref LIKE '% test' OR ref LIKE '%testing%'",'','') ;
} #------------------------------------------------------------------------------------------
sub sort_fields {
& users_sort_fields ;
} #-------------------------------------------------------------------------------
sub add_db_fields {
# &users_add_db_fields ;
} #------------------------------------------------------------------------------------------
sub edit_db_fields {
# &users_edit_db_fields ;
} #------------------------------------------------------------------------------------------
sub add_screen {
# called from common_add_screen
# &users_add_screen ;
} #------------------------------------------------------------------------------------------
sub edit_screen {
# &users_edit_screen ;
} #------------------------------------------------------------------------------------------
sub thead {
$ print_thead = qq~<THEAD><TR><TH nowrap>Nr</TH><TH nowrap>Event</TH><TH>Date Changed</TH><TH>Changed By</TH><TH>Changed From</TH></TR></THEAD>~ ;
} #-------------------------------------------------------------------------------
sub page_opts {
our $ glyphicon = 'list' ;
2026-02-03 12:35:43 +00:00
our $ lcpage = 'audit-trail' ; $ ucpage = uc $ lcpage ; $ ucfirstpage = ucfirst $ lcpage ;
2025-11-26 09:31:54 +00:00
# our $table = 'users' ;
# our $user_type = 'casual' ;
2026-02-03 12:35:43 +00:00
$ page_title = "Audit Trail" ;
2025-11-26 09:31:54 +00:00
# &common_min_add_extras ;
} #-------------------------------------------------------------------------------
sub screen2 {
& thead ;
if ( $ isaved ) { $ alert = & common_min_alert ( 'success' , "$ucpage $isaved!" , 'ok' ) ; } else { & common_min_alert_type ; }
my $ page = "event-quotes" ; if ( $ s { no } ) { $ page = $ lcpage ; }
& common_min_table ( 'id' , $ page , 'list' , '' , 1 ) ;
# &common_min_alert_type ;
# &common_min_footer('id','') ;
& common_min_dialog ;
print << ENDOFTEXT ;
$ dialog { 'common' } { 'head' }
< div id = "content" class = "col-lg-12 col-sm-12" >
< ! - - content starts - - >
$ print_top
< div class = "row" >
< div class = "box col-md-12" >
$ events_content
</div>
<!--/span-->
</div> <!--/row-->
< div class = "row" >
< div class = "box col-md-12" >
< div class = "box-inner" >
< div class = "box-header well" data - original - title = "" >
<h2> < i class = "glyphicon glyphicon-tasks" > </i> $ boxtitle Changes </h2>
</div>
< div class = "box-content" >
$ print_box_content_rows
</div>
</div>
</div>
</div> <!--/row-->
</div> <!--/row-->
</div> <!--/fluid-row-->
</div> <!--/.fluid-container-->
< ! - - external javascript - - >
<style> body { font - size: 14 px ; } . control - label { font - size: 14 px ; } </style>
< link href = "$useropts{'css'}/bootstrap-dialog.css" rel = 'stylesheet' >
$ dialog { 'common' } { 'js' }
< script src = "$useropts{'js'}/bootstrap-datetimepicker.min.js" > </script>
< script src = "$useropts{'js'}/jquery.form-validator.min.js" > </script>
< script src = "$useropts{'js'}/bootstrap-dialog.js" > </script>
<script>
\ $ . validate ( ) ;
\ $ ( document ) . ready ( function ( ) {
$ trigger_jquery
} ) ;
$ trigger_jquery_raw
</script>
$ print_footer_jscript
$ print_footer_forms
</body>
</html>
ENDOFTEXT
#
exit ;
} #------------------------------------------------------------------------------------------
sub screen3 {
& thead ;
if ( $ isaved ) { $ alert = & common_min_alert ( 'success' , "$ucpage $isaved!" , 'ok' ) ; } else { & common_min_alert_type ; }
my $ page = "event-quotes" ; if ( $ s { no } ) { $ page = $ lcpage ; }
& common_min_table ( 'id' , $ page , 'list' ) ;
# &common_min_extra_crumb("manage-$lcpage\s","Manage $ucfirstpage\s") ;
require _blank ;
exit ;
} #------------------------------------------------------------------------------------------
use common ;
use today ;
use report ;
use xlsxcreator ;
# use users ;
1 ;