1 <& /elements/header-popup.html, 'Merge customer' &>
3 <& /elements/error.html &>
5 <FORM NAME="cust_merge_popup" ID="cust_merge_popup" ACTION="<% popurl(1) %>cust_main-merge.html" METHOD=POST onSubmit="submit_merge(); return false;">
7 <SCRIPT TYPE="text/javascript">
9 var submit_interval_id;
10 function submit_merge() {
11 document.getElementById('confirm_merge_cust_button').disabled = 'true';
12 smart_new_custnum_search(document.getElementById('new_custnum_search'));
13 submit_interval_id = setInterval( do_submit_merge, 100);
16 function do_submit_merge() {
18 if ( new_custnum_search_active )
21 document.getElementById('confirm_merge_cust_button').disabled = '';
23 clearInterval(submit_interval_id);
25 if ( document.cust_merge_popup.new_custnum.value != '' ) {
26 document.cust_merge_popup.submit();
35 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
37 <TABLE BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto">
39 <& /elements/tr-search-cust_main.html,
40 'label' => 'Merge into: ',
41 'field' => 'new_custnum',
43 'curr_value' => scalar($cgi->param('new_custnum')),
46 % if ( 0 ) { #we start supporting payment info merge again in some way
48 % if ( scalar($cust_main->ncancelled_pkgs) ) {
51 <& /elements/radio.html,
54 'curr_value' => scalar($cgi->param('merge')),
60 % $cgi->param('merge', 'Y');
65 <& /elements/radio.html,
68 'curr_value' => scalar($cgi->param('merge')),
70 Merge invoices, payments/credits, notes, tickets and delete<!-- ^Warchive --> this customer.
78 %#have merge button start out disabled and enable after you select a target cust
79 <INPUT TYPE="submit" NAME="confirm_merge_cust_button" ID="confirm_merge_cust_button" VALUE="Merge customer"> <INPUT TYPE="BUTTON" VALUE="Don't merge" onClick="parent.cClick();">
87 my $conf = new FS::Conf;
89 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
92 my $curuser = $FS::CurrentUser::CurrentUser;
94 die "access denied" unless $curuser->access_right('Merge customer');
96 my $cust_main = qsearchs( {
97 'table' => 'cust_main',
98 'hashref' => { 'custnum' => $custnum },
99 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
101 die "No customer # $custnum" unless $cust_main;