Bug 11944: Fix encoding issue on adding a subscription
If frequencies or numbering patterns contain non-latin characters, so output was broken. To reproduce: - Create a frequency and a numbering pattern with non-latin characters - Add a new subscription using these values - The screen should not contain bad encoded characters. Signed-off-by: Paola Rossi <paola.rossi@cineca.it> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
parent
9987dbaebe
commit
b3aebd1f53
|
|
@ -128,7 +128,7 @@ function displaymoreoptions() {
|
|||
}
|
||||
|
||||
var X = 0, Y = 0, Z = 0;
|
||||
var numberingmethod = unescape(globalnumpatterndata.numberingmethod);
|
||||
var numberingmethod = globalnumpatterndata.numberingmethod;
|
||||
if(numberingmethod.match(/{X}/)) X = 1;
|
||||
if(numberingmethod.match(/{Y}/)) Y = 1;
|
||||
if(numberingmethod.match(/{Z}/)) Z = 1;
|
||||
|
|
@ -141,7 +141,7 @@ function displaymoreoptions() {
|
|||
|
||||
if(X) {
|
||||
if(globalnumpatterndata.label1) {
|
||||
$("#headerX").html(unescape(globalnumpatterndata.label1));
|
||||
$("#headerX").html(globalnumpatterndata.label1);
|
||||
} else {
|
||||
$("#headerX").html("X");
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ function displaymoreoptions() {
|
|||
}
|
||||
if(Y) {
|
||||
if(globalnumpatterndata.label2) {
|
||||
$("#headerY").html(unescape(globalnumpatterndata.label2));
|
||||
$("#headerY").html(globalnumpatterndata.label2);
|
||||
} else {
|
||||
$("#headerY").html("Y");
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ function displaymoreoptions() {
|
|||
}
|
||||
if(Z) {
|
||||
if(globalnumpatterndata.label3) {
|
||||
$("#headerZ").html(unescape(globalnumpatterndata.label3));
|
||||
$("#headerZ").html(globalnumpatterndata.label3);
|
||||
} else {
|
||||
$("#headerZ").html("Z");
|
||||
}
|
||||
|
|
@ -212,8 +212,8 @@ function modifyAdvancedPattern() {
|
|||
}
|
||||
|
||||
function restoreAdvancedPattern() {
|
||||
$("#patternname").attr("readonly", true).val(unescape(globalnumpatterndata.label));
|
||||
$("#numberingmethod").attr("readonly", true).val(unescape(globalnumpatterndata.numberingmethod));
|
||||
$("#patternname").attr("readonly", true).val(globalnumpatterndata.label);
|
||||
$("#numberingmethod").attr("readonly", true).val(globalnumpatterndata.numberingmethod);
|
||||
|
||||
$("#advancedpredictionpatternt input").each(function() {
|
||||
$(this).attr("readonly", true);
|
||||
|
|
@ -222,13 +222,13 @@ function restoreAdvancedPattern() {
|
|||
var tempid = id.replace(/(\d)/, "temp$1");
|
||||
$(this).val($("#"+tempid).val());
|
||||
} else {
|
||||
$(this).val(unescape(globalnumpatterndata[id]));
|
||||
$(this).val(globalnumpatterndata[id]);
|
||||
}
|
||||
});
|
||||
$("#advancedpredictionpatternt select").each(function() {
|
||||
$(this).attr("disabled", true);
|
||||
var id = $(this).attr('id');
|
||||
$(this).val(unescape(globalnumpatterndata[id]));
|
||||
$(this).val(globalnumpatterndata[id]);
|
||||
});
|
||||
|
||||
$("#restoreadvancedpatternbutton").hide();
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
use CGI;
|
||||
use C4::Context;
|
||||
use C4::Serials::Frequency;
|
||||
use C4::Auth qw/check_cookie_auth/;
|
||||
use URI::Escape;
|
||||
use strict;
|
||||
use JSON qw( to_json );
|
||||
|
||||
my $input=new CGI;
|
||||
my $frqid=$input->param("frequency_id");
|
||||
|
|
@ -33,4 +33,4 @@ if ($auth_status ne "ok") {
|
|||
my $frequencyrecord=GetSubscriptionFrequency($frqid);
|
||||
binmode STDOUT, ":encoding(UTF-8)";
|
||||
print $input->header(-type => 'text/plain', -charset => 'UTF-8');
|
||||
print "{".join (",",map { "\"$_\":\"".uri_escape_utf8($frequencyrecord->{$_})."\"" }sort keys %$frequencyrecord)."}";
|
||||
print to_json( $frequencyrecord );
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use Modern::Perl;
|
|||
use CGI;
|
||||
use C4::Serials::Numberpattern;
|
||||
use C4::Auth qw/check_cookie_auth/;
|
||||
use URI::Escape;
|
||||
use JSON qw( to_json );
|
||||
|
||||
my $input=new CGI;
|
||||
|
||||
|
|
@ -34,6 +34,7 @@ if ($auth_status ne "ok") {
|
|||
my $numpatternid=$input->param("numberpattern_id");
|
||||
|
||||
my $numberpatternrecord=GetSubscriptionNumberpattern($numpatternid);
|
||||
|
||||
binmode STDOUT, ":encoding(UTF-8)";
|
||||
print $input->header(-type => 'text/plain', -charset => 'UTF-8');
|
||||
print "{",join (",",map {"\"$_\":\"".(uri_escape_utf8($numberpatternrecord->{$_}) // '')."\"" }sort keys %$numberpatternrecord),"}";
|
||||
print to_json( $numberpatternrecord );
|
||||
|
|
|
|||
Loading…
Reference in New Issue