summaryrefslogtreecommitdiff
path: root/httemplate/misc/cust_main-merge.html
diff options
context:
space:
mode:
authorcvs2git <cvs2git>2010-11-05 19:05:57 +0000
committercvs2git <cvs2git>2010-11-05 19:05:57 +0000
commitaaf8baf3662e16e9414de236a39f8801a8c41b01 (patch)
tree2cda603e4311b3e80f79b93d9bcce3a7c7c2d053 /httemplate/misc/cust_main-merge.html
parent995a145c931164347683071c95c6754379d36604 (diff)
parent9b2de4257b6a2877434008188e52b8ef71ff339d (diff)
This commit was manufactured by cvs2svn to create branch
'FREESIDE_2_1_BRANCH'.
Diffstat (limited to 'httemplate/misc/cust_main-merge.html')
-rwxr-xr-xhttemplate/misc/cust_main-merge.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/httemplate/misc/cust_main-merge.html b/httemplate/misc/cust_main-merge.html
new file mode 100755
index 000000000..4decbef7a
--- /dev/null
+++ b/httemplate/misc/cust_main-merge.html
@@ -0,0 +1,40 @@
+% if ( $error ) {
+% $cgi->param('error', $error);
+<% $cgi->redirect(popurl(1). "merge_cust.html?". $cgi->query_string ) %>
+% } else {
+<% include('/elements/header-popup.html', "Customer merged") %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.href = '<% $p %>view/cust_main.cgi?<% $new_custnum %>';
+%# parent.nd(1) ?
+ </SCRIPT>
+ </BODY>
+</HTML>
+% }
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Merge customer');
+
+my $error = '';
+
+$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";
+my $custnum = $1;
+
+my $new_custnum;
+if ( $cgi->param('new_custnum') =~ /^(\d+)$/ ) {
+ $new_custnum = $1;
+
+ my $cust_main = qsearchs( {
+ 'table' => 'cust_main',
+ 'hashref' => { 'custnum' => $custnum },
+ 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+ } );
+ die "No customer # $custnum" unless $cust_main;
+
+ $error = $cust_main->merge($new_custnum);
+
+} else {
+ $error = 'Select a customer to merge into';
+}
+
+</%init>