From f864029b019d308d52717d97b5a6cec662478cbd Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
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 <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
https://bugs.koha-community.org/show_bug.cgi?id=18584
---
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 0000000..ae95d2c
--- /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 0000000..ebeb6c7
--- /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 61d63c5..bb5086b 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 c14748d..bae859b 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 @@
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
- <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basket.booksellerid.id %]">[% basket.booksellerid.name | html %]</a> ›
- <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Basket [% basket.basketname | html %] ([% basket.basketno %]) for [% basket.booksellerid.name | html %]</a> ›
+ <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basket.bookseller.id %]">[% basket.bookseller.name | html %]</a> ›
+ <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Basket [% basket.basketname | html %] ([% basket.basketno %]) for [% basket.bookseller.name | html %]</a> ›
Cancel order
</div>
--
2.7.4