X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=fcde22bf654f051e06672a69952039d935dfb77e;hb=09d3b99715ac707d64b1a06d8a2432b76ddb173d;hp=a78aa87d80d89723c8025ef85c6a69d66d85e952;hpb=55f003404af6a2416571138356d11c5ad3755e58;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a78aa87d8..fcde22bf6 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -29,6 +29,7 @@ 'pkg' => 'Package (customer-visible)', 'comment' => 'Comment (customer-hidden)', 'classnum' => 'Package class', + 'addon_classnum' => 'Restrict additional orders to package class', 'promo_code' => 'Promotional code', 'freq' => 'Recurring fee frequency', 'setuptax' => 'Setup fee tax exempt', @@ -76,6 +77,13 @@ onchange => 'agent_changed', }, {field=>'classnum', type=>'select-pkg_class' }, + ( $conf->exists('pkg-addon_classnum') + ? ( { field=>'addon_classnum', + type =>'select-pkg_class', + } + ) + : () + ), {field=>'disabled', type=>$disabled_type, value=>'Y'}, { type => 'tablebreak-tr-title', @@ -175,8 +183,9 @@ }, - { 'type' => 'tablebreak-tr-title', - 'value' => 'Pricing add-ons', + { 'type' => 'tablebreak-tr-title', + 'value' => 'Pricing add-ons', + 'colspan' => 4, }, { 'field' => 'bill_dst_pkgpart', 'type' => 'select-part_pkg', @@ -185,6 +194,13 @@ 'm2m_dstcol' => 'dst_pkgpart', 'm2_error_callback' => &{$m2_error_callback_maker}('bill'), + 'm2_fields' => [ { 'field' => 'hidden', + 'type' => 'checkbox', + 'value' => 'Y', + 'curr_value' => '', + 'label' => 'Bundle', + }, + ], }, { type => 'tablebreak-tr-title', @@ -385,16 +401,26 @@ my $m2_error_callback_maker = sub { my $link_type = shift; #yay closures return sub { my( $cgi, $object ) = @_; - map { - new FS::part_pkg_link { - 'link_type' => $link_type, - 'src_pkgpart' => $object->pkgpart, - 'dst_pkgpart' => $_, - }; - } - grep $_, - map $cgi->param($_), - grep /^${link_type}_dst_pkgpart(\d+)$/, $cgi->param; + my $num; + map { + + if ( /^${link_type}_dst_pkgpart(\d+)$/ && + ( my $dst = $cgi->param("${link_type}_dst_pkgpart$1") ) ) + { + + my $hidden = $cgi->param("${link_type}_dst_pkgpart__hidden$1") + || ''; + new FS::part_pkg_link { + 'link_type' => $link_type, + 'src_pkgpart' => $object->pkgpart, + 'dst_pkgpart' => $dst, + 'hidden' => $hidden, + }; + } else { + (); + } + } + $cgi->param; }; };