fix customer cancellation, sort of a side effect of #2872, fixes #3480, #3481
[freeside.git] / httemplate / view / cust_main.cgi
index 4ca777d..63df35a 100755 (executable)
@@ -4,10 +4,7 @@
   <A HREF="<% $p %>edit/cust_main.cgi?<% $custnum %>">Edit this customer</A> | 
 % } 
 
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_draggable.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
+<% include('/elements/init_overlib.html') %>
 
 <SCRIPT TYPE="text/javascript">
 function areyousure(href, message) {
@@ -20,9 +17,17 @@ function areyousure(href, message) {
 %        && $cust_main->ncancelled_pkgs
 %      ) {
 
-  <% cust_cancel_link($cust_main) %> | 
+  <% include( '/elements/popup_link-cust_main.html',
+              { 'action'      => $p. 'misc/cancel_cust.html',
+                'label'       => 'Cancel&nbsp;this&nbsp;customer',
+                'actionlabel' => 'Confirm Cancellation',
+                'color'       => '#ff0000',
+                'cust_main'   => $cust_main,
+              }
+            )
+  %> | 
 
-% } 
+% }
 
 % if ( $conf->exists('deletecustomers')
 %        && $curuser->access_right('Delete customer')
@@ -92,7 +97,15 @@ Comments
 %        ! $conf->exists('cust_main-disable_notes')
 %      ) {
 
-  <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_main_note.cgi?custnum=<% $cust_main->custnum %>', 616, 386, 'cust_main_note_popup' ), CAPTION, 'Enter customer note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">Add customer note</A>
+  <% include( '/elements/popup_link-cust_main.html',
+                'label'       => 'Add customer note',
+                'action'      => $p. 'edit/cust_main_note.cgi',
+                'actionlabel' => 'Enter customer note',
+                'cust_main'   => $cust_main,
+                'width'       => 616,
+                'height'      => 408,
+            )
+  %>
 
 %   }
 
@@ -155,33 +168,3 @@ my $cust_main = qsearchs( {
 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>