Bug 9529

Summary: Adding a patron shows javascript on screen under login section
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart+koha>
Severity: major    
Priority: P5 - low CC: bgkriegel, gmcharlt, jonathan.druart+koha, kyle.m.hall
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 9556    
Attachments: Bug 9529 - Adding a patron shows javascript on screen under login section
Bug 9529 - Adding a patron shows javascript on screen under login section
Bug 9529 - Adding a patron shows javascript on screen under login section

Description Marcel de Rooy 2013-02-01 11:16:35 UTC
Add patron shows under login section a html script tag in memberentry_messaging_prefs:

/ *').change(function() { message_prefs_dirty = true; }); $('#categorycode').change(function() { var categorycode = $(this).val(); if (message_prefs_dirty) { if (!confirm('Change messaging preferences to default for this category?')) { return; } } $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, function(data) { $.each(data.messaging_preferences, function(i, item) { var attrid = item.message_attribute_id; var transports = ['email', 'rss', 'sms']; $.each(transports, function(j, transport) { if (item['transport-' + transport] != ' ') { $('#' + transport + attrid).attr('checked', item['transport-' + transport]); } else { $('#' + transport + attrid).removeAttr('checked'); } }); if (item.digest && item.digest != ' ') { $('#digest' + attrid).attr('checked', item.digest); } else { $('#digest' + attrid).removeAttr('checked'); } if (item.takes_days == '1') { $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); } }); message_prefs_dirty = false; } ); }); }); //]]>
Comment 1 Bernardo Gonzalez Kriegel 2013-02-01 12:07:44 UTC
This appears with EnhancedMessagingPreferences set to Allow.
The code is in koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
The JS code can be hidden with <!-- ... -->.
The confirm message needs to be between " (double quotes), can't produce a situation to trigger it. Don't know if this code is used.
Comment 2 Owen Leonard 2013-02-06 15:08:03 UTC Comment hidden (obsolete)
Comment 3 Galen Charlton 2013-02-06 15:32:21 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2013-02-07 10:56:17 UTC
Created attachment 15130 [details] [review]
Bug 9529 - Adding a patron shows javascript on screen under login section

A typo in my patch for Bug 9265 (HTML5 switch) left an extra quotation
mark in a  <script> tag on the patron entry form, causing JavaScript
code to be output as text instead of interpreted. This patch corrects
it.

To test, apply the patch, enable EnhancedMessagingPreferences, and load
the patron entry form. You should see no JavaScript on screen around
the 'Patron messaging preferences' fieldset.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 5 Jared Camins-Esakov 2013-02-07 12:21:23 UTC
This patch has been pushed to master.