[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.110, 1.111

Jeff Finucane,420,, jeff at wavetail.420.am
Mon Jul 20 07:26:14 PDT 2009


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

Modified Files:
	part_pkg.cgi 
Log Message:
bundle bill linked packages into top line total when desired #5724

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- part_pkg.cgi	29 Jun 2009 13:53:24 -0000	1.110
+++ part_pkg.cgi	20 Jul 2009 14:26:12 -0000	1.111
@@ -175,8 +175,9 @@
                             },
 
 
-                            { 'type'  => 'tablebreak-tr-title',
-                              'value' => 'Pricing add-ons',
+                            { 'type'    => 'tablebreak-tr-title',
+                              'value'   => 'Pricing add-ons',
+                              'colspan' => 4,
                             },
                             { 'field'      => 'bill_dst_pkgpart',
                               'type'       => 'select-part_pkg',
@@ -185,6 +186,13 @@
                               'm2m_dstcol' => 'dst_pkgpart',
                               'm2_error_callback' =>
                                 &{$m2_error_callback_maker}('bill'),
+                              'm2_fields' => [ { 'field' => 'hidden',
+                                                 'type'  => 'checkbox',
+                                                 'value' => 'Y',
+                                                 'curr_value' => '',
+                                                 'label' => 'Bundle',
+                                               },
+                                             ],
                             },
 
                             { type  => 'tablebreak-tr-title',
@@ -385,16 +393,26 @@
   my $link_type = shift; #yay closures
   return sub {
     my( $cgi, $object ) = @_;
-      map  {
-             new FS::part_pkg_link {
-               'link_type'   => $link_type,
-               'src_pkgpart' => $object->pkgpart,
-               'dst_pkgpart' => $_,
-             };
-           }
-      grep $_,
-      map  $cgi->param($_),
-      grep /^${link_type}_dst_pkgpart(\d+)$/, $cgi->param;
+    my $num;
+    map {
+
+          if ( /^${link_type}_dst_pkgpart(\d+)$/ &&
+               ( my $dst = $cgi->param("${link_type}_dst_pkgpart$1") ) )
+          {
+
+            my $hidden = $cgi->param("${link_type}_dst_pkgpart__hidden$1")
+                         || '';
+            new FS::part_pkg_link {
+              'link_type'   => $link_type,
+              'src_pkgpart' => $object->pkgpart,
+              'dst_pkgpart' => $dst,
+              'hidden'      => $hidden,
+            };
+          } else {
+            ();
+          }
+        }
+    $cgi->param;
   };
 };
 



More information about the freeside-commits mailing list