Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / misc / xmlhttp-cust_main-duplicates.html
1 % if ( @cust_main ) {
2 <CENTER><BR><B>Duplicate customer</B><BR>
3 Choose an existing customer
4 <TABLE WIDTH="300px">
5 <FORM name="DuplicateForm">
6 % foreach (@cust_main) {
7 %   my $custnum = $_->custnum;
8 <TR>
9   <TD ALIGN="right" VALIGN="top"><B><% $custnum %>: </B></TD>
10   <TD ALIGN="left">
11     <% $_->name |h %>&mdash;<B><FONT COLOR="#<%$_->statuscolor%>"><%$_->cust_status_label%></FONT></B><BR>
12 <% $_->address1 |h %><BR>
13 <% $_->city |h %>,&nbsp;<% $_->state %>&nbsp;&nbsp;<% $_->zip %>
14   </TD>
15   <TD ALIGN="center">
16     <INPUT TYPE="radio" NAME="dup_custnum" VALUE="<%$custnum%>">
17   </TD>
18 </TR>
19 % } #foreach cust_main
20 </FORM>
21 </TABLE>
22 <TABLE WIDTH="100%">
23 <TR>
24   <TD ALIGN="center">
25     <BUTTON TYPE="button" onclick="submit_continue();">
26       <IMG SRC="<%$p%>images/error.png"> Create a new customer
27     </BUTTON>
28   </TD>
29   <TD ALIGN="center">
30     <BUTTON TYPE="button" onclick="<% $set_to_customer %>">
31       <IMG SRC="<%$p%>images/tick.png"> Use the selected customer
32     </BUTTON>
33   </TD>
34 </TR>
35 <TR>
36   <TD COLSPAN=2 ALIGN="center">
37     <BUTTON TYPE="button" onclick="submit_abort();">
38       <IMG SRC="<%$p%>images/cross.png"> Cancel submission
39     </BUTTON>
40   </TD>
41 </TR>
42 % }
43 %# else return nothing
44 <%init>
45
46 die "access denied"
47   unless $FS::CurrentUser::CurrentUser->access_right('List customers');
48
49 my $conf = new FS::Conf;
50
51 my $sub = $cgi->param('sub');
52 my $hashref = decode_json($cgi->param('arg'));
53 my $search = FS::cust_main->search($hashref);
54 #warn Dumper($search);
55 my @cust_main = qsearch( $search );
56
57 my $set_to_customer = <<EOF;
58   var custnum_array = document.getElementsByName('dup_custnum');
59   var custnum;
60   for(i=0; i<custnum_array.length; i++) {
61     if(custnum_array[i].checked) {
62       custnum = custnum_array[i].value;
63     }
64   }
65   //alert('Setting to customer '+custnum);
66   document.CustomerForm.elements['duplicate_of_custnum'].value = custnum;
67   submit_continue();
68 EOF
69
70 </%init>