Bug 32046: (follow-up) Accommodate the inclusion of item information

If you have item information configured in the MarcItemFieldsToOrder
system preference, the "Select to import" tab will display a basic item
information form which needs to use the same style as other item edit
forms.

In order to make the CSS in addbiblio.css more generic, I've changed
some styles to use a class, .item_edit_form, instead of an ID. This lets
us have multiple <div class="item_edit_form"> in this template without
duplicating IDs. Other instances of <div
id="cataloguing_additem_newitem"> have haa the .item_edit_form class
added.

To test you must have a staged MARC file which includes items and you
must configure the MarcItemFieldsToOrder preference to map those items
in the ordering interface.

As you follow the previous patch's test plan you'll find that when you
click a checkbox or title to expand the information about that title
you'll see "Item record X" headings following by a properly-styled form.

To confirm that the changes to addbiblio.css are not too far-reaching,
test the other affected pages:

 - Item add/edit
 - Batch item modification
 - Batch item deletion

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2022-11-16 15:26:29 +00:00 committed by Tomas Cohen Arazi
parent 26ca471424
commit ff7ad7aaa6
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
5 changed files with 189 additions and 178 deletions

View File

@ -219,30 +219,39 @@ a.tagnum {
width: 1em;
}
#cataloguing_additem_newitem .subfield_line {
.item_edit_form .subfield_line {
align-items: flex-start;
display: flex;
flex-basis: 100%;
}
#cataloguing_additem_newitem fieldset.rows label,
#cataloguing_additem_newitem fieldset.rows span.label {
div.item_edit_form ol li label,
div.item_edit_form ol li span.label {
flex-basis: 25%;
font-size: 100%;
margin-right: 1rem;
}
#cataloguing_additem_newitem fieldset.rows li {
div.item_edit_form ol li {
padding-bottom: 3px;
}
#cataloguing_additem_newitem .input_marceditor {
.item_edit_form .input_marceditor {
flex-basis: 50%;
float: none;
}
#cataloguing_additem_newitem textarea.input_marceditor {
.item_edit_form textarea.input_marceditor {
width: 31em;
}
div.item_edit_form ol li label:first-child,
fieldset.order_details ol li label:first-child,
div.item_edit_form ol li .label:first-child,
fieldset.order_details ol li .label:first-child {
flex-basis: 25%;
}
#cat_addbiblio .field_marceditor .flatpickr_wrapper {
display: none;
}

View File

@ -10,9 +10,9 @@
Batch list
[% END %] &rsaquo; Order staged MARC records &rsaquo; Acquisitions &rsaquo; Koha
</title>
[% Asset.css("css/addbiblio.css") | $raw %]
<style>.biblio { padding: 0 .5em;margin:0; }@media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
<style>.biblio { padding: 0 .5em;margin:0; }.item_edit_form{border-top:1px solid #AAA;padding-top:.5em;}@media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/addbiblio.css") | $raw %]
[%# As long as cataloging plugins rely on 'script' tags added inline, JS must be in the header %]
<script>
const template_path = "[% interface | html %]/[% theme | html %]";
@ -206,136 +206,138 @@
<input id="sort2_record_[% biblio.import_record_id | html %]" type="text" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
</li>
</ol>
</fieldset>
<div style="float:right">
[% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
[% FOREACH item IN biblio.iteminfos %]
<fieldset>
<legend>Item record [% item.item_id | html %]</legend>
<ol>
<li>
<label for="homebranch_item_[% item.item_id | html %]">homebranch</label>
<select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% item.biblio_count | html %]">
[% FOREACH l IN libraries %]
[% IF l.branchcode == item.homebranch %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
[% END %]
</select>
</li>
[% IF ( biblio.iteminfos.size ) %]
<div class="item_edit_form">
[% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
[% FOREACH item IN biblio.iteminfos %]
<fieldset>
<legend>Item record [% item.item_id | html %]</legend>
<ol>
<li>
<label for="homebranch_item_[% item.item_id | html %]">homebranch</label>
<select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% biblio.import_record_id | html %]">
[% FOREACH l IN libraries %]
[% IF l.branchcode == item.homebranch %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="holdingbranch_item_[% item.item_id | html %]">holdingbranch</label>
<select id="holdingbranch_item_[% item.item_id | html %]" name="holdingbranch_[% item.biblio_count | html %]">
[% FOREACH l IN libraries %]
[% IF l.branchcode == item.holdingbranch %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="itype_item_[% item.item_id | html %]">itype</label>
<select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]">
[% FOREACH itemtype IN itemtypes %]
[% IF itemtype.itemtype == item.itype %]
<option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
[% ELSE %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="holdingbranch_item_[% item.item_id | html %]">holdingbranch</label>
<select id="holdingbranch_item_[% item.item_id | html %]" name="holdingbranch_[% biblio.import_record_id | html %]">
[% FOREACH l IN libraries %]
[% IF l.branchcode == item.holdingbranch %]
<option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
[% ELSE %]
<option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="itype_item_[% item.item_id | html %]">itype</label>
<select id="itype_item_[% item.item_id | html %]" name="itype_[% biblio.import_record_id | html %]">
[% FOREACH itemtype IN itemtypes %]
[% IF itemtype.itemtype == item.itype %]
<option value="[% itemtype.itemtype | html %]" selected="selected">[% itemtype.description | html %]</option>
[% ELSE %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="nonpublic_note_item_[% item.item_id | html %]">nonpublic_note</label>
<input type="text" id="nonpublic_note_item_[% item.item_id | html %]" name="nonpublic_note_[% item.biblio_count | html %]" value="[% item.nonpublic_note | html %]">
</li>
<li>
<label for="public_note_item_[% item.item_id | html %]">public_note</label>
<input type="text" id="public_note_item_[% item.item_id | html %]" name="public_note_[% item.biblio_count | html %]" value="[% item.public_note | html %]">
</li>
<li>
<label for="loc_item_[% item.item_id | html %]">loc</label>
<select id="loc_item_[% item.item_id | html %]" name="loc_[% item.biblio_count | html %]">
<option value=""> </option>
[% FOREACH locationloo IN locationloop %]
[% IF ( locationloo.code ) == (item.loc) %]
<option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>
[% ELSE %]
<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="nonpublic_note_item_[% item.item_id | html %]">nonpublic_note</label>
<input type="text" id="nonpublic_note_item_[% item.item_id | html %]" name="nonpublic_note_[% biblio.import_record_id | html %]" value="[% item.nonpublic_note | html %]">
</li>
<li>
<label for="public_note_item_[% item.item_id | html %]">public_note</label>
<input type="text" id="public_note_item_[% item.item_id | html %]" name="public_note_[% biblio.import_record_id | html %]" value="[% item.public_note | html %]">
</li>
<li>
<label for="loc_item_[% item.item_id | html %]">loc</label>
<select id="loc_item_[% item.item_id | html %]" name="loc_[% biblio.import_record_id | html %]">
<option value=""> </option>
[% FOREACH locationloo IN locationloop %]
[% IF ( locationloo.code ) == (item.loc) %]
<option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>
[% ELSE %]
<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="ccode_item_[% item.item_id | html %]">ccode</label>
<select id="ccode_item_[% item.item_id | html %]" name="ccode_[% item.biblio_count | html %]">
<option value=""> </option>
[% FOREACH ccodeloo IN ccodeloop %]
[% IF ( ccodeloo.code ) == (item.ccode) %]
<option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>
[% ELSE %]
<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="ccode_item_[% item.item_id | html %]">ccode</label>
<select id="ccode_item_[% item.item_id | html %]" name="ccode_[% biblio.import_record_id | html %]">
<option value=""> </option>
[% FOREACH ccodeloo IN ccodeloop %]
[% IF ( ccodeloo.code ) == (item.ccode) %]
<option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>
[% ELSE %]
<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="notforloan_item_[% item.item_id | html %]">notforloan</label>
<select id="notforloan_item_[% item.item_id | html %]" name="notforloan_[% item.biblio_count | html %]">
<option value=""> </option>
[% FOREACH n IN notforloanloop %]
[% IF n.code == item.notforloan %]
<option value="[% n.code | html %]" selected="selected">[% n.description | html %]</option>
[% ELSE %]
<option value="[% n.code | html %]">[% n.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="uri_item_[% item.item_id | html %]">uri</label>
<input type="text" id="uri_item_[% item.item_id | html %]" name="uri_[% item.biblio_count | html %]" value="[% item.uri | html %]">
</li>
<li>
<label for="copyno_item_[% item.item_id | html %]">copyno</label>
<input type="text" id="copyno_item_[% item.item_id | html %]" name="copyno_[% item.biblio_count | html %]" value="[% item.copyno | html %]">
</li>
<li>
<label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
<select class="budget_code_item" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
<option value="">Select a fund (will use default if set)</option>
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
[% END %]
[% END %]
</select>
<span class="item_fund required">Required</span>
</li>
<li>
<label for="price_item_[% item.item_id | html %]">price</label>
<input type="text" id="price_item_[% item.item_id | html %]" name="itemprice_[% item.biblio_count | html %]" value="[% item.itemprice | html %]">
</li>
<li>
<label for="replacementprice_item_[% item.item_id | html %]">replacement price</label>
<input type="text" id="replacementprice_item_[% item.item_id | html %]" name="replacementprice_[% item.biblio_count | html %]" value="[% item.replacementprice | html %]">
</li>
<li>
<label for="callnumber_item_[% item.item_id | html %]">callnumber</label>
<input type="text" id="callnumber_item_[% item.item_id | html %]" name="itemcallnumber_[% item.biblio_count | html %]" value="[% item.itemcallnumber | html %]">
</li>
</ol>
</fieldset>
[% END # /FOREACH item %]
</div>
<li>
<label for="notforloan_item_[% item.item_id | html %]">notforloan</label>
<select id="notforloan_item_[% item.item_id | html %]" name="notforloan_[% biblio.import_record_id | html %]">
<option value=""> </option>
[% FOREACH n IN notforloanloop %]
[% IF n.code == item.notforloan %]
<option value="[% n.code | html %]" selected="selected">[% n.description | html %]</option>
[% ELSE %]
<option value="[% n.code | html %]">[% n.description | html %]</option>
[% END %]
[% END %]
</select>
</li>
<li>
<label for="uri_item_[% item.item_id | html %]">uri</label>
<input type="text" id="uri_item_[% item.item_id | html %]" name="uri_[% biblio.import_record_id | html %]" value="[% item.uri | html %]">
</li>
<li>
<label for="copyno_item_[% item.item_id | html %]">copyno</label>
<input type="text" id="copyno_item_[% item.item_id | html %]" name="copyno_[% biblio.import_record_id | html %]" value="[% item.copyno | html %]">
</li>
<li>
<label for="budget_code_item_[% item.item_id | html %]">budget_code</label>
<select class="budget_code_item" id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% biblio.import_record_id | html %]">
<option value="">Select a fund (will use default if set)</option>
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
[% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
[% END %]
[% END %]
</select>
<span class="item_fund required">Required</span>
</li>
<li>
<label for="price_item_[% item.item_id | html %]">price</label>
<input type="text" id="price_item_[% item.item_id | html %]" name="itemprice_[% biblio.import_record_id | html %]" value="[% item.itemprice | html %]">
</li>
<li>
<label for="replacementprice_item_[% item.item_id | html %]">replacement price</label>
<input type="text" id="replacementprice_item_[% item.item_id | html %]" name="replacementprice_[% biblio.import_record_id | html %]" value="[% item.replacementprice | html %]">
</li>
<li>
<label for="callnumber_item_[% item.item_id | html %]">callnumber</label>
<input type="text" id="callnumber_item_[% item.item_id | html %]" name="itemcallnumber_[% biblio.import_record_id | html %]" value="[% item.itemcallnumber | html %]">
</li>
</ol>
</fieldset>
[% END # /FOREACH item %]
</div> <!-- /.item_edit_form -->
[% END %]
</fieldset> <!-- /.rows.order_details -->
</td>
<td class="actions">
<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id | uri %]" class="previewData btn btn-default btn-xs">MARC</a>
@ -371,55 +373,55 @@
<p>Import all the checked items in the basket with the following parameters:</p>
[% IF ( items ) %]
<div id="cataloguing_additem_newitem">
<fieldset class="rows" style="float:none;">
<legend>Item</legend>
[% IF ( NoACQframework ) %]
<div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
[% END %]
[% FOREACH item IN items %]
<div id="outeritemblock">
<div id="itemblock">
<ol>
[% FOREACH iteminformatio IN item.iteminformation %]
<li style="[% iteminformatio.hidden | html %];">
<div class="subfield_line" id="subfield[% iteminformatio.serialid | html %][% iteminformatio.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]">
[% IF (iteminformatio.mandatory) %]
<label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
[% ELSE %]
<label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
[% END %]
<div class="item_edit_form">
[% FOREACH item IN items %]
<div id="outeritemblock">
<div id="itemblock">
<ol>
[% FOREACH iteminformatio IN item.iteminformation %]
<li style="[% iteminformatio.hidden | html %];">
<div class="subfield_line" id="subfield[% iteminformatio.serialid | html %][% iteminformatio.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]">
[% IF (iteminformatio.mandatory) %]
<label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
[% ELSE %]
<label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
[% END %]
[% IF ( iteminformatio.marc_value.type == 'select' ) %]
<select name="field_value" class="input_marceditor">
[% FOREACH value IN iteminformatio.marc_value.values %]
[% IF ( value == iteminformatio.marc_value.default ) %]
<option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
[% ELSE %]
<option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
[% IF ( iteminformatio.marc_value.type == 'select' ) %]
<select name="field_value" class="input_marceditor">
[% FOREACH value IN iteminformatio.marc_value.values %]
[% IF ( value == iteminformatio.marc_value.default ) %]
<option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
[% ELSE %]
<option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
[% END %]
[% END %]
[% END %]
</select>
[% ELSE %]
[% iteminformatio.marc_value | $raw %]
[% END %]
<input type="hidden" name="itemid" value="1" />
<input type="hidden" name="kohafield" value="[% iteminformatio.kohafield | html %]" />
<input type="hidden" name="tag" value="[% iteminformatio.tag | html %]" />
<input type="hidden" name="subfield" value="[% iteminformatio.subfield | html %]" />
<input type="hidden" name="mandatory" value="[% iteminformatio.mandatory | html %]" />
[% IF ( iteminformatio.mandatory ) %]
<span class="required">Required</span>
[% END %]
</div>
</li>
[% END %]
</ol>
</div><!-- /#itemblock -->
</div> <!-- /#outeritemblock -->
[% END #/FOREACH item %]
</select>
[% ELSE %]
[% iteminformatio.marc_value | $raw %]
[% END %]
<input type="hidden" name="itemid" value="1" />
<input type="hidden" name="kohafield" value="[% iteminformatio.kohafield | html %]" />
<input type="hidden" name="tag" value="[% iteminformatio.tag | html %]" />
<input type="hidden" name="subfield" value="[% iteminformatio.subfield | html %]" />
<input type="hidden" name="mandatory" value="[% iteminformatio.mandatory | html %]" />
[% IF ( iteminformatio.mandatory ) %]
<span class="required">Required</span>
[% END %]
</div>
</li>
[% END %]
</ol>
</div><!-- /#itemblock -->
</div> <!-- /#outeritemblock -->
[% END #/FOREACH item %]
</div> <!-- /.item_edit_form -->
</fieldset>
</div>
[% END # /IF items %]
</div> <!-- /#items_info -->

View File

@ -150,7 +150,7 @@
</div>
<div class="col-sm-10">
<div id="cataloguing_additem_newitem">
<div id="cataloguing_additem_newitem" class="item_edit_form">
<form id="f" method="post" action="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblio.biblionumber | html %]" name="f">
<input type="hidden" name="op" value="[% op | html %]" />
[% IF (popup) %]

View File

@ -143,7 +143,7 @@
[% END %]
[% IF ( itemresults ) %]
<div id="cataloguing_additem_newitem">
<div id="cataloguing_additem_newitem" class="item_edit_form">
<input type="hidden" name="op" value="[% op | html %]" />
<p>This will delete [% IF ( too_many_items_display ) %]all the[% ELSE %]the selected[% END %] items.</p>
<input type="hidden" name="del" value="1" />

View File

@ -172,7 +172,7 @@
[% END # /IF too_many_items_process %]
[% UNLESS (too_many_items_process) %]
<div id="cataloguing_additem_newitem">
<div id="cataloguing_additem_newitem" class="item_edit_form">
<h2>Edit items</h2>
<div class="hint">Checking the box right next to the subfield label will disable the entry and delete the subfield on all selected items. Leave fields blank to make no change.</div>
<fieldset class="rows">