From: Ivan Kohler Date: Fri, 2 Jun 2017 21:21:22 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=00366d997194ebfa62b8502e638cdfef4c932256;hp=717f2ce998bbe7ee79a92b907f82bee098a773a1 Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 7df481ec6..8c082ec0d 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -2581,10 +2581,14 @@ sub change_pkg { my $err_or_cust_pkg = $cust_pkg->change( 'pkgpart' => $p->{'pkgpart'}, 'quantity' => $p->{'quantity'} || 1, ); + + my $new_pkg = qsearchs('part_pkg', { 'pkgpart' => $p->{pkgpart} } ) + or return { 'error' => "unknown package $p->{pkgpart}" }; return { error=>$err_or_cust_pkg, pkgnum=>$cust_pkg->pkgnum } unless ref($err_or_cust_pkg); + if ( $conf->exists('signup_server-realtime') ) { my $bill_error = _do_bop_realtime( $cust_main, $status, 'no_invoice_void'=>1 ); @@ -2600,7 +2604,7 @@ sub change_pkg { $err_or_cust_pkg->reexport; } - return { error => '', pkgnum => $cust_pkg->pkgnum }; + return { error => '', pkg => $new_pkg->pkg, pkgnum => $err_or_cust_pkg->pkgnum }; } diff --git a/httemplate/elements/change_history_common.html b/httemplate/elements/change_history_common.html index dfcfcb958..5fba23621 100644 --- a/httemplate/elements/change_history_common.html +++ b/httemplate/elements/change_history_common.html @@ -44,6 +44,40 @@ % } else { % $bgcolor = $bgcolor1; % } +% +% ## Create Description and check to see it is not empty, no need to display a record with no description, so skip it. +% my $description = ''; +% if ( $item->table eq 'legacy_cust_history' ) { +% $description = $item->description; +% } elsif ( $item->table eq 'h_cust_tag' ) { +% $description = &{ $h_table_descripsub{$item->table} }( $item, $tables{'cust_tag'} ) +% if $single_cust && $h_table_descripsub{$item->table}; +% } else { +% $description = join(', ', +% map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) +% ? 'N/A' +% : $item->get($_); +% $value = time2str($cust_pkg_date_format, $value) +% if $item->table eq 'h_cust_pkg' +% && $cust_pkg_date_fields{$_} +% && $value; +% +% $value = substr($value, 0, 77).'...' if length($value) > 80; +% $value = encode_entities($value); +% "$_:$value"; +% } +% grep { $history_other +% ? ( $item->get($_) ne $history_other->get($_) ) +% : ( $item->get($_) =~ /\S/ ) +% } +% grep { ! /^(history|custnum$)/i } +% $item->fields +% ); +% if ( $single_cust && $h_table_descripsub{$item->table} ) { +% $description = &{ $h_table_descripsub{$item->table} }( $item ); +% } +% } #else +% if (!$description) { next; } @@ -102,39 +136,7 @@ -% my $description = ''; -% if ( $item->table eq 'legacy_cust_history' ) { - <% $item->description |h %> -% } elsif ( $item->table eq 'h_cust_tag' ) { -% $description = &{ $h_table_descripsub{$item->table} }( $item, $tables{'cust_tag'} ) -% if $single_cust && $h_table_descripsub{$item->table}; - <% $description %> -% } else { - <% join(', ', - map { my $value = ( $_ =~ /(^pay(info|cvv)|^ss|_password)$/ ) - ? 'N/A' - : $item->get($_); - $value = time2str($cust_pkg_date_format, $value) - if $item->table eq 'h_cust_pkg' - && $cust_pkg_date_fields{$_} - && $value; - - $value = substr($value, 0, 77).'...' if length($value) > 80; - $value = encode_entities($value); - "$_:$value"; - } - grep { $history_other - ? ( $item->get($_) ne $history_other->get($_) ) - : ( $item->get($_) =~ /\S/ ) - } - grep { ! /^(history|custnum$)/i } - $item->fields - ) - %> -% if ( $single_cust && $h_table_descripsub{$item->table} ) { - <% &{ $h_table_descripsub{$item->table} }( $item ) %> -% } -% } + <% $description %> diff --git a/ng_selfservice/packages_change.php b/ng_selfservice/packages_change.php index 8b4386ce0..876f6cd19 100644 --- a/ng_selfservice/packages_change.php +++ b/ng_selfservice/packages_change.php @@ -6,32 +6,20 @@ $customer_info = $freeside->customer_info_short( array( 'session_id' => $_COOKIE['session_id'], ) ); -$list_pkgs = $freeside->list_pkgs( array( - 'session_id' => $_COOKIE['session_id'], -) ); - -if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) { - $error = $list_pkgs['error']; - header('Location:index.php?error='. urlencode($error)); - die(); +foreach ( $cust_pkg AS $pkg ) { + $part_pkg .= $pkg[pkgpart]; + $class_num .= $pkg[classnum]; } -extract($list_pkgs); - -$get_params = array( 'pkgnum', 'pkg' ); +$get_params = array( 'pkgnum', 'pkg', 'classnum', 'pkgpart' ); foreach ( $get_params AS $param ) { $params[$param] = $_GET[$param]; } -$pkgnum = $_GET['pkgnum']; -$pkg = $_GET['pkg']; - $pkgselect = $freeside->mason_comp( array( 'session_id' => $_COOKIE['session_id'], 'comp' => '/elements/select-part_pkg.html', - 'args' => array( 'custnum' => $customer_info['custnum'], - 'curr_value' => 'current_value', - ), + 'args' => [ 'classnum', $params['classnum'], 'curr_value', $params['pkgpart'], ], ) ); @@ -53,7 +41,7 @@ function enable_change_pkg () { } -Purchase replacement package for ""

+Purchase replacement package for ""

diff --git a/ng_selfservice/process_packages_change.php b/ng_selfservice/process_packages_change.php index 114cc6b1a..3ea655e60 100644 --- a/ng_selfservice/process_packages_change.php +++ b/ng_selfservice/process_packages_change.php @@ -53,8 +53,6 @@ if ( ! $results['error'] ) { $results = $freeside->change_pkg($change_pkg); - echo $results; - } # if ( $results->{'error'} ) { @@ -83,7 +81,7 @@ if ( isset($results['error']) && $results['error'] ) { ?> -Package Changed Su for ""

+Package Successfully Changed To ""

\ No newline at end of file diff --git a/ng_selfservice/services.php b/ng_selfservice/services.php index 25fbdde4f..987e5826d 100644 --- a/ng_selfservice/services.php +++ b/ng_selfservice/services.php @@ -33,7 +33,7 @@ extract($list_pkgs); $change_link = ''; if ( in_array("Change packages", $menu_disable) == 0) { - $change_link = '[change]'; + $change_link = '[change]'; } ?>