From dba9cc11f7ad2337506e40ed2aa6bc9e890cc977 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 21 Jul 2015 15:16:12 -0700 Subject: [PATCH] remove invoice deletion (and ancient & unused config settings), RT#37157 --- FS/FS/Conf.pm | 125 ------------------ FS/FS/cust_bill.pm | 11 +- httemplate/misc/delete-cust_bill.html | 21 --- httemplate/misc/delete-cust_pkg_discount.html | 2 +- httemplate/view/cust_bill.cgi | 21 +-- .../view/cust_main/payment_history.html | 4 +- .../cust_main/payment_history/invoice.html | 10 +- .../payment_history/voided_invoice.html | 10 +- 8 files changed, 12 insertions(+), 192 deletions(-) delete mode 100644 httemplate/misc/delete-cust_bill.html diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 1d4a85a57..4e1736be3 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -719,13 +719,6 @@ my $validate_email = sub { $_[0] =~ @config_items = map { new FS::ConfItem $_ } ( - { - 'key' => 'address', - 'section' => 'deprecated', - 'description' => 'This configuration option is no longer used. See invoice_template instead.', - 'type' => 'text', - }, - { 'key' => 'event_log_level', 'section' => 'notification', @@ -1045,13 +1038,6 @@ my $validate_email = sub { $_[0] =~ 'per_locale' => 1, }, - { - 'key' => 'deleteinvoices', - 'section' => 'UI', - 'description' => 'Enable invoices deletions. Be very careful! Deleting an invoice will remove all traces that the invoice ever existed! Normally, you would void or apply a credit against the invoice instead.', - 'type' => 'checkbox', - }, - { 'key' => 'deletecredits', #not actually deprecated yet @@ -1069,20 +1055,6 @@ my $validate_email = sub { $_[0] =~ 'type' => 'checkbox', }, - { - 'key' => 'unapplypayments', - 'section' => 'deprecated', - 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable "unapplication" of unclosed payments.', - 'type' => 'checkbox', - }, - - { - 'key' => 'unapplycredits', - 'section' => 'deprecated', - 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable "unapplication" of unclosed credits.', - 'type' => 'checkbox', - }, - { 'key' => 'dirhash', 'section' => 'shell', @@ -1669,13 +1641,6 @@ and customer address. Include units.', 'type' => 'checkbox', }, - { - 'key' => 'invoice_send_receipts', - 'section' => 'deprecated', - 'description' => 'DEPRECATED, this used to send an invoice copy on payments and credits. See the payment_receipt_email and XXXX instead.', - 'type' => 'checkbox', - }, - { 'key' => 'payment_receipt', 'section' => 'notification', @@ -1873,13 +1838,6 @@ and customer address. Include units.', # 'description' => 'Directory which contains domain registry information. Each registry is a directory.', # }, - { - 'key' => 'report_template', - 'section' => 'deprecated', - 'description' => 'Deprecated template file for reports.', - 'type' => 'textarea', - }, - { 'key' => 'maxsearchrecordsperpage', 'section' => 'UI', @@ -2686,13 +2644,6 @@ and customer address. Include units.', 'type' => 'checkbox', }, - { - 'key' => 'paymentforcedtobatch', - 'section' => 'deprecated', - 'description' => 'See batch-enable_payby and realtime-disable_payby. Used to (for CHEK): Cause per customer payment entry to be forced to a batch processor rather than performed realtime.', - 'type' => 'checkbox', - }, - { 'key' => 'svc_acct-notes', 'section' => 'deprecated', @@ -2767,13 +2718,6 @@ and customer address. Include units.', 'validate' => $validate_email, }, - { - 'key' => 'users-allow_comp', - 'section' => 'deprecated', - 'description' => 'DEPRECATED, enable the Complimentary customer access right instead. Was: Usernames (Freeside users, created with freeside-adduser) which can create complimentary customers, one per line. If no usernames are entered, all users can create complimentary accounts.', - 'type' => 'textarea', - }, - { 'key' => 'credit_card-recurring_billing_flag', 'section' => 'billing', @@ -3382,27 +3326,6 @@ and customer address. Include units.', 'per_agent' => 1, }, - { - 'key' => 'echeck-void', - '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' => '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' => 'deprecated', - 'description' => 'DEPRECATED, now controlled by ACLs. Used to enable unvoiding of voided payments', - 'type' => 'checkbox', - }, - { 'key' => 'address1-search', 'section' => 'UI', @@ -3432,12 +3355,6 @@ and customer address. Include units.', 'per_agent' => 1, }, - { 'key' => 'referral_credit', - 'section' => 'deprecated', - 'description' => "Used to enable one-time referral credits in the amount of one month referred customer's recurring fee (irregardless of frequency). Replace with a billing event on appropriate packages.", - 'type' => 'checkbox', - }, - { 'key' => 'selfservice_server-cache_module', 'section' => 'self-service', 'description' => 'Module used to store self-service session information. All modules handle any number of self-service servers. Cache::SharedMemoryCache is appropriate for a single database / single Freeside server. Cache::FileCache is useful for multiple databases on a single server, or when IPC::ShareLite is not available (i.e. FreeBSD).', # _Database stores session information in the database and is appropriate for multiple Freeside servers, but may be slower.', @@ -5998,48 +5915,6 @@ and customer address. Include units.', 'type' => 'text', }, - { key => "apacheroot", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "apachemachine", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "apachemachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "bindprimary", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "bindsecondaries", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "bsdshellmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "cyrus", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "cp_app", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "erpcdmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "icradiusmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "icradius_mysqldest", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "icradius_mysqlsource", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "icradius_secrets", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "maildisablecatchall", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "mxmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "nsmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "arecords", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "cnamerecords", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "nismachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "qmailmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "radiusmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "sendmailconfigpath", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "sendmailmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "sendmailrestart", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "shellmachine", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "shellmachine-useradd", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "shellmachine-userdel", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "shellmachine-usermod", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "shellmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "radiusprepend", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "textradiusprepend", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "username_policy", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "vpopmailmachines", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "vpopmailrestart", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "safe-part_pkg", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "selfservice_server-quiet", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "signup_server-quiet", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "signup_server-email", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "vonage-username", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "vonage-password", section => "deprecated", description => "DEPRECATED", type => "text" }, - { key => "vonage-fromnumber", section => "deprecated", description => "DEPRECATED", type => "text" }, - ); 1; diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 6a4fa1e8f..b694924f3 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -267,14 +267,13 @@ sub void { =item delete -This method now works but you probably shouldn't use it. Instead, apply a -credit against the invoice, or use the new void method. +DO NOT USE THIS METHOD. Instead, apply a credit against the invoice, or use +the B method. -Using this method to delete invoices outright is really, really bad. There -would be no record you ever posted this invoice, and there are no check to -make sure charged = 0 or that there are no associated cust_bill_pkg records. +This is only for internal use by V, which is what you should be using. -Really, don't use it. +DO NOT USE THIS METHOD. Whatever reason you think you have is almost certainly +wrong. Use B, that's what it is for. Really. This means you. =cut diff --git a/httemplate/misc/delete-cust_bill.html b/httemplate/misc/delete-cust_bill.html deleted file mode 100644 index 3a642b0e9..000000000 --- a/httemplate/misc/delete-cust_bill.html +++ /dev/null @@ -1,21 +0,0 @@ -% if ( $error ) { -% errorpage($error); -% } else { -<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> -% } -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Delete invoices'); - -#untaint invnum -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal crednum"; -my $invnum = $1; - -my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); -my $custnum = $cust_bill->custnum; - -my $error = $cust_bill->delete; - - diff --git a/httemplate/misc/delete-cust_pkg_discount.html b/httemplate/misc/delete-cust_pkg_discount.html index 0bdaa13b3..58a99ca67 100644 --- a/httemplate/misc/delete-cust_pkg_discount.html +++ b/httemplate/misc/delete-cust_pkg_discount.html @@ -13,7 +13,7 @@ my $curuser = $FS::CurrentUser::CurrentUser; #XXX ACL to remove discounts #die "access denied" -# unless $curuser->access_right('Delete invoices'); +# unless $curuser->access_right('Delete discounts'); #untaint pkgdiscountnum my($query) = $cgi->keywords; diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index f1bcf4d52..2ff3ca883 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -9,30 +9,13 @@ function areyousure(href, message) { } -% if ( !$cust_bill->closed ) { # otherwise allow no changes -% my $can_delete = $conf->exists('deleteinvoices') -% && $curuser->access_right('Delete invoices'); -% my $can_void = $curuser->access_right('Void invoices'); -% if ( $can_void ) { +% if ( !$cust_bill->closed && $curuser->access_right('Void invoices') ) { <& /elements/popup_link.html, 'label' => emt('Void this invoice'), 'actionlabel' => emt('Void this invoice'), 'action' => $p.'misc/void-cust_bill.html?invnum='.$invnum, &> -% } -% if ( $can_void and $can_delete ) { -  |  -% } -% if ( $can_delete ) { - \ - <% emt('Delete this invoice') |h %> -% } -% if ( $can_void or $can_delete ) { -

-% } +

% } % if ( $cust_bill->owed > 0 diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 458469cb1..e3599bc06 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -217,7 +217,7 @@ my %opt = ( qw( card_refund-days date_format ) ), ( map { $_ => $conf->exists($_) } - qw( deleteinvoices deletepayments deleterefunds pkg-balances + qw( deletepayments deleterefunds pkg-balances cust_credit_bill_pkg-manual cust_bill_pay_pkg-manual ) ), @@ -226,7 +226,7 @@ my %opt = ( #rights ( map { $_ => $curuser->access_right($_) } ( - 'View invoices', 'Void invoices', 'Unvoid invoices', 'Delete invoices', + 'View invoices', 'Void invoices', 'Unvoid invoices', 'Apply payment', 'Refund credit card payment', 'Refund Echeck payment', 'Credit card void', 'Echeck void', 'Void payments', 'Unvoid payments', 'Delete payment', 'Unapply payment', diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html index acb1d6956..be4e93e31 100644 --- a/httemplate/view/cust_main/payment_history/invoice.html +++ b/httemplate/view/cust_main/payment_history/invoice.html @@ -1,4 +1,4 @@ -<% $link %><% $invoice %><% $link ? '' : '' %><% "$void$delete$under" %> +<% $link %><% $invoice %><% $link ? '' : '' %><% "$void$under" %> <%init> my( $cust_bill, %opt ) = @_; @@ -34,14 +34,6 @@ if ( $cust_bill->closed !~ /^Y/i && $opt{'Void invoices'} ) { ')'; } -my $delete = ''; -$delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum", - emt('Are you sure you want to delete this invoice?'), - emt('Delete this invoice from the database completely'), - emt('delete') - ) - if ( $opt{'deleteinvoices'} && $opt{'Delete invoices'} ); - my $events = ''; if ( $cust_bill->num_cust_event && ($opt{'Billing event reports'} || $opt{'View customer billing events'}) diff --git a/httemplate/view/cust_main/payment_history/voided_invoice.html b/httemplate/view/cust_main/payment_history/voided_invoice.html index 3d81e662f..ea61f8446 100644 --- a/httemplate/view/cust_main/payment_history/voided_invoice.html +++ b/httemplate/view/cust_main/payment_history/voided_invoice.html @@ -10,7 +10,7 @@ % } <% mt("on [_1]", time2str($date_format, $cust_bill_void->void_date) ) |h %> -<% "$unvoid$delete$under" %> +<% "$unvoid$under" %> <%init> my( $cust_bill_void, %opt ) = @_; @@ -35,14 +35,6 @@ $unvoid = areyousure_link("${p}misc/unvoid-cust_bill_void.html?invnum=". $cust_b ) if $cust_bill_void->closed !~ /^Y/ && $opt{'Unvoid invoices'}; -my $delete = ''; -$delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum", - emt('Are you sure you want to delete this invoice?'), - emt('Delete this invoice from the database completely'), - emt('delete') - ) - if $opt{'deleteinvoices'} && $opt{'Delete invoices'}; - my $events = ''; if ( $cust_bill_void->num_cust_event && ($opt{'Billing event reports'} || $opt{'View customer billing events'}) -- 2.20.1