[freeside-commits] freeside/httemplate/browse addr_block.cgi, 1.3, 1.4 agent.cgi, 1.36, 1.37 agent_type.cgi, 1.17, 1.18 cust_main_county.cgi, 1.15, 1.16 msgcat.cgi, 1.5, 1.6 part_bill_event.cgi, 1.13, 1.14 part_export.cgi, 1.5, 1.6 part_pkg.cgi, 1.36, 1.37 part_svc.cgi, 1.29, 1.30 part_virtual_field.cgi, 1.5, 1.6 rate.cgi, 1.4, 1.5 router.cgi, 1.7, 1.8 svc_acct_pop.cgi, 1.18, 1.19 access_group.html, 1.3, 1.4 access_user.html, 1.4, 1.5 inventory_class.html, 1.3, 1.4 part_referral.html, 1.5, 1.6 payment_gateway.html, 1.4, 1.5 pkg_class.html, 1.3, 1.4 reason.html, 1.1, 1.2 reason_type.html, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Tue Jan 30 12:59:16 PST 2007


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail:/tmp/cvs-serv11411/browse

Modified Files:
	addr_block.cgi agent.cgi agent_type.cgi cust_main_county.cgi 
	msgcat.cgi part_bill_event.cgi part_export.cgi part_pkg.cgi 
	part_svc.cgi part_virtual_field.cgi rate.cgi router.cgi 
	svc_acct_pop.cgi access_group.html access_user.html 
	inventory_class.html part_referral.html payment_gateway.html 
	pkg_class.html reason.html reason_type.html 
Log Message:
its all about control

Index: access_user.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/access_user.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- access_user.html	23 Aug 2006 22:25:36 -0000	1.4
+++ access_user.html	30 Jan 2007 20:59:13 -0000	1.5
@@ -1,83 +1,3 @@
-%
-%
-%my $html_init = 
-%  "Internal users have access to the back-office interface.  Typically, this is your employees and contractors, but in a VISP setup, you can also add accounts for your reseller's employees.  It is <B>highly recommended</B> to add a <B>separate account for each person</B> rather than using role accounts.<BR><BR>".
-%  qq!<A HREF="${p}edit/access_user.html"><I>Add an internal user</I></A><BR><BR>!;
-%
-%#false laziness w/part_pkg.cgi
-%my %search = ();
-%my $search = '';
-%unless ( $cgi->param('showdisabled') ) {
-%  %search = ( 'disabled' => '' );
-%  $search = "( disabled = '' OR disabled IS NULL )";
-%}
-%
-%#false laziness w/access_group.html & agent_type.cgi
-%my $groups_sub = sub {
-%  my $access_user = shift;
-%
-%  [ map {
-%          my $access_usergroup = $_;
-%          my $access_group = $access_usergroup->access_group;
-%          [
-%            {
-%              'data'  => $access_group->groupname,
-%              'align' => 'left',
-%              'link'  =>
-%                $p. 'edit/access_group.html?'. $access_usergroup->groupnum,
-%            },
-%          ];
-%        }
-%    grep { $_->access_group # and ! $_->access_group->disabled
-%         }
-%    $access_user->access_usergroup,
-%
-%  ];
-%
-%};
-%
-%my $posttotal;
-%if ( $cgi->param('showdisabled') ) {
-%  $cgi->param('showdisabled', 0);
-%  $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled users</a> )';
-%  $cgi->param('showdisabled', 1);
-%} else {
-%  $cgi->param('showdisabled', 1);
-%  $posttotal = '( <a href="'. $cgi->self_url. '">show disabled users</a> )';
-%  $cgi->param('showdisabled', 0);
-%}
-%
-%my $count_query = 'SELECT COUNT(*) FROM access_user';
-%$count_query .= " WHERE $search"
-%  if $search;
-%
-%my $link = [ $p.'edit/access_user.html?', 'usernum' ];
-%
-%my @header = ( '#', 'Username' );
-%my @fields = ( 'usernum', 'username' );
-%my $align = 'rl';
-%my @links = ( $link, $link );
-%my @style = ( '', '' );
-%
-%#false laziness w/part_pkg.cgi
-%#unless ( $cgi->param('showdisabled') ) { #its been reversed already
-%if ( $cgi->param('showdisabled') ) { #its been reversed already
-%  push @header, 'Status';
-%  push @fields, sub { shift->disabled
-%                        ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
-%                        : '<FONT COLOR="#00CC00">Active</FONT>'
-%                    };
-%  push @links, '';
-%  $align .= 'c';
-%  push @style, 'b';
-%}
-%
-%push @header, 'Full name', 'Groups';
-%push @fields, 'name',      $groups_sub;
-%push @links,  $link,       '';
-%$align .= 'll';
-%
-%
 <% include( 'elements/browse.html',
                  'title'          => 'Internal Users',
                  'menubar'        => [ #'Main menu' => $p,
@@ -97,3 +17,86 @@
                  'style'          => \@style,
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init = 
+  "Internal users have access to the back-office interface.  Typically, this is your employees and contractors, but in a VISP setup, you can also add accounts for your reseller's employees.  It is <B>highly recommended</B> to add a <B>separate account for each person</B> rather than using role accounts.<BR><BR>".
+  qq!<A HREF="${p}edit/access_user.html"><I>Add an internal user</I></A><BR><BR>!;
+
+#false laziness w/part_pkg.cgi
+my %search = ();
+my $search = '';
+unless ( $cgi->param('showdisabled') ) {
+  %search = ( 'disabled' => '' );
+  $search = "( disabled = '' OR disabled IS NULL )";
+}
+
+#false laziness w/access_group.html & agent_type.cgi
+my $groups_sub = sub {
+  my $access_user = shift;
+
+  [ map {
+          my $access_usergroup = $_;
+          my $access_group = $access_usergroup->access_group;
+          [
+            {
+              'data'  => $access_group->groupname,
+              'align' => 'left',
+              'link'  =>
+                $p. 'edit/access_group.html?'. $access_usergroup->groupnum,
+            },
+          ];
+        }
+    grep { $_->access_group # and ! $_->access_group->disabled
+         }
+    $access_user->access_usergroup,
+
+  ];
+
+};
+
+my $posttotal;
+if ( $cgi->param('showdisabled') ) {
+  $cgi->param('showdisabled', 0);
+  $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled users</a> )';
+  $cgi->param('showdisabled', 1);
+} else {
+  $cgi->param('showdisabled', 1);
+  $posttotal = '( <a href="'. $cgi->self_url. '">show disabled users</a> )';
+  $cgi->param('showdisabled', 0);
+}
+
+my $count_query = 'SELECT COUNT(*) FROM access_user';
+$count_query .= " WHERE $search"
+  if $search;
+
+my $link = [ $p.'edit/access_user.html?', 'usernum' ];
+
+my @header = ( '#', 'Username' );
+my @fields = ( 'usernum', 'username' );
+my $align = 'rl';
+my @links = ( $link, $link );
+my @style = ( '', '' );
+
+#false laziness w/part_pkg.cgi
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
+  push @header, 'Status';
+  push @fields, sub { shift->disabled
+                        ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
+                        : '<FONT COLOR="#00CC00">Active</FONT>'
+                    };
+  push @links, '';
+  $align .= 'c';
+  push @style, 'b';
+}
+
+push @header, 'Full name', 'Groups';
+push @fields, 'name',      $groups_sub;
+push @links,  $link,       '';
+$align .= 'll';
+
+</%init>

Index: cust_main_county.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/cust_main_county.cgi,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cust_main_county.cgi	23 Aug 2006 22:25:36 -0000	1.15
+++ cust_main_county.cgi	30 Jan 2007 20:59:13 -0000	1.16
@@ -164,3 +164,7 @@
 </TABLE>
 
 <% include('/elements/footer.html') %>
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+</%init>

Index: access_group.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/access_group.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- access_group.html	23 Aug 2006 22:25:36 -0000	1.3
+++ access_group.html	30 Jan 2007 20:59:13 -0000	1.4
@@ -1,53 +1,3 @@
-%
-%
-%my $html_init = 
-%  "Internal access groups control access to the back-office interface.<BR><BR>".
-%  qq!<A HREF="${p}edit/access_group.html"><I>Add an internal access group</I></A><BR><BR>!;
-%
-%#false laziness w/access_user.html & agent_type.cgi
-%my $agents_sub = sub {
-%  my $access_group = shift;
-%
-%  [ map {
-%          my $access_groupagent = $_;
-%          my $agent = $access_groupagent->agent;
-%          [
-%            {
-%              'data'  => $agent->agent,
-%              'align' => 'left',
-%              'link'  => $p. 'edit/agent.cgi?'. $agent->agentnum,
-%            },
-%          ];
-%        }
-%    grep { $_->agent } #?
-%    $access_group->access_groupagent,
-%
-%  ];
-%  
-%};
-%
-%my $rights_sub = sub {
-%  my $access_group = shift;
-%
-%  [ map { my $access_right = $_;
-%          [
-%            { 
-%              'data'  => $access_right->rightname,
-%              'align' => 'left',
-%            },
-%          ];
-%        }
-%    $access_group->access_rights,
-%
-%  ];
-%
-%};
-%
-%my $count_query = 'SELECT COUNT(*) FROM access_group';
-%
-%my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => 'Internal Access Groups',
                  'menubar'     => [ # 'Main menu' => $p,
@@ -77,3 +27,56 @@
                                   ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init = 
+  "Internal access groups control access to the back-office interface.<BR><BR>".
+  qq!<A HREF="${p}edit/access_group.html"><I>Add an internal access group</I></A><BR><BR>!;
+
+#false laziness w/access_user.html & agent_type.cgi
+my $agents_sub = sub {
+  my $access_group = shift;
+
+  [ map {
+          my $access_groupagent = $_;
+          my $agent = $access_groupagent->agent;
+          [
+            {
+              'data'  => $agent->agent,
+              'align' => 'left',
+              'link'  => $p. 'edit/agent.cgi?'. $agent->agentnum,
+            },
+          ];
+        }
+    grep { $_->agent } #?
+    $access_group->access_groupagent,
+
+  ];
+  
+};
+
+my $rights_sub = sub {
+  my $access_group = shift;
+
+  [ map { my $access_right = $_;
+          [
+            { 
+              'data'  => $access_right->rightname,
+              'align' => 'left',
+            },
+          ];
+        }
+    $access_group->access_rights,
+
+  ];
+
+};
+
+my $count_query = 'SELECT COUNT(*) FROM access_group';
+
+my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
+
+</%init>

Index: part_svc.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_svc.cgi,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- part_svc.cgi	29 Dec 2006 08:51:32 -0000	1.29
+++ part_svc.cgi	30 Jan 2007 20:59:13 -0000	1.30
@@ -1,43 +1,3 @@
-% 
-%
-%#code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm
-%my %flag = (
-%  ''  => '',
-%  'D' => 'Default',
-%  'F' => 'Fixed (unchangeable)',
-%  'S' => 'Selectable choice',
-%  #'M' => 'Manual selection from inventory',
-%  'M' => 'Manual selected from inventory',
-%  #'A' => 'Automatically fill in from inventory',
-%  'A' => 'Automatically filled in from inventory',
-%  'X' => 'Excluded',
-%);
-%
-%my %search;
-%if ( $cgi->param('showdisabled') ) {
-%  %search = ();
-%} else {
-%  %search = ( 'disabled' => '' );
-%}
-%
-%my @part_svc =
-%  sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') }
-%    qsearch('part_svc', \%search );
-%my $total = scalar(@part_svc);
-%
-%my %num_active_cust_svc = map { $_->svcpart => $_->num_cust_svc } @part_svc;
-%
-%if ( $cgi->param('orderby') eq 'active' ) {
-%  @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=>
-%                     $num_active_cust_svc{$a->svcpart}     } @part_svc;
-%} elsif ( $cgi->param('orderby') eq 'svc' ) { 
-%  @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc;
-%}
-%
-%my %inventory_class = ();
-%
-%
-
 <% include("/elements/header.html",'Service Definition Listing', menubar( 'Main Menu' => $p) ) %>
 
 <SCRIPT>
@@ -208,3 +168,45 @@
 </TABLE>
 </BODY>
 </HTML>
+<%init>
+ 
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+#code duplication w/ edit/part_svc.cgi, should move this hash to part_svc.pm
+my %flag = (
+  ''  => '',
+  'D' => 'Default',
+  'F' => 'Fixed (unchangeable)',
+  'S' => 'Selectable choice',
+  #'M' => 'Manual selection from inventory',
+  'M' => 'Manual selected from inventory',
+  #'A' => 'Automatically fill in from inventory',
+  'A' => 'Automatically filled in from inventory',
+  'X' => 'Excluded',
+);
+
+my %search;
+if ( $cgi->param('showdisabled') ) {
+  %search = ();
+} else {
+  %search = ( 'disabled' => '' );
+}
+
+my @part_svc =
+  sort { $a->getfield('svcpart') <=> $b->getfield('svcpart') }
+    qsearch('part_svc', \%search );
+my $total = scalar(@part_svc);
+
+my %num_active_cust_svc = map { $_->svcpart => $_->num_cust_svc } @part_svc;
+
+if ( $cgi->param('orderby') eq 'active' ) {
+  @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=>
+                     $num_active_cust_svc{$a->svcpart}     } @part_svc;
+} elsif ( $cgi->param('orderby') eq 'svc' ) { 
+  @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc;
+}
+
+my %inventory_class = ();
+
+</%init>

Index: reason_type.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/reason_type.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- reason_type.html	19 Oct 2006 14:25:03 -0000	1.1
+++ reason_type.html	30 Jan 2007 20:59:13 -0000	1.2
@@ -1,44 +1,3 @@
-%
-%$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
-%my $class=$1;
-%
-%my %classmap = ( 'C' => 'cancel',
-%                 'S' => 'suspend',
-%                );
-%
-%my $classname = $classmap{$class};
-%
-%my $html_init = ucfirst($classname) .
-%  " reason types allow groups of $classname reasons for reporting purposes." .
-%  qq!<BR><BR><A HREF="${p}edit/reason_type.html?class=$class"><I>Add a ! .
-%  $classname . " reason type</I></A><BR><BR>";
-%
-%my $reasons_sub = sub {
-%  my $reason_type = shift;
-%
-%  [ map {
-%          [
-%            {
-%              'data'  => $_->reason,
-%              'align' => 'left',
-%              'link'  => $p. "edit/reason.html?class=$class&reasonnum=".
-%                             $_->reasonnum,
-%            },
-%          ];
-%        }
-%    $reason_type->enabled_reasons,
-%
-%  ];
-%  
-%};
-%
-%my $where_clause = "WHERE class='$class'";
-%my $count_query = 'SELECT COUNT(*) FROM reason_type ';
-%$count_query .= $where_clause;
-%
-%my $link = [ $p.'edit/reason_type.html?class='.$class.'&typenum=', 'typenum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => ucfirst($classname) . " Reason Types",
                  'menubar'     => [ ucfirst($classname) . " reasons" =>
@@ -66,3 +25,48 @@
                                   ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
+my $class=$1;
+
+my %classmap = ( 'C' => 'cancel',
+                 'S' => 'suspend',
+                );
+
+my $classname = $classmap{$class};
+
+my $html_init = ucfirst($classname) .
+  " reason types allow groups of $classname reasons for reporting purposes." .
+  qq!<BR><BR><A HREF="${p}edit/reason_type.html?class=$class"><I>Add a ! .
+  $classname . " reason type</I></A><BR><BR>";
+
+my $reasons_sub = sub {
+  my $reason_type = shift;
+
+  [ map {
+          [
+            {
+              'data'  => $_->reason,
+              'align' => 'left',
+              'link'  => $p. "edit/reason.html?class=$class&reasonnum=".
+                             $_->reasonnum,
+            },
+          ];
+        }
+    $reason_type->enabled_reasons,
+
+  ];
+  
+};
+
+my $where_clause = "WHERE class='$class'";
+my $count_query = 'SELECT COUNT(*) FROM reason_type ';
+$count_query .= $where_clause;
+
+my $link = [ $p.'edit/reason_type.html?class='.$class.'&typenum=', 'typenum' ];
+
+</%init>

Index: router.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/router.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- router.cgi	23 Aug 2006 22:25:37 -0000	1.7
+++ router.cgi	30 Jan 2007 20:59:13 -0000	1.8
@@ -58,4 +58,7 @@
 </TABLE>
 </BODY>
 </HTML>
-
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+</%init>

Index: agent.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/agent.cgi,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- agent.cgi	20 Nov 2006 10:34:43 -0000	1.36
+++ agent.cgi	30 Jan 2007 20:59:13 -0000	1.37
@@ -1,17 +1,3 @@
-%
-%
-%  my %search;
-%  if ( $cgi->param('showdisabled')
-%       || !dbdef->table('agent')->column('disabled') ) {
-%    %search = ();
-%  } else {
-%    %search = ( 'disabled' => '' );
-%  }
-%
-%  my $conf = new FS::Conf;
-%
-%
-
 <% include("/elements/header.html",'Agent Listing', menubar(
   'Main Menu'   => $p,
   'Agent Types' => $p. 'browse/agent_type.cgi',
@@ -370,3 +356,19 @@
     </TABLE>
   </BODY>
 </HTML>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my %search;
+if ( $cgi->param('showdisabled')
+     || !dbdef->table('agent')->column('disabled') ) {
+  %search = ();
+} else {
+  %search = ( 'disabled' => '' );
+}
+
+my $conf = new FS::Conf;
+
+</%init>

Index: agent_type.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/agent_type.cgi,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- agent_type.cgi	23 Aug 2006 22:25:36 -0000	1.17
+++ agent_type.cgi	30 Jan 2007 20:59:13 -0000	1.18
@@ -1,37 +1,3 @@
-%
-%
-%my $html_init = 
-%  'Agent types define groups of packages that you can then assign to'.
-%  ' particular agents.<BR><BR>'.
-%  qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!;
-%
-%my $count_query = 'SELECT COUNT(*) FROM agent_type';
-%
-%#false laziness w/access_user.html
-%my $packages_sub = sub {
-%  my $agent_type = shift;
-%
-%  [ map  {
-%           my $type_pkgs = $_;
-%           #my $part_pkg = $type_pkgs->part_pkg;
-%           [
-%             {
-%               #'data'  => $part_pkg->pkg. ' - '. $part_pkg->comment,
-%               'data'  => $type_pkgs->pkg. ' - '. $type_pkgs->comment,
-%               'align' => 'left',
-%               'link'  => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
-%             },
-%           ];
-%         }
-%
-%    $agent_type->type_pkgs_enabled
-%  ];
-%
-%};
-%
-%my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'   => 'Agent Types',
                  'menubar'     => [ #'Main menu' => $p,
@@ -58,3 +24,40 @@
                                   ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init = 
+'Agent types define groups of packages that you can then assign to'.
+' particular agents.<BR><BR>'.
+qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM agent_type';
+
+#false laziness w/access_user.html
+my $packages_sub = sub {
+my $agent_type = shift;
+
+[ map  {
+         my $type_pkgs = $_;
+         #my $part_pkg = $type_pkgs->part_pkg;
+         [
+           {
+             #'data'  => $part_pkg->pkg. ' - '. $part_pkg->comment,
+             'data'  => $type_pkgs->pkg. ' - '. $type_pkgs->comment,
+             'align' => 'left',
+             'link'  => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
+           },
+         ];
+       }
+
+  $agent_type->type_pkgs_enabled
+];
+
+};
+
+my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ];
+
+</%init>

Index: inventory_class.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/inventory_class.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- inventory_class.html	23 Aug 2006 22:25:37 -0000	1.3
+++ inventory_class.html	30 Jan 2007 20:59:13 -0000	1.4
@@ -1,27 +1,3 @@
-%
-%
-%tie my %labels, 'Tie::IxHash',
-%  'num_avail' => 'Available', #  <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>',
-%  'num_used'  => 'In use', #'Used', #'Allocated',
-%  'num_total' => 'Total',
-%;
-%
-%my %link = (
-%  'num_avail' => ';avail=1',
-%  'num_used'  => ';used=1',
-%  'num_total' => '',
-%);
-%
-%my %inv_action_link = (
-%  'num_avail' => [ 'upload batch',
-%                   $p.'misc/inventory_item-import.html?classnum=',
-%                   'classnum'
-%                 ],
-%);
-%
-%my $link = [ "${p}edit/inventory_class.html?", 'classnum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => 'Inventory Classes',
                  'name'        => 'inventory classes',
@@ -88,3 +64,30 @@
                                   ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+tie my %labels, 'Tie::IxHash',
+  'num_avail' => 'Available', #  <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>',
+  'num_used'  => 'In use', #'Used', #'Allocated',
+  'num_total' => 'Total',
+;
+
+my %link = (
+  'num_avail' => ';avail=1',
+  'num_used'  => ';used=1',
+  'num_total' => '',
+);
+
+my %inv_action_link = (
+  'num_avail' => [ 'upload batch',
+                   $p.'misc/inventory_item-import.html?classnum=',
+                   'classnum'
+                 ],
+);
+
+my $link = [ "${p}edit/inventory_class.html?", 'classnum' ];
+
+</%init>

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_pkg.cgi,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- part_pkg.cgi	24 Nov 2006 10:34:33 -0000	1.36
+++ part_pkg.cgi	30 Jan 2007 20:59:13 -0000	1.37
@@ -1,242 +1,3 @@
-%
-%
-%#false laziness w/access_user.html
-%my %search = ();
-%my $search = '';
-%unless ( $cgi->param('showdisabled') ) {
-%  %search = ( 'disabled' => '' );
-%  $search = "( disabled = '' OR disabled IS NULL )";
-%}
-%
-%my $select = '*';
-%my $orderby = 'pkgpart';
-%if ( $cgi->param('active') ) {
-%
-%  $orderby = 'num_active DESC';
-%}
-%  $select = "
-%
-%    *,
-%
-%    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
-%       AND ( cancel IS NULL OR cancel = 0 )
-%       AND ( susp IS NULL OR susp = 0 )
-%    ) AS num_active,
-%
-%    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
-%        AND ( cancel IS NULL OR cancel = 0 )
-%        AND susp IS NOT NULL AND susp != 0
-%    ) AS num_suspended,
-%
-%    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
-%        AND cancel IS NOT NULL AND cancel != 0
-%    ) AS num_cancelled
-%
-%  ";
-%
-%#}
-%
-%my $conf = new FS::Conf;
-%my $taxclasses = $conf->exists('enable_taxclasses');
-%
-%my $html_init;
-%#unless ( $cgi->param('active') ) {
-%  $html_init = qq!
-%    One or more service definitions are grouped together into a package 
-%    definition and given pricing information.  Customers purchase packages
-%    rather than purchase services directly.<BR><BR>
-%    <A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A>
-%    <BR><BR>
-%  !;
-%#}
-%
-%my $posttotal;
-%if ( $cgi->param('showdisabled') ) {
-%  $cgi->param('showdisabled', 0);
-%  $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled packages</a> )';
-%  $cgi->param('showdisabled', 1);
-%} else {
-%  $cgi->param('showdisabled', 1);
-%  $posttotal = '( <a href="'. $cgi->self_url. '">show disabled packages</a> )';
-%  $cgi->param('showdisabled', 0);
-%}
-%
-%
-%# ------
-%
-%my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
-%
-%my @header = ( '#', 'Package', 'Comment' );
-%my @fields = ( 'pkgpart', 'pkg', 'comment' );
-%my $align = 'rll';
-%my @links = ( $link, $link, '' );
-%my @style = ( '', '', '' );
-%
-%#false laziness w/access_user.html
-%#unless ( $cgi->param('showdisabled') ) { #its been reversed already
-%if ( $cgi->param('showdisabled') ) { #its been reversed already
-%  push @header, 'Status';
-%  push @fields, sub { shift->disabled
-%                        ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
-%                        : '<FONT COLOR="#00CC00">Active</FONT>'
-%                    };
-%  push @links, '';
-%  $align .= 'c';
-%  push @style, 'b';
-%}
-%
-%unless ( 0 ) { #already showing only one class or something?
-%  push @header, 'Class';
-%  push @fields, sub { shift->classname || '(none)'; };
-%  $align .= 'l';
-%}
-%
-%#if ( $cgi->param('active') ) {
-%  push @header, 'Customer<BR>packages';
-%  my %col = (
-%    'active'          => '00CC00',
-%    'suspended'       => 'FF9900',
-%    'cancelled'       => 'FF0000',
-%    #'one-time charge' => '000000',
-%    'charge'          => '000000',
-%  );
-%  my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
-%  push @fields, sub { my $part_pkg = shift;
-%                      [
-%                        map {
-%                              my $magic = $_;
-%                              my $label = $_;
-%                              if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
-%                                $magic = 'inactive';
-%                                #$label = 'one-time charge',
-%                                $label = 'charge',
-%                              }
-%                          
-%                              [
-%                                {
-%                                 'data'  => '<B><FONT COLOR="#'. $col{$label}. '">'.
-%                                            $part_pkg->get("num_$_").
-%                                            '</FONT></B>',
-%                                 'align' => 'right',
-%                                },
-%                                {
-%                                 'data'  => $label.
-%                                              ( $part_pkg->get("num_$_") != 1
-%                                                && $label =~ /charge$/
-%                                                  ? 's'
-%                                                  : ''
-%                                              ),
-%                                 'align' => 'left',
-%                                 'link'  => ( $part_pkg->get("num_$_")
-%                                                ? $cust_pkg_link.
-%                                                  $part_pkg->pkgpart.
-%                                                  ";magic=$magic"
-%                                                : ''
-%                                            ),
-%                                },
-%                              ],
-%                            } (qw( active suspended cancelled ))
-%                      ]; };
-%  $align .= 'r';
-%#}
-%
-%push @header, 'Frequency';
-%push @fields, sub { shift->freq_pretty; };
-%$align .= 'l';
-%
-%if ( $taxclasses ) {
-%  push @header, 'Taxclass';
-%  push @fields, sub { shift->taxclass() || '&nbsp;'; };
-%  $align .= 'l';
-%}
-%
-%push @header, 'Plan',
-%              'Data',
-%              'Services';
-%              #'Service', 'Quan', 'Primary';
-%
-%push @fields, sub { shift->plan || '(legacy)' }, 
-%
-%              sub {
-%                    my $part_pkg = shift;
-%                    if ( $part_pkg->plan ) {
-%
-%                      [ map { 
-%                              /^(\w+)=(.*)$/; #or something;
-%                              [
-%                                { 'data'  => $1,
-%                                  'align' => 'right',
-%                                },
-%                                { 'data'  => $2,
-%                                  'align' => 'left',
-%                                },
-%                              ];
-%                            }
-%                        split(/\n/, $part_pkg->plandata)
-%                      ];
-%
-%                    } else {
-%
-%                      [ map { [
-%                                { 'data'  => uc($_),
-%                                  'align' => 'right',
-%                                },
-%                                {
-%                                  'data'  => $part_pkg->$_(),
-%                                  'align' => 'left',
-%                                },
-%                              ];
-%                            }
-%                        (qw(setup recur))
-%                      ];
-%
-%                    }
-%
-%                  },
-%
-%              sub {
-%                    my $part_pkg = shift;
-%
-%                    [ map  {
-%                             my $pkg_svc = $_;
-%                             my $part_svc = $pkg_svc->part_svc;
-%                             my $svc = $part_svc->svc;
-%                             if ( $pkg_svc->primary_svc =~ /^Y/i ) {
-%                               $svc = "<B>$svc (PRIMARY)</B>";
-%                             }
-%                             $svc =~ s/ +/&nbsp;/g;
-%
-%                             [
-%                               {
-%                                 'data'  => '<B>'. $pkg_svc->quantity. '</B>',
-%                                 'align' => 'right'
-%                               },
-%                               {
-%                                 'data'  => $svc,
-%                                 'align' => 'left',
-%                                 'link'  => $p. 'edit/part_svc.cgi?'.
-%                                            $part_svc->svcpart,
-%                               },
-%                             ];
-%                           }
-%                      sort {     $b->primary_svc =~ /^Y/i
-%                             <=> $a->primary_svc =~ /^Y/i
-%                           }
-%                           $part_pkg->pkg_svc
-%
-%                    ];
-%
-%                  };
-%
-%$align .= 'lrl'; #rr';
-%
-%# --------
-%
-%my $count_query = 'SELECT COUNT(*) FROM part_pkg';
-%$count_query .= " WHERE $search"
-%  if $search;
-%
-%
 <% include( 'elements/browse.html',
                  'title'          => 'Package Definitions',
                  'menubar'        => [ 'Main Menu' => $p ],
@@ -256,3 +17,245 @@
                  'style'          => \@style,
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+#false laziness w/access_user.html
+my %search = ();
+my $search = '';
+unless ( $cgi->param('showdisabled') ) {
+  %search = ( 'disabled' => '' );
+  $search = "( disabled = '' OR disabled IS NULL )";
+}
+
+my $select = '*';
+my $orderby = 'pkgpart';
+if ( $cgi->param('active') ) {
+
+  $orderby = 'num_active DESC';
+}
+  $select = "
+
+    *,
+
+    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
+       AND ( cancel IS NULL OR cancel = 0 )
+       AND ( susp IS NULL OR susp = 0 )
+    ) AS num_active,
+
+    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
+        AND ( cancel IS NULL OR cancel = 0 )
+        AND susp IS NOT NULL AND susp != 0
+    ) AS num_suspended,
+
+    ( SELECT COUNT(*) FROM cust_pkg WHERE cust_pkg.pkgpart = part_pkg.pkgpart
+        AND cancel IS NOT NULL AND cancel != 0
+    ) AS num_cancelled
+
+  ";
+
+#}
+
+my $conf = new FS::Conf;
+my $taxclasses = $conf->exists('enable_taxclasses');
+
+my $html_init;
+#unless ( $cgi->param('active') ) {
+  $html_init = qq!
+    One or more service definitions are grouped together into a package 
+    definition and given pricing information.  Customers purchase packages
+    rather than purchase services directly.<BR><BR>
+    <A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A>
+    <BR><BR>
+  !;
+#}
+
+my $posttotal;
+if ( $cgi->param('showdisabled') ) {
+  $cgi->param('showdisabled', 0);
+  $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled packages</a> )';
+  $cgi->param('showdisabled', 1);
+} else {
+  $cgi->param('showdisabled', 1);
+  $posttotal = '( <a href="'. $cgi->self_url. '">show disabled packages</a> )';
+  $cgi->param('showdisabled', 0);
+}
+
+
+# ------
+
+my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
+
+my @header = ( '#', 'Package', 'Comment' );
+my @fields = ( 'pkgpart', 'pkg', 'comment' );
+my $align = 'rll';
+my @links = ( $link, $link, '' );
+my @style = ( '', '', '' );
+
+#false laziness w/access_user.html
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
+  push @header, 'Status';
+  push @fields, sub { shift->disabled
+                        ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
+                        : '<FONT COLOR="#00CC00">Active</FONT>'
+                    };
+  push @links, '';
+  $align .= 'c';
+  push @style, 'b';
+}
+
+unless ( 0 ) { #already showing only one class or something?
+  push @header, 'Class';
+  push @fields, sub { shift->classname || '(none)'; };
+  $align .= 'l';
+}
+
+#if ( $cgi->param('active') ) {
+  push @header, 'Customer<BR>packages';
+  my %col = (
+    'active'          => '00CC00',
+    'suspended'       => 'FF9900',
+    'cancelled'       => 'FF0000',
+    #'one-time charge' => '000000',
+    'charge'          => '000000',
+  );
+  my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
+  push @fields, sub { my $part_pkg = shift;
+                      [
+                        map {
+                              my $magic = $_;
+                              my $label = $_;
+                              if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
+                                $magic = 'inactive';
+                                #$label = 'one-time charge',
+                                $label = 'charge',
+                              }
+                          
+                              [
+                                {
+                                 'data'  => '<B><FONT COLOR="#'. $col{$label}. '">'.
+                                            $part_pkg->get("num_$_").
+                                            '</FONT></B>',
+                                 'align' => 'right',
+                                },
+                                {
+                                 'data'  => $label.
+                                              ( $part_pkg->get("num_$_") != 1
+                                                && $label =~ /charge$/
+                                                  ? 's'
+                                                  : ''
+                                              ),
+                                 'align' => 'left',
+                                 'link'  => ( $part_pkg->get("num_$_")
+                                                ? $cust_pkg_link.
+                                                  $part_pkg->pkgpart.
+                                                  ";magic=$magic"
+                                                : ''
+                                            ),
+                                },
+                              ],
+                            } (qw( active suspended cancelled ))
+                      ]; };
+  $align .= 'r';
+#}
+
+push @header, 'Frequency';
+push @fields, sub { shift->freq_pretty; };
+$align .= 'l';
+
+if ( $taxclasses ) {
+  push @header, 'Taxclass';
+  push @fields, sub { shift->taxclass() || '&nbsp;'; };
+  $align .= 'l';
+}
+
+push @header, 'Plan',
+              'Data',
+              'Services';
+              #'Service', 'Quan', 'Primary';
+
+push @fields, sub { shift->plan || '(legacy)' }, 
+
+              sub {
+                    my $part_pkg = shift;
+                    if ( $part_pkg->plan ) {
+
+                      [ map { 
+                              /^(\w+)=(.*)$/; #or something;
+                              [
+                                { 'data'  => $1,
+                                  'align' => 'right',
+                                },
+                                { 'data'  => $2,
+                                  'align' => 'left',
+                                },
+                              ];
+                            }
+                        split(/\n/, $part_pkg->plandata)
+                      ];
+
+                    } else {
+
+                      [ map { [
+                                { 'data'  => uc($_),
+                                  'align' => 'right',
+                                },
+                                {
+                                  'data'  => $part_pkg->$_(),
+                                  'align' => 'left',
+                                },
+                              ];
+                            }
+                        (qw(setup recur))
+                      ];
+
+                    }
+
+                  },
+
+              sub {
+                    my $part_pkg = shift;
+
+                    [ map  {
+                             my $pkg_svc = $_;
+                             my $part_svc = $pkg_svc->part_svc;
+                             my $svc = $part_svc->svc;
+                             if ( $pkg_svc->primary_svc =~ /^Y/i ) {
+                               $svc = "<B>$svc (PRIMARY)</B>";
+                             }
+                             $svc =~ s/ +/&nbsp;/g;
+
+                             [
+                               {
+                                 'data'  => '<B>'. $pkg_svc->quantity. '</B>',
+                                 'align' => 'right'
+                               },
+                               {
+                                 'data'  => $svc,
+                                 'align' => 'left',
+                                 'link'  => $p. 'edit/part_svc.cgi?'.
+                                            $part_svc->svcpart,
+                               },
+                             ];
+                           }
+                      sort {     $b->primary_svc =~ /^Y/i
+                             <=> $a->primary_svc =~ /^Y/i
+                           }
+                           $part_pkg->pkg_svc
+
+                    ];
+
+                  };
+
+$align .= 'lrl'; #rr';
+
+# --------
+
+my $count_query = 'SELECT COUNT(*) FROM part_pkg';
+$count_query .= " WHERE $search"
+  if $search;
+
+</%init>

Index: addr_block.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/addr_block.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- addr_block.cgi	23 Aug 2006 22:25:36 -0000	1.3
+++ addr_block.cgi	30 Jan 2007 20:59:13 -0000	1.4
@@ -80,4 +80,7 @@
 </TABLE>
 </BODY>
 </HTML>
-
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+</%init>

Index: svc_acct_pop.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/svc_acct_pop.cgi,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- svc_acct_pop.cgi	23 Aug 2006 22:25:37 -0000	1.18
+++ svc_acct_pop.cgi	30 Jan 2007 20:59:13 -0000	1.19
@@ -1,10 +1,3 @@
-<!-- mason kludge -->
-%
-%  my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct
-%                                     WHERE popnum = ?           ")
-%    or die dbh->errstr;
-%
-
 <% include("/elements/header.html",'Access Number Listing', menubar( 'Main Menu' => $p )) %>
 Points of Presence<BR><BR>
 <A HREF="<% $p %>edit/svc_acct_pop.cgi"><I>Add new Access Number</I></A><BR><BR>
@@ -68,4 +61,13 @@
     </TABLE>
   </BODY>
 </HTML>
+<%init>
 
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct
+                                   WHERE popnum = ?           ")
+  or die dbh->errstr;
+
+</%init>

Index: reason.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/reason.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- reason.html	19 Oct 2006 14:24:56 -0000	1.1
+++ reason.html	30 Jan 2007 20:59:13 -0000	1.2
@@ -1,37 +1,3 @@
-%
-%$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
-%my $class = $1;
-%
-%my %classmap = ( 'C' => 'cancel',
-%                 'S' => 'suspend',
-%               );
-%
-%my $classname = $classmap{$class};
-%
-%my $html_init = ucfirst($classname) .
-%  " reasons explain why we $classname a package.<BR><BR>".
-%  qq!<A HREF="${p}edit/reason.html?class=$class">!.
-%  "<I>Add a $classname reason</I></A><BR><BR>";
-%
-%my $where_clause = "WHERE class='$class'";
-%$where_clause .= " AND (disabled = '' OR disabled IS NULL)"
-%  unless $cgi->param('showdisabled');
-
-%my $disabledurl = $cgi->param('showdisabled')
-%     ? do { $cgi->param('showdisabled', 0);
-%           '( <a href="'. $cgi->self_url. '">hide disabled reasons</a> )'; }
-%     : do { $cgi->param('showdisabled', 1);
-%           '( <a href="'. $cgi->self_url. '">show disabled reasons</a> )'; }
-%     ;
-%
-%$html_init .= $disabledurl;
-%
-%my $count_query = 'SELECT COUNT(*) FROM reason LEFT JOIN reason_type on ' .
-%                  'reason_type.typenum = reason.reason_type ' . $where_clause;
-%
-%my $link = [ $p."edit/reason.html?class=$class&reasonnum=", 'reasonnum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => ucfirst($classname) . ' Reasons',
                  'menubar'     => [ # 'Main menu' => $p,
@@ -62,3 +28,41 @@
                                   ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+$cgi->param('class') =~ /^(\w)$/ or die "illegal class";
+my $class = $1;
+
+my %classmap = ( 'C' => 'cancel',
+               'S' => 'suspend',
+             );
+
+my $classname = $classmap{$class};
+
+my $html_init = ucfirst($classname) .
+" reasons explain why we $classname a package.<BR><BR>".
+qq!<A HREF="${p}edit/reason.html?class=$class">!.
+"<I>Add a $classname reason</I></A><BR><BR>";
+
+my $where_clause = "WHERE class='$class'";
+$where_clause .= " AND (disabled = '' OR disabled IS NULL)"
+unless $cgi->param('showdisabled');
+
+my $disabledurl = $cgi->param('showdisabled')
+   ? do { $cgi->param('showdisabled', 0);
+         '( <a href="'. $cgi->self_url. '">hide disabled reasons</a> )'; }
+   : do { $cgi->param('showdisabled', 1);
+         '( <a href="'. $cgi->self_url. '">show disabled reasons</a> )'; }
+   ;
+
+$html_init .= $disabledurl;
+
+my $count_query = 'SELECT COUNT(*) FROM reason LEFT JOIN reason_type on ' .
+                'reason_type.typenum = reason.reason_type ' . $where_clause;
+
+my $link = [ $p."edit/reason.html?class=$class&reasonnum=", 'reasonnum' ];
+
+</%init>

Index: msgcat.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/msgcat.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- msgcat.cgi	23 Aug 2006 22:25:37 -0000	1.5
+++ msgcat.cgi	30 Jan 2007 20:59:13 -0000	1.6
@@ -1,42 +1,44 @@
 <% include('/elements/header.html', "View Message catalog", menubar(
   'Edit message catalog' => $p. "edit/msgcat.cgi",
 )) %>
-%
-%
-%my $widget = new HTML::Widgets::SelectLayers(
-%  'selected_layer' => 'en_US',
-%  'options'        => { 'en_US'=>'en_US' },
-%  'layer_callback' => sub {
-%    my $layer = shift;
-%    my $html = "<BR>Messages for locale $layer<BR>". table().
-%               "<TR><TH COLSPAN=2>Code</TH>".
-%               "<TH>Message</TH>";
-%    $html .= "<TH>en_US Message</TH>" unless $layer eq 'en_US';
-%    $html .= '</TR>';
-%
-%    #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode }
-%    #                       qsearch('msgcat', { 'locale' => $layer } ) ) {
-%    foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) {
-%      $html .= '<TR><TD>'. $msgcat->msgnum. '</TD>'.
-%               '<TD>'. $msgcat->msgcode. '</TD>'.
-%               '<TD>'. $msgcat->msg. '</TD>';
-%      unless ( $layer eq 'en_US' ) {
-%        my $en_msgcat = qsearchs('msgcat', {
-%          'locale'  => 'en_US',
-%          'msgcode' => $msgcat->msgcode,
-%        } );
-%        $html .= '<TD>'. $en_msgcat->msg. '</TD>';
-%      }
-%      $html .= '</TR>';
-%    }
-%
-%    $html .= '</TABLE>';
-%    $html;
-%  },
-%
-%);
-%
-
-
 <%  $widget->html %>
 <% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $widget = new HTML::Widgets::SelectLayers(
+  'selected_layer' => 'en_US',
+  'options'        => { 'en_US'=>'en_US' },
+  'layer_callback' => sub {
+    my $layer = shift;
+    my $html = "<BR>Messages for locale $layer<BR>". table().
+               "<TR><TH COLSPAN=2>Code</TH>".
+               "<TH>Message</TH>";
+    $html .= "<TH>en_US Message</TH>" unless $layer eq 'en_US';
+    $html .= '</TR>';
+
+    #foreach my $msgcat ( sort { $a->msgcode cmp $b->msgcode }
+    #                       qsearch('msgcat', { 'locale' => $layer } ) ) {
+    foreach my $msgcat ( qsearch('msgcat', { 'locale' => $layer } ) ) {
+      $html .= '<TR><TD>'. $msgcat->msgnum. '</TD>'.
+               '<TD>'. $msgcat->msgcode. '</TD>'.
+               '<TD>'. $msgcat->msg. '</TD>';
+      unless ( $layer eq 'en_US' ) {
+        my $en_msgcat = qsearchs('msgcat', {
+          'locale'  => 'en_US',
+          'msgcode' => $msgcat->msgcode,
+        } );
+        $html .= '<TD>'. $en_msgcat->msg. '</TD>';
+      }
+      $html .= '</TR>';
+    }
+
+    $html .= '</TABLE>';
+    $html;
+  },
+
+);
+
+</%init>

Index: part_bill_event.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_bill_event.cgi,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- part_bill_event.cgi	18 Oct 2006 23:07:07 -0000	1.13
+++ part_bill_event.cgi	30 Jan 2007 20:59:13 -0000	1.14
@@ -1,16 +1,3 @@
-% 
-%my %search;
-%if ( $cgi->param('showdisabled') ) {
-%  %search = ();
-%} else {
-%  %search = ( 'disabled' => '' );
-%}
-%
-%my @part_bill_event = qsearch('part_bill_event', \%search );
-%my $total = scalar(@part_bill_event);
-%
-
-
 <% include("/elements/header.html",'Invoice Event Listing', menubar( 'Main Menu' => $p) ) %>
 
     Invoice events are actions taken on open invoices.<BR><BR>
@@ -118,3 +105,19 @@
 
 </BODY>
 </HTML>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my %search;
+if ( $cgi->param('showdisabled') ) {
+%search = ();
+} else {
+%search = ( 'disabled' => '' );
+}
+
+my @part_bill_event = qsearch('part_bill_event', \%search );
+my $total = scalar(@part_bill_event);
+
+</%init>

Index: part_export.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_export.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- part_export.cgi	23 Aug 2006 22:25:37 -0000	1.5
+++ part_export.cgi	30 Jan 2007 20:59:13 -0000	1.6
@@ -1,4 +1,3 @@
-<!-- mason kludge -->
 <% include("/elements/header.html","Export Listing", menubar( 'Main Menu' => "$p#sysadmin" )) %>
 Provisioning services to external machines, databases and APIs.<BR><BR>
 <A HREF="<% $p %>edit/part_export.cgi"><I>Add a new export</I></A><BR><BR>
@@ -39,3 +38,7 @@
 </TABLE>
 </BODY>
 </HTML>
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+</%init>

Index: rate.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/rate.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rate.cgi	23 Aug 2006 22:25:37 -0000	1.4
+++ rate.cgi	30 Jan 2007 20:59:13 -0000	1.5
@@ -1,22 +1,3 @@
-%
-%
-%my $html_init = 
-%  'Rate plans, regions and prefixes for VoIP and call billing.<BR><BR>'.
-%  qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
-%  qq! | <A HREF="${p}edit/rate_region.cgi"><I>Add a region</I></A>!.
-%  '<BR><BR>
-%   <SCRIPT>
-%   function rate_areyousure(href) {
-%    if (confirm("Are you sure you want to delete this rate plan?") == true)
-%      window.location.href = href;
-%   }
-%   </SCRIPT>';
-%
-%my $count_query = 'SELECT COUNT(*) FROM rate';
-%
-%my $link = [ $p.'edit/rate.cgi?', 'ratenum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => 'Rate plans',
                  'menubar'     => [ 'Main menu' => $p, ],
@@ -32,3 +13,25 @@
                  'links'       => [ $link, $link ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init = 
+'Rate plans, regions and prefixes for VoIP and call billing.<BR><BR>'.
+qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
+qq! | <A HREF="${p}edit/rate_region.cgi"><I>Add a region</I></A>!.
+'<BR><BR>
+ <SCRIPT>
+ function rate_areyousure(href) {
+  if (confirm("Are you sure you want to delete this rate plan?") == true)
+    window.location.href = href;
+ }
+ </SCRIPT>';
+
+my $count_query = 'SELECT COUNT(*) FROM rate';
+
+my $link = [ $p.'edit/rate.cgi?', 'ratenum' ];
+
+</%init>

Index: part_referral.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_referral.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- part_referral.html	23 Aug 2006 22:25:37 -0000	1.5
+++ part_referral.html	30 Jan 2007 20:59:13 -0000	1.6
@@ -139,3 +139,9 @@
     </TABLE>
   </BODY>
 </HTML>
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration')
+      || $FS::CurrentUser::CurrentUser->access_right('Edit advertising sources')
+      || $FS::CurrentUser::CurrentUser->access_right('Edit global advertising sources');
+</%init>

Index: payment_gateway.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/payment_gateway.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- payment_gateway.html	23 Aug 2006 22:25:37 -0000	1.4
+++ payment_gateway.html	30 Jan 2007 20:59:13 -0000	1.5
@@ -1,14 +1,3 @@
-%
-%
-%  my %search;
-%  if ( $cgi->param('showdisabled') ) {
-%    %search = ();
-%  } else {
-%    %search = ( 'disabled' => '' );
-%  }
-%
-%
-
 <% include("/elements/header.html",'Payment gateways', menubar(
   'Main Menu' => $p,
   'Agents'    => $p. 'browse/agent.cgi',
@@ -75,4 +64,16 @@
 </TABLE>
 </BODY>
 </HTML>
+<%init>
 
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my %search;
+if ( $cgi->param('showdisabled') ) {
+  %search = ();
+} else {
+  %search = ( 'disabled' => '' );
+}
+
+</%init>

Index: part_virtual_field.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_virtual_field.cgi,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- part_virtual_field.cgi	23 Aug 2006 22:25:37 -0000	1.5
+++ part_virtual_field.cgi	30 Jan 2007 20:59:13 -0000	1.6
@@ -40,4 +40,7 @@
 
 </BODY>
 </HTML>
-
+<%init>
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+</%init>

Index: pkg_class.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/pkg_class.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pkg_class.html	20 Dec 2006 09:49:08 -0000	1.3
+++ pkg_class.html	30 Jan 2007 20:59:13 -0000	1.4
@@ -1,15 +1,3 @@
-%
-%
-%my $html_init = 
-%  'Package classes define groups of packages, for reporting and '.
-%  'convenience purposes.<BR><BR>'.
-%  qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!;
-%
-%my $count_query = 'SELECT COUNT(*) FROM pkg_class';
-%
-%my $link = [ $p.'edit/pkg_class.html?', 'classnum' ];
-%
-%
 <% include( 'elements/browse.html',
                  'title'       => 'Package classes',
                  'html_init'   => $html_init,
@@ -25,3 +13,18 @@
                  'links'       => [ $link, $link ],
              )
 %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init = 
+  'Package classes define groups of packages, for reporting and '.
+  'convenience purposes.<BR><BR>'.
+  qq!<A HREF="${p}edit/pkg_class.html"><I>Add a package class</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM pkg_class';
+
+my $link = [ $p.'edit/pkg_class.html?', 'classnum' ];
+
+</%init>



More information about the freeside-commits mailing list