From 1d618ab747e4be84e8d8c96763c78c0525151d1a Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Thu, 13 Jun 2024 00:14:57 +0000 Subject: [PATCH] Bug 27063: [WIP] Link different record to order from existing records So far this works for * from an existing record * from a suggestion * from a new (empty) record --- acqui/neworderempty.pl | 22 +++++++++++++++++++ acqui/newordersuggestion.pl | 16 ++++++++------ .../prog/en/modules/acqui/basket.tt | 2 +- .../en/modules/acqui/newordersuggestion.tt | 12 ++++++++-- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 95c31d9aa85..f4b1566491c 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -146,6 +146,28 @@ $booksellerid = $basket->{booksellerid} unless $booksellerid; my $bookseller = Koha::Acquisition::Booksellers->find($booksellerid); $data = GetOrder($ordernumber) if $ordernumber; +my $newdata; + +# re-linking order to a different record +if ( $biblionumber and $biblionumber != $data->{biblionumber} ) { + $newdata = GetBiblioData($biblionumber); +} elsif ( $suggestionid and $ordernumber ) { + $newdata = GetSuggestion($suggestionid); +} elsif ( $ordernumber and $input->param('relink') ) { + $newdata = {}; +} +if ($newdata) { + $data->{biblionumber} = $biblionumber; + $data->{title} = $newdata->{title} || ""; + $data->{author} = $newdata->{author} || ""; + $data->{publishercode} = $newdata->{publishercode} || ""; + $data->{editionstatement} = $newdata->{editionstatement} || ""; + $data->{publicationyear} = $newdata->{publicationyear} || ""; + $data->{isbn} = $newdata->{isbn} || ""; + $data->{seriestitle} = $newdata->{seriestitle} || ""; + $data->{copyrightdate} = $newdata->{copyrightdate} || ""; +} + output_and_exit( $input, $cookie, $template, 'unknown_basket') unless $basketobj; output_and_exit( $input, $cookie, $template, 'unknown_vendor') unless $bookseller; diff --git a/acqui/newordersuggestion.pl b/acqui/newordersuggestion.pl index 9d35ec48def..964b88c0181 100755 --- a/acqui/newordersuggestion.pl +++ b/acqui/newordersuggestion.pl @@ -103,14 +103,15 @@ my $input = CGI->new; # getting the CGI params my $basketno = $input->param('basketno'); -my $booksellerid = $input->param('booksellerid'); +my $booksellerid = $input->param('booksellerid'); my $author = $input->param('author'); my $title = $input->param('title'); my $publishercode = $input->param('publishercode'); my $op = $input->param('op'); my $suggestionid = $input->param('suggestionid'); my $duplicateNumber = $input->param('duplicateNumber'); -my $uncertainprice = $input->param('uncertainprice'); +my $uncertainprice = $input->param('uncertainprice'); +my $ordernumber = $input->param('ordernumber') || undef; $op = 'else' unless $op; @@ -140,11 +141,12 @@ my $suggestions = [ Koha::Suggestions->search_limited( my $vendor = Koha::Acquisition::Booksellers->find( $booksellerid ); $template->param( - suggestions => $suggestions, - basketno => $basketno, - booksellerid => $booksellerid, - name => $vendor->name, - "op_$op" => 1, + suggestions => $suggestions, + basketno => $basketno, + booksellerid => $booksellerid, + name => $vendor->name, + "op_$op" => 1, + ordernumber => $ordernumber, ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index f10b7a0d1de..046135b7902 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -910,7 +910,7 @@
  • From a suggestion
  • From a subscription
  • -
  • From a new (empty) record
  • +
  • From a new (empty) record
  • From existing orders (copy)
  • From an external source
  • [% IF ( CAN_user_tools_stage_marc_import ) %]
  • From a new file
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt index 0a0b968b57a..1d1b37e0399 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/newordersuggestion.tt @@ -101,9 +101,17 @@ [% IF ( suggestion.biblionumber ) %] - [% tp('verb', 'Order') | html %] + [% IF ordernumber %] + [% tp('verb', 'Order') | html %] + [% ELSE %] + [% tp('verb', 'Order') | html %] + [% END %] [% ELSE %] - [% tp('verb', 'Order') | html %] + [% IF ordernumber %] + [% tp('verb', 'Order') | html %] + [% ELSE %] + [% tp('verb', 'Order') | html %] + [% END %] [% END %] -- 2.39.2