RT# 73993 - updated ng_selfservice/services.php and ng_selfservice/packages_change...
[freeside.git] / ng_selfservice / packages_change.php
1 <? $title ='Change Package'; include('elements/header.php'); ?>
2 <? $current_menu = 'services.php'; include('elements/menu.php'); ?>
3 <?
4
5 $get_params = array( 'pkgnum' );
6 foreach ( $get_params AS $param ) {
7   $params[$param] = $_GET[$param];
8 }
9
10 $customer_info = $freeside->customer_info_short( array(
11   'session_id' => $_COOKIE['session_id'],
12 ) );
13
14 $list_pkgs = $freeside->list_pkgs( array(
15   'session_id' => $_COOKIE['session_id'],
16 ) );
17
18 if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) {
19   $error = $list_pkgs['error'];
20   header('Location:index.php?error='. urlencode($error));
21   die();
22 }
23
24 extract($list_pkgs);
25
26 foreach ( $cust_pkg AS $pkg ) {
27   if ( $pkg['pkgnum'] == $params['pkgnum'] ) { 
28     $pkg_label = $pkg['pkg_label'];
29     $pkg_part = $pkg['pkgpart'];
30     $class_num = $pkg['classnum'];
31   }
32 }
33
34 $pkgselect = $freeside->mason_comp( array(
35     'session_id' => $_COOKIE['session_id'],
36     'comp'       => '/elements/select-part_pkg.html',
37     'args'       => [ 'classnum', $class_num, 'curr_value', $pkg_part, ],
38   )
39 );
40
41 if ( isset($pkgselect['error']) && $pkgselect['error'] ) {
42   $error = $pkgselect['error'];
43   header('Location:index.php?error='. urlencode($error));
44   die();
45 }
46
47 ?>
48
49 <SCRIPT TYPE="text/javascript">
50 function enable_change_pkg () {
51   if ( document.ChangePkgForm.pkgpart_svcpart.selectedIndex > 0 ) {
52     document.ChangePkgForm.submit.disabled = false;
53   } else {
54     document.ChangePkgForm.submit.disabled = true;
55   }
56 }
57 </SCRIPT>
58
59 <FONT SIZE=4>Purchase replacement package for "<? echo htmlspecialchars($pkg_label); ?>"</FONT><BR><BR>
60
61 <? include('elements/error.php'); ?>
62
63 <FORM NAME="ChangePkgForm" ACTION="process_packages_change.php" METHOD=POST>
64 <TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
65
66 <TR>
67   <TD COLSPAN=2>
68     <TABLE><TR><TD> <? echo $pkgselect['output']; ?>
69
70   </TD>
71 </TR>
72
73 </TABLE>
74 <BR>
75 <INPUT TYPE="hidden" NAME="custnum" VALUE="<? echo $customer_info['custnum'] ?>">
76 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<? echo $params['pkgnum'] ?>">
77 <INPUT TYPE="hidden" NAME="pkg" VALUE="<? echo $params['pkg'] ?>">
78 <INPUT TYPE="hidden" NAME="action" VALUE="process_change_pkg">
79 <INPUT NAME="submit" TYPE="submit" VALUE="Change Package">
80 </FORM>
81
82 <? include('elements/menu_footer.php'); ?>
83 <? include('elements/footer.php'); ?>