v4 styling
[freeside.git] / httemplate / misc / merge_cust.html
1 <& /elements/header-popup.html, 'Merge customer' &>
2
3 <& /elements/error.html &>
4
5 <FORM NAME="cust_merge_popup" ID="cust_merge_popup" ACTION="<% popurl(1) %>cust_main-merge.html" METHOD=POST onSubmit="submit_merge(); return false;">
6
7 <SCRIPT TYPE="text/javascript">
8
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);
14 }
15
16 function do_submit_merge() {
17
18   if ( new_custnum_search_active )
19     return;
20
21   document.getElementById('confirm_merge_cust_button').disabled = '';
22
23   clearInterval(submit_interval_id);
24
25   if ( document.cust_merge_popup.new_custnum.value != '' ) {
26     document.cust_merge_popup.submit();
27   }
28
29 }
30
31 </SCRIPT>
32
33 </SCRIPT>
34
35 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
36
37 <TABLE BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto">
38
39   <& /elements/tr-search-cust_main.html,
40                'label'       => 'Merge into: ',
41                'field'       => 'new_custnum',
42                'find_button' => 1,
43                'curr_value'  => scalar($cgi->param('new_custnum')),
44   &>
45
46 % if ( 0 ) { #we start supporting payment info merge again in some way
47
48 %   if ( scalar($cust_main->ncancelled_pkgs) ) {
49       <TR>
50         <TD COLSPAN=2>
51           <& /elements/radio.html,
52                'field'       => 'merge',
53                'value'       => '',
54                'curr_value'  => scalar($cgi->param('merge')),
55           &>
56           Merge packages only.
57         </TD>
58       </TR>
59 %   } else {
60 %     $cgi->param('merge', 'Y');
61 %   }
62
63     <TR>
64       <TD COLSPAN=2>
65         <& /elements/radio.html,
66              'field'       => 'merge',
67              'value'       => 'Y',
68              'curr_value'  => scalar($cgi->param('merge')),
69         &>
70         Merge invoices, payments/credits, notes, tickets and delete<!-- ^Warchive --> this customer.
71       </TD>
72     </TR>
73 % }
74
75 </TABLE>
76
77 <P ALIGN="CENTER">
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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don't merge" onClick="parent.cClick();"> 
80
81 </FORM>
82 </BODY>
83 </HTML>
84
85 <%init>
86
87 my $conf = new FS::Conf;
88
89 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
90 my $custnum = $1;
91
92 my $curuser = $FS::CurrentUser::CurrentUser;
93
94 die "access denied" unless $curuser->access_right('Merge customer');
95
96 my $cust_main = qsearchs( {
97   'table'     => 'cust_main',
98   'hashref'   => { 'custnum' => $custnum },
99   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
100 } );
101 die "No customer # $custnum" unless $cust_main;
102
103 </%init>
104