summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2010-04-09 08:18:24 +0000
committerivan <ivan>2010-04-09 08:18:24 +0000
commit2ab068f449eb97a10e18d20e9dab5ab9faa017e7 (patch)
treef1464912b3f3072cbb4290cfa2a4a26e32165676 /httemplate
parent4125a128eaa40c751c89a69c2f9888463a78c6f3 (diff)
fix date parsing when using international dates (package date edit), RT#8027
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/REAL_cust_pkg.cgi4
-rwxr-xr-xhttemplate/edit/cust_pay.cgi2
-rwxr-xr-xhttemplate/edit/process/REAL_cust_pkg.cgi10
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi2
-rwxr-xr-xhttemplate/edit/process/cust_pay.cgi2
-rw-r--r--httemplate/edit/process/quick-charge.cgi2
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi2
-rwxr-xr-xhttemplate/misc/process/cancel_pkg.html2
-rwxr-xr-xhttemplate/misc/process/delay_susp_pkg.html2
-rw-r--r--httemplate/search/elements/cust_main_dayranges.html2
-rwxr-xr-xhttemplate/search/pay_batch.cgi4
-rw-r--r--httemplate/search/report_prepaid_income.cgi2
-rw-r--r--httemplate/search/sqlradius.cgi8
13 files changed, 19 insertions, 25 deletions
diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi
index 29c8ca6..77ab1fe 100755
--- a/httemplate/edit/REAL_cust_pkg.cgi
+++ b/httemplate/edit/REAL_cust_pkg.cgi
@@ -187,9 +187,9 @@ if ( $cgi->param('error') ) {
$cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
die "No package!" unless $cust_pkg;
- foreach my $col (qw( setup last_bill bill adjourn expire )) {
+ foreach my $col (qw( start_date setup last_bill bill adjourn expire )) {
my $value = $cgi->param($col);
- $cust_pkg->set( $col, $value ? str2time($value) : '' );
+ $cust_pkg->set( $col, $value ? parse_datetime($value) : '' );
}
} else {
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi
index a6b73b1..cc4ec60 100755
--- a/httemplate/edit/cust_pay.cgi
+++ b/httemplate/edit/cust_pay.cgi
@@ -113,7 +113,7 @@ if ( $cgi->param('error') ) {
$paid = $cgi->param('paid');
$payby = $cgi->param('payby');
$payinfo = $cgi->param('payinfo');
- $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time;
+ $_date = $cgi->param('_date') ? parse_datetime($cgi->param('_date')) : time;
} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
$link = $cgi->param('popup') ? 'popup' : 'custnum';
$linknum = $1;
diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi
index b5796eb..570f0e0 100755
--- a/httemplate/edit/process/REAL_cust_pkg.cgi
+++ b/httemplate/edit/process/REAL_cust_pkg.cgi
@@ -19,13 +19,8 @@ die "access denied"
my $pkgnum = $cgi->param('pkgnum') or die;
my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
my %hash = $old->hash;
-$hash{'start_date'} = $cgi->param('start_date') ? str2time($cgi->param('start_date')) : '';
-$hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : '';
-$hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : '';
-$hash{'last_bill'} =
- $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : '';
-$hash{'adjourn'} = $cgi->param('adjourn') ? str2time($cgi->param('adjourn')) : '';
-$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : '';
+$hash{$_}= $cgi->param($_) ? parse_datetime($cgi->param($_)) : ''
+ foreach qw( start_date setup bill last_bill adjourn expire );
my @errors = ();
@@ -47,7 +42,6 @@ my $error;
if ( @errors ) {
$error = join(',', @errors);
} else {
- warn join(',',%hash);
$new = new FS::cust_pkg \%hash;
$error = $new->replace($old);
}
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index f72ca0a..1311ba4 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -98,7 +98,7 @@ foreach my $dfield (qw( birthdate signupdate )) {
} else {
- $parsed = str2time($value)
+ $parsed = parse_datetime($value)
or $error ||= "Invalid $dfield: $value";
}
diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi
index a310c53..df506c6 100755
--- a/httemplate/edit/process/cust_pay.cgi
+++ b/httemplate/edit/process/cust_pay.cgi
@@ -39,7 +39,7 @@ $cgi->param('link') =~ /^(custnum|invnum|popup)$/
my $field = my $link = $1;
$field = 'custnum' if $field eq 'popup';
-my $_date = str2time($cgi->param('_date'));
+my $_date = parse_datetime($cgi->param('_date'));
my $new = new FS::cust_pay ( {
$field => $linknum,
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi
index 27921b8..484f6fc 100644
--- a/httemplate/edit/process/quick-charge.cgi
+++ b/httemplate/edit/process/quick-charge.cgi
@@ -58,7 +58,7 @@ unless ( $error ) {
'bill_now' => scalar($cgi->param('bill_now')),
'invoice_terms' => scalar($cgi->param('invoice_terms')),
'start_date' => ( scalar($cgi->param('start_date'))
- ? str2time($cgi->param('start_date'))
+ ? parse_datetime($cgi->param('start_date'))
: ''
),
'no_auto' => scalar($cgi->param('no_auto')),
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index 202d0a3..2fde17f 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -54,7 +54,7 @@ my $cust_pkg = new FS::cust_pkg {
'custnum' => $custnum,
'pkgpart' => $pkgpart,
'start_date' => ( scalar($cgi->param('start_date'))
- ? str2time($cgi->param('start_date'))
+ ? parse_datetime($cgi->param('start_date'))
: ''
),
'no_auto' => scalar($cgi->param('no_auto')),
diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html
index 669af9c..e17872c 100755
--- a/httemplate/misc/process/cancel_pkg.html
+++ b/httemplate/misc/process/cancel_pkg.html
@@ -44,7 +44,7 @@ my $date = time;
if ($method eq 'expire' || $method eq 'adjourn'){
#untaint date
$date = $cgi->param('date');
- str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
+ parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
$date = $1;
$method = ($method eq 'expire') ? 'cancel' : 'suspend';
}
diff --git a/httemplate/misc/process/delay_susp_pkg.html b/httemplate/misc/process/delay_susp_pkg.html
index c7cc7de..8649cc2 100755
--- a/httemplate/misc/process/delay_susp_pkg.html
+++ b/httemplate/misc/process/delay_susp_pkg.html
@@ -21,7 +21,7 @@ $cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum";
$pkgnum = $1;
#untaint date
-str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
+parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
my $date = $1;
$cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} );
diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html
index 9e4e86f..b3f1a2e 100644
--- a/httemplate/search/elements/cust_main_dayranges.html
+++ b/httemplate/search/elements/cust_main_dayranges.html
@@ -110,7 +110,7 @@ my $range_sub = delete($opt{'range_sub'}); #or die
my $offset = 0;
if($cgi->param('as_of')) {
- $offset = int((time - str2time($cgi->param('as_of'))) / 86400);
+ $offset = int((time - parse_datetime($cgi->param('as_of'))) / 86400);
$opt{'title'} .= ' ('.$cgi->param('as_of').')' if $offset > 0;
}
diff --git a/httemplate/search/pay_batch.cgi b/httemplate/search/pay_batch.cgi
index fb45287..ebd323e 100755
--- a/httemplate/search/pay_batch.cgi
+++ b/httemplate/search/pay_batch.cgi
@@ -97,12 +97,12 @@ my($begin, $end) = ( '', '' );
my @where;
if ( $cgi->param('beginning')
&& $cgi->param('beginning') =~ /^([ 0-9\-\/]{0,10})$/ ) {
- $begin = str2time($1);
+ $begin = parse_datetime($1);
push @where, "download >= $begin";
}
if ( $cgi->param('ending')
&& $cgi->param('ending') =~ /^([ 0-9\-\/]{0,10})$/ ) {
- $end = str2time($1) + 86399;
+ $end = parse_datetime($1) + 86399;
push @where, "download < $end";
}
diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi
index c0e2b80..bfb699b 100644
--- a/httemplate/search/report_prepaid_income.cgi
+++ b/httemplate/search/report_prepaid_income.cgi
@@ -84,7 +84,7 @@ my $actual_label = $legacy ? 'Actual ' : '';
my $time = time;
-my $now = $cgi->param('date') && str2time($cgi->param('date')) || $time;
+my $now = $cgi->param('date') && parse_datetime($cgi->param('date')) || $time;
$now =~ /^(\d+)$/ or die "unparsable date?";
$now = $1;
diff --git a/httemplate/search/sqlradius.cgi b/httemplate/search/sqlradius.cgi
index 29f3602..cca1211 100644
--- a/httemplate/search/sqlradius.cgi
+++ b/httemplate/search/sqlradius.cgi
@@ -100,11 +100,11 @@ die "access denied"
my( $beginning, $ending ) = ( '', '' );
if ( $cgi->param('stoptime_beginning')
&& $cgi->param('stoptime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
- $beginning = str2time($1);
+ $beginning = parse_datetime($1);
}
if ( $cgi->param('stoptime_ending')
&& $cgi->param('stoptime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
- $ending = str2time($1); # + 86399;
+ $ending = parse_datetime($1); # + 86399;
}
if ( $cgi->param('begin') && $cgi->param('begin') =~ /^(\d+)$/ ) {
$beginning = $1;
@@ -121,11 +121,11 @@ if ( $cgi->param('open_sessions') =~ /^(\d*)$/ ) {
my( $starttime_beginning, $starttime_ending ) = ( '', '' );
if ( $cgi->param('starttime_beginning')
&& $cgi->param('starttime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
- $starttime_beginning = str2time($1);
+ $starttime_beginning = parse_datetime($1);
}
if ( $cgi->param('starttime_ending')
&& $cgi->param('starttime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
- $starttime_ending = str2time($1); # + 86399;
+ $starttime_ending = parse_datetime($1); # + 86399;
}
my $cgi_svc_acct = '';