[freeside-commits] freeside/httemplate/browse pkg_category.html, NONE, 1.1 pkg_class.html, 1.5, 1.6

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Jun 18 20:18:20 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv10248/httemplate/browse

Modified Files:
	pkg_class.html 
Added Files:
	pkg_category.html 
Log Message:
package categories (meta package classes) and grouping invoices by them

Index: pkg_class.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/pkg_class.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pkg_class.html	1 Aug 2007 22:24:58 -0000	1.5
+++ pkg_class.html	19 Jun 2008 03:18:18 -0000	1.6
@@ -9,9 +9,9 @@
                                     'extra_sql' => 'ORDER BY classnum',
                                   },
                  'count_query' => $count_query,
-                 'header'      => [ '#', 'Class', ],
-                 'fields'      => [ 'classnum', 'classname' ],
-                 'links'       => [ $link, $link ],
+                 'header'      => $header,
+                 'fields'      => $fields,
+                 'links'       => $links,
              )
 %>
 <%init>
@@ -28,4 +28,19 @@
 
 my $link = [ $p.'edit/pkg_class.html?', 'classnum' ];
 
+my $header = [ '#', 'Class' ];
+my $fields = [ 'classnum', 'classname' ];
+my $links  = [ $link, $link ];
+
+my $cat_query = 'SELECT COUNT(*) FROM pkg_class where categorynum IS NOT NULL';
+my $sth = dbh->prepare($cat_query)
+  or die "Error preparing $cat_query: ". dbh->errstr;
+$sth->execute
+  or die "Error executing $cat_query: ". $sth->errstr;
+if ($sth->fetchrow_arrayref->[0]) {
+  push @$header, 'Category';
+  push @$fields, 'categoryname';
+  push @$links,  $link;
+}
+
 </%init>

--- NEW FILE: pkg_category.html ---
<% include( 'elements/browse.html',
                 'title'       => 'Package categories',
                 'html_init'   => $html_init,
                 'name'        => 'package categories',
                 'disableable' => 1,
                 'disabled_statuspos' => 2,
                 'query'       => { 'table'     => 'pkg_category',
                                    'hashref'   => {},
                                    'extra_sql' => 'ORDER BY categorynum',
                                  },
                 'count_query' => $count_query,
                 'header'      => [ '#', 'Category' ],
                 'fields'      => [ 'categorynum', 'categoryname' ],
                 'links'       => [ $link, $link ],
             )
%>

<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $html_init = 
  qq!<A HREF="${p}browse/pkg_class.html">Package classes</A><BR><BR>!.
  'Package categories define groups of package classes, for reporting and '.
  'convenience purposes.<BR><BR>'.
  qq!<A HREF="${p}edit/pkg_category.html"><I>Add a package category</I></A><BR><BR>!;

my $count_query = 'SELECT COUNT(*) FROM pkg_category';

my $link = [ $p.'edit/pkg_category.html?', 'categorynum' ];

</%init>



More information about the freeside-commits mailing list