Skip to content

Commit

Permalink
Fix #466, make sure the incipit gets the correct field index. Also fi…
Browse files Browse the repository at this point in the history
…x incipit config (which was harmless but incorrect)
  • Loading branch information
xhero committed Nov 23, 2016
1 parent 063e4ef commit 390000c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 10 additions & 4 deletions app/views/options/_subfield_secondary.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<%- master = params.include?("has_links_to") && params["has_links_to"] == true ? subfield : @item.marc.config.get_master(tag_name) %>
<%- marc_subfield_m = marc_tag.fetch_first_by_tag(master) || MarcNode.new(@item.marc.get_model) %>
<%- has_links_to = params.has_key?("has_links_to") ? params['has_links_to'] : false %>
<%- master = has_links_to ? subfield : @item.marc.config.get_master(tag_name) %>
<% if has_links_to == true
marc_subfield_m = marc_subfield || MarcNode.new(@item.marc.get_model)
else
marc_subfield_m = marc_tag.fetch_first_by_tag(master) || MarcNode.new(@item.marc.get_model)
end %>

<%- no_new = params.include?("no_new") ? params["no_new"] : false %>
<%- ac_path = send(params['type'] + "_default_autocomplete")%>
<%- field = params.has_key?("field") ? params['field'] : "id" %>
<%- allow_new = params.has_key?("allow_new") ? params['allow_new'] : false %>
<%- has_links_to = params.has_key?("has_links_to") ? params['has_links_to'] : false %>

<%- disabled = params.has_key?("only_new_window") ? true : false %>
<!-- validation plugin REQUIRES a name. Make it random as we never call it elsewhere -->
<%- check_name = "confirmation_uniq_" + SecureRandom.hex(5)%>
Expand All @@ -31,7 +37,7 @@ end
name_tag_subfield = "#{tag_name}#{subfield}"
%>

<input type="hidden" class="autocomplete_target serialize_marc <%=validate_class_master%>" data-tag="<%=tag_name%>" data-subfield="<%=master%>" data-field="<%=field%>" value="<%= marc_subfield_m.content %>" <%=name_tag_master%> data-allow-new="<%=allow_new%>" data-has-links-to="<%=has_links_to%>">
<input type="hidden" class="autocomplete_target serialize_marc <%=validate_class_master%>" data-tag="<%=tag_name%>" data-subfield="<%=master%>" data-field="<%=field%>" value="<%=marc_subfield_m.content %>" <%=name_tag_master%> data-allow-new="<%=allow_new%>" data-has-links-to="<%=has_links_to%>">

<%
options = {
Expand Down
8 changes: 1 addition & 7 deletions config/marc/tag_config_source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,11 @@
- :occurrences: "?"
:no_browse: true
"031":
:master: "0"
:master: t
:master_optional: true
:indicator: "##"
:occurrences: "*"
:fields:
- - "0"
- :occurrences: "*"
:foreign_class: StandardTitle
:foreign_field: id
:no_show: true
:no_browse: true
- - a
- :occurrences: "?"
- - b
Expand Down

0 comments on commit 390000c

Please sign in to comment.