Bug Fix MT2104 : Edit authorities problem on multiple field
When editing a field 500 linked to an authority, when duplicate field, all the 500 fields were replaced.
This commit is contained in:
parent
c71acb2a1f
commit
a4662fd614
2 changed files with 39 additions and 7 deletions
|
@ -185,10 +185,9 @@ sub create_input {
|
|||
value=\"$value\"
|
||||
class=\"input_marceditor\"
|
||||
tabindex=\"1\"
|
||||
disabled=\"disabled\"
|
||||
readonly=\"readonly\" \/>
|
||||
<span class=\"buttonDot\"
|
||||
onclick=\"Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=".$tagslib->{$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}')\">...</span>
|
||||
<a href=\"#\" class=\"buttonDot\"
|
||||
onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
|
||||
";
|
||||
# it's a plugin field
|
||||
}
|
||||
|
|
|
@ -119,6 +119,43 @@ function Check(){
|
|||
}
|
||||
|
||||
|
||||
// returns the subfieldcode based upon subfieldid writing
|
||||
function getSubfieldcode(tagsubfieldid){
|
||||
// 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
|
||||
return tagsubfieldid.substr(3+3+4+8-1,1);
|
||||
}
|
||||
|
||||
// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
|
||||
// returns the filter
|
||||
function getTagInputnameFilter(tagsubfieldid){
|
||||
var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
|
||||
var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
|
||||
tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
|
||||
tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
|
||||
tagsubfield=tagsubfield+"_."+tagcode;
|
||||
return tagsubfield;
|
||||
}
|
||||
|
||||
function openAuth(tagsubfieldid,authtype) {
|
||||
// let's take the base of tagsubfield information (removing the indexes and the codes
|
||||
var element=document.getElementById(tagsubfieldid);
|
||||
var tagsubfield=getTagInputnameFilter(tagsubfieldid);
|
||||
var elementsubfcode=getSubfieldcode(element.name);
|
||||
var mainmainstring=element.value;
|
||||
var mainstring="";
|
||||
var inputs = element.parentNode.parentNode.getElementsByTagName("input");
|
||||
|
||||
for (var myindex =0; myindex<inputs.length;myindex++){
|
||||
if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
|
||||
var subfieldcode=getSubfieldcode(inputs[myindex].name);
|
||||
if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
|
||||
mainstring=inputs[myindex].value+" "+mainstring;
|
||||
}
|
||||
}
|
||||
}
|
||||
newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
function AddField(field,cntrepeatfield) {
|
||||
document.forms['f'].op.value = "addfield";
|
||||
document.forms['f'].addfield_field.value=field;
|
||||
|
@ -126,10 +163,6 @@ function AddField(field,cntrepeatfield) {
|
|||
document.f.submit();
|
||||
}
|
||||
|
||||
function Dopop(link,i) {
|
||||
defaultvalue = document.getElementById(i).value;
|
||||
window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes');
|
||||
}
|
||||
|
||||
function ExpandField(index) {
|
||||
var original = document.getElementById(index); //original <div>
|
||||
|
|
Loading…
Reference in a new issue