%if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) {
- <% include('/elements/xmlhttp.html',
+ <& /elements/xmlhttp.html,
'url' => $p.'misc/cust-part_pkg.cgi',
'subs' => [ 'get_part_pkg' ],
- )
- %>
+ &>
<SCRIPT TYPE="text/javascript">
- function opt(what,value,text) {
+ function part_pkg_opt(what,value,text,can_discount) {
var optionName = new Option(text, value, false, false);
+ optionName.setAttribute('data-can_discount', can_discount);
var length = what.length;
what.options[length] = optionName;
}
function classnum_changed(what) {
what.form.pkgpart.disabled = 'disabled'; //disable part_pkg dropdown
- what.form.submit.disabled = true; //disable the submit button
+ var submitButton = what.form.submitButton; // || what.form.submit;
+ if ( submitButton ) {
+ submitButton.disabled = true; //disable the submit button
+ }
+ var discountnum = what.form.discountnum;
+ if ( discountnum ) {
+ discountnum.disabled = true; //disable discount dropdown
+ }
classnum = what.options[what.selectedIndex].value;
// add the new packages
opt(what.form.pkgpart, '', 'Select package');
var packagesArray = eval('(' + part_pkg + ')' );
- for ( var s = 0; s < packagesArray.length; s=s+2 ) {
+ for ( var s = 0; s < packagesArray.length; s=s+3 ) {
var packagesLabel = packagesArray[s+1];
- opt(what.form.pkgpart, packagesArray[s], packagesLabel);
+ var can_discount = packagesArray[s+2];
+ part_pkg_opt(
+ what.form.pkgpart, packagesArray[s], packagesLabel, can_discount
+ );
}
what.form.pkgpart.disabled = ''; //re-enable part_pkg dropdown
</SCRIPT>
<TR>
- <TH ALIGN="right">Package Class</TH>
+ <TH ALIGN="right"><% mt('Package Class') |h %></TH>
<TD COLSPAN=7>
- <% include('/elements/select-cust-pkg_class.html',
+ <& /elements/select-cust-pkg_class.html,
'curr_value' => $opt{'classnum'},
'pkg_class' => \@pkg_class,
'onchange' => 'classnum_changed',
- )
- %>
+ &>
</TD>
</TR>
%}
<TR>
- <TH ALIGN="right">Package</TH>
+ <TH ALIGN="right"><% mt('Package') |h %></TH>
<TD COLSPAN=7>
- <% include('/elements/select-cust-part_pkg.html',
+ <& /elements/select-cust-part_pkg.html,
'curr_value' => $opt{'curr_value'}, #$pkgpart
'classnum' => $opt{'classnum'},
'cust_main' => $opt{'cust_main'}, #$cust_main
'onchange' => 'enable_order_pkg',
- )
- %>
+ &>
</TD>
</TR>
my $cust_main = $opt{'cust_main'}
or die "cust_main not specified";
-#my @pkg_class = sort { $a->classname cmp $b->classname }
-# qsearch( 'pkg_class', { 'disabled' => '' } );
-
#"normal" part_pkg agent virtualization (agentnum or type)
my @part_pkg = qsearch({
'select' => 'DISTINCT classnum',