X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Forder_pkg.html;h=2332f20281f208b6a766622d20bf45076a791b9d;hb=dfba562ff61f541ba7c75f2c02b32951b73aa002;hp=c81f5b06f27be2b5ed54b26ea30205df1cc7d396;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index c81f5b06f..2332f2028 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -1,62 +1,149 @@ -<% include('/elements/header-popup.html', 'Order new package' ) %> - - +<& /elements/header-popup.html, mt('Order new package') &> + + + + + + + + +<& /elements/error.html &>
+ +% if ( $svcpart ) { + +% } <% ntable("#cccccc", 2) %> - - Package - - + + <% mt('Package') |h %> + <% $part_pkg->pkg_comment |h %> + +% } else { + <& /elements/tr-select-cust-part_pkg.html, + 'curr_value' => $pkgpart, + 'classnum' => -1, + 'cust_main' => $cust_main, + &> +% } -%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 )' -% ) -%) { + + <% mt('Start date') |h %> + + <& /elements/input-date-field.html,{ + 'name' => 'start_date', + 'format' => $date_format, + 'value' => $start_date, + 'noinit' => 1, + } &> + (<% mt('leave blank to start immediately') |h %>) + + -
+ + <%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 +151,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')); +