From: Henri-Damien LAURENT Date: Tue, 27 Oct 2009 22:42:42 +0000 (+0100) Subject: Bug Fix MT2104 : Edit authorities problem on multiple field X-Git-Tag: 3.0.5_rc1~107 X-Git-Url: http://git.rot13.org/?p=koha.git;a=commitdiff_plain;h=cb55b9a13d2891d25bc4eefaa346d1664efa06fd 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. --- diff --git a/authorities/authorities.pl b/authorities/authorities.pl index ce476ebb22..9eb205de35 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -186,8 +186,8 @@ sub create_input { class=\"input_marceditor\" tabindex=\"1\" 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