1 <& /elements/header-popup.html, mt("Detach Package to New Customer") &>
3 <SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT>
5 <& /elements/error.html &>
7 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/detach-cust_pkg.html" METHOD=POST>
8 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
9 % foreach my $f (qw( agentnum refnum )) {
10 <INPUT TYPE="hidden" NAME="<% $f %>" VALUE="<% $cust_main->$f() %>">
12 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $cust_main->custnum %>">
13 % foreach my $f (FS::cust_main->location_fields) {
14 <INPUT TYPE="hidden" NAME="<% $f %>" VALUE="<% $loc->$f() |h %>">
17 <% ntable('#cccccc') %>
20 <TH ALIGN="right"><% mt('Package') |h %></TH>
21 <TD COLSPAN=7 BGCOLOR="#dddddd">
22 <% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B> - <% $part_pkg->comment |h %>
26 % #always should be present for detaching, yes? #if ( $cust_pkg->contactnum ) {
27 % my $cust_contact = $cust_pkg->contact_obj;
29 <INPUT TYPE="hidden" NAME="first" VALUE="<% $cust_contact->get('first') |h %>">
30 <INPUT TYPE="hidden" NAME="last" VALUE="<% $cust_contact->get('last') |h %>">
33 <TH ALIGN="right"><% mt('Name') %></TH>
34 <TD COLSPAN=7 BGCOLOR="#dddddd">
35 <% $cust_pkg->contact_obj->line |h %>
41 <TH ALIGN="right" VALIGN="top"><% mt('Address') %></TH>
42 <TD COLSPAN=7 BGCOLOR="#dddddd">
44 <% $loc->location_label( 'join_string' => '<BR>',
45 'double_space' => ' ',
46 'escape_function' => \&encode_entities,
47 'countrydefault' => $countrydefault,
56 %#XXX should be sticky on errors...
57 <& /edit/cust_main/billing.html, FS::cust_main->new({}),
64 <INPUT NAME = "submitButton"
66 VALUE = "<% mt("Detach package") |h %>"
69 %#and a cancel button? or is the popup close sufficient?
77 my $conf = new FS::Conf;
78 my $countrydefault = $conf->config('countrydefault') || 'US';
80 my $curuser = $FS::CurrentUser::CurrentUser;
82 unless $curuser->access_right('Change customer package');
84 my $pkgnum = scalar($cgi->param('pkgnum'));
85 $pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
90 'table' => 'cust_pkg',
91 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
92 'hashref' => { 'pkgnum' => $pkgnum },
93 'extra_sql' => ' AND '. $curuser->agentnums_sql,
94 }) or die "unknown pkgnum $pkgnum";
96 my $loc = $cust_pkg->cust_location_or_main;
98 my $cust_main = $cust_pkg->cust_main
99 or die "can't get cust_main record for custnum ". $cust_pkg->custnum.
100 " ( pkgnum ". cust_pkg->pkgnum. ")";
102 my $part_pkg = $cust_pkg->part_pkg;