[freeside-commits] branch master updated. 4289ed53f86f18d6107339db5b7cee38f64533c0

Ivan ivan at 420.am
Tue Mar 25 16:33:22 PDT 2014


The branch, master has been updated
       via  4289ed53f86f18d6107339db5b7cee38f64533c0 (commit)
      from  def4273b6560ff747dfbb53fb5d921a4e5d1c79d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4289ed53f86f18d6107339db5b7cee38f64533c0
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Mar 25 16:33:19 2014 -0700

    improve performance of package add/edit (don't pull up pricing info in add-on/supplemental package dropdowns), RT#24000

diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index e872232..07f59aa 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -839,6 +839,16 @@ sub pkg_comment {
   $pre. $self->pkg. ( $custom_comment ? " - $custom_comment" : '' );
 }
 
+#without price info (so without hitting the DB again)
+sub pkg_comment_only {
+  my $self = shift;
+  my %opt = @_;
+
+  my $pre = $opt{nopkgpart} ? '' : $self->pkgpart. ': ';
+  my $comment = $self->comment;
+  $pre. $self->pkg. ( $comment ? " - $comment" : '' );
+}
+
 sub price_info { # safety, in case a part_pkg hasn't defined price_info
     '';
 }
@@ -1241,6 +1251,8 @@ will be suppressed.
 
 sub option {
   my( $self, $opt, $ornull ) = @_;
+  cluck "$self -> option: searching for $opt"
+    if $DEBUG;
   my $part_pkg_option =
     qsearchs('part_pkg_option', {
       pkgpart    => $self->pkgpart,
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index f356980..54d6768 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -325,6 +325,9 @@ Example:
 %     'disabled'      => $f->{'disabled'},
 %     'fixed'         => $f->{'fixed'},
 %
+%     #umm.  for select-agent_types at least
+%     'label_callback'=> $f->{'label_callback'},
+%
 %     #any?
 %     'colspan'       => $f->{'colspan'},
 %     'required'      => $f->{'required'},
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index cabaf0a..c7d314c 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -308,6 +308,7 @@
                                             ? "AND pkgpart != $pkgpart"
                                             : ''
                                          },
+                     'label_callback' => sub { shift->pkg_comment_only },
                      'm2_label'   => 'Include line item(s) from package',
                      'm2m_method' => 'bill_part_pkg_link',
                      'm2m_dstcol' => 'dst_pkgpart',
@@ -334,6 +335,7 @@
                                             ? "AND pkgpart != $pkgpart"
                                             : ''
                                          },
+                     'label_callback' => sub { shift->pkg_comment_only },
                      'm2_label'   => 'Include services of package: ',
                      'm2m_method' => 'svc_part_pkg_link',
                      'm2m_dstcol' => 'dst_pkgpart',
@@ -350,6 +352,7 @@
                    },
                    { 'field'       => 'supp_dst_pkgpart',
                      'type'        => 'select-part_pkg',
+                     'label_callback' => sub { shift->pkg_comment_only },
                      'm2_label'    => 'When ordering package, also order',
                      'm2m_method'  => 'supp_part_pkg_link',
                      'm2m_dstcol'  => 'dst_pkgpart',
diff --git a/httemplate/elements/select-part_pkg.html b/httemplate/elements/select-part_pkg.html
index 9d41b07..bf58191 100644
--- a/httemplate/elements/select-part_pkg.html
+++ b/httemplate/elements/select-part_pkg.html
@@ -15,17 +15,16 @@ Example:
 
 </%doc>
 
-<% include( '/elements/select-table.html',
-              'table'          => 'part_pkg',
-              'agent_virt'     => 1,
-              'agent_null'     => 1,
-              'name_col'       => 'pkg',
-              'empty_label'    => 'Select package', #should this be the default?
-              'label_callback' => sub { shift->pkg_comment },
-              'hashref'        => \%hash,
-              %opt,
-          )
-%>
+<& /elements/select-table.html,
+     'table'          => 'part_pkg',
+     'agent_virt'     => 1,
+     'agent_null'     => 1,
+     'name_col'       => 'pkg',
+     'empty_label'    => 'Select package', #should this be the default?
+     'label_callback' => $opt{'label_callback'} || sub { shift->pkg_comment },
+     'hashref'        => \%hash,
+     %opt,
+&>
 <%init>
  
 my( %opt ) = @_;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_pkg.pm                        |   12 ++++++++++++
 httemplate/edit/elements/edit.html       |    3 +++
 httemplate/edit/part_pkg.cgi             |    3 +++
 httemplate/elements/select-part_pkg.html |   21 ++++++++++-----------
 4 files changed, 28 insertions(+), 11 deletions(-)




More information about the freeside-commits mailing list