Bugzilla – Attachment 49374 Details for
Bug 15962
Currency deletion doesn't correctly identify currencies in use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 15962: Block the currency deletion if used
PASSED-QA-Bug-15962-Block-the-currency-deletion-if.patch (text/plain), 3.44 KB, created by
Katrin Fischer
on 2016-03-21 06:31:34 UTC
(
hide
)
Description:
[PASSED QA] Bug 15962: Block the currency deletion if used
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-03-21 06:31:34 UTC
Size:
3.44 KB
patch
obsolete
>From eb0fc3a35100a6a951bb07b14d20a8cc53bded96 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Mar 2016 10:46:46 +0000 >Subject: [PATCH] [PASSED QA] Bug 15962: Block the currency deletion if used > >A currency should not be deleted if used by a vendor or a basket. > >Test plan: >1/ Add a new currency >2/ Create a vendor using this currency >3/ Create a basket using this currency >4/ Try to delete the currency >5/ Delete the basket >6/ Try to delete the currency >7/ Delete the vendor >8/ Delete the currency > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Acquisition/Bookseller.pm | 2 -- > admin/currency.pl | 3 +++ > koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt | 11 +++++++++-- > 3 files changed, 12 insertions(+), 4 deletions(-) > >diff --git a/Koha/Acquisition/Bookseller.pm b/Koha/Acquisition/Bookseller.pm >index 79b1510..57a6113 100644 >--- a/Koha/Acquisition/Bookseller.pm >+++ b/Koha/Acquisition/Bookseller.pm >@@ -31,8 +31,6 @@ sub fetch { > sub search { > my ( $class, $params ) = @_; > >- croak "Cannot search on other fields than aqbooksellers.name" if $params and grep { $_ !~ /^name$/ } keys %$params; >- > my $schema = Koha::Database->new->schema; > > my $search_params; >diff --git a/admin/currency.pl b/admin/currency.pl >index 4d791db..5258a2f 100755 >--- a/admin/currency.pl >+++ b/admin/currency.pl >@@ -25,6 +25,7 @@ use C4::Auth; > use C4::Context; > use C4::Output; > >+use Koha::Acquisition::Bookseller; > use Koha::Acquisition::Currency; > use Koha::Acquisition::Currencies; > >@@ -94,9 +95,11 @@ if ( $op eq 'add_form' ) { > # TODO rewrite the following when Koha::Acquisition::Orders will use Koha::Objects > my $schema = Koha::Database->schema; > my $nb_of_orders = $schema->resultset('Aqorder')->search( { currency => $currency->currency } )->count; >+ my $nb_of_vendors = Koha::Acquisition::Bookseller->search( { -or => { listprice => $currency->currency, invoiceprice => $currency->currency } }); > $template->param( > currency => $currency, > nb_of_orders => $nb_of_orders, >+ nb_of_vendors => $nb_of_vendors, > ); > } elsif ( $op eq 'delete_confirmed' ) { > my $currency = Koha::Acquisition::Currencies->find($currency_code); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >index ea438f2..e25f64a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -147,10 +147,17 @@ > [% END %] > > [% IF op =='delete_confirm' %] >- [% IF nb_of_orders %] >+ [% IF nb_of_orders or nb_of_vendors %] > <div class="dialog alert"> > <h3>Cannot delete currency <span class="ex">'[% currency.currency %]'</span></h3> >- <p>This currency is used by [% nb_of_orders %] orders. Deletion not possible</p> >+ <p> >+ [% IF nb_of_orders %] >+ This currency is used by [% nb_of_orders %] orders. >+ [% ELSIF nb_of_vendors %] >+ This currency is used by [% nb_of_vendors %] vendors. >+ [% END %] >+ Deletion not possible >+ </p> > <form action="/cgi-bin/koha/admin/currency.pl" method="post"> > <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button> > </form> >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15962
:
48773
|
48774
|
49047
|
49048
|
49374
|
49375
|
49376
|
50232