X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fmisc%2Forder_pkg.html;h=4f511cc36c51d97b0a2c0edf3562cecc543d7ef5;hp=c81f5b06f27be2b5ed54b26ea30205df1cc7d396;hb=ee953407088b8f71cf671aeb88fa6f227a4f109c;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index c81f5b06f..4f511cc36 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -1,62 +1,155 @@ <% include('/elements/header-popup.html', 'Order new package' ) %> - + + + + + + + +<% include('/elements/error.html') %>
+ +% if ( $svcpart ) { + +% } <% ntable("#cccccc", 2) %> - - Package - - + + Package + <% $part_pkg->pkg_comment |h %> + +% } else { + <% include('/elements/tr-select-cust-part_pkg.html', + 'curr_value' => $pkgpart, + 'classnum' => -1, + 'cust_main' => $cust_main, + 'onchange' => 'enable_order_pkg', + ) + %> +% } -%foreach my $part_pkg ( -% qsearch( 'part_pkg', { 'disabled' => '' }, '', -% ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '. -% ' WHERE typenum = '. $cust_main->agent->typenum. -% ' AND type_pkgs.pkgpart = part_pkg.pkgpart )' -% ) -%) { + + Start date + + <% include('/elements/input-date-field.html',{ + 'name' => 'start_date', + 'format' => $date_format, + 'value' => $start_date, + 'noinit' => 1, + }) %> + (leave blank to start immediately) + + -
+ + <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Order customer package'); + my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; +$cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum"; my $custnum = $1; my $cust_main = qsearchs({ 'table' => 'cust_main', @@ -64,4 +157,25 @@ my $cust_main = qsearchs({ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); +my $part_pkg = ''; +if ( $cgi->param('lock_pkgpart') ) { + $part_pkg = qsearchs({ + 'table' => 'part_pkg', + 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) }, + 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ), + }) + or die "unknown pkgpart ". $cgi->param('lock_pkgpart'); +} + +my $pkgpart = $part_pkg ? $part_pkg->pkgpart : scalar($cgi->param('pkgpart')); + +my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi? +my $start_date = ''; +if( ! $conf->exists('order_pkg-no_start_date') ) { + $start_date = $cust_main->next_bill_date; + $start_date = $start_date ? time2str($format, $start_date) : ''; +} + +my $svcpart = scalar($cgi->param('svcpart')); +