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

(-)a/C4/Biblio.pm (-1 lines)
Lines 2831-2837 sub EmbedItemsInMarcBiblio { Link Here
2831
    $itemnumbers = [] unless defined $itemnumbers;
2831
    $itemnumbers = [] unless defined $itemnumbers;
2832
2832
2833
    if ( !$skip_holdings && C4::Context->preference('SummaryHoldings') && !@$itemnumbers ) {
2833
    if ( !$skip_holdings && C4::Context->preference('SummaryHoldings') && !@$itemnumbers ) {
2834
        require Koha::Holdings;
2835
        my $holdings_fields = Koha::Holdings->get_embeddable_marc_fields({ biblionumber => $biblionumber });
2834
        my $holdings_fields = Koha::Holdings->get_embeddable_marc_fields({ biblionumber => $biblionumber });
2836
        $marc->append_fields(@$holdings_fields) if ( @$holdings_fields );
2835
        $marc->append_fields(@$holdings_fields) if ( @$holdings_fields );
2837
    }
2836
    }
(-)a/C4/Items.pm (-1 / +1 lines)
Lines 1694-1700 sub MoveItemFromBiblio { Link Here
1694
    |, undef, $tobiblioitem, $tobiblio, $itemnumber, $frombiblio );
1694
    |, undef, $tobiblioitem, $tobiblio, $itemnumber, $frombiblio );
1695
    if ($return == 1) {
1695
    if ($return == 1) {
1696
        # Check if the moved item is attached to a holdings record
1696
        # Check if the moved item is attached to a holdings record
1697
        my $item = my $item = Koha::Items->find($itemnumber);
1697
        my $item = Koha::Items->find($itemnumber);
1698
        if ($item->holding_id()) {
1698
        if ($item->holding_id()) {
1699
            my $oldHolding = Koha::Holdings->find($item->holding_id());
1699
            my $oldHolding = Koha::Holdings->find($item->holding_id());
1700
            if ($oldHolding) {
1700
            if ($oldHolding) {
(-)a/C4/Search.pm (-1 / +1 lines)
Lines 2259-2265 sub searchResults { Link Here
2259
2259
2260
        # Fetch summary holdings
2260
        # Fetch summary holdings
2261
        if (C4::Context->preference('SummaryHoldings')) {
2261
        if (C4::Context->preference('SummaryHoldings')) {
2262
            $summary_holdings = Koha::Holdings->search({ biblionumber => $oldbiblio->{biblionumber}, deleted_on => undef })->unblessed;
2262
            $summary_holdings = Koha::Holdings->search({ biblionumber => $oldbiblio->{biblionumber}, deleted_on => undef });
2263
        }
2263
        }
2264
2264
2265
        # XSLT processing of some stuff
2265
        # XSLT processing of some stuff
(-)a/Koha/Holding.pm (-6 / +33 lines)
Lines 28-33 use C4::Log; Link Here
28
use Koha::Database;
28
use Koha::Database;
29
use Koha::DateUtils qw(dt_from_string);
29
use Koha::DateUtils qw(dt_from_string);
30
use Koha::Holdings::Metadatas;
30
use Koha::Holdings::Metadatas;
31
use Koha::Items;
31
32
32
use base qw(Koha::Object);
33
use base qw(Koha::Object);
33
34
Lines 41-46 Koha::Holding - Koha Holding Object class Link Here
41
42
42
=cut
43
=cut
43
44
45
=head3 holding_branch
46
47
my $branch = $hold->holding_branch();
48
49
Returns the holding branch for this record.
50
51
=cut
52
53
sub holding_branch {
54
    my ($self) = @_;
55
56
    my $branch = $self->_result->holdingbranch();
57
    return Koha::Library->_new_from_dbic($branch);
58
}
59
44
=head3 metadata
60
=head3 metadata
45
61
46
my $metadata = $holding->metadata();
62
my $metadata = $holding->metadata();
Lines 52-60 Returns a Koha::Holding::Metadata object Link Here
52
sub metadata {
68
sub metadata {
53
    my ($self) = @_;
69
    my ($self) = @_;
54
70
55
    $self->{_metadata} ||= Koha::Holdings::Metadatas->find({ holding_id => $self->id });
71
    my $metadata = $self->_result()->metadata();
56
72
    return unless $metadata;
57
    return $self->{_metadata};
73
    return Koha::Holdings::Metadata->_new_from_dbic($metadata);
58
}
74
}
59
75
60
=head3 set_marc
76
=head3 set_marc
Lines 92-98 sub set_marc { Link Here
92
    $self->{_marcxml} = $record->as_xml_record($encoding);
108
    $self->{_marcxml} = $record->as_xml_record($encoding);
93
    my $fields = $self->marc_to_koha_fields({ record => $record });
109
    my $fields = $self->marc_to_koha_fields({ record => $record });
94
    delete $fields->{holding_id};
110
    delete $fields->{holding_id};
95
    $self->set($fields);
111
    # Filter the columns since we have e.g. public_note that's not stored in the database
112
    my $columns = [$self->_result()->result_source()->columns()];
113
    my $db_fields = {};
114
    foreach my $key (keys %{$fields}) {
115
        if (grep {/^$key$/} @{$columns}) {
116
            $db_fields->{$key} = $fields->{$key};
117
        }
118
    }
119
    $self->set($db_fields);
96
120
97
    return $self;
121
    return $self;
98
}
122
}
Lines 110-118 or list of Koha::Item objects in list context. Link Here
110
sub items {
134
sub items {
111
    my ($self) = @_;
135
    my ($self) = @_;
112
136
113
    $self->{_items} ||= Koha::Items->search( { holding_id => $self->holding_id() } );
137
    my $items_rs = $self->_result->items;
114
138
115
    return wantarray ? $self->{_items}->as_list : $self->{_items};
139
    return
140
        wantarray
141
        ? Koha::Items->_new_from_dbic($items_rs)->as_list
142
        : Koha::Items->_new_from_dbic($items_rs);
116
}
143
}
117
144
118
=head3 store
145
=head3 store
(-)a/Koha/Template/Plugin/Holdings.pm (-22 / +20 lines)
Lines 56-63 sub GetLocation { Link Here
56
        return '';
56
        return '';
57
    }
57
    }
58
58
59
    if (ref($holding) ne 'HASH') {
59
    if (ref($holding) ne 'Koha::Holding') {
60
        $holding = Koha::Holdings->find($holding)->unblessed;
60
        $holding = Koha::Holdings->find($holding);
61
        if (!$holding) {
61
        if (!$holding) {
62
            return '';
62
            return '';
63
        }
63
        }
Lines 66-92 sub GetLocation { Link Here
66
    my @parts;
66
    my @parts;
67
67
68
    if ($opac) {
68
    if ($opac) {
69
        if ($holding->{'holdingbranch'}) {
69
        if (my $branch = $holding->holding_branch()) {
70
            my $query = "SELECT branchname FROM branches WHERE branchcode = ?";
70
            push @parts, $branch->branchname();
71
            my $sth = C4::Context->dbh->prepare($query);
72
            $sth->execute($holding->{'holdingbranch'});
73
            my $b = $sth->fetchrow_hashref();
74
            push @parts, $b->{'branchname'} if $b;
75
            $sth->finish();
76
        }
71
        }
77
        if ($holding->{'location'}) {
72
        if ($holding->location()) {
78
            my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $holding->{'location'} });
73
            my $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $holding->location() });
79
            push @parts, $av->next->opac_description if $av->count;
74
            push @parts, $av->next()->opac_description() if $av->count;
80
        }
75
        }
81
        push @parts, $holding->{'callnumber'} if $holding->{'callnumber'};
76
        push @parts, $holding->callnumber() if $holding->callnumber();
82
        return join(' - ', @parts);
77
        return join(' - ', @parts);
83
    }
78
    }
84
79
85
    push @parts, $holding->{'holding_id'};
80
    push @parts, $holding->holding_id();
86
    push @parts, $holding->{'holdingbranch'} if $holding->{'holdingbranch'};
81
    push @parts, $holding->holdingbranch() if $holding->holdingbranch();
87
    push @parts, $holding->{'location'} if $holding->{'location'};
82
    push @parts, $holding->location() if $holding->location();
88
    push @parts, $holding->{'ccode'} if $holding->{'ccode'};
83
    push @parts, $holding->ccode() if $holding->ccode();
89
    push @parts, $holding->{'callnumber'} if $holding->{'callnumber'};
84
    push @parts, $holding->callnumber() if $holding->callnumber();
90
    return join(' ', @parts);
85
    return join(' ', @parts);
91
}
86
}
92
87
Lines 106-118 sub GetDetails { Link Here
106
        return '';
101
        return '';
107
    }
102
    }
108
103
109
    if (ref($holding) eq 'HASH') {
104
    if (ref($holding) ne 'Koha::Holding') {
110
        $holding = $holding->{'holding_id'};
105
        $holding = Koha::Holdings->find($holding);
106
        if (!$holding) {
107
            return '';
108
        }
111
    }
109
    }
112
110
113
    my $holding_marc = Koha::Holdings->find($holding)->metadata()->record();
111
    my $holding_marc = $holding->metadata()->record();
114
112
115
    return Koha::Holding::marc_to_koha_fields({ record => $holding_marc });
113
    return Koha::Holding->marc_to_koha_fields({ record => $holding_marc });
116
}
114
}
117
115
118
1;
116
1;
(-)a/catalogue/detail.pl (-1 / +1 lines)
Lines 195-201 foreach my $subscription (@subscriptions) { Link Here
195
# Summary holdings
195
# Summary holdings
196
my $summary_holdings;
196
my $summary_holdings;
197
if (C4::Context->preference('SummaryHoldings')) {
197
if (C4::Context->preference('SummaryHoldings')) {
198
    $summary_holdings = Koha::Holdings->search({ biblionumber => $biblionumber, deleted_on => undef })->unblessed;
198
    $summary_holdings = Koha::Holdings->search({ biblionumber => $biblionumber, deleted_on => undef });
199
}
199
}
200
200
201
# Get acquisition details
201
# Get acquisition details
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc (-1 / +1 lines)
Lines 11-17 CAN_user_serials_create_subscription ) %] Link Here
11
            [% END %]
11
            [% END %]
12
12
13
            [% IF ( show_summary_holdings && CAN_user_editcatalogue_edit_items ) %]
13
            [% IF ( show_summary_holdings && CAN_user_editcatalogue_edit_items ) %]
14
            <li><a id="newholding" href="/cgi-bin/koha/cataloguing/addholding.pl?biblionumber=[% biblionumber %]#addholding">New holdings record</a></li>
14
            <li><a id="newholding" href="/cgi-bin/koha/cataloguing/addholding.pl?biblionumber=[% biblionumber | uri %]#addholding">New holdings record</a></li>
15
            [% END %]
15
            [% END %]
16
16
17
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
17
            [% IF ( CAN_user_editcatalogue_edit_items ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-5 / +5 lines)
Lines 145-151 Link Here
145
145
146
<ul>
146
<ul>
147
    [% IF (show_summary_holdings) %]
147
    [% IF (show_summary_holdings) %]
148
        <li><a href="#summaryholdings">Holdings ([% summary_holdings.size() || 0 | html %])</a></li>
148
        <li><a href="#summaryholdings">Holdings ([% summary_holdings.count() || 0 | html %])</a></li>
149
    [% END %]
149
    [% END %]
150
    [% IF (SeparateHoldings) %]
150
    [% IF (SeparateHoldings) %]
151
        <li>
151
        <li>
Lines 197-203 Link Here
197
                [% FOREACH holding IN summary_holdings %]
197
                [% FOREACH holding IN summary_holdings %]
198
                    <tr>
198
                    <tr>
199
                        <td class="branch">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( holding.holdingbranch ) | html %] [% END %]</td>
199
                        <td class="branch">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( holding.holdingbranch ) | html %] [% END %]</td>
200
                        <td class="location"><span class="shelvingloc">[% holding.location | html %][% IF ( holding.sub_location ) %] ([% holding.sub_location | html %])[% END %]</span>
200
                        <td class="location"><span class="shelvingloc">[% holding.location | html %]</span>
201
                        <td class="collection">[% holding.ccode | html %]</span>
201
                        <td class="collection">[% holding.ccode | html %]</span>
202
                        <td class="itemcallnumber">[% IF ( holding.callnumber ) %] [% holding.callnumber | html %][% END %]</td>
202
                        <td class="itemcallnumber">[% IF ( holding.callnumber ) %] [% holding.callnumber | html %][% END %]</td>
203
                        <td class="status">
203
                        <td class="status">
Lines 207-215 Link Here
207
                        </td>
207
                        </td>
208
                    [% IF CAN_user_editcatalogue_edit_items %]
208
                    [% IF CAN_user_editcatalogue_edit_items %]
209
                        <td class="actions">
209
                        <td class="actions">
210
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/addholding.pl?op=edit&biblionumber=[% holding.biblionumber %]&holding_id=[% holding.holding_id %]#editholding"><i class="fa fa-pencil"></i> Edit</a>
210
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/addholding.pl?op=edit&biblionumber=[% holding.biblionumber | uri %]&holding_id=[% holding.holding_id | uri %]#editholding"><i class="fa fa-pencil"></i> Edit</a>
211
                            <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/cataloguing/addholding.pl?op=delete&biblionumber=[% holding.biblionumber %]&holding_id=[% holding.holding_id %]"><i class="fa fa-eraser"></i> Delete</a>
211
                            <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/cataloguing/addholding.pl?op=delete&biblionumber=[% holding.biblionumber | uri %]&holding_id=[% holding.holding_id | uri %]"><i class="fa fa-eraser"></i> Delete</a>
212
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% holding.biblionumber %]&holding_id=[% holding.holding_id %]#additema"><i class="fa fa-plus"></i> Add item</a>
212
                            <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% holding.biblionumber | uri %]&holding_id=[% holding.holding_id | uri %]#additema"><i class="fa fa-plus"></i> Add item</a>
213
                            <a class="btn btn-default btn-xs previewMARC" href="/cgi-bin/koha/catalogue/showmarc.pl?holding_id=[% holding.holding_id | uri %]&amp;viewas=html" title="MARC">Show MARC</a>
213
                            <a class="btn btn-default btn-xs previewMARC" href="/cgi-bin/koha/catalogue/showmarc.pl?holding_id=[% holding.holding_id | uri %]&amp;viewas=html" title="MARC">Show MARC</a>
214
                        </td>
214
                        </td>
215
                    [% END %]
215
                    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addholding.tt (-382 / +378 lines)
Lines 8-124 Link Here
8
 [% Asset.js("js/cataloging.js") | $raw %]
8
 [% Asset.js("js/cataloging.js") | $raw %]
9
[% INCLUDE 'browser-strings.inc' %]
9
[% INCLUDE 'browser-strings.inc' %]
10
[% Asset.js("js/browser.js") | $raw %]
10
[% Asset.js("js/browser.js") | $raw %]
11
<script type="text/javascript">
11
[% Asset.css("css/addholding.css") | $raw %]
12
//<![CDATA[
12
[% INCLUDE 'select2.inc' %]
13
    var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10));
13
[% IF ( bidi ) %]
14
    browser.show();
14
   [% Asset.css("css/right-to-left.css") | $raw %]
15
[% END %]
16
</head>
17
<body id="cat_addholding" class="cat">
15
18
16
    $(window).load(function() {
19
   <div id="loading">
17
        $("#loading").hide();
20
       <div>Loading, please wait...</div>
18
    });
21
   </div>
19
    var Sticky;
20
    $(document).ready(function() {
21
        $('#addholdingtabs').tabs().bind('show.ui-tabs', function(e, ui) {
22
            $("#"+ui.panel.id+" input:eq(0)").focus();
23
        });
24
22
25
        [% IF tab %]
23
[% INCLUDE 'header.inc' %]
26
            $('#addholdingtabs').selectTabByID("#[% tab | html %]");
27
        [% END %]
28
24
29
        Sticky = $("#toolbar");
25
<div id="breadcrumbs">
30
        Sticky.hcSticky({
26
          <a href="/cgi-bin/koha/mainpage.pl">Home</a>
31
            stickTo: ".main",
27
 &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
32
            stickyClass: "floating"
28
 &rsaquo; Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | uri %]">[% title | html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber | html %])</a>
33
        });
29
 &rsaquo; <a href="/cgi-bin/koha/cataloguing/addholding.pl?biblionumber=[% biblionumber | uri %]">Holdings</a>
30
</div>
34
31
35
        /* check cookie to hide/show marcdocs*/
32
<div class="main container-fluid">
36
        if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
33
    <div class="row">
37
            toggleMARCdocLinks(false);
34
        <div class="col-md-10 col-md-offset-1">
38
        } else {
39
            toggleMARCdocLinks(true);
40
        }
41
35
42
        $("#marcDocsSelect").click(function(){
36
<h1>
43
            if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
37
[% IF ( holding_id ) %]Editing holdings record number [% holding_id | html %]
44
                toggleMARCdocLinks(true);
38
[% ELSE %]Add holdings record
45
            } else {
39
[% END %]
46
                toggleMARCdocLinks(false);
40
</h1>
47
            }
48
        });
49
41
50
        /* check cookie to hide/show marc tags*/
42
[% IF ( error_items_exist ) %]<div class="dialog alert"><strong>This holdings record has items attached.</strong> Please delete them first.</div>[% END %]
51
        var marctags_cookie = $.cookie("marctags_[% borrowernumber | html %]");
43
[% IF ( error_delete_failed ) %]<div class="dialog alert"><strong>Error deleting the record.</strong></div>[% END %]
52
        if (marctags_cookie == 'hide'){
53
            toggleMARCTagLinks(false);
54
        } else if( marctags_cookie == 'show'){
55
            toggleMARCTagLinks(true)
56
        } else {
57
            [% UNLESS Koha.Preference("hide_marc") %]
58
                toggleMARCTagLinks(true)
59
            [% ELSE %]
60
                toggleMARCTagLinks(false);
61
            [% END %]
62
        }
63
44
64
        $("#marcTagsSelect").click(function(){
45
[% IF ( done ) %]
65
            if( $.cookie("marctags_[% borrowernumber | html %]") == 'hide'){
46
    <script>
66
                toggleMARCTagLinks(true)
47
        opener.document.forms['f'].holding_id.value=[% holding_id | html %];
67
            } else {
48
        window.close();
68
                toggleMARCTagLinks(false);
49
    </script>
69
            }
50
[% ELSE %]
70
        });
51
    <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addholding.pl" onsubmit="return Check();">
52
    <input type="hidden" value="[% IF ( holding_id ) %]view[% ELSE %]holdings[% END %]" id="redirect" name="redirect" />
53
    <input type="hidden" value="" id="current_tab" name="current_tab" />
54
[% END %]
71
55
72
        $("#saverecord").click(function(){
56
<div id="toolbar" class="btn-toolbar">
73
            $(".btn-group").removeClass("open");
57
    [% IF CAN_user_editcatalogue_edit_items %]
74
            onOption();
58
        <div class="btn-group">
75
            return false;
59
            <button class="btn btn-default btn-sm" id="saverecord"><i class="fa fa-save"></i> Save</button>
76
        });
60
            <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
61
            <span class="caret"></span>
62
            </button>
63
            <ul class="dropdown-menu">
64
                <li><a id="saveandview" href="#">Save and view record</a></li>
65
                <li><a id="saveanditems" href="#">Save and edit items</a></li>
66
                <li><a id="saveandcontinue" href="#">Save and continue editing</a></li>
67
            </ul>
68
        </div>
69
    [% END %]
77
70
78
        $("#saveandview").click(function(){
71
    <div class="btn-group">
79
            $(".btn-group").removeClass("open");
72
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
80
            redirect("view");
73
        <ul id="settings-menu" class="dropdown-menu">
81
            return false;
74
            [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %]
82
        });
75
                [% # disabled until supported <li><a href="#" id="switcheditor">Switch to advanced editor</a></li> %]
76
            [% END %]
77
            [% IF marcflavour != 'NORMARC' AND NOT advancedMARCEditor %]
78
                <li>
79
                    <a href="#" id="marcDocsSelect"><i class="fa fa-check-square-o"></i> Show MARC tag documentation links</a>
80
                <li>
81
                    <a href="#" id="marcTagsSelect"><i class="fa fa-check-square-o"></i> Show tags</a>
82
                </li>
83
            [% END %]
84
            <li class="divider"></li>
85
            <li class="nav-header">Change framework</li>
86
            <li>
87
                <a href="#" class="change-framework" data-frameworkcode="">
88
                    [% IF ( frameworkcode ) %]
89
                       <i class="fa fa-fw">&nbsp;</i>
90
                    [% ELSE %]
91
                        <i class="fa fa-fw fa-check"></i>
92
                    [% END %]
93
                    Default
94
                </a>
95
            </li>
96
            [% FOREACH framework IN frameworks%]
97
                <li>
98
                    <a href="#" class="change-framework" data-frameworkcode="[% framework.frameworkcode | html %]">
99
                        [% IF framework.frameworkcode == frameworkcode %]
100
                            <i class="fa fa-fw fa-check"></i>
101
                        [% ELSE %]
102
                            <i class="fa fa-fw">&nbsp;</i>
103
                        [% END %]
104
                        [% framework.frameworktext | html %]
105
                    </a>
106
                </li>
107
            [% END %]
108
        </ul>
109
    </div>
110
    <div class="btn-group">
111
        <a class="btn btn-default btn-sm" id="cancel" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | url %]">Cancel</a>
112
    </div>
113
</div>
83
114
84
        $("#saveanditems").click(function(){
115
[% IF ( popup ) %]
85
            $(".btn-group").removeClass("open");
116
        <input type="hidden" name="mode" value="popup" />
86
            redirect("items");
117
[% END %]
87
            return false;
118
        <input type="hidden" name="op" value="add" />
88
        });
119
        <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode | html %]" />
89
        $("#saveandcontinue").click(function(){
120
        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
90
            $(".btn-group").removeClass("open");
121
        <input type="hidden" name="holding_id" value="[% holding_id | html %]" />
91
            var tab = $("#addholdingtabs li.ui-tabs-active:first a").attr('href');
122
        <input type="hidden" name="changed_framework" value="" />
92
            tab = tab.replace('#', '');
93
            $("#current_tab").val(tab);
94
            redirect("just_save", tab);
95
            return false;
96
        });
97
123
98
        $( '#switcheditor' ).click( function() {
124
<div id="addholdingtabs" class="toptabs numbered">
125
    <ul>
126
        [% FOREACH BIG_LOO IN BIG_LOOP %]
127
        <li><a href="#tab[% BIG_LOO.number | uri %]XX">[% BIG_LOO.number | html %]</a></li>
128
        [% END %]
129
    </ul>
99
130
100
            if ( !confirm( _("Any changes will not be saved. Continue?") ) ) return false;
131
[% FOREACH BIG_LOO IN BIG_LOOP %]
132
    <div id="tab[% BIG_LOO.number | html %]XX">
101
133
102
            $.cookie( 'catalogue_editor_[% USER_INFO.borrowernumber | html %]', 'advanced', { expires: 365, path: '/' } );
134
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
135
    [% IF ( innerloo.tag ) %]
136
    <div class="tag" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
137
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
138
            [% IF advancedMARCEditor %]
139
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag | html %]</a>
140
            [% ELSE %]
141
                <span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
142
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
143
            [% END %]
144
                [% IF ( innerloo.fixedfield ) %]
145
                    <input type="text"
146
                        tabindex="1"
147
                        class="indicator flat"
148
                        style="display:none;"
149
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
150
                        size="1"
151
                        maxlength="1"
152
                        value="[% innerloo.indicator1 | html %]" />
153
                    <input type="text"
154
                        tabindex="1"
155
                        class="indicator flat"
156
                        style="display:none;"
157
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
158
                        size="1"
159
                        maxlength="1"
160
                        value="[% innerloo.indicator2 | html %]" />
161
                [% ELSE %]
162
                    <input type="text"
163
                        tabindex="1"
164
                        class="indicator flat"
165
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
166
                        size="1"
167
                        maxlength="1"
168
                        value="[% innerloo.indicator1 | html %]" />
169
                    <input type="text"
170
                        tabindex="1"
171
                        class="indicator flat"
172
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
173
                        size="1"
174
                        maxlength="1"
175
                        value="[% innerloo.indicator2 | html %]" />
176
                [% END %] -
103
177
104
            var holding_id = [% holding_id || "''" | html %];
178
            [% UNLESS advancedMARCEditor %]
105
            window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber + '/holdings/' + holding_id;
179
                <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib | html %]</a>
180
            [% END %]
181
                <span class="field_controls">
182
                [% IF ( innerloo.repeatable ) %]
183
                    <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','0','[% advancedMARCEditor | html %]'); return false;" title="Repeat this Tag">
184
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
185
                    </a>
186
                [% END %]
187
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
188
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
189
                    </a>
190
                </span>
106
191
107
            return false;
192
        </div>
108
        } );
109
        $(".change-framework").on("click", function(){
110
            var frameworkcode = $(this).data("frameworkcode");
111
            $("#frameworkcode").val( frameworkcode );
112
            Changefwk();
113
        });
114
    });
115
193
116
function redirect(dest){
194
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
117
    $("#redirect").attr("value",dest);
195
            <!--  One line on the marc editor -->
118
    return Check();
196
            <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
119
}
120
197
121
[% IF ( CAN_user_editcatalogue_edit_items ) %]
198
                [% UNLESS advancedMARCEditor %]
199
                    [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" style="display:none;" class="labelsubfield">
200
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
201
                    [% END %]
202
                [% END %]
203
204
                <span class="subfieldcode">
205
                    [% IF ( subfield_loo.fixedfield ) %]
206
                        <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
207
                    [% ELSE %]
208
                        <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
209
                    [% END %]
210
                        <input type="text"
211
                            title="[% subfield_loo.marc_lib | html %]"
212
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
213
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
214
                            value="[% subfield_loo.subfield | html %]"
215
                            size="1"
216
                            maxlength="1"
217
                            class="flat"
218
                            tabindex="0" />
219
                </span>
220
221
                [% UNLESS advancedMARCEditor %]
222
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
223
                        [% subfield_loo.marc_lib | html %]
224
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
225
                    </span>
226
                    </label>
227
                [% END %]
228
229
                [% SET mv = subfield_loo.marc_value %]
230
                [% IF ( mv.type == 'text' ) %]
231
                    [% IF ( mv.readonly == 1 ) %]
232
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor readonly" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" readonly="readonly" />
233
                    [% ELSE %]
234
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
235
                    [% END %]
236
                    [% IF ( mv.authtype ) %]
237
                    <span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype | html -%]','holding'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>
238
                    [% END %]
239
                [% ELSIF ( mv.type == 'text_complex' ) %]
240
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
241
                    <span class="subfield_controls">
242
                        [% IF mv.noclick %]
243
                            <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup"></a>
244
                        [% ELSE %]
245
                            <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
246
                        [% END %]
247
                    </span>
248
                    [% mv.javascript | $raw %]
249
                [% ELSIF ( mv.type == 'hidden' ) %]
250
                    <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
251
                [% ELSIF ( mv.type == 'textarea' ) %]
252
                    <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value | html -%]</textarea>
253
                [% ELSIF ( mv.type == 'select' ) %]
254
                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
255
                    [% FOREACH aval IN mv.values %]
256
                        [% IF aval == mv.default %]
257
                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
258
                        [% ELSE %]
259
                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
260
                        [% END %]
261
                    [% END %]
262
                    </select>
263
                [% END %]
264
265
                <span class="subfield_controls">
266
                [% IF ( subfield_loo.repeatable ) %]
267
                    <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]','[% advancedMARCEditor | html %]'); return false;">
268
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
269
                    </a>
270
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
271
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
272
                    </a>
273
                [% END %]
274
                </span>
275
276
            </div>
277
            <!-- End of the line -->
278
        [% END %]
279
280
    </div>
281
    [% END %]<!-- if innerloo.tag -->
282
    [% END %]<!-- BIG_LOO.innerloop -->
283
    </div>
284
[% END %]<!-- BIG_LOOP -->
285
286
</div><!-- tabs -->
287
288
</form>
289
290
</div>
291
</div>
292
</div>
293
294
<script>
295
    var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10));
296
    browser.show();
297
298
    $(window).load(function() {
299
        $("#loading").hide();
300
    });
301
    var Sticky;
302
    $(document).ready(function() {
303
        $('#addholdingtabs').tabs().bind('show.ui-tabs', function(e, ui) {
304
            $("#"+ui.panel.id+" input:eq(0)").focus();
305
        });
306
307
        [% IF tab %]
308
            $('#addholdingtabs').selectTabByID("#[% tab | html %]");
309
        [% END %]
310
311
        Sticky = $("#toolbar");
312
        Sticky.hcSticky({
313
            stickTo: ".main",
314
            stickyClass: "floating"
315
        });
316
317
        /* check cookie to hide/show marcdocs*/
318
        if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
319
            toggleMARCdocLinks(false);
320
        } else {
321
            toggleMARCdocLinks(true);
322
        }
323
324
        $("#marcDocsSelect").click(function(){
325
            if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){
326
                toggleMARCdocLinks(true);
327
            } else {
328
                toggleMARCdocLinks(false);
329
            }
330
        });
331
332
        /* check cookie to hide/show marc tags*/
333
        var marctags_cookie = $.cookie("marctags_[% borrowernumber | html %]");
334
        if (marctags_cookie == 'hide'){
335
            toggleMARCTagLinks(false);
336
        } else if( marctags_cookie == 'show'){
337
            toggleMARCTagLinks(true)
338
        } else {
339
            [% UNLESS Koha.Preference("hide_marc") %]
340
                toggleMARCTagLinks(true)
341
            [% ELSE %]
342
                toggleMARCTagLinks(false);
343
            [% END %]
344
        }
345
346
        $("#marcTagsSelect").click(function(){
347
            if( $.cookie("marctags_[% borrowernumber | html %]") == 'hide'){
348
                toggleMARCTagLinks(true)
349
            } else {
350
                toggleMARCTagLinks(false);
351
            }
352
        });
353
354
        $("#saverecord").click(function(){
355
            $(".btn-group").removeClass("open");
356
            onOption();
357
            return false;
358
        });
359
360
        $("#saveandview").click(function(){
361
            $(".btn-group").removeClass("open");
362
            redirect("view");
363
            return false;
364
        });
365
366
        $("#saveanditems").click(function(){
367
            $(".btn-group").removeClass("open");
368
            redirect("items");
369
            return false;
370
        });
371
        $("#saveandcontinue").click(function(){
372
            $(".btn-group").removeClass("open");
373
            var tab = $("#addholdingtabs li.ui-tabs-active:first a").attr('href');
374
            tab = tab.replace('#', '');
375
            $("#current_tab").val(tab);
376
            redirect("just_save", tab);
377
            return false;
378
        });
379
380
        $( '#switcheditor' ).click( function() {
381
382
            if ( !confirm( _("Any changes will not be saved. Continue?") ) ) return false;
383
384
            $.cookie( 'catalogue_editor_[% USER_INFO.borrowernumber | html %]', 'advanced', { expires: 365, path: '/' } );
385
386
            var holding_id = [% holding_id || "''" | html %];
387
            window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber + '/holdings/' + holding_id;
388
389
            return false;
390
        } );
391
        $(".change-framework").on("click", function(){
392
            var frameworkcode = $(this).data("frameworkcode");
393
            $("#frameworkcode").val( frameworkcode );
394
            Changefwk();
395
        });
396
    });
397
398
function redirect(dest){
399
    $("#redirect").attr("value",dest);
400
    return Check();
401
}
402
403
[% IF ( CAN_user_editcatalogue_edit_items ) %]
122
    var onOption = function () {
404
    var onOption = function () {
123
        return Check();
405
        return Check();
124
    }
406
    }
Lines 329-624 function Changefwk() { Link Here
329
    f.submit();
611
    f.submit();
330
}
612
}
331
613
332
//]]>
614
$(document).ready(function() {
333
</script>
334
[% Asset.css("css/addholding.css") | $raw %]
335
336
[% INCLUDE 'select2.inc' %]
337
<script>
338
  $(document).ready(function() {
339
    $('.subfield_line select').select2();
615
    $('.subfield_line select').select2();
340
  });
616
});
341
</script>
617
</script>
342
618
343
[% IF ( bidi ) %]
344
   [% Asset.css("css/right-to-left.css") | $raw %]
345
[% END %]
346
</head>
347
<body id="cat_addholding" class="cat">
348
349
   <div id="loading">
350
       <div>Loading, please wait...</div>
351
   </div>
352
353
[% INCLUDE 'header.inc' %]
354
355
<div id="breadcrumbs">
356
          <a href="/cgi-bin/koha/mainpage.pl">Home</a>
357
 &rsaquo; <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a>
358
 &rsaquo; Edit <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber | html %]">[% title | html %] [% IF ( author ) %] by [% author | html %][% END %] (Record #[% biblionumber | html %])</a>
359
 &rsaquo; <a href="/cgi-bin/koha/cataloguing/addholding.pl?biblionumber=[% biblionumber | html %]">Holdings</a>
360
</div>
361
362
<div class="main container-fluid">
363
    <div class="row">
364
        <div class="col-md-10 col-md-offset-1">
365
366
<h1>
367
[% IF ( holding_id ) %]Editing holdings record number [% holding_id | html %]
368
[% ELSE %]Add holdings record
369
[% END %]
370
</h1>
371
372
[% IF ( error_items_exist ) %]<div class="dialog alert"><strong>This holdings record has items attached.</strong> Please delete them first.</div>[% END %]
373
[% IF ( error_delete_failed ) %]<div class="dialog alert"><strong>Error deleting the record.</strong></div>[% END %]
374
375
[% IF ( done ) %]
376
    <script type="text/javascript">
377
        opener.document.forms['f'].holding_id.value=[% holding_id | html %];
378
        window.close();
379
    </script>
380
[% ELSE %]
381
    <form method="post" name="f" id="f" action="/cgi-bin/koha/cataloguing/addholding.pl" onsubmit="return Check();">
382
    <input type="hidden" value="[% IF ( holding_id ) %]view[% ELSE %]holdings[% END %]" id="redirect" name="redirect" />
383
    <input type="hidden" value="" id="current_tab" name="current_tab" />
384
[% END %]
385
386
<div id="toolbar" class="btn-toolbar">
387
    [% IF CAN_user_editcatalogue_edit_items %]
388
        <div class="btn-group">
389
            <button class="btn btn-default btn-sm" id="saverecord"><i class="fa fa-save"></i> Save</button>
390
            <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
391
            <span class="caret"></span>
392
            </button>
393
            <ul class="dropdown-menu">
394
                <li><a id="saveandview" href="#">Save and view record</a></li>
395
                <li><a id="saveanditems" href="#">Save and edit items</a></li>
396
                <li><a id="saveandcontinue" href="#">Save and continue editing</a></li>
397
            </ul>
398
        </div>
399
    [% END %]
400
401
    <div class="btn-group">
402
        <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button>
403
        <ul id="settings-menu" class="dropdown-menu">
404
            [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %]
405
                [% # disabled until supported <li><a href="#" id="switcheditor">Switch to advanced editor</a></li> %]
406
            [% END %]
407
            [% IF marcflavour != 'NORMARC' AND NOT advancedMARCEditor %]
408
                <li>
409
                    <a href="#" id="marcDocsSelect"><i class="fa fa-check-square-o"></i> Show MARC tag documentation links</a>
410
                <li>
411
                    <a href="#" id="marcTagsSelect"><i class="fa fa-check-square-o"></i> Show tags</a>
412
                </li>
413
            [% END %]
414
            <li class="divider"></li>
415
            <li class="nav-header">Change framework</li>
416
            <li>
417
                <a href="#" class="change-framework" data-frameworkcode="">
418
                    [% IF ( frameworkcode ) %]
419
                       <i class="fa fa-fw">&nbsp;</i>
420
                    [% ELSE %]
421
                        <i class="fa fa-fw fa-check"></i>
422
                    [% END %]
423
                    Default
424
                </a>
425
            </li>
426
            [% FOREACH framework IN frameworks%]
427
                <li>
428
                    <a href="#" class="change-framework" data-frameworkcode="[% framework.frameworkcode | html %]">
429
                        [% IF framework.frameworkcode == frameworkcode %]
430
                            <i class="fa fa-fw fa-check"></i>
431
                        [% ELSE %]
432
                            <i class="fa fa-fw">&nbsp;</i>
433
                        [% END %]
434
                        [% framework.frameworktext | html %]
435
                    </a>
436
                </li>
437
            [% END %]
438
        </ul>
439
    </div>
440
    <div class="btn-group">
441
        <a class="btn btn-default btn-sm" id="cancel" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | url %]">Cancel</a>
442
    </div>
443
</div>
444
445
[% IF ( popup ) %]
446
        <input type="hidden" name="mode" value="popup" />
447
[% END %]
448
        <input type="hidden" name="op" value="add" />
449
        <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% frameworkcode | html %]" />
450
        <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
451
        <input type="hidden" name="holding_id" value="[% holding_id | html %]" />
452
        <input type="hidden" name="changed_framework" value="" />
453
454
<div id="addholdingtabs" class="toptabs numbered">
455
    <ul>
456
        [% FOREACH BIG_LOO IN BIG_LOOP %]
457
        <li><a href="#tab[% BIG_LOO.number | html %]XX">[% BIG_LOO.number | html %]</a></li>
458
        [% END %]
459
    </ul>
460
461
[% FOREACH BIG_LOO IN BIG_LOOP %]
462
    <div id="tab[% BIG_LOO.number | html %]XX">
463
464
    [% FOREACH innerloo IN BIG_LOO.innerloop %]
465
    [% IF ( innerloo.tag ) %]
466
    <div class="tag" id="tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
467
        <div class="tag_title" id="div_indicator_tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]">
468
            [% IF advancedMARCEditor %]
469
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag %]</a>
470
            [% ELSE %]
471
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag | html %]</span>
472
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>[% END %]
473
            [% END %]
474
                [% IF ( innerloo.fixedfield ) %]
475
                    <input type="text"
476
                        tabindex="1"
477
                        class="indicator flat"
478
                        style="display:none;"
479
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
480
                        size="1"
481
                        maxlength="1"
482
                        value="[% innerloo.indicator1 | html %]" />
483
                    <input type="text"
484
                        tabindex="1"
485
                        class="indicator flat"
486
                        style="display:none;"
487
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
488
                        size="1"
489
                        maxlength="1"
490
                        value="[% innerloo.indicator2 | html %]" />
491
                [% ELSE %]
492
                    <input type="text"
493
                        tabindex="1"
494
                        class="indicator flat"
495
                        name="tag_[% innerloo.tag | html %]_indicator1_[% innerloo.index | html %][% innerloo.random | html %]"
496
                        size="1"
497
                        maxlength="1"
498
                        value="[% innerloo.indicator1 | html %]" />
499
                    <input type="text"
500
                        tabindex="1"
501
                        class="indicator flat"
502
                        name="tag_[% innerloo.tag | html %]_indicator2_[% innerloo.index | html %][% innerloo.random | html %]"
503
                        size="1"
504
                        maxlength="1"
505
                        value="[% innerloo.indicator2 | html %]" />
506
                [% END %] -
507
508
            [% UNLESS advancedMARCEditor %]
509
                <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib | html %]</a>
510
            [% END %]
511
                <span class="field_controls">
512
                [% IF ( innerloo.repeatable ) %]
513
                    <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]','0','[% advancedMARCEditor | html %]'); return false;" title="Repeat this Tag">
514
                        <img src="[% interface | html %]/[% theme | html %]/img/repeat-tag.png" alt="Repeat this Tag" />
515
                    </a>
516
                [% END %]
517
                    <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;" title="Delete this Tag">
518
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-tag.png" alt="Delete this Tag" />
519
                    </a>
520
                </span>
521
522
        </div>
523
524
        [% FOREACH subfield_loo IN innerloo.subfield_loop %]
525
            <!--  One line on the marc editor -->
526
            <div class="subfield_line" style="[% subfield_loo.visibility | html %]" id="subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]">
527
528
                [% UNLESS advancedMARCEditor %]
529
                    [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" style="display:none;" class="labelsubfield">
530
                    [% ELSE %]<label for="tag_[% subfield_loo.tag | html %]_subfield_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]" class="labelsubfield">
531
                    [% END %]
532
                [% END %]
533
534
                <span class="subfieldcode">
535
                    [% IF ( subfield_loo.fixedfield ) %]
536
                        <img class="buttonUp" style="display:none;" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
537
                    [% ELSE %]
538
                        <img class="buttonUp" src="[% interface | html %]/[% theme | html %]/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]')" alt="Move Up" title="Move Up" />
539
                    [% END %]
540
                        <input type="text"
541
                            title="[% subfield_loo.marc_lib | html %]"
542
                            style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
543
                            name="tag_[% subfield_loo.tag | html %]_code_[% subfield_loo.subfield | html %]_[% subfield_loo.index | html %]_[% subfield_loo.index_subfield | html %]"
544
                            value="[% subfield_loo.subfield | html %]"
545
                            size="1"
546
                            maxlength="1"
547
                            class="flat"
548
                            tabindex="0" />
549
                </span>
550
551
                [% UNLESS advancedMARCEditor %]
552
                    [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
553
                        [% subfield_loo.marc_lib %]
554
                        [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
555
                    </span>
556
                    </label>
557
                [% END %]
558
559
                [% SET mv = subfield_loo.marc_value %]
560
                [% IF ( mv.type == 'text' ) %]
561
                    [% IF ( mv.readonly == 1 ) %]
562
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor readonly" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" readonly="readonly" />
563
                    [% ELSE %]
564
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
565
                    [% END %]
566
                    [% IF ( mv.authtype ) %]
567
                    <span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype | html -%]','holding'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>
568
                    [% END %]
569
                [% ELSIF ( mv.type == 'text_complex' ) %]
570
                    <input type="text" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" value="[%- mv.value | html -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" />
571
                    <span class="subfield_controls">
572
                        [% IF mv.noclick %]
573
                            <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup"></a>
574
                        [% ELSE %]
575
                            <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
576
                        [% END %]
577
                    </span>
578
                    [% mv.javascript %]
579
                [% ELSIF ( mv.type == 'hidden' ) %]
580
                    <input tabindex="1" type="hidden" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" size="[%- mv.size | html -%]" maxlength="[%- mv.maxlength | html -%]" value="[%- mv.value | html -%]" />
581
                [% ELSIF ( mv.type == 'textarea' ) %]
582
                    <textarea cols="70" rows="4" id="[%- mv.id | html -%]" name="[%- mv.name | html -%]" class="input_marceditor" tabindex="1">[%- mv.value -%]</textarea>
583
                [% ELSIF ( mv.type == 'select' ) %]
584
                    <select name="[%- mv.name | html -%]" tabindex="1" size="1" class="input_marceditor" id="[%- mv.id | html -%]">
585
                    [% FOREACH aval IN mv.values %]
586
                        [% IF aval == mv.default %]
587
                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
588
                        [% ELSE %]
589
                        <option value="[%- aval | html -%]">[%- mv.labels.$aval | html -%]</option>
590
                        [% END %]
591
                    [% END %]
592
                    </select>
593
                [% END %]
594
595
                <span class="subfield_controls">
596
                [% IF ( subfield_loo.repeatable ) %]
597
                    <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]','[% advancedMARCEditor | html %]'); return false;">
598
                        <img src="[% interface | html %]/[% theme | html %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
599
                    </a>
600
                    <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag | html %][% subfield_loo.subfield | html %][% subfield_loo.random | html %]'); return false;">
601
                        <img src="[% interface | html %]/[% theme | html %]/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
602
                    </a>
603
                [% END %]
604
                </span>
605
606
            </div>
607
            <!-- End of the line -->
608
        [% END %]
609
610
    </div>
611
    [% END %]<!-- if innerloo.tag -->
612
    [% END %]<!-- BIG_LOO.innerloop -->
613
    </div>
614
[% END %]<!-- BIG_LOOP -->
615
616
</div><!-- tabs -->
617
618
</form>
619
620
</div>
621
</div>
622
</div>
623
619
624
[% INCLUDE 'intranet-bottom.inc' %]
620
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_holdings.tt (-20 / +19 lines)
Lines 164-194 Link Here
164
</table>
164
</table>
165
<fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
165
<fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
166
</form>
166
</form>
167
<script type="text/javascript">//<![CDATA[
167
<script>
168
    function report() {
168
    function report() {
169
            var doc   = opener.document;
169
        var doc   = opener.document;
170
            var field = doc.getElementById("[% index | html %]");
170
        var field = doc.getElementById("[% index | html %]");
171
171
172
            field.value =
172
        field.value =
173
            document.f_pop.f1.value+
173
        document.f_pop.f1.value+
174
            document.f_pop.f6.value+
174
        document.f_pop.f6.value+
175
            document.f_pop.f7.value+
175
        document.f_pop.f7.value+
176
            (document.f_pop.f8.value + '    ').substr(0, 4)+
176
        (document.f_pop.f8.value + '    ').substr(0, 4)+
177
            document.f_pop.f12.value+
177
        document.f_pop.f12.value+
178
            document.f_pop.f13.value+
178
        document.f_pop.f13.value+
179
            document.f_pop.f14.value+
179
        document.f_pop.f14.value+
180
            document.f_pop.f15.value+
180
        document.f_pop.f15.value+
181
            document.f_pop.f16.value+
181
        document.f_pop.f16.value+
182
            (document.f_pop.f17.value + '   ').substr(0, 3)+
182
        (document.f_pop.f17.value + '   ').substr(0, 3)+
183
            document.f_pop.f20.value+
183
        document.f_pop.f20.value+
184
            document.f_pop.f21.value+
184
        document.f_pop.f21.value+
185
            (document.f_pop.f22.value + '   ').substr(0, 3)+
185
        (document.f_pop.f22.value + '   ').substr(0, 3)+
186
            document.f_pop.f25.value+
186
        document.f_pop.f25.value+
187
            document.f_pop.f26.value;
187
        document.f_pop.f26.value;
188
        self.close();
188
        self.close();
189
        return false;
189
        return false;
190
    }
190
    }
191
    //]]>
192
</script>
191
</script>
193
192
194
[% INCLUDE 'popup-bottom.inc' %]
193
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_leader_holdings.tt (-17 / +15 lines)
Lines 80-105 Link Here
80
</table>
80
</table>
81
<fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
81
<fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
82
</form>
82
</form>
83
<script type="text/javascript">
83
<script>
84
//<![CDATA[
84
    function report() {
85
function report() {
85
        var doc   = opener.document;
86
            var doc   = opener.document;
86
        var field = doc.getElementById("[% index | html %]");
87
            var field = doc.getElementById("[% index | html %]");
88
87
89
            field.value =
88
        field.value =
90
            '     '+
89
        '     '+
91
            document.f_pop.f5.value+
90
        document.f_pop.f5.value+
92
            document.f_pop.f6.value+
91
        document.f_pop.f6.value+
93
            '  '+
92
        '  '+
94
            'a'+ // MARC21 UNICODE flag - must be 'a' for Koha
93
        'a'+ // MARC21 UNICODE flag - must be 'a' for Koha
95
            '22     '+
94
        '22     '+
96
            document.f_pop.f17.value+
95
        document.f_pop.f17.value+
97
            document.f_pop.f18.value+
96
        document.f_pop.f18.value+
98
            ' '+
97
        ' '+
99
            '4500';
98
        '4500';
100
        self.close();
99
        self.close();
101
        return false;
100
        return false;
102
    }
101
    }
103
    //]]>
104
</script>
102
</script>
105
[% INCLUDE 'popup-bottom.inc' %]
103
[% INCLUDE 'popup-bottom.inc' %]
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 750-756 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { Link Here
750
750
751
# Fetch summary holdings
751
# Fetch summary holdings
752
if (C4::Context->preference('SummaryHoldings')) {
752
if (C4::Context->preference('SummaryHoldings')) {
753
    my $summary_holdings = Koha::Holdings->search({ biblionumber => $biblionumber, deleted_on => undef })->unblessed;
753
    my $summary_holdings = Koha::Holdings->search({ biblionumber => $biblionumber, deleted_on => undef });
754
    $template->param( summary_holdings => $summary_holdings );
754
    $template->param( summary_holdings => $summary_holdings );
755
}
755
}
756
756
(-)a/t/db_dependent/Koha/Holding.t (-3 / +5 lines)
Lines 23-34 use t::lib::TestBuilder; Link Here
23
23
24
use C4::Biblio;
24
use C4::Biblio;
25
25
26
use Koha::BiblioFramework;
27
use Koha::BiblioFrameworks;
26
use Koha::BiblioFrameworks;
28
use Koha::Database;
27
use Koha::Database;
29
use Koha::Libraries;
28
use Koha::Libraries;
30
use Koha::Library;
29
use Koha::Library;
31
use Koha::MarcSubfieldStructure;
32
use Koha::MarcSubfieldStructures;
30
use Koha::MarcSubfieldStructures;
33
31
34
BEGIN {
32
BEGIN {
Lines 40-46 my $schema = Koha::Database->new->schema; Link Here
40
38
41
subtest 'Koha::Holding tests' => sub {
39
subtest 'Koha::Holding tests' => sub {
42
40
43
    plan tests => 17;
41
    plan tests => 19;
44
42
45
    $schema->storage->txn_begin;
43
    $schema->storage->txn_begin;
46
44
Lines 109-114 subtest 'Koha::Holding tests' => sub { Link Here
109
    is($holding->frameworkcode(), $frameworkcode, 'Framework code correct in Koha::Holding object');
107
    is($holding->frameworkcode(), $frameworkcode, 'Framework code correct in Koha::Holding object');
110
    is($holding->holdingbranch(), 'ABC', 'Location correct in Koha::Holding object');
108
    is($holding->holdingbranch(), 'ABC', 'Location correct in Koha::Holding object');
111
109
110
    my $branch = $holding->holding_branch();
111
    is(ref $branch, 'Koha::Library', 'holding_branch() returns a Koha::Library object');
112
    is($branch->branchname(), 'Abc', 'holding_branch() returns correct library');
113
112
    my $metadata = $holding->metadata;
114
    my $metadata = $holding->metadata;
113
    is( ref $metadata, 'Koha::Holdings::Metadata', 'Method metadata() returned a Koha::Holdings::Metadata object');
115
    is( ref $metadata, 'Koha::Holdings::Metadata', 'Method metadata() returned a Koha::Holdings::Metadata object');
114
116
(-)a/t/db_dependent/Koha/Holdings.t (-3 lines)
Lines 23-32 use t::lib::TestBuilder; Link Here
23
23
24
use C4::Biblio;
24
use C4::Biblio;
25
25
26
use Koha::BiblioFramework;
27
use Koha::BiblioFrameworks;
26
use Koha::BiblioFrameworks;
28
use Koha::Database;
27
use Koha::Database;
29
use Koha::MarcSubfieldStructure;
30
use Koha::MarcSubfieldStructures;
28
use Koha::MarcSubfieldStructures;
31
29
32
BEGIN {
30
BEGIN {
33
- 

Return to bug 20447