[freeside-commits] freeside/httemplate/browse hardware_class.html, NONE, 1.1 hardware_status.html, NONE, 1.1 part_svc.cgi, 1.36, 1.37

Mark Wells mark at wavetail.420.am
Thu Mar 31 19:52:15 PDT 2011


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

Modified Files:
	part_svc.cgi 
Added Files:
	hardware_class.html hardware_status.html 
Log Message:
svc_hardware and svc_dish, #11454

Index: part_svc.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_svc.cgi,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -w -d -r1.36 -r1.37
--- part_svc.cgi	7 Nov 2010 07:07:06 -0000	1.36
+++ part_svc.cgi	1 Apr 2011 02:52:13 -0000	1.37
@@ -169,14 +169,14 @@
 
      <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
 % my $value = &$formatter($part_svc->part_svc_column($field)->columnvalue);
-%          if ( $flag =~ /^[MA]$/ ) { 
-%            $inventory_class{$value}
-%              ||= qsearchs('inventory_class', { 'classnum' => $value } );
+% if ( $flag =~ /^[MAH]$/ ) { 
+%   my $select_table = ($flag eq 'H') ? 'hardware_class' : 'inventory_class';
+%   $select_class{$value} ||= 
+%       qsearchs($select_table, { 'classnum' => $value } );
 %       
-
-            <% $inventory_class{$value}
-                  ? $inventory_class{$value}->classname
-                  : "WARNING: inventory_class.classnum $value not found" %>
+            <% $select_class{$value}
+                  ? $select_class{$value}->classname
+                  : "WARNING: $select_table.classnum $value not found" %>
 % } else { 
 
             <% $value %>
@@ -208,6 +208,7 @@
   'M' => 'Manual selected from inventory',
   #'A' => 'Automatically fill in from inventory',
   'A' => 'Automatically filled in from inventory',
+  'H' => 'Selected from hardware class',
   'X' => 'Excluded',
 );
 
@@ -232,6 +233,6 @@
   @part_svc = sort { lc($a->svc) cmp lc($b->svc) } @part_svc;
 }
 
-my %inventory_class = ();
+my %select_class = ();
 
 </%init>

--- NEW FILE: hardware_status.html ---
<% include( 'elements/browse.html',
                 'title'       => 'Hardware Statuses',
                 'name'        => 'hardware statuses',
                 'menubar'     => $menubar,
                 'query'       => { 'table' => 'hardware_status', },
                 'count_query' => 'SELECT COUNT(*) FROM hardware_status',
                 'header'      => [ '#', 'Status' ],
                 'fields'      => [ 'statusnum', 'label' ],
                 'links'       => [ $link, $link ],
             )
%>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Configuration');

my $menubar = [ 'Hardware classes' => $p.'browse/hardware_class.html',
                'Add a status' => $p.'edit/hardware_status.html' ];

my $link = [ "${p}edit/hardware_status.html?", 'statusnum' ];

</%init>

--- NEW FILE: hardware_class.html ---
<% include( 'elements/browse.html',
                 'title'       => 'Hardware Classes and Types',
                 'name'        => 'hardware classes',
                 'menubar'     => $menubar,
                 'query'       => { 'table' => 'hardware_class' },
                 'count_query' => 'SELECT COUNT(*) FROM hardware_class',
                 'header'      => [ '#', 'Hardware class', '', 'Device types' ],
                 'fields'      => [ 'classnum',
                                    'classname',
                                    '',
                                    $types_sub,
                                  ],
                 'links'       => [ $class_link,
                                    $class_link,
                                    '',
                                    '',
                                  ],
             )
%>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Configuration');

my $menubar = 
  [ 'Hardware statuses'    => $p.'browse/hardware_status.html',
    'Add a hardware class' => $p.'edit/hardware_class.html',
    'Add a device type',   => $p.'edit/hardware_type.html', ];

my $types_sub = sub {
  my $hardware_class = shift;
  my @rows = map { 
      my $type_link = $p.'edit/hardware_type.html?'.$_->typenum;
      [ { 'data' => $_->model, 'link' => $type_link }, ] 
    } $hardware_class->hardware_type;

  \@rows;
};

my $class_link = [ "${p}edit/hardware_class.html?", 'classnum' ];

</%init>



More information about the freeside-commits mailing list