Koha/koha-tmpl/intranet-tmpl/prog/en/includes/merge-record.inc
Julian Maurice 44c4b9310d Bug 8064: Change the way target record is built.
Instead of copying/removing a piece of DOM in target record each time a
checkbox is checked/unchecked, the target record is *entirely* rebuilt
each time a checkbox is checked/unchecked.
This is slower but allow for a more consistent and less error-prone
behaviour.

This patch also fix the mandatory check for subfields

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-09 15:08:57 -03:00

75 lines
3.8 KiB
HTML

[% BLOCK sourcetab %]
<div id="tabrecord[% record.biblionumber %]">
<div class="record">
<ul id="ulrecord[% record.biblionumber %]">
[% FOREACH field IN record.display %]
[% IF field.tag != biblionumbertag %]
<li id="k[% field.key %]">
[% IF (tabrecord.reference) %]
<input type="checkbox" checked="checked" class="fieldpick" id="rec_[% record.biblionumber %]_[% field.key %]" />
[% ELSE %]
<input type="checkbox" class="fieldpick" id="rec_[% record.biblionumber %]_[% field.key %]" />
[% END %]
<label for="rec_[% record.biblionumber %]_[% field.key %]"><span class="field">[% field.tag %]</span></label>
<input type="hidden" name="tag_[% field.tag %]_indicator1_[% field.key %]" value="[% field.indicator1 %]" />
<input type="hidden" name="tag_[% field.tag %]_indicator2_[% field.key %]" value="[% field.indicator2 %]" />
[% IF ( field.value ) %]
/ [% field.value %]
<input type="hidden" name="tag_[% field.tag %]_code_00_[% field.key %]" value="00" />
<input type="hidden" name="tag_[% field.tag %]_subfield_00_[% field.key %]" value="[% field.value %]" />
[% END %]
[% IF ( field.subfield.size ) %]
<ul>
[% FOREACH subfield IN field.subfield %]
<li id="k[% subfield.subkey %]">
[% IF (tabrecord.reference) %]
<input type="checkbox" checked="checked" class="subfieldpick" id="rec_[% record.biblionumber %]_[% subfield.subkey %]" />
[% ELSE %]
<input type="checkbox" class="subfieldpick" id="rec_[% record.biblionumber %]_[% subfield.subkey %]" />
[% END %]
<label for="rec_[% record.biblionumber %]_[% subfield.subkey %]"><span class="subfield">[% subfield.subtag %]</span> / [% subfield.value %]</label>
<input type="hidden" name="tag_[% field.tag %]_code_[% subfield.subtag %]_[% field.key %]_[% subfield.subkey %]" value="[% subfield.subtag %]" />
<input type="hidden" name="tag_[% field.tag %]_subfield_[% subfield.subtag %]_[% subfield.key %]_[% subfield.subkey %]" value="[% subfield.value |html%]" />
</li>
[% END %]
</ul>
[% END %]
</li>
[% END %]
[% END %]
</ul>
</div><!-- /div.record -->
</div><!-- /div#tabrecordXXX -->
[% END %]
[% BLOCK mergesource %]
<div id="tabs" class="toptabs">
<h2>Source records</h2>
<ul>
[% FOREACH record IN sourcerecords %]
<li>
<a href="#tabrecord[% record.biblionumber %]">
[% record.biblionumber %]
[% IF record.reference %](ref)[% END %]
</a>
</li>
[% END %]
</ul>
[% IF ( sourcerecords.size ) %]
[% FOREACH record IN sourcerecords %]
[% PROCESS sourcetab tabrecord=record %]
[% END %]
[% END %]
</div> <!-- // #tabs -->
[% END %]
[% BLOCK mergetarget %]
<div id="result">
<h2>Destination record</h2>
<div style="border:1px solid #E8E8E8;padding:1em;margin-top:2em;">
<ul id="resultul"></ul>
</div>
</div> <!-- // #result -->
[% END %]