X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Forder_pkg.html;h=17db18714e1be2e4534f60da6b906121d011c643;hb=f6e967c7686cbf6381a88709ae50d859c521df20;hp=684f94e7c47a276d75901aebfa03c149716f4efd;hpb=2d5f9e43a60773a9b079e96c330cb9e0e089800a;p=freeside.git diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 684f94e7c..17db18714 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -9,9 +9,25 @@ function enable_order_pkg () { if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { - document.OrderPkgForm.submit.disabled = false; + document.OrderPkgForm.submitButton.disabled = false; + if ( document.OrderPkgForm.pkgpart.options[document.OrderPkgForm.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { + document.OrderPkgForm.discountnum.disabled = false; + } else { + document.OrderPkgForm.discountnum.disabled = true; + } } else { - document.OrderPkgForm.submit.disabled = true; + document.OrderPkgForm.submitButton.disabled = true; + document.OrderPkgForm.discountnum.disabled = true; + } + } + + function standardize_new_location() { + var form = document.OrderPkgForm; + var loc = form.locationnum; + if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){ + standardize_locations(); + } else { + form.submit(); } } @@ -22,46 +38,56 @@
+ +% if ( $svcpart ) { + +% } <% ntable("#cccccc", 2) %> -<% include('/elements/tr-select-cust-part_pkg.html', - 'curr_value' => $pkgpart, - 'classnum' => -1, - 'cust_main' => $cust_main, - 'onchange' => 'enable_order_pkg', - ) -%> - -%# false laziness w/edit/quick-charge.html +% if ( $part_pkg ) { + + + 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', + ) + %> +% } + Start date - - + <% include('/elements/input-date-field.html',{ + 'name' => 'start_date', + 'format' => $date_format, + 'value' => $start_date, + 'noinit' => 1, + }) %> (leave blank to start immediately) - +% if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) { +% my $what = lc(FS::payby->shortname($cust_main->payby)); + + Disable automatic <% $what %> charge + + +% } % if ( $curuser->access_right('Discount customer package') ) { - <% include('/elements/tr-select-discount.html') %> + <% include('/elements/tr-select-discount.html', + 'element_etc' => 'DISABLED', + 'colspan' => 7, + 'cgi' => $cgi, + ) + %> % } % if ( $conf->exists('pkg_referral') ) { @@ -74,16 +100,60 @@ %> % } -<% include('/elements/tr-select-cust_location.html', - 'cgi' => $cgi, - 'cust_main' => $cust_main, - ) -%> +% if ( $cgi->param('lock_locationnum') ) { + + + +% } else { + + <% include('/elements/tr-select-cust_location.html', + 'cgi' => $cgi, + 'cust_main' => $cust_main, + ) + %> + +% } + + + Contract end date + + <% include('/elements/input-date-field.html',{ + 'name' => 'contract_end', + 'format' => $date_format, + 'value' => '', + 'noinit' => 1, + }) %> + + +% unless ( $cgi->param('lock_locationnum') ) { + + <% include( '/elements/standardize_locations.html', + 'form' => "OrderPkgForm", + 'onlyship' => 1, + 'no_company' => 1, + 'callback' => 'document.OrderPkgForm.submit();', + ) + %> + +% } +
-> +% my $onclick = $cgi->param('lock_locationnum') +% ? 'document.OrderPkgForm.submit()' +% : 'standardize_new_location()'; + +>
@@ -96,6 +166,7 @@ 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'; $cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum"; my $custnum = $1; @@ -105,10 +176,25 @@ my $cust_main = qsearchs({ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); -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) : ''; +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'));