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 / +39 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 51-56 Link Here
51
52
52
	[% ELSE %]
53
	[% ELSE %]
53
	    [% IF ( success ) %]
54
	    [% IF ( success ) %]
55
            [% IF from_biblio.items.count == 0 %]
56
                <div class="dialog alert">
57
                    The record <em>[% from_biblio.title | html %]</em> has [% from_biblio.items.count | html %] attached items.
58
                    <p>
59
                        <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
60
                        </button>
61
                        <span id="del-bib-success" style="display:none">Record deleted</span>
62
                        <span id="del-bib-failure" style="display:none">Attempt to delete record failed.</span>
63
                    </p>
64
                </div>
65
                <br/>
66
            [% END %]
67
54
            <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %]<i>[% bibliotitle | html %]</i></a>.
68
            <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %]<i>[% bibliotitle | html %]</i></a>.
55
			<p>
69
			<p>
56
			[% INCLUDE actions %]
70
			[% INCLUDE actions %]
Lines 62-67 Link Here
62
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
76
                                <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
63
                        </form>
77
                        </form>
64
	                </p>
78
	                </p>
79
65
			</div>
80
			</div>
66
    [% ELSE %]
81
    [% ELSE %]
67
	[% IF ( missingparameter ) %]
82
	[% IF ( missingparameter ) %]
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
            if ( confirm(_("Are you sure you want to delete this record?")) ) {
119
                let btn = $(this);
120
                $("#del-bib-spn").show();
121
                let biblionumber = $(this).data('biblionumber');
122
                $.ajax({
123
                    url: '/api/v1/biblios/' + biblionumber,
124
                    type: 'DELETE',
125
                    success: function(result) {
126
                        btn.hide();
127
                        $('#del-bib-success').show();
128
                    },
129
                    error: function(result) {
130
                        btn.hide();
131
                        $('#del-bib-failure').show();
132
                    }
133
                });
134
            }
135
        });
136
    </script>
137
[% END %]
138
100
[% INCLUDE 'intranet-bottom.inc' %]
139
[% INCLUDE 'intranet-bottom.inc' %]
101
- 

Return to bug 15496