[freeside-commits] branch master updated. b31455ec31222bd0e882b76895baa794d80acb17

Ivan ivan at 420.am
Sun May 13 16:21:28 PDT 2012


The branch, master has been updated
       via  b31455ec31222bd0e882b76895baa794d80acb17 (commit)
      from  4cc0b69a94138d85b1ff8b67966127af3c72288d (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 b31455ec31222bd0e882b76895baa794d80acb17
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun May 13 16:21:27 2012 -0700

    add cust_main-custom_content config item for Globelink's custom customer view, RT#17579

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index a1fda68..da8717e 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -4784,6 +4784,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-custom_content',
+    'section'     => 'UI',
+    'description' => 'As an alternative to cust_main-custom_link (leave it blank), the contant to display on this customer page, one item per line.  Available iems are: small_custview, birthdate, spouse_birthdate, svc_acct, svc_phone and svc_external.',
+    'type'        => 'textarea',
+  },
+
+  {
     'key'         => 'cust_main-custom_title',
     'section'     => 'UI',
     'description' => 'Title for the "Custom" tab in the View Customer page.',
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 1d4a90c..788b1d3 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2070,7 +2070,7 @@ sub cust_svc {
   }
   if ( $opt{'svcdb'} ) {
     $search{addl_from} = ' LEFT JOIN part_svc USING ( svcpart ) ';
-    $search{hashref}->{svcdb} = $opt{'svcdb'};
+    $search{extra_sql} = ' AND svcdb = '. dbh->quote( $opt{'svcdb'} );
   }
 
   cluck "cust_pkg->cust_svc called" if $DEBUG > 2;
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 9ce55b0..83f28d3 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -277,7 +277,13 @@ function areyousure(href, message) {
 % }
 
 % if ( $view eq 'custom' ) { 
+%   if ( $conf->config('cust_main-custom_link') ) {
 <& cust_main/custom.html, $cust_main &>
+%   } elsif ( $conf->config('cust_main-custom_content') ) {
+      <& cust_main/custom_content.html, $cust_main &>
+%   #} else {
+%   #  warn "custom view without cust_main-custom_link or -custom_content?";
+%   }
 % }
 
 </DIV>
@@ -326,7 +332,8 @@ $views{emt('Payment History')} =  'payment_history'
 $views{emt('Change History')}  =  'change_history'
   if $curuser->access_right('View customer history');
 $views{$conf->config('cust_main-custom_title') || emt('Custom')} =  'custom'
-  if $conf->config('cust_main-custom_link');
+  if $conf->config('cust_main-custom_link')
+  || $conf->config('cust_main-custom_content');
 $views{emt('Jumbo')}           =  'jumbo';
 
 my %viewname = reverse %views;
diff --git a/httemplate/view/cust_main/custom_content/.birthdate.html.swp b/httemplate/view/cust_main/custom_content/.birthdate.html.swp
new file mode 100644
index 0000000..9571d22
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.birthdate.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.small_custview.html.swp b/httemplate/view/cust_main/custom_content/.small_custview.html.swp
new file mode 100644
index 0000000..a39f52d
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.small_custview.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.spouse_birthdate.html.swp b/httemplate/view/cust_main/custom_content/.spouse_birthdate.html.swp
new file mode 100644
index 0000000..0042012
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.spouse_birthdate.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.svc_Common.html.swp b/httemplate/view/cust_main/custom_content/.svc_Common.html.swp
new file mode 100644
index 0000000..15591b9
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.svc_Common.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.svc_acct.html.swp b/httemplate/view/cust_main/custom_content/.svc_acct.html.swp
new file mode 100644
index 0000000..e2db6d5
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.svc_acct.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.svc_hardware.html.swp b/httemplate/view/cust_main/custom_content/.svc_hardware.html.swp
new file mode 100644
index 0000000..1106f9e
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.svc_hardware.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/.svc_phone.html.swp b/httemplate/view/cust_main/custom_content/.svc_phone.html.swp
new file mode 100644
index 0000000..79b8185
Binary files /dev/null and b/httemplate/view/cust_main/custom_content/.svc_phone.html.swp differ
diff --git a/httemplate/view/cust_main/custom_content/birthdate.html b/httemplate/view/cust_main/custom_content/birthdate.html
new file mode 100644
index 0000000..1f16963
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/birthdate.html
@@ -0,0 +1,15 @@
+<TABLE CLASS="fsinnerbox">
+  <& /elements/tr-td-label.html, 'label' => mt('Date of Birth') &>
+  <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
+</TR>
+</TABLE>
+<%init>
+my($cust_main) = @_;
+my $conf = new FS::Conf;
+my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
+my $dt = $cust_main->birthdate ne ''
+           ? DateTime->from_epoch( 'epoch'     => $cust_main->birthdate,
+                                   'time_zone' =>'floating',
+                                 )
+           : '';
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/small_custview.html b/httemplate/view/cust_main/custom_content/small_custview.html
new file mode 100644
index 0000000..b325f2a
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/small_custview.html
@@ -0,0 +1,8 @@
+<& /elements/small_custview.html, $cust_main &>
+<%init>
+
+my($cust_main) = @_;
+
+my $conf = new FS::Conf;
+
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/spouse_birthdate.html b/httemplate/view/cust_main/custom_content/spouse_birthdate.html
new file mode 100644
index 0000000..c78fd26
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/spouse_birthdate.html
@@ -0,0 +1,15 @@
+<TABLE CLASS="fsinnerbox">
+  <& /elements/tr-td-label.html, 'label' => mt('Spouse Date of Birth') &>
+  <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
+</TR>
+</TABLE>
+<%init>
+my($cust_main) = @_;
+my $conf = new FS::Conf;
+my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
+my $dt = $cust_main->spouse_birthdate ne ''
+           ? DateTime->from_epoch( 'epoch'     => $cust_main->spouse_birthdate,
+                                   'time_zone' =>'floating',
+                                 )
+           : '';
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/svc_Common.html b/httemplate/view/cust_main/custom_content/svc_Common.html
new file mode 100644
index 0000000..519a395
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/svc_Common.html
@@ -0,0 +1,40 @@
+% foreach my $cust_svc (@cust_svc) {
+%   my $svc_x = $cust_svc->svc_x;
+%   #warn $svc_x;
+<TABLE CLASS="fsinnerbox">
+%   foreach my $field ( grep $svc_x->$_(), @{ $opt{fields} } ) {
+      <& /elements/tr-td-label.html, 'label' => $labels{$field} &>
+      <TD BGCOLOR="#ffffff"><% $svc_x->$field() |h %></TD>
+    </TR>
+%   }
+</TABLE>
+% }
+<%init>
+my($cust_main, %opt) = @_;
+
+my $table = $opt{table};
+warn $table;
+my @cust_svc = ();
+foreach my $cust_pkg (
+  grep {warn $_->num_cust_svc( 'svcdb'=>$table ); $_->num_cust_svc( 'svcdb'=>$table ); }
+       $cust_main->all_pkgs
+) { 
+  my @wtf = $cust_pkg->cust_svc( 'svcdb'=>$table );
+  warn scalar(@wtf);
+  push @cust_svc, $cust_pkg->cust_svc( 'svcdb'=>$table );
+}
+
+my %labels;
+if ( UNIVERSAL::can("FS::$table", 'table_info') ) {
+#  $opt{'name'}   = "FS::$table"->table_info->{'name'};
+
+  my $fields = "FS::$table"->table_info->{'fields'};
+  %labels = map { $_ =>  ( ref($fields->{$_})
+                            ? $fields->{$_}{'label'}
+                            : $fields->{$_}
+                        );
+                }
+            keys %$fields;
+}
+
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/svc_acct.html b/httemplate/view/cust_main/custom_content/svc_acct.html
new file mode 100644
index 0000000..49b9798
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/svc_acct.html
@@ -0,0 +1,7 @@
+<& svc_Common.html, $cust_main,
+  'table' => 'svc_acct',
+  'fields' => [qw( username _password )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/svc_hardware.html b/httemplate/view/cust_main/custom_content/svc_hardware.html
new file mode 100644
index 0000000..f5d53a2
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/svc_hardware.html
@@ -0,0 +1,7 @@
+<& svc_Common.html, $cust_main,
+  'table' => 'svc_hardware',
+  'fields' => [qw( ip_addr hw_addr serial )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>
diff --git a/httemplate/view/cust_main/custom_content/svc_phone.html b/httemplate/view/cust_main/custom_content/svc_phone.html
new file mode 100644
index 0000000..46ec476
--- /dev/null
+++ b/httemplate/view/cust_main/custom_content/svc_phone.html
@@ -0,0 +1,7 @@
+<& svc_Common.html, $cust_main,
+  'table' => 'svc_phone',
+  'fields' => [qw( phonenum )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>

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

Summary of changes:
 FS/FS/Conf.pm                                      |    7 +++
 FS/FS/cust_pkg.pm                                  |    2 +-
 httemplate/view/cust_main.cgi                      |    9 ++++-
 .../cust_main/custom_content/.birthdate.html.swp   |  Bin 0 -> 12288 bytes
 .../custom_content/.small_custview.html.swp        |  Bin 0 -> 12288 bytes
 .../custom_content/.spouse_birthdate.html.swp      |  Bin 0 -> 12288 bytes
 .../cust_main/custom_content/.svc_Common.html.swp  |  Bin 0 -> 12288 bytes
 .../cust_main/custom_content/.svc_acct.html.swp    |  Bin 0 -> 12288 bytes
 .../custom_content/.svc_hardware.html.swp          |  Bin 0 -> 12288 bytes
 .../cust_main/custom_content/.svc_phone.html.swp   |  Bin 0 -> 12288 bytes
 .../view/cust_main/custom_content/birthdate.html   |   15 +++++++
 .../cust_main/custom_content/small_custview.html   |    8 ++++
 .../cust_main/custom_content/spouse_birthdate.html |   15 +++++++
 .../view/cust_main/custom_content/svc_Common.html  |   40 ++++++++++++++++++++
 .../view/cust_main/custom_content/svc_acct.html    |    7 +++
 .../cust_main/custom_content/svc_hardware.html     |    7 +++
 .../view/cust_main/custom_content/svc_phone.html   |    7 +++
 17 files changed, 115 insertions(+), 2 deletions(-)
 create mode 100644 httemplate/view/cust_main/custom_content/.birthdate.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.small_custview.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.spouse_birthdate.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.svc_Common.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.svc_acct.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.svc_hardware.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/.svc_phone.html.swp
 create mode 100644 httemplate/view/cust_main/custom_content/birthdate.html
 create mode 100644 httemplate/view/cust_main/custom_content/small_custview.html
 create mode 100644 httemplate/view/cust_main/custom_content/spouse_birthdate.html
 create mode 100644 httemplate/view/cust_main/custom_content/svc_Common.html
 create mode 100644 httemplate/view/cust_main/custom_content/svc_acct.html
 create mode 100644 httemplate/view/cust_main/custom_content/svc_hardware.html
 create mode 100644 httemplate/view/cust_main/custom_content/svc_phone.html




More information about the freeside-commits mailing list