From 3bdee4a05f782376e7851e1025c9909426f78c57 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 27 Jul 2017 01:54:35 +0000 Subject: [PATCH] Bug 13208: [FOLLOW-UP] Creating and implementing new Koha::Acquisition::Basket[s] modules Test plan remains the same. Sponsored-by: Catalyst IT Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: David Bourgault Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- Koha/Acquisition/Basket.pm | 19 +++++++++++++++++++ Koha/Acquisition/Baskets.pm | 18 ++++++++++++++++++ acqui/cancelorder.pl | 3 ++- .../prog/en/modules/acqui/cancelorder.tt | 4 ++-- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 Koha/Acquisition/Basket.pm create mode 100644 Koha/Acquisition/Baskets.pm diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm new file mode 100644 index 0000000000..ae95d2c26b --- /dev/null +++ b/Koha/Acquisition/Basket.pm @@ -0,0 +1,19 @@ +package Koha::Acquisition::Basket; + +use Modern::Perl; + +use Koha::Database; + +use base qw( Koha::Object ); + +sub bookseller { + my ($self) = @_; + my $bookseller_rs = $self->_result->booksellerid; + return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs ); +} + +sub _type { + return 'Aqbasket'; +} + +1; diff --git a/Koha/Acquisition/Baskets.pm b/Koha/Acquisition/Baskets.pm new file mode 100644 index 0000000000..ebeb6c773a --- /dev/null +++ b/Koha/Acquisition/Baskets.pm @@ -0,0 +1,18 @@ +package Koha::Acquisition::Baskets; + +use Modern::Perl; + +use Koha::Database; +use Koha::Acquisition::Basket; + +use base qw( Koha::Objects ); + +sub _type { + return 'Aqbasket'; +} + +sub object_class { + return 'Koha::Acquisition::Basket'; +} + +1; diff --git a/acqui/cancelorder.pl b/acqui/cancelorder.pl index 61d63c54b6..bb5086bb4d 100755 --- a/acqui/cancelorder.pl +++ b/acqui/cancelorder.pl @@ -35,6 +35,7 @@ use CGI; use C4::Auth; use C4::Output; use C4::Acquisition; +use Koha::Acquisition::Baskets; my $input = new CGI; my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { @@ -50,7 +51,7 @@ my $action = $input->param('action'); my $ordernumber = $input->param('ordernumber'); my $biblionumber = $input->param('biblionumber'); my $basketno = $input->param('basketno'); -my $basket = Koha::Database->new()->schema()->resultset('Aqbasket')->find($basketno); +my $basket = Koha::Acquisition::Baskets->find({ basketno => $basketno }, { prefetch => 'booksellerid' }); my $referrer = $input->param('referrer') || $input->referer; my $del_biblio = $input->param('del_biblio') ? 1 : 0; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt index c14748d98e..bae859b877 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt @@ -9,8 +9,8 @@ -- 2.39.5