quiet warnings about CGI::param in list context
[freeside.git] / httemplate / misc / detach_pkg.html
1 <& /elements/header-popup.html, mt("Detach Package to New Customer") &>
2
3 <& /elements/error.html &>
4
5 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/detach-cust_pkg.html" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
7 % foreach my $f (qw( agentnum refnum )) {
8   <INPUT TYPE="hidden" NAME="<% $f %>" VALUE="<% $cust_main->$f() %>">
9 % }
10 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->custnum %>">
11 % foreach my $f (FS::cust_main->location_fields) {
12   <INPUT TYPE="hidden" NAME="<% $f %>" VALUE="<% $loc->$f() |h %>">
13 % }
14
15 <% ntable('#cccccc') %>
16
17   <TR>
18     <TH ALIGN="right"><% mt('Package') |h %></TH>
19     <TD COLSPAN=7 BGCOLOR="#dddddd">
20       <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B> - <% $part_pkg->comment |h %>
21     </TD>
22   </TR>
23
24 % #always should be present for detaching, yes? #if ( $cust_pkg->contactnum ) {
25 %   my $cust_contact = $cust_pkg->contact_obj;
26
27     <INPUT TYPE="hidden" NAME="first" VALUE="<% $cust_contact->get('first') |h %>">
28     <INPUT TYPE="hidden" NAME="last"  VALUE="<% $cust_contact->get('last')  |h %>">
29
30     <TR>
31       <TH ALIGN="right"><% emt('Name') %></TH>
32       <TD COLSPAN=7 BGCOLOR="#dddddd">
33         <% $cust_pkg->contact_obj->line |h %>
34       </TD>
35     </TR>
36 % #}
37
38   <TR>
39     <TH ALIGN="right" VALIGN="top"><% emt('Address') %></TH>
40     <TD COLSPAN=7 BGCOLOR="#dddddd">
41
42       <% $loc->location_label( 'join_string'     => '<BR>',
43                                'double_space'    => ' &nbsp; ',
44                                'escape_function' => \&encode_entities,
45                                'countrydefault'  => $countrydefault,
46                              )
47       %>
48     </TD>
49   </TR>
50
51 %  if ( $conf->config_bool('cust_main-require_phone') ) {
52 %    #XXX should be sticky on errors
53 %    my $ph_cust_main = FS::cust_main->new({});
54 %    foreach my $contact_phone ( $cust_contact->contact_phone ) {
55 %      my $t = $contact_phone->typename;
56 %      #countrycodes?  interface doesn't parse/take em yet
57 %      $ph_cust_main->daytime( $contact_phone->phonenum ) if $t eq 'Work';
58 %      $ph_cust_main->night(   $contact_phone->phonenum ) if $t eq 'Home';
59 %      $ph_cust_main->mobile(  $contact_phone->phonenum ) if $t eq 'Mobile';
60 %      $ph_cust_main->fax(     $contact_phone->phonenum ) if $t eq 'Fax';
61 %    }
62
63      <& /elements/tr-cust_main-phones.html,
64           'cust_main'    => $ph_cust_main,
65      &>
66 %  }
67
68 </TABLE>
69
70 %#payment info
71 %#XXX should be sticky on errors...
72 <& /edit/cust_main/billing.html, FS::cust_main->new({}),
73                                  invoicing_list => [],
74
75 &>
76
77 <BR>
78 <BR>
79 <INPUT NAME    = "submitButton"
80        TYPE    = "submit"
81        VALUE   = "<% mt("Detach package") |h %>"
82 >
83
84 %#and a cancel button?  or is the popup close sufficient?
85
86 </FORM>
87 </BODY>
88 </HTML>
89
90 <%init>
91
92 my $conf = new FS::Conf;
93 my $countrydefault = $conf->config('countrydefault') || 'US';
94
95 my $curuser = $FS::CurrentUser::CurrentUser;
96 die "access denied"
97   unless $curuser->access_right('Change customer package');
98
99 my $pkgnum = scalar($cgi->param('pkgnum'));
100 $pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
101 $pkgnum = $1;
102
103 my $cust_pkg =
104   qsearchs({
105     'table'     => 'cust_pkg',
106     'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
107     'hashref'   => { 'pkgnum' => $pkgnum },
108     'extra_sql' => ' AND '. $curuser->agentnums_sql,
109   }) or die "unknown pkgnum $pkgnum";
110
111 my $loc = $cust_pkg->cust_location_or_main;
112
113 my $cust_main = $cust_pkg->cust_main
114   or die "can't get cust_main record for custnum ". $cust_pkg->custnum.
115          " ( pkgnum ". cust_pkg->pkgnum. ")";
116
117 my $part_pkg = $cust_pkg->part_pkg;
118
119 </%init>