1 <& /elements/header-popup.html, mt("Detach Package to New Customer") &>
3 <& /elements/error.html &>
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() %>">
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 %>">
15 <% ntable('#cccccc') %>
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 %>
24 % #always should be present for detaching, yes? #if ( $cust_pkg->contactnum ) {
25 % my $cust_contact = $cust_pkg->contact_obj;
27 <INPUT TYPE="hidden" NAME="first" VALUE="<% $cust_contact->get('first') |h %>">
28 <INPUT TYPE="hidden" NAME="last" VALUE="<% $cust_contact->get('last') |h %>">
31 <TH ALIGN="right"><% mt('Name') %></TH>
32 <TD COLSPAN=7 BGCOLOR="#dddddd">
33 <% $cust_pkg->contact_obj->line |h %>
39 <TH ALIGN="right" VALIGN="top"><% mt('Address') %></TH>
40 <TD COLSPAN=7 BGCOLOR="#dddddd">
42 <% $loc->location_label( 'join_string' => '<BR>',
43 'double_space' => ' ',
44 'escape_function' => \&encode_entities,
45 'countrydefault' => $countrydefault,
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';
63 <& /elements/tr-cust_main-phones.html,
64 'cust_main' => $ph_cust_main,
71 %#XXX should be sticky on errors...
72 <& /edit/cust_main/billing.html, FS::cust_main->new({}),
79 <INPUT NAME = "submitButton"
81 VALUE = "<% mt("Detach package") |h %>"
84 %#and a cancel button? or is the popup close sufficient?
92 my $conf = new FS::Conf;
93 my $countrydefault = $conf->config('countrydefault') || 'US';
95 my $curuser = $FS::CurrentUser::CurrentUser;
97 unless $curuser->access_right('Change customer package');
99 my $pkgnum = scalar($cgi->param('pkgnum'));
100 $pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
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";
111 my $loc = $cust_pkg->cust_location_or_main;
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. ")";
117 my $part_pkg = $cust_pkg->part_pkg;