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,
53 % if ( $conf->config_bool('cust_main-require_phone') ) {
54 % #XXX should be sticky on errors
55 % my $ph_cust_main = FS::cust_main->new({});
56 % foreach my $contact_phone ( $cust_contact->contact_phone ) {
57 % my $t = $contact_phone->typename;
58 % #countrycodes? interface doesn't parse/take em yet
59 % $ph_cust_main->daytime( $contact_phone->phonenum ) if $t eq 'Work';
60 % $ph_cust_main->night( $contact_phone->phonenum ) if $t eq 'Home';
61 % $ph_cust_main->mobile( $contact_phone->phonenum ) if $t eq 'Mobile';
62 % $ph_cust_main->fax( $contact_phone->phonenum ) if $t eq 'Fax';
65 <& /elements/tr-cust_main-phones.html,
66 'cust_main' => $ph_cust_main,
73 %#XXX should be sticky on errors...
74 <& /edit/cust_main/billing.html, FS::cust_main->new({}),
81 <INPUT NAME = "submitButton"
83 VALUE = "<% mt("Detach package") |h %>"
86 %#and a cancel button? or is the popup close sufficient?
94 my $conf = new FS::Conf;
95 my $countrydefault = $conf->config('countrydefault') || 'US';
97 my $curuser = $FS::CurrentUser::CurrentUser;
99 unless $curuser->access_right('Change customer package');
101 my $pkgnum = scalar($cgi->param('pkgnum'));
102 $pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
107 'table' => 'cust_pkg',
108 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
109 'hashref' => { 'pkgnum' => $pkgnum },
110 'extra_sql' => ' AND '. $curuser->agentnums_sql,
111 }) or die "unknown pkgnum $pkgnum";
113 my $loc = $cust_pkg->cust_location_or_main;
115 my $cust_main = $cust_pkg->cust_main
116 or die "can't get cust_main record for custnum ". $cust_pkg->custnum.
117 " ( pkgnum ". cust_pkg->pkgnum. ")";
119 my $part_pkg = $cust_pkg->part_pkg;