[freeside-commits] freeside/httemplate/elements tr-checkboxes-table.html, NONE, 1.1 checkboxes-table.html, 1.3, 1.4 menu.html, 1.44, 1.45 select-agent.html, 1.7, 1.8 select-table.html, 1.11, 1.12

Jeff Finucane,420,, jeff at wavetail.420.am
Sat Jun 28 12:25:25 PDT 2008


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

Modified Files:
	checkboxes-table.html menu.html select-agent.html 
	select-table.html 
Added Files:
	tr-checkboxes-table.html 
Log Message:
agent virtualize address blocks and routers

Index: select-agent.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-agent.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- select-agent.html	1 Aug 2007 22:25:09 -0000	1.7
+++ select-agent.html	28 Jun 2008 19:25:22 -0000	1.8
@@ -4,9 +4,8 @@
                  'value'       => $agentnum || '',
                  'empty_label' => 'all',
                  'hashref'     => { 'disabled' => '' },
-                 'extra_sql'   => ' AND '.
-                                  $FS::CurrentUser::CurrentUser->agentnums_sql.
-                                  ' ORDER BY agent',
+                 'order_by'    => ' ORDER BY agent',
+                 'disable_empty' => $disable_empty,
                  %opt,
              )
 %>
@@ -18,4 +17,13 @@
 $opt{'records'} = delete $opt{'agents'}
   if $opt{'agents'};
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+my $disable_empty = 1;
+if ( $opt{'agent_null_right'} &&
+     $curuser->access_right($opt{'agent_null_right'})
+   )
+{
+  $disable_empty--;
+}
+
 </%init>

Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- select-table.html	13 Apr 2008 20:35:10 -0000	1.11
+++ select-table.html	28 Jun 2008 19:25:22 -0000	1.12
@@ -92,14 +92,25 @@
 my $value = $opt{'curr_value'} || $opt{'value'};
 $value = [ split(/\s*,\s*/, $value) ] if $opt{'multiple'} && $value =~ /,/;
 
+my $extra_sql = $opt{'extra_sql'} || '';
+my $hashref =   $opt{'hashref'} || {};
+
+if ( $opt{'agent_virt'} ) {
+  $extra_sql .=
+    ( $extra_sql =~ /WHERE/i || scalar(keys %$hashref ) ? ' AND ' : ' WHERE ' ).
+    $FS::CurrentUser::CurrentUser->agentnums_sql(
+                                    'null_right' => $opt{'agent_null_right'}
+                                   );
+}
+
 my @records = ();
 if ( $opt{'records'} ) {
   @records = @{ $opt{'records'} };
 } else {
   @records = qsearch( {
     'table'     => $opt{'table'},
-    'hashref'   => ( $opt{'hashref'} || {} ),
-    'extra_sql' => ( $opt{'extra_sql'} || '' ),
+    'hashref'   => $hashref,
+    'extra_sql' => $extra_sql,
     'order_by'  => ( $opt{'order_by'} || "ORDER BY $name_col" ),
   });
 }
@@ -113,7 +124,7 @@
   $opt{hashref}->{$key} = $value;
   my $record = qsearchs( {
     'table'     => $opt{table},
-    'hashref'   => $opt{hashref},
+    'hashref'   => $hashref,
     'extra_sql' => ( $opt{extra_sql} || '' ),
   });
   push @records, $record if $record;

--- NEW FILE: tr-checkboxes-table.html ---
% unless ( $opt{'js_only'} ) {

    <% include('tr-td-label.html', @_ ) %>

      <TD <% $style %>>
% }

        <% include( '/elements/checkboxes-table.html', %opt ) %>

% unless ( $opt{'js_only'} ) {
      </TD>
    </TR>
% }
<%init>

my( %opt ) = @_;

my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';

</%init>

Index: menu.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/menu.html,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- menu.html	19 Jun 2008 03:18:19 -0000	1.44
+++ menu.html	28 Jun 2008 19:25:22 -0000	1.45
@@ -334,7 +334,7 @@
 $config_menu{'Billing'} = [ \%config_billing, ''    ]
   if $curuser->access_right('Edit billing events')
   || $curuser->access_right('Edit global billing events');
-if ( $curuser->access_right('Configuration') ) {
+if ( $curuser->access_right('Engineering configuration') ) {
   $config_menu{'Dialup'}  = [ \%config_dialup, ''    ];
   $config_menu{'Fixed (username-less) broadband'} = 
                             [ \%config_broadband, ''    ];

Index: checkboxes-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/checkboxes-table.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- checkboxes-table.html	23 Aug 2006 22:25:37 -0000	1.3
+++ checkboxes-table.html	28 Jun 2008 19:25:22 -0000	1.4
@@ -28,9 +28,9 @@
 %  my $target_pkey = dbdef->table($opt{'target_table'})->primary_key;
 %
 %  my( $source_pkey, $sourcenum, $source_obj );
-%  if ( $opt{'source_obj'} ) {
+%  if ( $opt{'source_obj'} || $opt{'object'} ) {
 %
-%    $source_obj = $opt{'source_obj'};
+%    $source_obj = $opt{'source_obj'} || $opt{'object'};
 %    #$source_table = $source_obj->dbdef_table->table;
 %    $source_pkey = $source_obj->dbdef_table->primary_key;
 %    $sourcenum = $source_obj->$source_pkey();
@@ -48,11 +48,17 @@
 %
 %  my $extra_sql = '';
 %
+%  if ( $opt{'agent_virt'} ) {
+%    $extra_sql .= ' AND' . $FS::CurrentUser::CurrentUser->agentnums_sql(
+%                             'null_right' => $opt{'agent_null_right'}
+%                           );
+%  }
+%
 %  if ( $opt{'disable-able'} ) {
 %    $hashref->{'disabled'} = '';
 %
 %    $extra_sql .= ( $sourcenum && $source_pkey ) 
-%                    ? "OR $source_pkey = $sourcenum"
+%                    ? " OR $source_pkey = $sourcenum"
 %                    : '';
 %  }
 %



More information about the freeside-commits mailing list