From a4662fd614adb0c68a47275a67f447d24795909d Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 27 Oct 2009 23:42:42 +0100 Subject: [PATCH] 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. --- authorities/authorities.pl | 5 +-- .../en/modules/authorities/authorities.tmpl | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index aacb7f6076..9eb205de35 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -185,10 +185,9 @@ sub create_input { value=\"$value\" class=\"input_marceditor\" tabindex=\"1\" - disabled=\"disabled\" readonly=\"readonly\" \/> - {$tag}->{$subfield}->{authtypecode}."&index=$subfield_data{id}','$subfield_data{id}')\">... + {$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">... "; # it's a plugin field } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl index 31b73c4664..d50c9f9b82 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tmpl @@ -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 -- 2.39.5