RT# 77193 - updated selfservice change payment accounts to work with version 4
[freeside.git] / fs_selfservice / FS-SelfService / cgi / change_ship.html
1 <%= include('header', 'Edit service address') %>
2
3 <%= if ( $error ) { 
4   $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!;
5 }  ''; %>
6
7 <FORM NAME="OneTrueForm" ACTION="<%= $selfurl %>" METHOD=POST onSubmit="document.bottomform.submit.disabled=true;">
8 <INPUT TYPE="hidden" NAME="action" VALUE="process_change_ship">
9 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
10
11 <%=
12   foreach (
13     qw( last first company address1 address2 city county state zip country
14         daytime night fax )
15   ) {
16     $OUT .= qq!<INPUT TYPE="hidden" NAME="$_" VALUE="${$_}">!;
17   };
18   '';
19 %>
20 <SCRIPT>
21 function bill_changed(what) {
22   if ( what.form.same.checked ) {
23 <%=
24   for (qw( last first company address1 address2 city zip daytime night fax )) { 
25     $OUT .= "what.form.ship_$_.value = what.form.$_.value;";
26   } 
27   '';
28 %>
29     what.form.ship_country.selectedIndex = what.form.country.selectedIndex;
30
31     function fix_ship_county() {
32       what.form.ship_county.selectedIndex = what.form.county.selectedIndex;
33     }
34
35     function fix_ship_state() {
36       what.form.ship_state.selectedIndex = what.form.state.selectedIndex;
37       ship_state_changed(what.form.ship_state, fix_ship_county );
38     }
39
40     ship_country_changed(what.form.ship_country, fix_ship_state );
41
42   }
43 }
44 function samechanged(what) {
45   if ( what.checked ) {
46     bill_changed(what);
47
48 <%=
49   for (qw( last first company address1 address2 city county state zip country daytime night fax )) { 
50     $OUT .= "what.form.ship_$_.disabled = true;";
51     $OUT .= "what.form.ship_$_.style.backgroundColor = '#dddddd';";
52   } 
53   if ( $require_address2 ) {
54     $OUT .= "document.getElementById('ship_address2_required').style.visibility = 'hidden';";
55     $OUT .= "document.getElementById('ship_address2_label').style.visibility = 'hidden';";
56   }
57 %> 
58
59   } else {
60
61 <%=
62   for (qw( last first company address1 address2 city county state zip country daytime night fax )) { 
63     $OUT .= "what.form.ship_$_.disabled = false;";
64     $OUT .= "what.form.ship_$_.style.backgroundColor = '#ffffff';";
65   } 
66   if ( $require_address2 ) {
67     $OUT .= "document.getElementById('ship_address2_required').style.visibility = '';";
68     $OUT .= "document.getElementById('ship_address2_label').style.visibility = '';";
69   }
70 %>
71   }
72 }
73 </SCRIPT>
74 (<INPUT TYPE="checkbox" NAME="same" VALUE="Y" onClick="samechanged(this)"
75   <%= (!$ship_last || $cgi->param('same') eq 'Y') ? 'CHECKED' : '' %>
76  >same as billing address)
77 <%= $r=qq!<font color="#ff0000">*</font>&nbsp;!;
78     if (!$ship_last || $cgi->param('same') eq 'Y') {
79       $disabled = 'DISABLED STYLE="background-color: #dddddd"';
80       foreach ( qw( last first company address1 address2 city county state
81                     zip country daytime night fax )
82       ) {
83         ${"ship_$_"} = ${$_};
84       }
85     }else{
86       $disabled = '';
87     }
88     $pre = 'ship_';
89     include('contact');
90 %>
91
92 <INPUT TYPE="submit" NAME="submit" VALUE="<%= $custnum ?  "Apply Changes" : "Add Customer" %>">
93 <BR>
94 </FORM>
95
96 <%= include('footer') %>