prevent reload loops on process pages, #71249
authorMark Wells <mark@freeside.biz>
Tue, 26 Jul 2016 22:06:36 +0000 (15:06 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 28 Jul 2016 00:10:12 +0000 (17:10 -0700)
53 files changed:
httemplate/edit/process/bulk-cust_main_county.html
httemplate/edit/process/bulk-cust_svc-pkgnum.html
httemplate/edit/process/cgp_rule-simplified.html
httemplate/edit/process/change-cust_pkg.html
httemplate/edit/process/credit-cust_bill_pkg.html
httemplate/edit/process/cust_credit-pkgnum.html
httemplate/edit/process/cust_credit.cgi
httemplate/edit/process/cust_location-censustract.html
httemplate/edit/process/cust_location.cgi
httemplate/edit/process/cust_main_attach.cgi
httemplate/edit/process/cust_main_county-add.cgi
httemplate/edit/process/cust_main_county-expand.cgi
httemplate/edit/process/cust_main_note.cgi
httemplate/edit/process/cust_pay-no_auto_apply.cgi
httemplate/edit/process/cust_pay-pkgnum.html
httemplate/edit/process/cust_pay.cgi
httemplate/edit/process/cust_pay_pending.html
httemplate/edit/process/cust_pkg_detail.html
httemplate/edit/process/cust_pkg_discount.html
httemplate/edit/process/cust_pkg_quantity.html
httemplate/edit/process/cust_pkg_salesnum.html
httemplate/edit/process/cust_refund.cgi
httemplate/edit/process/cust_tax_adjustment.html
httemplate/edit/process/detach-cust_pkg.html
httemplate/edit/process/domain_record.cgi
httemplate/edit/process/elements/ApplicationCommon.html
httemplate/edit/process/elements/process.html
httemplate/edit/process/quick-charge.cgi
httemplate/edit/process/quotation_pkg_detail.html
httemplate/elements/header-full.html
httemplate/elements/header-popup.html
httemplate/elements/topreload.js [new file with mode: 0644]
httemplate/misc/cust_main-cancel.cgi
httemplate/misc/cust_main-suspend.cgi
httemplate/misc/cust_main-unsuspend.cgi
httemplate/misc/delete-addr_range.html
httemplate/misc/delete-rate_detail.html
httemplate/misc/did_order_confirmed.html
httemplate/misc/disable-cust_location.cgi
httemplate/misc/disable-msg_template.cgi
httemplate/misc/process/bulk_pkg_increment_bill.cgi
httemplate/misc/process/cancel_pkg.html
httemplate/misc/process/change_pkg_contact.html
httemplate/misc/process/cust_bill-promised_date.html
httemplate/misc/process/delay_susp_pkg.html
httemplate/misc/process/enable_or_disable_tax.html
httemplate/misc/process/nms-add_iface.html
httemplate/misc/process/nms-add_router.html
httemplate/misc/process/recharge_svc.html
httemplate/misc/process/unhold_pkg.html
httemplate/misc/process/void-cust_bill.html
httemplate/misc/reason-merge.html
httemplate/misc/void-cust_credit.html

index b7ff40f..b5a0258 100644 (file)
@@ -12,7 +12,7 @@
   <% include('/elements/header-popup.html', "Taxes ${action}ed") %>
 
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 
   </BODY>
index f5cf7dd..3c27306 100644 (file)
@@ -7,7 +7,7 @@
 
     <% header(emt("Services moved")) %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index 60769d4..24515d5 100644 (file)
@@ -4,7 +4,7 @@
 % } else { #success XXX better msg talking about vacation vs. redirect all
   <% include('/elements/header-popup.html', 'Rule updated') %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 
   </BODY>
index 308ea8f..54cafbf 100644 (file)
@@ -5,7 +5,7 @@
 
     <% header(emt("Package changed")) %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index 75900bd..12b68c0 100644 (file)
@@ -3,7 +3,7 @@
 %} else {
 <& /elements/header-popup.html, 'Credit successful' &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 % }
index 8941cbc..56f7989 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <% header(emt('Credit package changed')) %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
 
     </BODY></HTML>
index 39c6f19..5d30287 100755 (executable)
@@ -16,7 +16,7 @@
 %  
 <% header(emt('Credit successful')) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 
   </BODY></HTML>
index bc9cd4f..6edaca3 100644 (file)
@@ -5,7 +5,7 @@
 
     <% header("Census tract changed") %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index fd1b874..3a23881 100644 (file)
@@ -5,7 +5,7 @@
 
     <% header("Location changed") %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index 09c18ad..5695002 100644 (file)
@@ -9,7 +9,7 @@
 % $act = 'deleted' if($attachnum and $delete);
 <% header('Attachment ' . $act ) %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
     </BODY></HTML>
 % }
index fc8956b..fcc138f 100755 (executable)
@@ -1,7 +1,7 @@
 <% include('/elements/header-popup.html', 'Addition successful' ) %>
 
 <SCRIPT TYPE="text/javascript">
-  window.top.location.reload();
+  topreload();
 </SCRIPT>
 
 </BODY>
index a108276..42e4673 100755 (executable)
@@ -1,7 +1,7 @@
 <% include('/elements/header-popup.html', 'Addition successful' ) %>
 
 <SCRIPT TYPE="text/javascript">
-  window.top.location.reload();
+  topreload();
 </SCRIPT>
 
 </BODY>
index 53e616a..bb52db8 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <% header('Note ' . ($notenum ? 'updated' : 'added') ) %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
     </BODY></HTML>
 % }
index ccbd2d7..4a5ee84 100644 (file)
@@ -15,7 +15,7 @@ Requires 'Apply payment' acl.
 <P STYLE="font-weight: bold;"><% emt($message) %></P>
 <P><% emt('Please wait while the page reloads.') %></P>
 <SCRIPT TYPE="text/javascript">
-window.top.location.reload();
+topreload();
 </SCRIPT>
 
 % }
index d9a92a1..cefe970 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <% header(emt('Payment package changed')) %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
 
     </BODY></HTML>
index 56d3f2f..d85267c 100755 (executable)
@@ -14,7 +14,7 @@
 %    
 <% header(emt('Payment entered')) %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
 
     </BODY></HTML>
index 0ff7d26..80bd14a 100644 (file)
@@ -3,7 +3,7 @@
   <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
 % } else {
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
 % }
 </BODY>
index 132ff63..25fabd9 100644 (file)
@@ -6,7 +6,7 @@
 % } else {
 <% header($action) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 % }
index 143611e..9635463 100644 (file)
@@ -5,7 +5,7 @@
 
     <% header("Discount applied") %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index fb26572..b605955 100644 (file)
@@ -5,7 +5,7 @@
 
     <& /elements/header-popup.html, "Quantity changed" &>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index aab3741..c1cb268 100644 (file)
@@ -5,7 +5,7 @@
 
     <& /elements/header-popup.html, "Sales Person changed" &>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index 8977ced..d4236bc 100755 (executable)
@@ -7,7 +7,7 @@
 %
 <% header('Refund entered') %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
 
     </BODY></HTML>
index 204b5b9..fe23275 100644 (file)
@@ -4,7 +4,7 @@
 % } else {
 <% header("Tax adjustment added") %>
   <SCRIPT TYPE="text/javascript">
-    //window.top.location.reload();
+    //topreload();
     parent.cClick();
   </SCRIPT>
   </BODY></HTML>
index 782ffa5..34c5805 100644 (file)
@@ -5,7 +5,7 @@
 
     <% header(emt("Package detached")) %>
       <SCRIPT TYPE="text/javascript">
-        window.top.location.reload();
+        topreload();
       </SCRIPT>
     </BODY>
     </HTML>
index 8369f71..9d869d5 100755 (executable)
@@ -3,7 +3,7 @@
 %} elsif ( $recnum ) { #editing
 <% header('Nameservice record changed') %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 %} else { #adding
index a73b1bc..67fa891 100644 (file)
@@ -26,7 +26,7 @@ Examples:
 %} else {
 <% header("$src_thing application$to sucessful") %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
   </HTML>
index 60aaf74..76722c9 100644 (file)
@@ -188,7 +188,7 @@ process();
   <% include('/elements/header-popup.html', $opt{'popup_reload'} ) %>
 
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 
   </BODY>
index d1b8e10..00d17c8 100644 (file)
@@ -1,4 +1,13 @@
+% if ( $error ) {
+%   $cgi->param('error', $error );
 <% $cgi->redirect($redirect) %>
+% } else {
+<% header(emt($message)) %>
+  <SCRIPT TYPE="text/javascript">
+    topreload();
+  </SCRIPT>
+  </BODY></HTML>
+% }
 <%init>
 
 my $curuser = $FS::CurrentUser::CurrentUser;
index b836bae..5728832 100644 (file)
@@ -6,7 +6,7 @@
 % } else {
 <% header($action) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 % }
index 07595a5..850eaed 100644 (file)
@@ -53,7 +53,7 @@ Example:
 %   }
     <% include('init_overlib.html') |n %>
     <% include('rs_init_object.html') |n %>
-
+    <script type="text/javascript" src="<% $fsurl %>elements/topreload.js"></script>
     <% $head |n %>
 
 %# announce our base path, and the Mason comp path of this page
index 6c0f80b..839a636 100644 (file)
@@ -34,6 +34,7 @@ Example:
       <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT>
 %     }
 %   }
+    <SCRIPT SRC="<% $fsurl %>elements/topreload.js"></SCRIPT>
     <% $head |n %>
   </HEAD>
   <BODY <% $etc |n %>>
diff --git a/httemplate/elements/topreload.js b/httemplate/elements/topreload.js
new file mode 100644 (file)
index 0000000..a66703b
--- /dev/null
@@ -0,0 +1,5 @@
+window.topreload = function() {
+  if (window != window.top) {
+    window.top.location.reload();
+  }
+}
index f6fd1e9..73c4deb 100755 (executable)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html, mt("Customer cancelled") &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index 7a501d6..e81e2b4 100755 (executable)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html, mt("Customer suspended") &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index e8ac8d3..99ec70a 100755 (executable)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html, mt("Customer unsuspended") &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index c6310e9..239332d 100644 (file)
@@ -3,7 +3,7 @@
 % } else {
 <& /elements/header-popup.html, "Address range deleted" &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 </BODY>
 </HTML>
index 30856a7..b4d31b3 100755 (executable)
@@ -3,7 +3,7 @@
 % } else {
 <% header('Rate deleted') %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
     </BODY></HTML>
 % }
index 53dbb2f..3cc121c 100644 (file)
@@ -14,7 +14,7 @@ die "access denied"
 my $action = $1;
 my $header = '';
 my $popup = '';
-my $js = 'window.top.location.reload();';
+my $js = 'topreload();';
 
 $cgi->param('ordernum') =~ /^(\d+)$/ or die 'illegal ordernum';
 my $ordernum = $1;
index ee7ba1d..677f0b8 100755 (executable)
@@ -1,6 +1,6 @@
 <% header("Location disabled") %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 </BODY>
 </HTML>
index 1eb4d25..565eb2c 100644 (file)
@@ -3,7 +3,7 @@
 % } else {
 <& /elements/header-popup.html, "Template ${actioned}" &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 </BODY>
 </HTML>
index 0d8417b..8da8495 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <% header('Packages Adjusted') %>
     <SCRIPT TYPE="text/javascript">
-      window.top.location.reload();
+      topreload();
     </SCRIPT>
     </BODY></HTML>
 % }
index eb3b2ef..46ba06a 100755 (executable)
@@ -1,6 +1,6 @@
 <% header(emt("Package $past_method")) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index 2795c11..5bf8962 100644 (file)
@@ -1,6 +1,6 @@
 <% header(emt("Package contact $past_method")) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index 721a763..f390609 100644 (file)
@@ -1,4 +1,4 @@
-<SCRIPT TYPE="text/javascript">window.top.location.reload()</SCRIPT>
+<SCRIPT TYPE="text/javascript">topreload()</SCRIPT>
 <%init>
 # XXX ACL?
 die "access denied"
index 675da04..15a3c96 100755 (executable)
@@ -1,6 +1,6 @@
 <% header($msg) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index 9b7324b..8a7a559 100755 (executable)
@@ -4,7 +4,7 @@
   <% include('/elements/header-popup.html', $title) %>
 
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 
   </BODY>
index 79e6856..cbd0fc0 100644 (file)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html, 'Interface added' &>
 <SCRIPT TYPE="text/javascript">
-  window.top.location.reload();
+  topreload();
 </SCRIPT>
 </BODY></HTML>
 <%init>
index c3b42a8..a4c3423 100644 (file)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html, 'Router added' &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
 </BODY></HTML>
 <%init>
index 2d49f6b..88a1f7f 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <% header("Package recharged") %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 %}
index 6940480..7e54262 100755 (executable)
@@ -1,6 +1,6 @@
 <& /elements/header-popup.html &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>
index 7773b0b..32a2fc5 100755 (executable)
@@ -4,7 +4,7 @@
 %} else {
 <& /elements/header-popup.html, 'Invoice voided' &>
 <SCRIPT TYPE="text/javascript">
-  window.top.location.reload();
+  topreload();
 </SCRIPT>
 </BODY></HTML>
 %}
index 14f5ebb..b7e4df4 100644 (file)
@@ -1,7 +1,7 @@
 % if ($success) {
 <% include('/elements/header-popup.html', 'Reason Merge Success') %>
 <SCRIPT>
-window.top.location.reload()
+topreload()
 </SCRIPT>
 % } else {
 <% include('/elements/header-popup.html', 'Merge Reasons') %>
index 1e71f00..81ba31d 100755 (executable)
@@ -1,7 +1,7 @@
 %if ( $success ) {
 <& /elements/header-popup.html, mt("Credit voided") &>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY>
 </HTML>