Bug 13208: [FOLLOW-UP] Creating and implementing new Koha::Acquisition::Basket[s...
authorAleisha Amohia <aleishaamohia@hotmail.com>
Thu, 27 Jul 2017 01:54:35 +0000 (01:54 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 9 Oct 2017 17:00:58 +0000 (14:00 -0300)
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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Acquisition/Basket.pm [new file with mode: 0644]
Koha/Acquisition/Baskets.pm [new file with mode: 0644]
acqui/cancelorder.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt

diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm
new file mode 100644 (file)
index 0000000..ae95d2c
--- /dev/null
@@ -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 (file)
index 0000000..ebeb6c7
--- /dev/null
@@ -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;
index 61d63c5..bb5086b 100755 (executable)
@@ -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;
 
index c14748d..bae859b 100644 (file)
@@ -9,8 +9,8 @@
 <div id="breadcrumbs">
     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
     <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
-    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basket.booksellerid.id %]">[% basket.booksellerid.name | html %]</a> &rsaquo;
-    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Basket [% basket.basketname | html %] ([% basket.basketno %]) for [% basket.booksellerid.name | html %]</a> &rsaquo;
+    <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% basket.bookseller.id %]">[% basket.bookseller.name | html %]</a> &rsaquo;
+    <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">Basket [% basket.basketname | html %] ([% basket.basketno %]) for [% basket.bookseller.name | html %]</a> &rsaquo;
     Cancel order
 </div>