[freeside-commits] branch master updated. 219c811aa5ee634bb17e1fa19a2d75351949b8d4

Ivan Kohler ivan at freeside.biz
Tue Nov 27 15:20:09 PST 2018


The branch, master has been updated
       via  219c811aa5ee634bb17e1fa19a2d75351949b8d4 (commit)
       via  3e6b291920daf5546efa5355e3ea6199e875d9db (commit)
      from  4466b9790181b76b2955cf522562231228047054 (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 219c811aa5ee634bb17e1fa19a2d75351949b8d4
Merge: 3e6b29192 4466b9790
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Nov 27 15:20:05 2018 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 3e6b291920daf5546efa5355e3ea6199e875d9db
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Nov 27 15:19:59 2018 -0800

    select agent and customer fields on attachment report, RT#81809

diff --git a/FS/FS/cust_attachment.pm b/FS/FS/cust_attachment.pm
index 5e5e07673..8f6278960 100644
--- a/FS/FS/cust_attachment.pm
+++ b/FS/FS/cust_attachment.pm
@@ -1,7 +1,7 @@
 package FS::cust_attachment;
 
 use strict;
-use base qw( FS::otaker_Mixin FS::Record );
+use base qw( FS::cust_main_Mixin FS::otaker_Mixin FS::Record );
 use Carp;
 use FS::Record qw( qsearch qsearchs );
 use FS::Conf;
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 9220073f3..ed9d59d4e 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -501,7 +501,7 @@ $report_menu{'SQL Query'}      = [ $fsurl.'search/report_sql.html', 'SQL Query']
 tie my %tools_customers, 'Tie::IxHash', ();
 $tools_customers{'Appointments'} = [ $fsurl.'rt/Search/Schedule.html?LengthMin=0', 'View appointment schedule' ]
   if $curuser->access_right('View appointments');
-$tools_customers{'Attachments'} = [ $fsurl.'browse/cust_attachment.html', 'View customer attachments' ]
+$tools_customers{'Attachments'} = [ $fsurl.'search/cust_attachment.html', 'View customer attachments' ]
   if !$conf->config('disable_cust_attachment') and $curuser->access_right('View attachments') and $curuser->access_right('Browse attachments');
 $tools_customers{'Customer email settings'} = [ $fsurl.'misc/manage_cust_email.html' ]
   if $curuser->access_right('Edit customer');
diff --git a/httemplate/browse/cust_attachment.html b/httemplate/search/cust_attachment.html
similarity index 77%
rename from httemplate/browse/cust_attachment.html
rename to httemplate/search/cust_attachment.html
index 7330c05a4..556bb527a 100755
--- a/httemplate/browse/cust_attachment.html
+++ b/httemplate/search/cust_attachment.html
@@ -1,4 +1,4 @@
-<% include( 'elements/browse.html',
+<% include( 'elements/search.html',
                  'title'       => 'Attachments',
                  'menubar'     => '',
                  'name'        => ($disabled ? 'deleted' : '') .' attachments',
@@ -14,7 +14,10 @@
                  'query'       => $query,
                  'count_query' => $count_query,
                  'header' => [ selflink('#',orderby => 'attachnum'),
-                               selflink('Customer',orderby => 'custnum'),
+                               #selflink('Customer',orderby => 'custnum'),
+                               FS::UI::Web::cust_header(
+                                 $cgi->param('cust_fields')
+                               ),
                                selflink('Date',orderby => '_date'),
                                selflink('Filename',orderby => 'filename'),
                                selflink('Size',orderby => 'length(body)'),
@@ -24,7 +27,8 @@
                              ],
                  'fields' => [
                                'attachnum',
-                               $sub_cust,
+                               #$sub_cust,
+                               \&FS::UI::Web::cust_fields,
                                $sub_date,
                                'filename',
                                $sub_size,
@@ -33,14 +37,30 @@
                                $sub_checkbox,
                              ],
                  'links' => [ '',
-                              [ $p.'view/cust_main.cgi?', 'custnum' ],
+                              ( map { $_ ne 'Cust. Status' ? $clink : '' }
+                                    FS::UI::Web::cust_header(
+                                      $cgi->param('cust_fields')
+                                    )
+                              ),
                             ],
                  'link_onclicks' => [
                               '',
-                              '',
+                              ( map '', FS::UI::Web::cust_header(
+                                          $cgi->param('cust_fields')
+                                        )
+                              ),
                               '',
                               $sub_edit_link,
                               ],
+                 'color' => [
+                              '',
+                              FS::UI::Web::cust_colors(),
+                            ],
+                 'style' => [
+                              '',
+                              FS::UI::Web::cust_styles(),
+                            ],
+                 'align'  => 'r'. FS::UI::Web::cust_aligns(),
 
                  #'links' =>  [
                  #              '',
@@ -89,12 +109,17 @@ else {
 
 my $orderby = $cgi->param('orderby') || 'custnum';
 
+my $extra_sql = '';
+if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
+  $extra_sql = " AND agentnum = $1 ";
+}
+
 my $query = {
     table     => 'cust_attachment',
     hashref   => { disabled => $disabled ? { op => '>', value => 0 } : '', },
     order_by  => "ORDER BY $orderby",
     addl_from => 'JOIN cust_main USING (custnum)',
-    extra_sql => ' AND ' . $curuser->agentnums_sql,
+    extra_sql => "$extra_sql AND ". $curuser->agentnums_sql,
 };
 
 my $count_query = 'SELECT COUNT(*) FROM cust_attachment'
@@ -102,10 +127,13 @@ my $count_query = 'SELECT COUNT(*) FROM cust_attachment'
   . ' WHERE ' . $curuser->agentnums_sql
   . ' AND disabled ' . ( $disabled ? '> 0' : 'IS NULL' );
 
-my $sub_cust = sub {
-  my $c = qsearchs('cust_main', { custnum => shift->custnum } );
-  return $c ? encode_entities($c->name) : '<FONT COLOR="red"><B>(not found)</B></FONT>';
-};
+#still need to report on attachments with deleted customer?  did we ever?
+#my $sub_cust = sub {
+#  my $c = qsearchs('cust_main', { custnum => shift->custnum } );
+#  return $c ? encode_entities($c->name) : '<FONT COLOR="red"><B>(not found)</B></FONT>';
+#};
+
+my $clink = [ $p.'view/cust_main.cgi?', 'custnum' ];
 
 my $sub_date = sub {
   time2str("%b %o, %Y", shift->_date);
diff --git a/httemplate/search/report_cust_attachment.html b/httemplate/search/report_cust_attachment.html
new file mode 100644
index 000000000..d9d9cb430
--- /dev/null
+++ b/httemplate/search/report_cust_attachment.html
@@ -0,0 +1,42 @@
+<& /elements/header.html, mt('Customer attachment report') &>
+
+<FORM ACTION="cust_attachment.html" METHOD="GET">
+
+<FONT CLASS="fsinnerbox-title"><% emt('Attachment search options') %></FONT>
+<TABLE CLASS="fsinnerbox">
+
+  <& /elements/tr-select-agent.html &>
+
+% if ( $curuser->access_right('View deleted attachments') ) {
+
+    <& /elements/tr-checkbox.html,
+         'label' => 'Show deleted attachments',
+         'field' => 'show_deleted',
+         'value' => 1,
+    &>
+
+% }
+
+</TABLE>
+<BR><BR>
+
+<FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
+<TABLE CLASS="fsinnerbox">
+
+    <& /elements/tr-select-cust-fields.html &>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="<% emt('Get Report') %>">
+
+</FORM>
+
+<& /elements/footer.html &>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied" if !$curuser->access_right('View attachments')
+                    || !$curuser->access_right('Browse attachments');
+
+</%init>

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

Summary of changes:
 FS/FS/cust_attachment.pm                           |  2 +-
 httemplate/elements/menu.html                      |  2 +-
 httemplate/{browse => search}/cust_attachment.html | 48 +++++++++++++++++-----
 httemplate/search/report_cust_attachment.html      | 42 +++++++++++++++++++
 4 files changed, 82 insertions(+), 12 deletions(-)
 rename httemplate/{browse => search}/cust_attachment.html (77%)
 create mode 100644 httemplate/search/report_cust_attachment.html




More information about the freeside-commits mailing list