X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=f2c7448d5967cb88ce98b105e7b4c44a0ceb420e;hb=d807bc23b37960187378c44c4f03db2e44660b67;hp=fcde22bf654f051e06672a69952039d935dfb77e;hpb=09d3b99715ac707d64b1a06d8a2432b76ddb173d;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index fcde22bf6..f2c7448d5 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -247,6 +247,11 @@ my $begin_callback = sub { my $disabled_type = $acl_edit_either ? 'checkbox' : 'hidden'; +#arg. access rights for cloning are Hard. +# on the one hand we don't really want cloning (customizing a package) to fail +# for want of finding the source package in normal usage +# on the other hand, we don't want people using the clone link to be able to +# see my $agent_clone_extra_sql = ' ( '. FS::part_pkg->curuser_pkgs_sql. " OR ( part_pkg.custom = 'Y' ) ". @@ -254,7 +259,12 @@ my $agent_clone_extra_sql = my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); -my $census = scalar( qsearch( 'part_pkg_report_option', {} ) ); + +my $sth = dbh->prepare("SELECT COUNT(*) FROM part_pkg_report_option". + " WHERE disabled IS NULL OR disabled = '' ") + or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $census = $sth->fetchrow_arrayref->[0]; #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -330,7 +340,8 @@ my $edit_callback = sub { $recur_disabled = $object->freq ? 0 : 1; - (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1}); + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); my @report_option = (); foreach ($object->options) { @@ -387,6 +398,11 @@ my $clone_callback = sub { $object->disabled('Y'); + } else { #not when cloning... + + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs',{ 'pkgpart' => $object->pkgpart } ); + } %options = $object->options;