[freeside-commits] freeside/httemplate/view cust_bill-logo.cgi, 1.7, 1.8 cust_bill.cgi, 1.37, 1.38 cust_main.cgi, 1.112, 1.113 logo.cgi, NONE, 1.1 svc_Common.html, 1.2, 1.3

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


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

Modified Files:
	cust_bill-logo.cgi cust_bill.cgi cust_main.cgi svc_Common.html 
Added Files:
	logo.cgi 
Log Message:
event refactor, landing on HEAD!

Index: svc_Common.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/svc_Common.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- svc_Common.html	5 Feb 2007 12:51:05 -0000	1.2
+++ svc_Common.html	1 Aug 2007 22:26:51 -0000	1.3
@@ -1,9 +1,3 @@
-<% include('elements/svc_Common.html',
-             'table'    => $table,
-	     'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=",
-	     %opt,
-          )
-%>
 <%init>
 
 # false laziness w/edit/svc_Common.html
@@ -27,3 +21,9 @@
 }
 
 </%init>
+<% include('elements/svc_Common.html',
+             'table'    => $table,
+	     'edit_url' => $p."edit/svc_Common.html?svcdb=$table;svcnum=",
+	     %opt,
+          )
+%>

Index: cust_bill-logo.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_bill-logo.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cust_bill-logo.cgi	5 Feb 2007 12:51:05 -0000	1.7
+++ cust_bill-logo.cgi	1 Aug 2007 22:26:49 -0000	1.8
@@ -2,7 +2,8 @@
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('View invoices');
+  unless $FS::CurrentUser::CurrentUser->access_right('View invoices')
+      or $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
 my $conf = new FS::Conf;
 

Index: cust_main.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main.cgi,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- cust_main.cgi	5 Feb 2007 12:51:05 -0000	1.112
+++ cust_main.cgi	1 Aug 2007 22:26:50 -0000	1.113
@@ -16,52 +16,38 @@
 }
 </SCRIPT>
 
-<SCRIPT TYPE="text/javascript">
-%
-%my $ban = '';
-%if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
-%  $ban = '<BR><P ALIGN="center">'.
-%         '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\\\'s ';
-%  if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
-%    $ban .= 'credit card';
-%  } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
-%    $ban .= 'ACH account';
-%  }
-%}
-%
-
-
-var confirm_cancel = '<FORM METHOD="POST" ACTION="<% $p %>misc/cust_main-cancel.cgi"> <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <BR><P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B> <% $ban%><BR><P ALIGN="CENTER"> <INPUT TYPE="submit" VALUE="Cancel customer">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don\'t cancel" onClick="cClick()"> </FORM> ';
-
-</SCRIPT>
 % if ( $curuser->access_right('Cancel customer')
 %        && $cust_main->ncancelled_pkgs
 %      ) {
-%
 
-  <A HREF="javascript:void(0);" onClick="overlib(confirm_cancel, CAPTION, 'Confirm cancellation', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3, BGCOLOR, '#ff0000', CGCOLOR, '#ff0000' ); return false; ">Cancel this customer</A> | 
+  <% cust_cancel_link($cust_main) %> | 
+
 % } 
+
 % if ( $conf->exists('deletecustomers')
 %        && $curuser->access_right('Delete customer')
 %      ) {
-%
-
   <A HREF="<% $p %>misc/delete-customer.cgi?<% $custnum%>">Delete this customer</A> | 
 % } 
-% unless ( $conf->exists('disable_customer_referrals') ) { 
 
-  <A HREF="<% popurl(2) %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
-  <A HREF="<% popurl(2) %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
+% unless ( $conf->exists('disable_customer_referrals') ) { 
+  <A HREF="<% $p %>edit/cust_main.cgi?referral_custnum=<% $custnum %>">Refer a new customer</A> | 
+  <A HREF="<% $p %>search/cust_main.cgi?referral_custnum=<% $custnum %>">View this customer's referrals</A>
 % } 
 
+<BR><BR>
 
+% if (    $curuser->access_right('Billing event reports') 
+%      || $curuser->access_right('View customer billing events')
+%    ) {
+
+  <A HREF="<% $p %>search/cust_event.html?custnum=<% $custnum %>">View billing events for this customer</A>
+  <BR><BR>
+
+% }
 
-<BR><BR>
-%
 %my $signupurl = $conf->config('signupurl');
 %if ( $signupurl ) {
-%
-
   This customer's signup URL: <A HREF="<% $signupurl %>?ref=<% $custnum %>"><% $signupurl %>?ref=<% $custnum %></A><BR><BR>
 % } 
 
@@ -161,11 +147,41 @@
 my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array
 $query =~ /^(\d+)$/;
 my $custnum = $1;
-my $cust_main = qsearchs({
+my $cust_main = qsearchs( {
   'table'     => 'cust_main',
-  'hashref'   => {'custnum'=>$custnum},
+  'hashref'   => { 'custnum' => $custnum },
   'extra_sql' => ' AND '. $curuser->agentnums_sql,
 });
 die "Customer not found!" unless $cust_main;
 
 </%init>
+<%once>
+
+
+sub cust_cancel_link { cust_popup_link( 'misc/cancel_cust.html',
+                                        'Cancel&nbsp;this&nbsp;customer',
+                                        'Confirm Cancellation',
+                                        '#ff0000',
+                                        @_,
+                                      );
+}
+
+#false laziness w/view/cust_main/packages.html
+
+sub cust_popup_link {
+  my($action, $label, $actionlabel, $color, $cust_main) = @_;
+  $action .= '?'. $cust_main->custnum;
+  popup_link($action, $label, $actionlabel, $color);
+}
+
+sub popup_link {
+  my($action, $label, $actionlabel, $color) = @_;
+  $color ||= '#333399';
+  qq!<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('$p$action', 540, 336, 'pkg_or_svc_action_popup' ), CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '$color', CGCOLOR, '$color', CLOSETEXT, '' ); return false;">$label</A>!;
+
+# CLOSETEXT, '', 
+#WIDTH, 576, HEIGHT, 128, TEXTSIZE, 3,
+#BGCOLOR, '#ff0000', CGCOLOR, '#ff0000'
+}
+
+</%once>

--- NEW FILE: logo.cgi ---
<% $data %>
<%init>

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

my $conf = new FS::Conf;

my $type;
if ( $cgi->param('type') eq 'png' ) {
  $type = 'png';
} elsif ( $cgi->param('type') eq 'eps' ) {
  $type = 'eps';
} else {
  die "unknown logo type ". $cgi->param('type');
}

my $data;
if ( $cgi->param('preview_session') =~ /^(\w+)$/ ) {

  my $session = $1;
  my $curuser = $FS::CurrentUser::CurrentUser;
  $data = decode_base64( $curuser->option("logo_preview$session") );

} elsif ( $cgi->param('name') =~ /^([^\.\/]*)$/ ) {

  my $templatename = $1;
  if ( $templatename && $conf->exists("logo_$templatename.$type") ) {
    $templatename = "_$templatename";
  } else {
    $templatename = '';
  }

  if ( $type eq 'png' ) {
    $data = $conf->config_binary("logo$templatename.png");
  } elsif ( $type eq 'eps' ) {
    #convert EPS to a png... punting on that for now
  }

} else {
  die "neither a valid name nor a valid preview_session specified";
}

http_header('Content-Type' => 'image/png' );

</%init>


Index: cust_bill.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_bill.cgi,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- cust_bill.cgi	5 Feb 2007 12:51:05 -0000	1.37
+++ cust_bill.cgi	1 Aug 2007 22:26:49 -0000	1.38
@@ -60,63 +60,18 @@
   <A HREF="<% $p %>view/cust_bill-pdf.cgi?<% $link %>.pdf">View typeset invoice</A>
   <BR><BR>
 % } 
-% #false laziness with search/cust_bill_event.cgi
-%   unless ( $templatename ) { 
-
-
-  <% table() %>
-  <TR>
-    <TH>Event</TH>
-    <TH>Date</TH>
-    <TH>Status</TH>
-  </TR>
-% foreach my $cust_bill_event (
-%       sort { $a->_date <=> $b->_date } $cust_bill->cust_bill_event
-%     ) {
-%
-%    my $status = $cust_bill_event->status;
-%    $status .= ': '. encode_entities($cust_bill_event->statustext)
-%      if $cust_bill_event->statustext;
-%    my $part_bill_event = $cust_bill_event->part_bill_event;
-%  
 
-    <TR>
-      <TD><% $part_bill_event->event %>
-% if ( $part_bill_event->templatename ) {
-%          my $alt_templatename = $part_bill_event->templatename;
-%          my $alt_link = "$alt_templatename-$invnum";
-%        
-
-          ( <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 ) { 
-
-            | <A HREF="<% $p %>misc/email-invoice.cgi?<% $alt_link %>">re-email</A>
-% } 
-% if ( $conf->exists('hylafax')
-%                  && length($cust_bill->cust_main->fax) ) { 
-
-            | <A HREF="<% $p %>misc/fax-invoice.cgi?<% $alt_link %>">re-fax</A>
-% } 
-
-
-          )
+% my $br = 0;
+% if ( $cust_bill->num_cust_event ) { $br++;
+<A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">(&nbsp;View invoice events&nbsp;)</A> 
 % } 
 
-  
-      </TD>
-      <TD><% time2str("%a %b %e %T %Y", $cust_bill_event->_date) %></TD>
-      <TD><% $status %></TD>
-    </TR>
-% } 
+% if ( $cust_bill->num_cust_bill_event ) { $br++;
+<A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">(&nbsp;View deprecated, old-style invoice events&nbsp;)</A> 
+% }
 
+<% $br ? '<BR><BR>' : '' %>
 
-  </TABLE>
-  <BR>
-% } 
 % if ( $conf->exists('invoice_html') ) { 
 
   <% join('', $cust_bill->print_html('', $templatename) ) %>



More information about the freeside-commits mailing list