From 98f6d91ec7eaa907204afbfeb90ede1e3bff656d Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Mon, 13 Jul 2015 17:26:48 -0700 Subject: automatic package changes for supplemental packages, #37102 --- httemplate/browse/part_pkg.cgi | 72 ++++++++++++++++++------ httemplate/edit/part_pkg.cgi | 47 ++++++++++++---- httemplate/elements/freeside.css | 12 ++++ httemplate/elements/select.html | 26 +++++++++ httemplate/elements/tr-select-expire_months.html | 10 ++++ httemplate/elements/tr-select-months.html | 12 ++++ httemplate/view/cust_main/packages.html | 26 ++++++++- httemplate/view/cust_main/packages/package.html | 24 ++++---- httemplate/view/cust_main/packages/section.html | 8 ++- httemplate/view/cust_main/packages/status.html | 57 +++++++++++-------- 10 files changed, 223 insertions(+), 71 deletions(-) create mode 100644 httemplate/elements/tr-select-expire_months.html create mode 100644 httemplate/elements/tr-select-months.html (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index f8de620a7..c2f1430d7 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -247,6 +247,7 @@ push @fields, sub { $part_pkg->part_pkg_discount; [ + # Line 0: Family package link (if applicable) ( !$family_pkgpart && $part_pkg->pkgpart == $part_pkg->family_pkgpart ? () : [ { @@ -257,13 +258,13 @@ push @fields, sub { 'link' => $p.'browse/part_pkg.cgi?family='.$part_pkg->family_pkgpart, } ] ), - [ + [ # Line 1: Plan type (Anniversary, Prorate, Call Rating, etc.) { data =>$plan, align=>'center', colspan=>2, }, ], - [ + [ # Line 2: Setup fee { data =>$money_char. sprintf('%.2f ', $part_pkg->option('setup_fee') ), align=>'right' @@ -278,7 +279,7 @@ push @fields, sub { align=>'left', }, ], - [ + [ # Line 3: Recurring fee { data=>( $is_recur ? $money_char. sprintf('%.2f', $part_pkg->option('recur_fee')) @@ -288,20 +289,56 @@ push @fields, sub { colspan=> ( $is_recur ? 1 : 2 ), }, ( $is_recur - ? { data => ( $is_recur - ? '   '. $part_pkg->freq_pretty. - ( $part_pkg->option('recur_fee') == 0 - && $part_pkg->recur_show_zero - ? ' (printed on invoices)' - : '' - ) - : '' ), + ? { data => '   '. $part_pkg->freq_pretty. + ( $part_pkg->option('recur_fee') == 0 + && $part_pkg->recur_show_zero + ? ' (printed on invoices)' + : '' + ), align=>'left', } : () ), ], - ( + [ { data => ' ' }, ], # Line 4: empty + ( $part_pkg->adjourn_months ? + [ # Line 5: Adjourn months + { data => mt('After [quant,_1,month], suspend the package.', + $part_pkg->adjourn_months), + align => 'left', + size => -1, + colspan => 2, + } + ] : () + ), + ( $part_pkg->contract_end_months ? + [ # Line 6: Contract end months + { data => mt('After [quant,_1,month], contract ends.', + $part_pkg->contract_end_months), + align => 'left', + size => -1, + colspan => 2, + } + ] : () + ), + ( $part_pkg->expire_months ? + [ # Line 7: Expire months and automatic transfer + { data => $part_pkg->change_to_pkgpart ? + mt('After [quant,_1,month], change to ', + $part_pkg->expire_months) . + qq() . $part_pkg->change_to_pkg->pkg . qq() . '.' + : mt('After [quant,_1,month], cancel the package.', + $part_pkg->expire_months) + , + align => 'left', + size => -1, + colspan => 2, + } + ] : () + ), + ( # Usage prices map { my $amount = $_->amount / ($_->target_info->{multiplier} || 1); my $label = $_->target_info->{label}; [ @@ -315,7 +352,8 @@ push @fields, sub { } $part_pkg->part_pkg_usageprice ), - ( map { my $dst_pkg = $_->dst_pkg; + ( # Supplementals + map { my $dst_pkg = $_->dst_pkg; [ { data => 'Supplemental:  '. '' . @@ -327,7 +365,8 @@ push @fields, sub { } $part_pkg->supp_part_pkg_link ), - ( map { + ( # Billing add-ons/bundle packages + map { my $dst_pkg = $_->dst_pkg; [ { data => 'Add-on: '.$dst_pkg->pkg_comment, @@ -338,7 +377,8 @@ push @fields, sub { } $part_pkg->bill_part_pkg_link ), - ( scalar(@discounts) + ( # Discounts available + scalar(@discounts) ? [ { data => 'Discounts', align=>'center', #? @@ -360,7 +400,7 @@ push @fields, sub { @discounts : () ), - ]; + ]; # end of "middle column" # $plan_labels{$part_pkg->plan}.'
'. # $money_char.sprintf('%.2f setup
', $part_pkg->option('setup_fee') ). diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index a90a62508..9f5510d65 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -28,7 +28,7 @@ 'onsubmit' => 'confirm_submit', - 'labels' => { + 'labels' => { 'pkgpart' => 'Package Definition', 'pkg' => 'Package', %locale_field_labels, @@ -69,6 +69,10 @@ 'supp_dst_pkgpart' => 'When ordering package, also order', 'report_option' => 'Report classes', 'delay_start' => 'Default delay (days)', + 'adjourn_months' => 'Suspend the package after ', + 'contract_end_months' => 'Contract ends after ', + 'expire_months' => 'Cancel the package after ', + 'change_to_pkgpart'=> 'and replace it with ', }, 'fields' => [ @@ -164,6 +168,37 @@ sort $conf->config('currencies') ), + ( $conf->exists('part_pkg-delay_start') + ? ( { type => 'tablebreak-tr-title', + value => 'Delayed start', + }, + { field => 'delay_start', + type => 'text', size => 6 }, + ) + : () + ), + + { type => 'tablebreak-tr-title', + value => 'Limited duration', + }, + { field => 'adjourn_months', + type => 'select-months', + }, + { field => 'contract_end_months', + type => 'select-months', + }, + { field => 'expire_months', + type => 'select-expire_months', + }, + { field => 'change_to_pkgpart', + type => 'select-part_pkg', + extra_sql => sub { $pkgpart + ? "AND pkgpart != $pkgpart" + : '' + }, + empty_label => 'no package', + }, + #price plan #setup fee #recurring frequency @@ -219,16 +254,6 @@ ) ), - ( $conf->exists('part_pkg-delay_start') - ? ( { type => 'tablebreak-tr-title', - value => 'Delayed start', - }, - { field => 'delay_start', - type => 'text', size => 6 }, - ) - : () - ), - { type => 'columnnext' }, {type=>'justtitle', value=>'Agent (reseller) types' }, diff --git a/httemplate/elements/freeside.css b/httemplate/elements/freeside.css index d4e155aa1..dbd27cbaa 100644 --- a/httemplate/elements/freeside.css +++ b/httemplate/elements/freeside.css @@ -323,3 +323,15 @@ div#overDiv { box-shadow: #333333 1px 1px 2px; } +/* view/cust_main/packages/package.html */ +div.package-marker-supplemental { + height: 100%; + border-left: solid #bbbbff 30px; + display: inline-block; +} + +div.package-marker-change_from { + height: 100%; + border-left: solid #bbffbb 30px; + display: inline-block; +} diff --git a/httemplate/elements/select.html b/httemplate/elements/select.html index 4492681de..42cd89504 100644 --- a/httemplate/elements/select.html +++ b/httemplate/elements/select.html @@ -1,3 +1,29 @@ +<%doc> +<& select.html, + # required + field => 'myfield', # NAME property + curr_value => 'foo', + labels => { # or 'option_labels' + 'AL' => 'Alabama', + 'AK' => 'Alaska', + 'AR' => 'Arkansas', + }, + options => [ 'AL', 'AK', 'AR' ], + curr_value => $cgi->param('myfield'), + + # recommended + id => 'myid', # DOM id + + # optional + size => 1, # to show multiple rows at once + style => '', # STYLE property + multiple => 0, + disabled => 0, + onchange => 'do_something()', + js_only => 0, # disables the whole thing +&> + + % unless ( $opt{'js_only'} ) {