[freeside-commits] freeside/httemplate/search inventory_item.html, 1.2, 1.3

Ivan,,, ivan at wavetail.420.am
Thu Jun 29 06:47:47 PDT 2006


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

Modified Files:
	inventory_item.html 
Log Message:
finish at least the automatic provisioning part

Index: inventory_item.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/inventory_item.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- inventory_item.html	8 Mar 2006 12:14:04 -0000	1.2
+++ inventory_item.html	29 Jun 2006 13:47:44 -0000	1.3
@@ -24,7 +24,30 @@
 my $count_query =
   "SELECT COUNT(*) FROM inventory_item WHERE classnum = $classnum $extra_sql";
 
+my $link = sub {
+  my $inventory_item = shift;
+  if ( $inventory_item->svcnum ) {
+    [ "${p}view/svc_acct.cgi?", 'svcnum' ];
+  } else {
+    '';
+  }
+};
+my $link_cust = sub {
+  my $inventory_item = shift;
+  if ( $inventory_item->custnum ) {
+    [ "${p}view/cust_main.cgi?", 'custnum' ];
+  } else {
+    '';
+  }
+};
+
+my $addl_from = ' LEFT JOIN cust_svc  USING ( svcnum  ) '.
+                ' LEFT JOIN part_svc  USING ( svcpart ) '.
+                ' LEFT JOIN cust_pkg  USING ( pkgnum  ) '.
+                ' LEFT JOIN cust_main USING ( custnum ) ';
+
 %><%= include( 'elements/search.html',
+
                  'title'       => $title,
 
                  #less lame to use Lingua:: something to pluralize
@@ -33,19 +56,52 @@
                  'query'       => {
                                     'table'   => 'inventory_item',
                                     'hashref' => { 'classnum' => $classnum },
+                                    'select'  => join(', ',
+                                        'inventory_item.*',
+                                        'cust_main.custnum',
+                                        FS::UI::Web::cust_sql_fields(),
+                                      ),
                                     'extra_sql' => $extra_sql,
+                                    'addl_from' => $addl_from,
                                   },
 
                  'count_query' => $count_query,
 
-                 # XXX proper full service/customer link ala svc_acct
-                 'header'      => [ '#', $inventory_class->classname, 'svcnum' ],
+                 'header'      => [
+                   '#',
+                   $inventory_class->classname,
+                   'Service',
+                   FS::UI::Web::cust_header(),
+                 ],
 
                  'fields'      => [
                    'itemnum',
                    'item',
-                   'svcnum', #XXX proper full service customer link ala svc_acct
+                   #'svcnum', #XXX proper full service customer link ala svc_acct
                              # "unallocated" ?  "available" ?
+                   sub {
+                     #this could be way more efficient with a mixin
+                     # like cust_main_Mixin that let us all all the methods
+                     # on data we already have...
+                     my $inventory_item = shift;
+                     my $cust_svc = $inventory_item->cust_svc;
+                     if ( $cust_svc ) {
+                       my($label, $value) = $cust_svc->label;
+                       "$label: $value";
+                     } else {
+                       '(available)';
+                     }
+                   },
+
+                   \&FS::UI::Web::cust_fields,
+
+                 ],
+
+                 'links'       => [
+                   '',
+                   '',
+                   $link,
+                   ( map { $link_cust } FS::UI::Web::cust_header() ),
                  ],
 
              )



More information about the freeside-commits mailing list