<% include('/elements/header-popup.html', 'Order new package' ) %> <% include('/elements/xmlhttp.html', 'url' => $p.'misc/location.cgi', 'subs' => [ 'get_location' ], ) %> <% include('/elements/error.html') %>
<% ntable("#cccccc", 2) %> Package <% include('/elements/select-cust-part_pkg.html', 'curr_value' => $pkgpart, 'cust_main' => $cust_main, 'onchange' => 'enable_order_pkg', ) %> % 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, 'disable_empty' => 1, 'multiple' => $conf->exists('pkg_referral-multiple'), 'colspan' => 7, ) %> % } Service location <% include('/elements/location.html', 'object' => $cust_location, #'onchange' ? probably not 'disabled' => ( $locationnum == -1 ? '' : 'DISABLED' ), 'no_asterisks' => 1, ) %>
>
<%once> my @location_fields = qw( address1 address2 city county state zip country ); <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Order customer package'); my $conf = new FS::Conf; my $countrydefault = $conf->config('countrydefault') || 'US'; my $statedefault = $conf->config('statedefault') || ($countrydefault eq 'US' ? 'CA' : ''); $cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum"; my $custnum = $1; my $cust_main = qsearchs({ 'table' => 'cust_main', 'hashref' => { 'custnum' => $custnum }, 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); my $pkgpart = scalar($cgi->param('pkgpart')); $cgi->param('locationnum') =~ /^(\d*)$/ or die "illegal locationnum"; my $locationnum = $1; my $cust_location; if ( $locationnum ) { $cust_location = qsearchs('cust_location', { 'locationnum' => $locationnum } ) or die "unknown locationnum"; } else { $cust_location = new FS::cust_location; if ( $cgi->param('error') && $locationnum == -1 ) { $cust_location->$_( $cgi->param($_) ) foreach @location_fields; } else { $cust_location->$_( $cust_main->$_() ) foreach @location_fields; } }