X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-cust-part_pkg.html;h=7f91e8141934685b139359680c3a28485b8dbab7;hb=58cf1f1d5ac2083beafb7efa220293ae8140adcc;hp=8b446b95d49e7883c1aa43ecaaebcf9b4fb7c8fa;hpb=5e05724a635a22776f1b973f5d7e77989da4e048;p=freeside.git diff --git a/httemplate/elements/select-cust-part_pkg.html b/httemplate/elements/select-cust-part_pkg.html index 8b446b95d..7f91e8141 100644 --- a/httemplate/elements/select-cust-part_pkg.html +++ b/httemplate/elements/select-cust-part_pkg.html @@ -18,14 +18,9 @@ Example: -<% include( '/elements/select-table.html', - 'table' => 'part_pkg', - 'name_col' => 'pkg', - 'empty_label' => 'Select package', - 'label_callback' => sub { $_[0]->pkgpart. ': '. - $_[0]->pkg. ' - '. - $_[0]->comment; - }, +<% include( '/elements/select-part_pkg.html', + 'empty_label' => 'Select package', #? need here in case removed + #from select-part_pkg ?? %opt, ) %> @@ -36,21 +31,11 @@ my( %opt ) = @_; my $cust_main = $opt{'cust_main'} or die "cust_main not specified"; -$opt{'records'} = delete $opt{'part_pkg'} - if $opt{'part_pkg'}; - -my $extra_sql = $opt{'extra_sql'}. - ' AND 0 < ( SELECT COUNT(*) FROM type_pkgs '. - ' WHERE typenum = '. $cust_main->agent->typenum. - ' AND type_pkgs.pkgpart = part_pkg.pkgpart )'; - -$opt{'records'} ||= [ qsearch({ - 'table' => 'part_pkg', - 'hashref' => { 'disabled' => '', }, - 'extra_sql' => "$extra_sql ORDER BY pkg", - #'extra_sql' => $extra_sql, - #'order_by' => 'ORDER BY pkg', - }) - ]; +$opt{'extra_sql'} .= ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ); +# ' AND ( agentnum IS NOT NULL '. +# ' OR 0 < ( SELECT COUNT(*) FROM type_pkgs '. +# ' WHERE typenum = '. $cust_main->agent->typenum. +# ' AND type_pkgs.pkgpart = part_pkg.pkgpart )'. +# ' )';