[freeside-commits] branch master updated. 087c45b52363e519320eef20482ca94a7a8fb5f0

Jonathan Prykop jonathan at 420.am
Fri Nov 13 15:47:03 PST 2015


The branch, master has been updated
       via  087c45b52363e519320eef20482ca94a7a8fb5f0 (commit)
      from  2f4eb8cfbb07170dff09474e84adbf1c87284620 (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 087c45b52363e519320eef20482ca94a7a8fb5f0
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Nov 13 17:46:33 2015 -0600

    RT#17480: Freeside Cancel Reason [missing file]

diff --git a/httemplate/misc/reason-merge.html b/httemplate/misc/reason-merge.html
new file mode 100644
index 0000000..a531e58
--- /dev/null
+++ b/httemplate/misc/reason-merge.html
@@ -0,0 +1,79 @@
+% if ($success) {
+<% include('/elements/header-popup.html', 'Reason Merge Success') %>
+<SCRIPT>
+<!-- 
+window.top.location.reload()
+-->
+</SCRIPT>
+% } else {
+<% include('/elements/header-popup.html', 'Merge Reasons') %>
+%   if ($error) {
+<P STYLE="color: red;"><% emt($error) %></P>
+%   }
+%   if (@reasons > 1) {
+<P>
+The following reasons will be merged into one.
+Please select one reason to merge the others into.
+</P>
+<FORM METHOD="POST" ACTION="<% "${p}misc/reason-merge.html" %>">
+<P>
+%     foreach my $reason (@reasons) {
+<INPUT TYPE="hidden" NAME="reasonnum" VALUE="<% $reason->reasonnum %>">
+<INPUT TYPE="radio" NAME="destreasonnum" VALUE="<% $reason->reasonnum %>">
+<% $reason->reason %><BR>
+%     }
+<P>
+<P>Caution: merging reasons cannot be undone!</P>
+<P><INPUT TYPE="submit" NAME="process_merge" value="Merge"></P>
+</FORM>
+%   } else {
+<BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON>
+%   }
+% }
+
+<%init>
+my @reasonnums = $cgi->param('reasonnum');
+my $destreasonnum = $cgi->param('destreasonnum');
+
+my $error;
+my $class;
+my @reasons;
+my $destreason;
+foreach my $reasonnum (@reasonnums) {
+  unless ($reasonnum =~ /^\d+$/) {
+    $error = "Invalid reasonnum $reasonnum.";
+    last;
+  }
+  my $reason = qsearchs('reason',{ 'reasonnum' => $reasonnum });
+  unless ($reason) {
+    $error = "Reason $reasonnum could not be loaded.";
+    last;
+  }
+  my $reasontype = $reason->reasontype;
+  $class ||= $reasontype->class;
+  if ($class ne $reasontype->class) {
+    $error = "Selected reasons must have the same reason type class.";
+    last;
+  }
+  push(@reasons, $reason);
+  $destreason = $reason if $reasonnum eq $destreasonnum;
+}
+
+unless ($error) {
+  $error = "No reasons selected." unless @reasons;
+  $error = "Select two or more reasons to merge." unless @reasons > 1;
+}
+
+ at reasons = () if $error;
+
+my $success = 0;
+if ($cgi->param('process_merge') && !$error) {
+  if ($destreason) {
+    $error = $destreason->merge(\@reasons);
+    $success = 1 unless $error;
+  } else {
+    $error = "No desitation reason selected.";
+  }
+}
+
+</%init>

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

Summary of changes:
 httemplate/misc/reason-merge.html |   79 +++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 httemplate/misc/reason-merge.html




More information about the freeside-commits mailing list