diff options
author | ivan <ivan> | 2009-08-07 00:39:14 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-08-07 00:39:14 +0000 |
commit | 958afb8d05de67e12df258b57bedcf85028b6253 (patch) | |
tree | 504079330e2f553faf8a899dd8dcebe3d5d138d6 | |
parent | b3e081bbd2ba95554687a531bc134c00026a3669 (diff) |
don't start recurring billing when a start date hasn't been reached yet either... and since that works, add the start date to new package order, RT#5347
-rw-r--r-- | FS/FS/cust_main.pm | 7 | ||||
-rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 4 | ||||
-rw-r--r-- | httemplate/elements/tr-input-date-field.html | 15 | ||||
-rw-r--r-- | httemplate/misc/order_pkg.html | 37 | ||||
-rwxr-xr-x | httemplate/view/cust_main/packages.html | 1 |
5 files changed, 55 insertions, 9 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index becb9054b..8cd03ebc6 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2857,9 +2857,10 @@ sub _make_lines { my $recur = 0; my $unitrecur = 0; my $sdate; - if ( ! $cust_pkg->getfield('susp') and - ( $part_pkg->getfield('freq') ne '0' && - ( $cust_pkg->getfield('bill') || 0 ) <= $time + if ( ! $cust_pkg->get('susp') + and ! $cust_pkg->get('start_date') + and ( $part_pkg->getfield('freq') ne '0' + && ( $cust_pkg->getfield('bill') || 0 ) <= $time ) || ( $part_pkg->plan eq 'voip_cdr' && $part_pkg->option('bill_every_call') diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 57c696e7e..7a0f08280 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -49,6 +49,10 @@ my $locationnum = $1; my $cust_pkg = new FS::cust_pkg { 'custnum' => $custnum, 'pkgpart' => $pkgpart, + 'start_date' => ( scalar($cgi->param('start_date')) + ? str2time($cgi->param('start_date')) + : '' + ), 'refnum' => $refnum, 'locationnum' => $locationnum, }; diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html index 11581d5bc..428221a5c 100644 --- a/httemplate/elements/tr-input-date-field.html +++ b/httemplate/elements/tr-input-date-field.html @@ -28,12 +28,15 @@ my($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) - unless $value eq ''; -}else{ - $value = time2str($format, $value); +if ( $value =~ /\S/ ) { + if ( $usedatetime ) { + my $dt = DateTime->from_epoch(epoch => $value, time_zone => 'floating'); + $value = $dt->strftime($format); + } else { + $value = time2str($format, $value); + } +} else { + $value = ''; } </%init> diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 9caa57a69..a7571ca58 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -1,5 +1,10 @@ <% include('/elements/header-popup.html', 'Order new package' ) %> +<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> + <SCRIPT TYPE="text/javascript"> function enable_order_pkg () { @@ -27,6 +32,34 @@ ) %> +%# false laziness w/edit/quick-charge.html +<TR> + <TH ALIGN="right">Start date </TD> + <TD COLSPAN=6> + <INPUT TYPE = "text" + NAME = "start_date" + SIZE = 32 + ID = "start_date_text" + VALUE = "<% $start_date %>" + > + <IMG SRC = "../images/calendar.png" + ID = "start_date_button" + STYLE = "cursor: pointer" + TITLE = "Select date" + > + <FONT SIZE=-1>(leave blank to start immediately)</FONT> + </TD> +</TR> + +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "start_date_text", + ifFormat: "%m/%d/%Y", + button: "start_date_button", + align: "BR" + }); +</SCRIPT> + % if ( $conf->exists('pkg_referral') ) { <% include('/elements/tr-select-part_referral.html', 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum, @@ -68,4 +101,8 @@ my $cust_main = qsearchs({ my $pkgpart = scalar($cgi->param('pkgpart')); +my $format = "%m/%d/%Y %T %z (%Z)"; #false laziness w/REAL_cust_pkg.cgi? +my $start_date = $cust_main->next_bill_date; +$start_date = $start_date ? time2str($format, $start_date) : ''; + </%init> diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index 8fbefae50..16adc8c5f 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -9,6 +9,7 @@ 'cust_main' => $cust_main, 'closetext' => 'Close', 'width' => 763, + 'height' => 350, ) %> % } |