X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=a78aa87d80d89723c8025ef85c6a69d66d85e952;hb=55f003404af6a2416571138356d11c5ad3755e58;hp=2b1bab67f42c731d87a5df656882dd7a0579e69c;hpb=3fae9d8e9686f54eab803b77f6458772150227a9;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 2b1bab67f..a78aa87d8 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -5,8 +5,7 @@ 'agent_virt' => 1, 'agent_null_right' => $edit_global, - 'agent_clone_extra_sql' => FS::part_pkg->curuser_pkgs_sql, - + 'agent_clone_extra_sql' => $agent_clone_extra_sql, #'viewall_dir' => 'browse', 'viewall_url' => $p.'browse/part_pkg.cgi', 'html_init' => include('/elements/init_overlib.html'). @@ -38,6 +37,8 @@ 'taxproduct_select'=> 'Tax products', 'plan' => 'Price plan', 'disabled' => 'Disable new orders', + 'setup_cost' => 'Setup cost', + 'recur_cost' => 'Recur cost', 'pay_weight' => 'Payment weight', 'credit_weight' => 'Credit weight', 'agentnum' => 'Agent', @@ -45,6 +46,7 @@ 'recur_fee' => 'Recurring fee', 'bill_dst_pkgpart' => 'Include line item(s) from package', 'svc_dst_pkgpart' => 'Include services of package', + 'report_option' => 'Report classes', }, 'fields' => [ @@ -57,6 +59,8 @@ sub { shift->param('pkgnum') }, }, + { field=>'custom', type=>'hidden' }, + { type => 'columnstart' }, { field => 'pkg', @@ -132,10 +136,10 @@ { field=>'promo_code', type=>'text', size=>15 }, { type => 'tablebreak-tr-title', - value => 'Line-item revenue recogition', #better name? + value => 'Cost tracking', #better name? }, - { field=>'pay_weight', type=>'text', size=>6 }, - { field=>'credit_weight', type=>'text', size=>6 }, + { field=>'setup_cost', type=>'money', }, + { field=>'recur_cost', type=>'money', }, { type => 'columnnext' }, @@ -149,8 +153,28 @@ }, }, + { type => 'tablebreak-tr-title', + value => 'Line-item revenue recogition', #better name? + }, + { field=>'pay_weight', type=>'text', size=>6 }, + { field=>'credit_weight', type=>'text', size=>6 }, + + { type => 'columnend' }, + { 'type' => $census ? 'tablebreak-tr-title' + : 'hidden', + 'value' => 'Optional report classes', + 'field' => 'census_title', + }, + { 'field' => 'report_option', + 'type' => $census ? 'select-table' : 'hidden', + 'table' => 'part_pkg_report_option', + 'name_col' => 'name', + 'multiple' => 1, + }, + + { 'type' => 'tablebreak-tr-title', 'value' => 'Pricing add-ons', }, @@ -207,8 +231,14 @@ my $begin_callback = sub { my $disabled_type = $acl_edit_either ? 'checkbox' : 'hidden'; +my $agent_clone_extra_sql = + ' ( '. FS::part_pkg->curuser_pkgs_sql. + " OR ( part_pkg.custom = 'Y' ) ". + ' ) '; + my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); +my $census = scalar( qsearch( 'part_pkg_report_option', {} ) ); #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -286,14 +316,27 @@ my $edit_callback = sub { (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1}); + my @report_option = (); foreach ($object->options) { /^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1); + /^report_option_(\d+)$/ && (push @report_option, $1); } foreach ($object->part_pkg_taxoverride) { $taxproductnums{$_->usage_class} = 1 if $_->usage_class; } + $cgi->param('report_option', join(',', @report_option)); + foreach my $field ( @$fields ) { + next unless ( + ref($field) eq 'HASH' && + $field->{field} && + $field->{field} eq 'report_option' + ); + #$field->{curr_value} = join(',', @report_option); + $field->{value} = join(',', @report_option); + } + %options = $object->options; $object->set($_ => $object->option($_)) @@ -323,9 +366,8 @@ my $clone_callback = sub { $opt->{action} = 'Custom'; #my $part_pkg = $clone_part_pkg->clone; - #this is all clone did anyway - $object->comment( '(CUSTOM) '. $object->comment ) - unless $object->comment =~ /^\(CUSTOM\) /; + #this is all clone does anyway + $object->custom('Y'); $object->disabled('Y');