diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-05-03 00:31:07 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-05-03 00:31:07 -0700 |
commit | e0d4d66f670371a0c8a40dc471352634f9fd6017 (patch) | |
tree | 6196fe59c73b43ea6d2057345bb55684be8cfada /httemplate | |
parent | 4a3e900ad42a15a6a999e1d1461b816d7fac2230 (diff) |
merging is now attaching by default, with the old destructive merge operation as an option when deletecustomers is enabled, RT#22185
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/misc/cust_main-merge.html | 12 | ||||
-rw-r--r-- | httemplate/misc/merge_cust.html | 42 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 11 |
3 files changed, 56 insertions, 9 deletions
diff --git a/httemplate/misc/cust_main-merge.html b/httemplate/misc/cust_main-merge.html index 4decbef7a..3b4425fc8 100755 --- a/httemplate/misc/cust_main-merge.html +++ b/httemplate/misc/cust_main-merge.html @@ -31,7 +31,17 @@ if ( $cgi->param('new_custnum') =~ /^(\d+)$/ ) { } ); die "No customer # $custnum" unless $cust_main; - $error = $cust_main->merge($new_custnum); + if ( $cgi->param('merge') eq 'Y' ) { + + #old-style merge: everything + delete old customer + $error = $cust_main->merge($new_custnum); + + } else { + + #new-style attach: move packages 3.0 style, that's it + $error = $cust_main->attach_pkgs($new_custnum); + + } } else { $error = 'Select a customer to merge into'; diff --git a/httemplate/misc/merge_cust.html b/httemplate/misc/merge_cust.html index ad075be2f..9c869fa21 100644 --- a/httemplate/misc/merge_cust.html +++ b/httemplate/misc/merge_cust.html @@ -1,6 +1,6 @@ -<% include('/elements/header-popup.html', 'Merge customer' ) %> +<& /elements/header-popup.html, 'Merge customer' &> -<% include('/elements/error.html') %> +<& /elements/error.html &> <FORM NAME="cust_merge_popup" ID="cust_merge_popup" ACTION="<% popurl(1) %>cust_main-merge.html" METHOD=POST onSubmit="submit_merge(); return false;"> @@ -35,13 +35,43 @@ function do_submit_merge() { <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> <TABLE BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto"> - <% include('/elements/tr-search-cust_main.html', + + <& /elements/tr-search-cust_main.html, 'label' => 'Merge into: ', 'field' => 'new_custnum', 'find_button' => 1, 'curr_value' => scalar($cgi->param('new_custnum')), - ) - %> + &> + +% if ( $conf->exists('deletecustomers') ) { + +% if ( scalar($cust_main->ncancelled_pkgs) ) { + <TR> + <TD COLSPAN=2> + <& /elements/radio.html, + 'field' => 'merge', + 'value' => '', + 'curr_value' => scalar($cgi->param('merge')), + &> + Merge packages only. + </TD> + </TR> +% } else { +% $cgi->param('merge', 'Y'); +% } + + <TR> + <TD COLSPAN=2> + <& /elements/radio.html, + 'field' => 'merge', + 'value' => 'Y', + 'curr_value' => scalar($cgi->param('merge')), + &> + Merge invoices, payments/credits, notes, tickets and delete this customer. + </TD> + </TR> +% } + </TABLE> <P ALIGN="CENTER"> @@ -54,6 +84,8 @@ function do_submit_merge() { <%init> +my $conf = new FS::Conf; + $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; my $custnum = $1; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index ec3191971..be0100fb3 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -91,14 +91,19 @@ function areyousure(href, message) { &> | % } -% if ( $curuser->access_right('Merge customer') ) { +% if ( $curuser->access_right('Merge customer') +% and ( scalar($cust_main->ncancelled_pkgs) +% || $conf->exists('deletecustomers') +% ) +% ) +% { <& /elements/popup_link-cust_main.html, { 'action' => $p. 'misc/merge_cust.html', 'label' => emt('Merge this customer'), 'actionlabel' => emt('Merge customer'), 'cust_main' => $cust_main, - 'width' => 480, - 'height' => 192, + 'width' => 569, + 'height' => 210, } &> | % } |