68 lines
1.9 KiB
Perl
68 lines
1.9 KiB
Perl
#!/usr/bin/perl
|
|
|
|
BEGIN { use lib '/usr/home/cfg' ; require push_inc ; }
|
|
|
|
print "Content-type: text/html\n\n";
|
|
|
|
use CGI::Carp qw(fatalsToBrowser);
|
|
use Fcntl qw(:flock);
|
|
use JSON::Repair ':all';
|
|
|
|
require cfg ;
|
|
|
|
#------------------------------------------------------------------------------------------
|
|
|
|
@ARGV = split(/\\*\&/, $ENV{'QUERY_STRING'});
|
|
|
|
foreach $ARG (@ARGV) { ($par,$val) = split(/\=/,$ARG) ; $val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $param{$par} = $val ; }
|
|
|
|
# my $json_type = $param{json_type} ;
|
|
|
|
# e.g. https://itvadmin.co.za/cgi-bin/scripts/get/get_analytics_charge_client.pl?analytics_id=1001&row_cnt=1&reason='123'
|
|
|
|
our $debug = 1 ;
|
|
|
|
#------------------------------------------------------------------------------------------
|
|
|
|
&update_ ;
|
|
|
|
exit ;
|
|
|
|
#------------------------------------------------------------------------------------------
|
|
|
|
sub update_ {
|
|
|
|
exit if !$param{analytics_id} || !$param{row_cnt} || !$param{reason} ;
|
|
|
|
my $table = 'analytics_event_bookings' ;
|
|
|
|
&db_min_ro($table,'1,cant_charge_client_reasons',"id='$param{analytics_id}'",'','') if $param{analytics_id} ;
|
|
|
|
my @reasons = ($db{$table}{1}{cant_charge_client_reasons}) ? split(/\:\|;/,$db{$table}{1}{cant_charge_client_reasons}) : (undef) ;
|
|
|
|
%i = () ;
|
|
|
|
$param{reason} =~ s/\:\|;//g ;
|
|
|
|
$param{reason} =~ s/\_new_line_character_/\n/g ;
|
|
|
|
$param{reason} =~ s/_blank_space_/ /g ;
|
|
|
|
$#reasons = $param{row_cnt}-1 if $#reasons < $param{row_cnt}-1 ; # Pads with undef automatically
|
|
|
|
@reasons = map { defined($_) ? $_ : "" } @reasons ;
|
|
|
|
$reasons[$param{row_cnt}-1] = $param{reason} ;
|
|
|
|
$i{cant_charge_client_reasons} = join(":|;",@reasons) ;
|
|
|
|
$i{cant_charge_client_reasons} =~ s/\:\|;+$//g ;
|
|
|
|
&db_min_upd($table,"id='$param{analytics_id}'") ;
|
|
|
|
} #------------------------------------------------------------------------------------------
|
|
|
|
use db ;
|
|
use common ;
|
|
|
|
1; |