'type' => 'checkbox',
},
+ {
+ 'key' => 'cust_main-edit_signupdate',
+ 'section' => 'UI',
+ 'descritpion' => 'Enable manual editing of the signup date.',
+ 'type' => 'checkbox',
+ },
+
{ key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
{ key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
% }
% }
-<BR><BR>
+<BR>
<FONT SIZE="+1"><B>Billing address</B></FONT>
<% include('cust_main/contact.html',
<INPUT TYPE="hidden" NAME="otaker" VALUE="<% $cust_main->otaker %>">
+%# cust_main/bottomfixup.js
% foreach my $hidden (
% 'payauto',
% 'payinfo', 'payinfo1', 'payinfo2', 'paytype',
<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>
);
}
-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') )
<%init>
-my($name, $value, $label, $format, $usedatetime) = @_;
+my($name, $value, $label, $format, $usedatetime);
+if ( ref($_[0]) ) {
+ my $opt = shift;
+ $name = $opt->{'name'};
+ $value = $opt->{'value'};
+ $label = $opt->{'label'};
+ $format = $opt->{'format'};
+ $usedatetime = $opt->{'usedatetime'};
+} else {
+ ($name, $value, $label, $format, $usedatetime) = @_;
+}
$format = "%m/%d/%Y" unless $format;
$label = $name unless $label;
if ( $usedatetime ) {
my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating');
$value = $dt->strftime($format);
- } else {
+ } elsif ( $value =~ /^\d+$/ ) {
$value = time2str($format, $value);
}
} else {