From b8ec621c59747a1c2fcd7fbd603d0c6de41e7df5 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 12 Aug 2006 10:47:51 +0000 Subject: [PATCH] fix acl rewrite causing problems: void now shows up properly, deprecate all the redundant config values --- FS/FS/AccessRight.pm | 1 + FS/FS/Conf.pm | 28 ++++----- httemplate/view/cust_main/payment_history.html | 86 +++++++++++++++++--------- 3 files changed, 71 insertions(+), 44 deletions(-) diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 888a6865b..d03b79acd 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -120,6 +120,7 @@ assigned to users and/or groups. 'Credit card void', #aka. cc-void #Enable local-only voiding of echeck payments in addition to refunds against the payment gateway 'Echeck void', #aka. echeck-void #Enable local-only voiding of echeck payments in addition to refunds against the payment gateway + 'Regular void', 'Unvoid', #aka. unvoid #Enable unvoiding of voided payments 'List customers', diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 8b3cd1aa6..5b77234a6 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -435,29 +435,29 @@ httemplate/docs/config.html { 'key' => 'deletepayments', - 'section' => 'UI', - 'description' => 'Enable deletion of unclosed payments. Be very careful! Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.', + 'section' => 'billing', + 'description' => 'Enable deletion of unclosed payments. Really, with voids this is pretty much not recommended in any situation anymore. Be very careful! Only delete payments that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a payment is deleted.', 'type' => [qw( checkbox text )], }, { 'key' => 'deletecredits', - 'section' => 'UI', - 'description' => 'Enable deletion of unclosed credits. Be very careful! Only delete credits that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable deletion of unclosed credits. Be very careful! Only delete credits that were data-entry errors, not adjustments. Optionally specify one or more comma-separated email addresses to be notified when a credit is deleted.', 'type' => [qw( checkbox text )], }, { 'key' => 'unapplypayments', - 'section' => 'UI', - 'description' => 'Enable "unapplication" of unclosed payments.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable "unapplication" of unclosed payments.', 'type' => 'checkbox', }, { 'key' => 'unapplycredits', - 'section' => 'UI', - 'description' => 'Enable "unapplication" of unclosed credits.', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to nable "unapplication" of unclosed credits.', 'type' => 'checkbox', }, @@ -1557,22 +1557,22 @@ httemplate/docs/config.html { 'key' => 'echeck-void', - 'section' => 'billing', - 'description' => 'Enable local-only voiding of echeck payments in addition to refunds against the payment gateway', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable local-only voiding of echeck payments in addition to refunds against the payment gateway', 'type' => 'checkbox', }, { 'key' => 'cc-void', - 'section' => 'billing', - 'description' => 'Enable local-only voiding of credit card payments in addition to refunds against the payment gateway', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable local-only voiding of credit card payments in addition to refunds against the payment gateway', 'type' => 'checkbox', }, { 'key' => 'unvoid', - 'section' => 'billing', - 'description' => 'Enable unvoiding of voided payments', + 'section' => 'deprecated', + 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable unvoiding of voided payments', 'type' => 'checkbox', }, diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 5c2aa24c9..482136fa1 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -135,7 +135,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { $post = ''; $apply = qq! (apply)!; + qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!; } elsif ( scalar(@cust_bill_pay) == 1 && scalar(@cust_pay_refund) == 0 @@ -161,7 +161,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { } elsif ( $app->isa('FS::cust_pay_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on'. time2str("%D", $app->_date). + ' refunded on '. time2str("%D", $app->_date). '
'; } else { die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; @@ -173,7 +173,7 @@ foreach my $cust_pay ($cust_main->cust_pay) { $cust_pay->unapplied. ' unapplied'. qq! (apply)!. + qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!. '
'; } } @@ -195,13 +195,14 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $void = ''; if ( $cust_pay->closed !~ /^Y/i && ( ( $cust_pay->payby eq 'CARD' - && $conf->exists('cc-void') - && $curuser->acccess_right('Credit card void') + && $curuser->access_right('Credit card void') ) || ( $cust_pay->payby eq 'CHEK' - && $conf->exists('echeck-void') - && $curuser->acccess_right('Echeck void') - ) + && $curuser->access_right('Echeck void') + ) + || ( $cust_pay->payby !~ /^(CARD|CHEK)$/ + && $curuser->access_right('Regular void') + ) ) ) { @@ -231,7 +232,6 @@ foreach my $cust_pay ($cust_main->cust_pay) { my $unapply = ''; if ( $cust_pay->closed !~ /^Y/i - && $conf->exists('unapplypayments') && scalar(@cust_bill_pay) && $curuser->access_right('Unapply payment') ) @@ -268,7 +268,6 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { my $unvoid = ''; if ( $cust_pay_void->closed !~ /^Y/i - && $conf->exists('unvoid') && $curuser->access_right('Unvoid') ) { @@ -307,7 +306,7 @@ foreach my $cust_credit ($cust_main->cust_credit) { $post = ''; $apply = qq! (apply)!; + qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!; } elsif ( scalar(@cust_credit_bill) == 1 && scalar(@cust_credit_refund) == 0 && $cust_credit->credited == 0 ) { @@ -332,7 +331,7 @@ foreach my $cust_credit ($cust_main->cust_credit) { } elsif ( $app->isa('FS::cust_credit_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on'. time2str("%D", $app->_date). + ' refunded on '. time2str("%D", $app->_date). '
'; } else { die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; @@ -343,14 +342,18 @@ foreach my $cust_credit ($cust_main->cust_credit) { $cust_credit->credited. ' unapplied'. qq! (apply)!. + qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply)!. '
'; } } # my $delete = ''; if ( $cust_credit->closed !~ /^Y/i - && $conf->exists('deletecredits') + + #s'pose deleting a credit isn't bad like deleting a payment + # and this needs to be generally available until we have credit voiding.. + #&& $conf->exists('deletecredits') + && $curuser->access_right('Delete credit') ) { @@ -362,7 +365,6 @@ foreach my $cust_credit ($cust_main->cust_credit) { my $unapply = ''; if ( $cust_credit->closed !~ /^Y/i - && $conf->exists('unapplycredits') && scalar(@cust_credit_bill) && $curuser->access_right('Unapply credit') ) @@ -408,15 +410,21 @@ foreach my $cust_refund ($cust_main->cust_refund) { %> -<%= include("/elements/table.html") %> +<%= include("/elements/table-grid.html") %> + +<% my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor = ''; +%> + - Date - Description - Charge - Payment - In-house
Credit
- Refund - Balance + Date + Description + Charge + Payment + In-house
Credit
+ Refund + Balance <% @@ -426,6 +434,12 @@ my %target; my $balance = 0; foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; + } else { + $bgcolor = $bgcolor1; + } + my $charge = exists($item->{'charge'}) ? sprintf('$%.2f', $item->{'charge'}) : ''; @@ -454,7 +468,7 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { %> - + <% unless ( !$target || $target{$target}++ ) { %> <% } %> @@ -464,12 +478,24 @@ foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { <% } %> - <%= $item->{'desc'} %> - <%= $charge %> - <%= $payment %> - <%= $credit %> - <%= $refund %> - <%= $showbalance %> + + <%= $item->{'desc'} %> + + + <%= $charge %> + + + <%= $payment %> + + + <%= $credit %> + + + <%= $refund %> + + + <%= $showbalance %> + <% } %> -- 2.11.0