summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2009-08-07 23:08:03 +0000
committerivan <ivan>2009-08-07 23:08:03 +0000
commitc183de0b7e942672cafdc1c14a203e389ffd2c43 (patch)
tree87980978b6bd03281ac09538b0daed460bfb5a33 /httemplate/edit
parent958afb8d05de67e12df258b57bedcf85028b6253 (diff)
add ability to edit signup dates (turn on cust_main-edit_signupdate config), RT#4644
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_main.cgi3
-rw-r--r--httemplate/edit/cust_main/top_misc.html10
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi47
3 files changed, 46 insertions, 14 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 8b1d2b59c..15c9f45b2 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -56,7 +56,7 @@
% }
% }
-<BR><BR>
+<BR>
<FONT SIZE="+1"><B>Billing address</B></FONT>
<% include('cust_main/contact.html',
@@ -182,6 +182,7 @@ function samechanged(what) {
<INPUT TYPE="hidden" NAME="otaker" VALUE="<% $cust_main->otaker %>">
+%# cust_main/bottomfixup.js
% foreach my $hidden (
% 'payauto',
% 'payinfo', 'payinfo1', 'payinfo2', 'paytype',
diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/top_misc.html
index 5aaa0b0cc..041050664 100644
--- a/httemplate/edit/cust_main/top_misc.html
+++ b/httemplate/edit/cust_main/top_misc.html
@@ -71,6 +71,16 @@
<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">
% }
+%# signup date
+% if ( $conf->exists('cust_main-edit_signupdate') ) {
+ <% include('/elements/tr-input-date-field.html', {
+ 'name' => 'signupdate',
+ 'value' => $cust_main->signupdate,
+ 'label' => 'Signup date',
+ 'format' => $conf->config('date_format') || "%m/%d/%Y",
+ })
+ %>
+% }
</TABLE>
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 1709752fb..f72ca0a81 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -73,20 +73,41 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) {
);
}
-if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/) {
- my $format = $conf->config('date_format') || "%m/%d/%Y";
- my $parser = DateTime::Format::Strptime->new(pattern => $format,
- time_zone => 'floating',
- );
- my $dt = $parser->parse_datetime($1);
- if ($dt) {
- $new->setfield('birthdate', $dt->epoch);
- $cgi->param('birthdate', $dt->epoch);
- } else {
-# $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg;
- $error ||= "Invalid birthdate: " . $cgi->param('birthdate') . ".";
- $cgi->param('birthdate', '');
+my %usedatetime = ( 'birthdate' => 1 );
+
+foreach my $dfield (qw( birthdate signupdate )) {
+
+ if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) {
+
+ my $value = $1;
+ my $parsed = '';
+
+ if ( exists $usedatetime{$dfield} && $usedatetime{$dfield} ) {
+
+ my $format = $conf->config('date_format') || "%m/%d/%Y";
+ my $parser = DateTime::Format::Strptime->new( pattern => $format,
+ time_zone => 'floating',
+ );
+ my $dt = $parser->parse_datetime($value);
+ if ( $dt ) {
+ $parsed = $dt->epoch;
+ } else {
+ # $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg;
+ $error ||= "Invalid $dfield: $value";
+ }
+
+ } else {
+
+ $parsed = str2time($value)
+ or $error ||= "Invalid $dfield: $value";
+
+ }
+
+ $new->setfield( $dfield, $parsed );
+ $cgi->param( $dfield, $parsed );
+
}
+
}
$new->setfield('paid', $cgi->param('paid') )