[freeside-commits] freeside/httemplate/search cust_bill.html, 1.19, 1.20 cust_bill_event.cgi, 1.12, 1.13 cust_bill_event.html, 1.11, 1.12 cust_event.html, NONE, 1.1 report_cust_bill.html, 1.7, 1.8 report_cust_credit.html, 1.11, 1.12 report_cust_event.html, NONE, 1.1 report_cust_main-zip.html, 1.4, 1.5 report_cust_pay.html, 1.16, 1.17 report_cust_pay_batch.html, 1.3, 1.4 report_cust_pkg.html, 1.8, 1.9 svc_acct.cgi, 1.40, 1.41 svc_broadband.cgi, 1.4, 1.5 svc_domain.cgi, 1.23, 1.24 svc_forward.cgi, 1.12, 1.13 svc_phone.cgi, 1.4, 1.5 svc_www.cgi, 1.10, 1.11

Ivan,,, ivan at wavetail.420.am
Wed Aug 1 15:26:48 PDT 2007


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail:/tmp/cvs-serv23435/httemplate/search

Modified Files:
	cust_bill.html cust_bill_event.cgi cust_bill_event.html 
	report_cust_bill.html report_cust_credit.html 
	report_cust_main-zip.html report_cust_pay.html 
	report_cust_pay_batch.html report_cust_pkg.html svc_acct.cgi 
	svc_broadband.cgi svc_domain.cgi svc_forward.cgi svc_phone.cgi 
	svc_www.cgi 
Added Files:
	cust_event.html report_cust_event.html 
Log Message:
event refactor, landing on HEAD!

Index: report_cust_bill.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_bill.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- report_cust_bill.html	11 May 2007 23:18:52 -0000	1.7
+++ report_cust_bill.html	1 Aug 2007 22:26:45 -0000	1.8
@@ -5,8 +5,8 @@
 
 <TABLE>
   <% include( '/elements/tr-select-agent.html',
-                 ($cgi->param('agentnum') || ''),
-                 'label' => 'Invoices for agent: ',
+                 'curr_value' => scalar( $cgi->param('agentnum') ),
+                 'label'      => 'Invoices for agent: ',
              )
   %>
   <% include( '/elements/tr-input-beginning_ending.html' ) %>

Index: report_cust_main-zip.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_main-zip.html,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- report_cust_main-zip.html	11 May 2007 23:18:53 -0000	1.4
+++ report_cust_main-zip.html	1 Aug 2007 22:26:45 -0000	1.5
@@ -34,8 +34,8 @@
       </TR>
 
       <% include( '/elements/tr-select-agent.html',
-                     ($cgi->param('agentnum') || ''),
-                     'label' => 'for agent: ',
+                     'curr_value' => scalar( $cgi->param('agentnum') ),
+                     'label'      => 'For agent: ',
                  )
       %>
 

--- NEW FILE: cust_event.html ---
<% include( 'elements/search.html',
                 'title'       => $title,
                 'html_init'   => $html_init,
                 'menubar'     => $menubar,
                 'name'        => 'billing events',
                 'query'       => $sql_query,
                 'count_query' => $count_sql,
                 'header'      => [ 'Event',
                                    'Date',
                                    'Status',
                                    'Trigger',
                                    #'Inv #', 'Inv Date', 'Cust #',
                                    #'Invoice',
                                    
                                    FS::UI::Web::cust_header(), #'cust_main_custnum',
                                  ],
                 'fields' => [
                               'event',
                               sub { time2str("%b %d %Y %T", $_[0]->_date) },
                               $status_sub,
                               $trigger_sub,
                               #sub {
                               #      #my $cust_event = shift;
                               #      'Invoice #'. $_[0]->invnum.
                               #      ' ('.
                               #        time2str("%D", $_[0]->cust_bill_date).
                               #      ')';
                               #    },
                               \&FS::UI::Web::cust_fields,
                             ],
                'align' => 'lrll'.FS::UI::Web::cust_aligns(),
                'links' => [
                              '',
                              '',
                              '',
                              $trigger_link,
                              #sub {
                              #  my $part_event = shift;
                              #  #XXX
                              #  my $template = $part_event->templatename;
                              #  $template .= '-' if $template;
                              #  [ "${p}view/cust_bill.cgi?$template", 'invnum'];
                              #},

                              ( map { $_ ne 'Cust. Status' ? $link_cust : '' }
                                    FS::UI::Web::cust_header()
                              ),
                            ],
                 'color' => [ 
                              '',
                              '',
                              '',
                              '',
                              #'',
                              FS::UI::Web::cust_colors(),
                            ],
                 'style' => [ 
                              '',
                              '',
                              '',
                              '',
                              #'',
                              FS::UI::Web::cust_styles(),
                            ],
             )
%>
<%once>

my $status_sub = sub { 
  my $cust_event = shift;

  my $status = $cust_event->status;
  $status .= ': '.$cust_event->statustext
    if $cust_event->statustext;

  my $part_event = $cust_event->part_event;

  if ( $part_event->eventtable eq 'cust_bill' && $part_event->templatename ) {
    my $alt_templatename = $part_event->templatename;
    my $alt_link = "$alt_templatename-". $cust_event->tablenum;

    my $conf = new FS::Conf;
    my $cust_bill = $cust_event->cust_X;

    $status .= qq{
          ( <A HREF="${p}view/cust_bill.cgi?$alt_link">view</A>
          | <A HREF="${p}view/cust_bill-pdf.cgi?$alt_link.pdf">view
              typeset</A>
          | <A HREF="${p}misc/print-invoice.cgi?$alt_link">re-print</A>
    };

    if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { 
      $status .= qq{
            | <A HREF="${p}misc/email-invoice.cgi?$alt_link">re-email</A>
      };
    } 
   
    if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { 
      $status .= qq{
            | <A HREF="${p}misc/fax-invoice.cgi?$alt_link">re-fax</A>
      }
    } 

    $status .= ' ) ';

  }

  $status;
};

my $trigger_sub = sub {
  my $cust_event = shift;
  my $eventtable = $cust_event->eventtable;
  my $label = FS::part_event->eventtable_labels->{$eventtable};
  #if ( $eventtable eq 'cust_pkg' || $eventtable eq 'cust_bill' ) {
    "$label #". $cust_event->tablenum;
  #} else {
  #  $label;
  #}
};

my $trigger_link = sub {
  my $cust_event = shift;
  my $eventtable = $cust_event->eventtable;
  if ( $eventtable eq 'cust_pkg' ) {
    my $custnum = $cust_event->cust_main_custnum;
    [ "${p}view/cust_main.cgi?$custnum#cust_pkg", 'tablenum' ];
  } else {
    [ "${p}view/$eventtable.cgi?", 'tablenum' ];
  }
};

</%once>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Billing event reports')
      or $curuser->access_right('View customer billing events')
         && (    $cgi->param('custnum') =~ /^(\d+)$/
              || $cgi->param('invnum')  =~ /^(\d+)$/
              || $cgi->param('pkgnum')  =~ /^(\d+)$/
            );
         

my $title = $cgi->param('failed')
              ? 'Failed billing events'
              : 'Billing events';

my @search = ();

if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) {
  push @search, "agentnum = $1";
  #my $agent = qsearchs('agent', { 'agentnum' => $1 } );
  #die "unknown agentnum $1" unless $agent;
}

my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @search, "cust_event._date >= $beginning",
              "cust_event._date <= $ending";

if ( $cgi->param('failed') ) {
  push @search, "statustext != ''",
                "statustext IS NOT NULL",
                "statustext != 'N/A'";
}

#if ( $cgi->param('part_event.payby') =~ /^(\w+)$/ ) {
#  push @search, "part_event.payby = '$1'";
#}

if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
  push @search, "cust_main.custnum = '$1'";
}
if ( $cgi->param('invnum') =~ /^(\d+)$/ ) {
  push @search, "part_event.eventtable = 'cust_bill'",
                "tablenum = '$1'";
}
if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
  push @search, "part_event.eventtable = 'cust_pkg'",
                "tablenum = '$1'";
}

#here is the agent virtualization
my $agent_sql = $curuser->agentnums_sql;
$agent_sql =~ s/agentnum/cust_main.agentnum/g;
push @search, $agent_sql;

my $where = 'WHERE '. join(' AND ', @search );

my $join = "
       JOIN part_event USING ( eventpart )
  LEFT JOIN cust_bill ON ( eventtable = 'cust_bill' AND tablenum = invnum  )
  LEFT JOIN cust_pkg  ON ( eventtable = 'cust_pkg'  AND tablenum = pkgnum  )
  LEFT JOIN cust_main ON (    ( eventtable = 'cust_main' AND tablenum = cust_main.custnum )
                           OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum )
                           OR ( eventtable = 'cust_pkg'  AND cust_pkg.custnum  = cust_main.custnum )
                         )
";
           #'LEFT JOIN cust_main  USING ( custnum   ) ';

my $sql_query = {
  'table'     => 'cust_event',
  'select'    => join(', ',
                    'cust_event.*',
                    'part_event.*',
                    #'cust_bill.custnum',
                    #'cust_bill._date AS cust_bill_date',
                    'cust_main.custnum AS cust_main_custnum',
                    FS::UI::Web::cust_sql_fields(),
                  ),
  'hashref'   => {}, 
  'extra_sql' => "$where ORDER BY _date ASC",
  'addl_from' => $join,
};

my $count_sql = "SELECT COUNT(*) FROM cust_event $join $where";

my $conf = new FS::Conf;

my $failed = $cgi->param('failed');

my $html_init = join("\n", map {
  ( my $action = $_ ) =~ s/_$//;
  include('/elements/progress-init.html',
            $_.'form',
            [ 'action', 'beginning', 'ending', 'failed' ],
            "../misc/${_}events.cgi",
            { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but...
            $_, #key
         ),
  qq!<FORM NAME="${_}form">!,
  qq!<INPUT TYPE="hidden" NAME="action" VALUE="$_">!, #not used though
  qq!<INPUT TYPE="hidden" NAME="beginning" VALUE="$beginning">!,
  qq!<INPUT TYPE="hidden" NAME="ending"    VALUE="$ending">!,
  qq!<INPUT TYPE="hidden" NAME="failed"    VALUE="$failed">!,
  qq!</FORM>!
} qw( print_ email_ fax_ ) ).

'<SCRIPT TYPE="text/javascript">

function confirm_print_process() {
  if ( ! confirm("Are you sure you want to reprint these invoices?") ) {
    return;
  }
  print_process();
}
function confirm_email_process() {
  if ( ! confirm("Are you sure you want to re-email these invoices?") ) {
    return;
  }
  email_process();
}
function confirm_fax_process() {
  if ( ! confirm("Are you sure you want to re-fax these invoices?") ) {
    return;
  }
  fax_process();
}

</SCRIPT>';

my $menubar =  [
                 'Re-print these events' =>
                   "javascript:confirm_print_process()",
                 'Re-email these events' =>
                   "javascript:confirm_email_process()",
               ];

push @$menubar, 'Re-fax these events' =>
                  "javascript:confirm_fax_process()"
  if $conf->exists('hylafax');

my $link_cust = sub {
  my $cust_event = shift;
  $cust_event->cust_main_custnum
    ? [ "${p}view/cust_main.cgi?", 'cust_main_custnum' ]
    : '';
};

</%init>

Index: svc_domain.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_domain.cgi,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- svc_domain.cgi	3 Feb 2007 11:36:30 -0000	1.23
+++ svc_domain.cgi	1 Aug 2007 22:26:46 -0000	1.24
@@ -69,7 +69,9 @@
                 ' LEFT JOIN cust_main USING ( custnum ) ';
 
 #here is the agent virtualization
-push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
+push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( 
+                   'null_right' => 'View/link unlinked services'
+                 );
 
 my $extra_sql = '';
 if ( @extra_sql ) {

Index: svc_www.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_www.cgi,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- svc_www.cgi	14 Feb 2007 01:43:19 -0000	1.10
+++ svc_www.cgi	1 Aug 2007 22:26:46 -0000	1.11
@@ -76,7 +76,9 @@
                 ' LEFT JOIN cust_main USING ( custnum ) ';
 
 #here is the agent virtualization
-push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
+push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
+                   'null_right' => 'View/link unlinked services'
+                 );
 
 my $extra_sql = 
   scalar(@extra_sql)

Index: cust_bill_event.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_event.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cust_bill_event.cgi	3 Feb 2007 11:36:30 -0000	1.12
+++ cust_bill_event.cgi	1 Aug 2007 22:26:45 -0000	1.13
@@ -64,8 +64,12 @@
 %>
 <%init>
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('Billing event reports');
+  unless $curuser->access_right('Billing event reports')
+      or $curuser->access_right('View customer billing events')
+         && $cgi->param('invnum') =~ /^(\d+)$/;
 
 my $title = $cgi->param('failed')
               ? 'Failed invoice events'
@@ -93,6 +97,10 @@
   push @search, "part_bill_event.payby = '$1'";
 }
 
+if ( $cgi->param('invnum') =~ /^(\d+)$/ ) {
+  push @search, "cust_bill_event.invnum = '$1'";
+}
+
 #here is the agent virtualization
 push @search, $FS::CurrentUser::CurrentUser->agentnums_sql;
 
@@ -123,7 +131,11 @@
 
 my $failed = $cgi->param('failed');
 
-my $html_init = join("\n", map {
+my $html_init = '
+    <FONT SIZE="+1">Invoice events are the deprecated, old-style actions taken o
+n open invoices.  See Reports-&gt;Billing events-&gt;Billing events for current event reports.</FONT><BR><BR>';
+
+$html_init .= join("\n", map {
   ( my $action = $_ ) =~ s/_$//;
   include('/elements/progress-init.html',
             $_.'form',

Index: report_cust_credit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_credit.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- report_cust_credit.html	11 May 2007 23:18:53 -0000	1.11
+++ report_cust_credit.html	1 Aug 2007 22:26:45 -0000	1.12
@@ -18,8 +18,8 @@
   </TR>
 
   <% include( '/elements/tr-select-agent.html',
-                 ($cgi->param('agentnum') || ''),
-                 'label' => 'for agent: ',
+                 'curr_value' => scalar( $cgi->param('agentnum') ),
+                 'label'      => 'for agent: ',
              )
   %>
 

Index: cust_bill_event.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_event.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cust_bill_event.html	3 Feb 2007 11:36:30 -0000	1.11
+++ cust_bill_event.html	1 Aug 2007 22:26:45 -0000	1.12
@@ -4,6 +4,9 @@
    )
 %>
 
+    <FONT SIZE="+1">Invoice events are the deprecated, old-style actions taken
+    on open invoices.  See Reports-&gt;Billing events-&gt;Billing events for current event reports.</FONT><BR><BR>
+
     <FORM ACTION="cust_bill_event.cgi" METHOD="GET">
     <INPUT TYPE="hidden" NAME="failed" VALUE="<% $cgi->param('failed') %>">
     <TABLE>

Index: svc_phone.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_phone.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- svc_phone.cgi	3 Feb 2007 11:36:30 -0000	1.4
+++ svc_phone.cgi	1 Aug 2007 22:26:46 -0000	1.5
@@ -74,7 +74,9 @@
                 ' LEFT JOIN cust_main USING ( custnum ) ';
 
 #here is the agent virtualization
-push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
+push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql(
+                   'null_right' => 'View/link unlinked services'
+                 );
 
 my $extra_sql = '';
 if ( @extra_sql ) {

Index: report_cust_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_pkg.html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- report_cust_pkg.html	26 Jun 2007 15:37:19 -0000	1.8
+++ report_cust_pkg.html	1 Aug 2007 22:26:45 -0000	1.9
@@ -9,11 +9,11 @@
       <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
     </TR>
     <% include( '/elements/tr-select-agent.html',
-                   ($cgi->param('agentnum') || ''),
+                   'curr_value' => scalar( $cgi->param('agentnum') ),
                )
     %>
 
-    <% include( '/elements/tr-select-cust_pkg-status.html', '',
+    <% include( '/elements/tr-select-cust_pkg-status.html',
                   'onchange' => 'status_changed(this);',
               )
     %>
@@ -62,7 +62,7 @@
 
     </SCRIPT>
 
-    <% include( '/elements/tr-select-pkg_class.html', '',
+    <% include( '/elements/tr-select-pkg_class.html',
                    'pre_options' => [ '0' => 'all' ],
                    'empty_label' => '(empty class)',
                )

Index: svc_acct.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_acct.cgi,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- svc_acct.cgi	3 Feb 2007 11:36:30 -0000	1.40
+++ svc_acct.cgi	1 Aug 2007 22:26:45 -0000	1.41
@@ -132,7 +132,9 @@
                 ' LEFT JOIN cust_main USING ( custnum ) ';
 
 #here is the agent virtualization
-push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
+push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( 
+                   'null_right' => 'View/link unlinked services'
+                 );
 
 my $extra_sql = 
   scalar(@extra_sql)

Index: report_cust_pay.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_pay.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- report_cust_pay.html	11 May 2007 23:18:53 -0000	1.16
+++ report_cust_pay.html	1 Aug 2007 22:26:45 -0000	1.17
@@ -49,8 +49,8 @@
   </TR>
 
   <% include( '/elements/tr-select-agent.html',
-                 ($cgi->param('agentnum') || ''),
-                 'label' => 'for agent: ',
+                 'curr_value' => scalar($cgi->param('agentnum')),
+                 'label'      => 'for agent: ',
              )
   %>
 

--- NEW FILE: report_cust_event.html ---
<% include(
      '/elements/header.html',
      ( $cgi->param('failed') ? 'Failed billing events' : 'Billing events' ),
   )
%>

    <FORM ACTION="cust_event.html" METHOD="GET">
    <INPUT TYPE="hidden" NAME="failed" VALUE="<% $cgi->param('failed') %>">
    <TABLE>

      <% include( '/elements/tr-select-agent.html' ) %>

      <!--<TR>
        <TD ALIGN="right">Customer type</TD>
        <TD><SELECT MULTIPLE NAME="perhaps_payby">
          <OPTION SELECTED VALUE="CARD">Credit card (automatic)
          <OPTION SELECTED VALUE="CHEK">E-check (automatic)
          <OPTION SELECTED VALUE="LECB">Phone bill billing
          <OPTION SELECTED VALUE="BILL">Billing
          <OPTION SELECTED VALUE="DCRD">Credit card (on-demand)
          <OPTION SELECTED VALUE="DCHK">E-check (on-demand)
        </TD>
      </TR>
      -->
      <% include( '/elements/tr-input-beginning_ending.html' ) %>
      <!--
      <TR>
        <TD ALIGN="right">Events: </TD>
        <TD>
          <SELECT NAME="eventpart">
            <OPTION SELECTED VALUE=""><% $cgi->param('failed') ? '(all failed events)' : '(all events)' %>
% #foreach my $part_bill_event ( qsearch( 'part_bill_event', {} ) ) { 
% #} 

          </SELECT>
        </TD>
      </TR>
      -->
<!--      <TR>
        <TD ALIGN="right">Events for payment type: </TD>
        <TD>
          <SELECT NAME="part_bill_event.payby">
            <OPTION SELECTED VALUE="">(all)
            <OPTION VALUE="CARD">Credit card (automatic)
            <OPTION VALUE="BILL">Billing
            <OPTION VALUE="CHEK">Electronic check (automatic)
            <OPTION VALUE="DCRD">Credit card (on-demand)
            <OPTION VALUE="DCHK">Electronic check (on-demand)
            <OPTION VALUE="LECB">Phone bill billing
            <OPTION VALUE="COMP">Complimentary
          </SELECT>
        </TD>
      </TR>
-->
    </TABLE>
    <BR><INPUT TYPE="submit" VALUE="Get Report">
    </FORM>

<% include('/elements/footer.html') %>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Billing event reports');

</%init>

Index: report_cust_pay_batch.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cust_pay_batch.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- report_cust_pay_batch.html	11 May 2007 23:18:53 -0000	1.3
+++ report_cust_pay_batch.html	1 Aug 2007 22:26:45 -0000	1.4
@@ -16,8 +16,8 @@
   </TR>
 
   <% include( '/elements/tr-select-agent.html',
-                 ($cgi->param('agentnum') || ''),
-                 'label' => 'for agent: ',
+                 'curr_value' => scalar( $cgi->param('agentnum') ),
+                 'label'      => 'For agent: ',
              )
   %>
 

Index: svc_broadband.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_broadband.cgi,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- svc_broadband.cgi	3 Feb 2007 11:36:30 -0000	1.4
+++ svc_broadband.cgi	1 Aug 2007 22:26:45 -0000	1.5
@@ -5,9 +5,18 @@
 %
 %my @svc_broadband = ();
 %my $sortby=\*svcnum_sort;
+%#XXX agent-virtualization needs to be finished :/
+%my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql( 
+%                      'null_right' => 'View/link unlinked services'
+%                    );
+%
 %if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
 %
-%  @svc_broadband=qsearch('svc_broadband',{});
+%  @svc_broadband = qsearch(
+%    'table'     => 'svc_broadband',
+%    'hashref'   => {},
+%    #needs the join first 'extra_sql' => "WHERE $agentnums_sql",
+%  );
 %
 %  if ( $cgi->param('magic') eq 'unlinked' ) {
 %    @svc_broadband = grep { qsearchs('cust_svc', {
@@ -17,7 +26,7 @@
 %                                    )
 %                          }
 %		      @svc_broadband;
-%  }
+%  } else {
 %
 %  if ( $cgi->param('sortby') =~ /^(\w+)$/ ) {
 %    my $sortby = $1;

Index: cust_bill.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill.html,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cust_bill.html	3 Feb 2007 11:36:30 -0000	1.19
+++ cust_bill.html	1 Aug 2007 22:26:45 -0000	1.20
@@ -199,18 +199,41 @@
  qq!<INPUT TYPE="hidden" NAME="open"      VALUE="$open">!,
  qq!<INPUT TYPE="hidden" NAME="days"      VALUE="$days">!,
  qq!</FORM>!
-} qw( print_ email_ fax_ ) );
+} qw( print_ email_ fax_ ) ). 
+
+'<SCRIPT TYPE="text/javascript">
+
+function confirm_print_process() {
+  if ( ! confirm("Are you sure you want to reprint these invoices?") ) {
+    return;
+  }
+  print_process();
+}
+function confirm_email_process() {
+  if ( ! confirm("Are you sure you want to re-email these invoices?") ) {
+    return;
+  }
+  email_process();
+}
+function confirm_fax_process() {
+  if ( ! confirm("Are you sure you want to re-fax these invoices?") ) {
+    return;
+  }
+  fax_process();
+}
+
+</SCRIPT>';
 
 my $menubar =  [
                 'Main menu' => $p,
                 'Print these invoices' =>
-                  "javascript:print_process()",
+                  "javascript:confirm_print_process()",
                 'Email these invoices' =>
-                  "javascript:email_process()",
+                  "javascript:confirm_email_process()",
               ];
 
 push @$menubar, 'Fax these invoices' =>
-                 "javascript:fax_process()"
+                 "javascript:confirm_fax_process()"
  if $conf->exists('hylafax');
 
 </%init>

Index: svc_forward.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/svc_forward.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- svc_forward.cgi	3 Feb 2007 11:36:30 -0000	1.12
+++ svc_forward.cgi	1 Aug 2007 22:26:46 -0000	1.13
@@ -46,7 +46,6 @@
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('List services');
 
-
 my $conf = new FS::Conf;
 
 my $orderby = 'ORDER BY svcnum';
@@ -71,7 +70,9 @@
                 ' LEFT JOIN cust_main USING ( custnum ) ';
 
 #here is the agent virtualization
-push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql;
+push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( 
+                   'null_right' => 'View/link unlinked services'
+                 );
 
 my $extra_sql = 
   scalar(@extra_sql)



More information about the freeside-commits mailing list