View | Details | Raw Unified | Return to bug 15496
Collapse All | Expand All

(-)a/Koha/Biblio.pm (-6 / +3 lines)
Lines 351-370 sub article_requests_finished { Link Here
351
351
352
=head3 items
352
=head3 items
353
353
354
my @items = $biblio->items();
355
my $items = $biblio->items();
354
my $items = $biblio->items();
356
355
357
Returns the related Koha::Items object for this biblio in scalar context,
356
Returns the related Koha::Items object for this biblio
358
or list of Koha::Item objects in list context.
359
357
360
=cut
358
=cut
361
359
362
sub items {
360
sub items {
363
    my ($self) = @_;
361
    my ($self) = @_;
364
362
365
    $self->{_items} ||= Koha::Items->search( { biblionumber => $self->biblionumber() } );
363
    my $items_rs = $self->_result->items;
366
364
    return Koha::Items->_new_from_dbic( $items_rs );
367
    return wantarray ? $self->{_items}->as_list : $self->{_items};
368
}
365
}
369
366
370
=head3 itemtype
367
=head3 itemtype
(-)a/cataloguing/moveitem.pl (-1 / +4 lines)
Lines 77-83 if ( $barcode && $biblionumber ) { Link Here
77
77
78
        my $moveresult = MoveItemFromBiblio( $itemnumber, $frombiblionumber, $biblionumber );
78
        my $moveresult = MoveItemFromBiblio( $itemnumber, $frombiblionumber, $biblionumber );
79
        if ($moveresult) {
79
        if ($moveresult) {
80
            $template->param( success => 1 );
80
            $template->param(
81
                success => 1,
82
                from_biblio => scalar Koha::Biblios->find($frombiblionumber),
83
            );
81
        }
84
        }
82
        else {
85
        else {
83
            $template->param(
86
            $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt (-1 / +37 lines)
Lines 1-3 Link Here
1
[% SET footerjs = 1 %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Cataloging &rsaquo; Attach an item to [% bibliotitle | html %]</title>
3
<title>Koha &rsaquo; Cataloging &rsaquo; Attach an item to [% bibliotitle | html %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 62-68 Link Here
62
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
63
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
63
                        </form>
64
                        </form>
64
	                </p>
65
	                </p>
66
65
			</div>
67
			</div>
68
69
            <br/>
70
            [% IF from_biblio.items.count == 0 %]
71
                <div class="dialog message">
72
                    The record <em>[% from_biblio.title | html %]</em> has [% from_biblio.items.count | html %] attached items.
73
                    <p>
74
                        <button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record
75
                        </button>
76
                        <span id="del-bib-success" style="display:none">Record deleted</span>
77
                        <span id="del-bib-failure" style="display:none">Attempt to delete record failed.</span>
78
                    </p>
79
                </div>
80
            [% END %]
66
    [% ELSE %]
81
    [% ELSE %]
67
	[% IF ( missingparameter ) %]
82
	[% IF ( missingparameter ) %]
68
	<form method="post" action="/cgi-bin/koha/cataloguing/moveitem.pl">
83
	<form method="post" action="/cgi-bin/koha/cataloguing/moveitem.pl">
Lines 97-100 Link Here
97
    </div>
112
    </div>
98
</div>
113
</div>
99
114
115
[% MACRO jsinclude BLOCK %]
116
    <script type="text/javascript">
117
        $("#delete-biblio-btn").on("click", function(){
118
            let btn = $(this);
119
            $("#del-bib-spn").show();
120
            let biblionumber = $(this).data('biblionumber');
121
            $.ajax({
122
                url: '/api/v1/biblios/' + biblionumber,
123
                type: 'DELETE',
124
                success: function(result) {
125
                    btn.hide();
126
                    $('#del-bib-success').show();
127
                },
128
                error: function(result) {
129
                    btn.hide();
130
                    $('#del-bib-failure').show();
131
                }
132
            });
133
        });
134
    </script>
135
[% END %]
136
100
[% INCLUDE 'intranet-bottom.inc' %]
137
[% INCLUDE 'intranet-bottom.inc' %]
101
- 

Return to bug 15496