[freeside-commits] branch FREESIDE_4_BRANCH updated. a2c9ecade8035c39074e6d66d54bfe3a15f11424

Mark Wells mark at 420.am
Tue Aug 30 16:04:46 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  a2c9ecade8035c39074e6d66d54bfe3a15f11424 (commit)
       via  368b06f9e1934e791f9fe9391bd803f9e4e43348 (commit)
       via  92be841652923a8817bbadb37f26847764d923dd (commit)
      from  72e8c3cf0a7289402708742a82d7aff74f93055d (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 a2c9ecade8035c39074e6d66d54bfe3a15f11424
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Aug 30 16:01:48 2016 -0700

    fix cust-fields, #71964

diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html
index 231bbac..22a6740 100644
--- a/httemplate/search/cust_pkg-date.html
+++ b/httemplate/search/cust_pkg-date.html
@@ -5,6 +5,7 @@
   'count_query' => $count_query,
   'header'      => \@header,
   'fields'      => \@fields,
+  'sort_fields' => [],
   'align'       => 'rrrl'. FS::UI::Web::cust_aligns(),
   'color'       => \@color,
   'style'       => \@style,
@@ -31,7 +32,6 @@ my $col = $cgi->param('date');
 die "invalid date column" unless $cols{$col};
 
 my $title = 'Packages by ' . lc($cols{$col}) . ' date';
-my $cust_fields = $cgi->param('cust_fields');
 my @header = ( $cols{$col},
                emt('#'),
                emt('Quan.'),
@@ -43,14 +43,25 @@ my @fields = ( sub { time2str('%b %d %Y', $_[0]->$col) },
                'quantity',
                'pkg_label',
              );
-my @sort_fields = ( map '', @fields ); # should only ever sort by $col
 my @color = ( map '', @fields );
 my @style = ( map '', @fields );
 
-push @header, FS::UI::Web::cust_header($cust_fields);
+my $pkg_link = sub {
+  my $self = shift;
+  my $frag = 'cust_pkg'. $self->pkgnum;
+  [ "${p}view/cust_main.cgi?custnum=".$self->custnum.
+                           ";show=packages;fragment=$frag#cust_pkg",
+    'pkgnum'
+  ];
+};
+
+my @links = ( '', ($pkg_link) x 3 );
+
+push @header, FS::UI::Web::cust_header($cgi->param('cust_fields'));
 push @fields, \&FS::UI::Web::cust_fields;
-push @color, FS::UI::Web::cust_colors();
-push @style, FS::UI::Web::cust_styles();
+push @color,  FS::UI::Web::cust_colors();
+push @style,  FS::UI::Web::cust_styles();
+push @links,  FS::UI::Web::cust_links();
 
 my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main');
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
@@ -58,6 +69,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
 }
 
 my $query = {
+  'select'    => join(',', 'cust_pkg.*', FS::UI::Web::cust_sql_fields() ),
   'table'     => 'cust_pkg',
   'addl_from' => FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg'),
   'hashref'   => {
@@ -72,17 +84,6 @@ my $count_query =
   "SELECT COUNT(*) FROM cust_pkg JOIN cust_main USING (custnum) ".
   "WHERE $col IS NOT NULL AND cancel IS NULL AND $agentnums_sql";
 
-my $pkg_link = sub {
-  my $self = shift;
-  my $frag = 'cust_pkg'. $self->pkgnum;
-  [ "${p}view/cust_main.cgi?custnum=".$self->custnum.
-                           ";show=packages;fragment=$frag#cust_pkg",
-    'pkgnum'
-  ];
-};
-
-my @links = ( '', ($pkg_link) x 3,
-  FS::UI::Web::cust_links() );
 
 my $date_color_sub = sub {
   my $self = shift;

commit 368b06f9e1934e791f9fe9391bd803f9e4e43348
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Aug 30 12:55:54 2016 -0700

    fix password_history schema upgrade from pre-3.8 versions, #72265

diff --git a/FS/FS/password_history.pm b/FS/FS/password_history.pm
index a34f616..13d1601 100644
--- a/FS/FS/password_history.pm
+++ b/FS/FS/password_history.pm
@@ -161,9 +161,14 @@ sub password_equals {
 }
 
 sub _upgrade_schema {
+  my $class = shift;
+  # if the table doesn't exist yet then nothing needs to happen here
+  my $dbdef_table = $class->dbdef_table
+    or return;
+
   # clean up history records where linked_acct has gone away
   my @where;
-  for my $fk ( grep /__/, __PACKAGE__->dbdef_table->columns ) {
+  for my $fk ( grep /__/, $dbdef_table->columns ) {
     my ($table, $key) = split(/__/, $fk);
     push @where, "
       ( $fk IS NOT NULL AND NOT EXISTS(SELECT 1 FROM $table WHERE $table.$key = $fk) )";

commit 92be841652923a8817bbadb37f26847764d923dd
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Aug 30 12:24:36 2016 -0700

    add agent and cust-fields selection to package contract end date report, #71964

diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 933728f..62e0269 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -275,7 +275,7 @@ $report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', '
 $report_packages{'Customer packages with unconfigured services'} =  [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ];
 $report_packages{'FCC Form 477'} =  [ $fsurl.'search/report_477.html' ]
   if $conf->exists('part_pkg-show_fcc_options');
-$report_packages{'Contract end dates'} = [ $fsurl.'search/cust_pkg-date.html?date=contract_end', 'Show packages by contract end date' ];
+$report_packages{'Contract end dates'} = [ $fsurl.'search/report_cust_pkg-date.html?date=contract_end', 'Show packages by contract end date' ];
 $report_packages{'Advanced package reports'} =  [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ];
 
 tie my %report_inventory, 'Tie::IxHash',
diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html
index 5bb772b..231bbac 100644
--- a/httemplate/search/cust_pkg-date.html
+++ b/httemplate/search/cust_pkg-date.html
@@ -1,3 +1,16 @@
+<& elements/search.html,
+  'title'       => $title,
+  'name'        => 'packages',
+  'query'       => $query,
+  'count_query' => $count_query,
+  'header'      => \@header,
+  'fields'      => \@fields,
+  'align'       => 'rrrl'. FS::UI::Web::cust_aligns(),
+  'color'       => \@color,
+  'style'       => \@style,
+  'links'       => \@links,
+  'cell_style'  => [ $date_color_sub ],
+&>
 <%init>
 my $curuser = $FS::CurrentUser::CurrentUser;
 die 'access denied' unless $curuser->access_right('List packages');
@@ -18,8 +31,7 @@ my $col = $cgi->param('date');
 die "invalid date column" unless $cols{$col};
 
 my $title = 'Packages by ' . lc($cols{$col}) . ' date';
-# second option on the cust_fields_avail list, plus email
-my $cust_fields = 'Cust# | Customer | Day phone | Night phone | Mobile phone | Invoicing email(s)';
+my $cust_fields = $cgi->param('cust_fields');
 my @header = ( $cols{$col},
                emt('#'),
                emt('Quan.'),
@@ -32,11 +44,18 @@ my @fields = ( sub { time2str('%b %d %Y', $_[0]->$col) },
                'pkg_label',
              );
 my @sort_fields = ( map '', @fields ); # should only ever sort by $col
+my @color = ( map '', @fields );
+my @style = ( map '', @fields );
 
 push @header, FS::UI::Web::cust_header($cust_fields);
 push @fields, \&FS::UI::Web::cust_fields;
+push @color, FS::UI::Web::cust_colors();
+push @style, FS::UI::Web::cust_styles();
 
 my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main');
+if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) {
+  $agentnums_sql .= " AND agentnum = $1";
+}
 
 my $query = {
   'table'     => 'cust_pkg',
@@ -80,15 +99,4 @@ my $date_color_sub = sub {
 };
 
 </%init>
-<& elements/search.html,
-  'title'       => $title,
-  'name'        => 'packages',
-  'query'       => $query,
-  'count_query' => $count_query,
-  'header'      => \@header,
-  'fields'      => \@fields,
-  'align'       => 'rrrl'. FS::UI::Web::cust_aligns(),
-  'links'       => \@links,
-  'cell_style'  => [ $date_color_sub ],
-&>
 
diff --git a/httemplate/search/report_cust_pkg-date.html b/httemplate/search/report_cust_pkg-date.html
new file mode 100755
index 0000000..ceb9a9c
--- /dev/null
+++ b/httemplate/search/report_cust_pkg-date.html
@@ -0,0 +1,38 @@
+<& /elements/header.html, mt($title) &>
+
+<FORM ACTION="cust_pkg-date.html" METHOD="GET">
+<INPUT TYPE="hidden" NAME="date" VALUE="<% $col %>">
+
+<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+  <& /elements/tr-select-agent.html,
+                 'curr_value'    => scalar( $cgi->param('agentnum') ),
+                 'disable_empty' => 0,
+  &>
+
+  <& /elements/tr-select-cust-fields.html &>
+  
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+
+# for the page title
+my %cols = (
+  'contract_end' => 'Contract end'
+);
+
+# or let the column be selected here?
+my $col = $cgi->param('date');
+die "invalid date column" unless $cols{$col};
+my $title = 'Packages by ' . lc($cols{$col}) . ' date';
+
+</%init>

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

Summary of changes:
 FS/FS/password_history.pm                   |    7 ++-
 httemplate/elements/menu.html               |    2 +-
 httemplate/search/cust_pkg-date.html        |   61 +++++++++++++++------------
 httemplate/search/report_cust_pkg-date.html |   38 +++++++++++++++++
 4 files changed, 80 insertions(+), 28 deletions(-)
 create mode 100755 httemplate/search/report_cust_pkg-date.html




More information about the freeside-commits mailing list