[freeside-commits] freeside/httemplate/search inventory_class.html, NONE, 1.1 inventory_item.html, NONE, 1.1

Ivan,,, ivan at wavetail.420.am
Wed Mar 8 02:05:03 PST 2006


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail:/tmp/cvs-serv10076/httemplate/search

Added Files:
	inventory_class.html inventory_item.html 
Log Message:
Add a new table for inventory with for DIDs/serials/etc., and an additional
new table for inventory category (i.e. to distinguish DIDs, serials, MACs,
etc.)

--- NEW FILE: inventory_item.html ---
<%

my $classnum = $cgi->param('classnum');
$classnum =~ /^(\d+)$/ or eidiot "illegal agentnum $agentnum";
$classnum = $1;
my $inventory_class = qsearchs('inventory_class', { 'classnum' => $classnum } );

my $count_query =
  "SELECT COUNT(*) FROM inventory_class WHERE classnum = $classnum";

%><%= include( 'elements/search.html',
                 'title'       => $inventory_class->classname. ' Inventory',

                 #less lame to use Lingua:: something to pluralize
                 'name'        => $inventory_class->classname. 's',

                 'query'       => {
                                    'table'   => 'inventory_item',
                                    'hashref' => { 'classnum' => $classnum },
                                  },

                 'count_query' => $count_query,

                 # XXX proper full service/customer link ala svc_acct
                 'header'      => [ '#', $inventory_class->classname, 'svcnum' ],

                 'fields'      => [
                   'itemnum',
                   'item',
                   'svcnum', #XXX proper full service customer link ala svc_acct
                             # "unallocated" ?  "available" ?
                 ],

             )
%>

--- NEW FILE: inventory_class.html ---
<%

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 %inv_action_link = (
  'num_avail' => 'eventually'
);
my %inv_action_label = (
  'num_avail' => 'upload_batch'
);

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

%><%= include( 'elements/search.html',
                 'title'       => 'Inventory Classes',
                 'name'        => 'inventory classes',
                 'menubar'     => [ 'Add a new inventory class' =>
                                      $p.'edit/inventory_class.html',
                                  ],
                 'query'       => { 'table' => 'inventory_class', },
                 'count_query' => 'SELECT COUNT(*) FROM inventory_class',
                 'header'      => [ '#', 'Inventory class', 'Inventory' ],
                 'fields'      => [ 'classnum',
                                    'classname',
                                    sub {
                                          #my $inventory_class = shift;
                                          my $i_c = shift;

                                          [ map {
                                                  [
                                                    {
                                                      'data'  => '<B>'. $i_c->$_(). '</B>',
                                                      'align' => 'right',
                                                    },
                                                    {
                                                      'data'  => $labels{$_},
                                                      'align' => 'left',
                                                    },
                                                    { 'data'  => ( exists($inv_action_link{$_})
                                                                   ? '<FONT SIZE="-1">(<A HREF="'. $inv_action_link{$_}. '">'. $inv_action_label{$_}. '</A>)</FONT>'
                                                                   : ''
                                                                 ),
                                                      'align'  => 'left',
                                                    },
                                                  ]
                                                } keys %labels
                                          ];
                                        },
                                  ],
                 'links'       => [ $link,
                                    $link,
                                    '',
                                  ],
             )
%>



More information about the freeside-commits mailing list