Bug 34478: Add 'op' to cataloguing/moveitem

Bug 34478: [TO SQUASH] Add 'op' to cataloguing/moveitem

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2024-02-08 10:57:15 +01:00
parent ddbb1a4055
commit 6c8fc9ffc9
Signed by: jonathan.druart
GPG key ID: A085E712BEF0E0F0
2 changed files with 34 additions and 55 deletions

View file

@ -31,13 +31,6 @@ use Koha::Items;
my $query = CGI->new;
# The biblio to move the item to
my $biblionumber = $query->param('biblionumber');
# The barcode of the item to move
my $barcode = barcodedecode($query->param('barcode'));
my ($template, $loggedinuser, $cookie) = get_template_and_user(
{
template_name => "cataloguing/moveitem.tt",
@ -47,12 +40,18 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user(
}
);
my $op = $query->param('op') || q{};
# The biblio to move the item to
my $biblionumber = $query->param('biblionumber');
# The barcode of the item to move
my $barcode = barcodedecode($query->param('barcode'));
my $biblio = Koha::Biblios->find( $biblionumber );
$template->param(biblio => $biblio);
$template->param(biblionumber => $biblionumber);
# If we already have the barcode of the item to move and the biblionumber to move the item to
if ( $barcode && $biblionumber ) {
if ( $op eq 'cud-moveitem' && $barcode && $biblionumber ) {
my $itemnumber;
my $item = Koha::Items->find( { barcode => $barcode } );

View file

@ -28,49 +28,35 @@
[% END #/ WRAPPER breadcrumbs %]
[% END #/ WRAPPER sub-header.inc %]
[% SWITCH Koha.Preference('IntranetBiblioDefaultView') %]
[% CASE 'marc' %] [% action_link = "/cgi-bin/koha/catalogue/MARCdetail.pl" %]
[% CASE 'labeled_marc' %] [% action_link = "/cgi-bin/koha/catalogue/labeledMARCdetail.pl" %]
[% CASE 'isbd' %] [% action_link = "/cgi-bin/koha/catalogue/ISBDdetail.pl" %]
[% CASE %] [% action_link = "/cgi-bin/koha/catalogue/detail.pl" %]
[% END %]
[% action_link = action_link _ '?biblionumber=' _ biblio.biblionumber %]
<div class="main container-fluid">
<div class="row">
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
[% INCLUDE 'messages.inc' %]
<h1>Attach an item [% IF ( biblio.title ) %] to [% INCLUDE 'biblio-title.inc' %][% END %]</h1>
[% BLOCK actions %]
[% IF Koha.Preference('IntranetBiblioDefaultView') == 'marc' %]
<form action="/cgi-bin/koha/catalogue/MARCdetail.pl" method="post">
[% ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'labeled_marc' %]
<form action="/cgi-bin/koha/catalogue/labeledMARCdetail.pl" method="post">
[% ELSIF Koha.Preference('IntranetBiblioDefaultView') == 'isbd' %]
<form action="/cgi-bin/koha/catalogue/ISBDdetail.pl" method="post">
[% ELSE %]
<form action="/cgi-bin/koha/catalogue/detail.pl" method="post">
[% INCLUDE 'csrf-token.inc' %]
[% END %]
[% END %]
[% BLOCK fail %]
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
</form>
<form method="get" action="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber | html %]">
<button type="submit" class="new"><i class="fa fa-fw fa-plus"></i> Try again with a different barcode</button>
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
</form>
[% END %]
[% IF ( error ) %]
<div class="dialog alert">
[% IF ( errornonewitem ) %]ERROR: Unable to create the new item.<p>
[% INCLUDE actions %]
[% INCLUDE fail %]
</p>
[% END %]
[% IF ( errornoitem ) %]ERROR: Unable to get the item.<p>
[% INCLUDE actions %]
[% INCLUDE fail %]
</p>
[% IF errornonewitem %]
<span>ERROR: Unable to create the new item.</span>
[% ELSIF errornoitem %]
<span>ERROR: Unable to get the item.</span>
[% END %]
<p>
<a href="[% action_link | $raw %]" class="btn btn-primary approve"><i class="fa fa-fw fa-check"></i> OK</a>
<a href="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblio.biblionumber | uri %]" class="btn btn-default new"><i class="fa fa-fw fa-plus"></i> Try again with a different barcode</a>
</p>
</div>
[% ELSE %]
@ -89,19 +75,13 @@
</div>
[% END %]
<div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-title.inc' link = 1 %].
<p>
[% INCLUDE actions %]
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
</form>
<form method="get" action="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber | html %]"/>
<button type="submit" class="new"><i class="fa fa-fw fa-plus"></i> Attach another item</button>
<input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
</form>
</p>
</div>
<div class="dialog message">
The item has successfully been attached to [% INCLUDE 'biblio-title.inc' link = 1 %].
<p>
<a href="[% action_link | $raw %]" class="btn btn-primary approve"><i class="fa fa-fw fa-check"></i> OK</a>
<a href="/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblio.biblionumber | uri %]" class="btn btn-default new"><i class="fa fa-fw fa-plus"></i> Attach another item</a>
</p>
</div>
[% ELSE %]
[% IF ( missingparameter ) %]
<form method="post" action="/cgi-bin/koha/cataloguing/moveitem.pl">
@ -116,7 +96,7 @@
<input type="submit" class="btn btn-primary" value="Submit" />
</fieldset>
[% ELSE %]
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblionumber | html %]" />
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
[% END %]
[% IF ( missingbarcode ) %]
@ -131,7 +111,7 @@
[% ELSE %]
<input type="hidden" name="barcode" id="barcode" value="[% barcode | html %]" />
[% END %]
<input type="hidden" name="op" value="cud-moveitem" />
</form>
[% END %]
[% END %]