From 5ec31496a2343b9230f025a61501bdf0858b4620 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Thu, 17 Dec 2009 07:40:06 +0000 Subject: [PATCH] Org unit setting for requiring staff initials with copy/patron notes, and I18N for similar setting for standing penalties. Implemented the initial fields for copy/patron notes. Localizable format for staff initials, and option for an initials date (though it's %F format for saving space and not localized). Removed the "Note added." speedbump alerts. git-svn-id: svn://svn.open-ils.org/ILS/trunk@15183 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 9 +++++++-- .../0117.data.org-setting-notes-require-initials.sql | 11 +++++++++++ Open-ILS/xul/staff_client/server/cat/copy_notes.xul | 19 ++++++++++--------- .../staff_client/server/locale/en-US/cat.properties | 2 +- .../server/locale/en-US/common.properties | 2 ++ .../server/locale/en-US/patron.properties | 2 +- .../server/patron/edit_standing_penalty.js | 3 ++- .../xul/staff_client/server/patron/info_notes.xul | 14 ++++++++------ .../server/patron/new_standing_penalty.js | 3 ++- 10 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0117.data.org-setting-notes-require-initials.sql diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 4d8d346fb8..8714fad168 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0116'); -- Scott McKellar +INSERT INTO config.upgrade_log (version) VALUES ('0117'); -- phasefx CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 64a2e25d43..096bc2722e 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -1719,8 +1719,13 @@ INSERT into config.org_unit_setting_type 'bool' ), ( 'ui.circ.standing_penalty.require_initials', - 'Require staff initials for entry/edit of standing penalties.', - null, + oils_i18n_gettext('ui.circ.standing_penalty.require_initials', 'GUI: Require staff initials for entry/edit of standing penalties.', 'coust', 'label'), + oils_i18n_gettext('ui.circ.standing_penalty.require_initials', 'Appends staff initials and edit date into penalty note.', 'coust', 'description'), + 'bool' ), + +( 'ui.circ_and_cat.notes.require_initials', + oils_i18n_gettext('ui.circ_and_cat.notes.require_initials', 'GUI: Require staff initials for entry/edit of item and patron notes.', 'coust', 'label'), + oils_i18n_gettext('ui.circ_and_cat.notes.require_initials', 'Appends staff initials and edit date into note content.', 'coust', 'description'), 'bool' ), ( 'ui.general.button_bar', diff --git a/Open-ILS/src/sql/Pg/upgrade/0117.data.org-setting-notes-require-initials.sql b/Open-ILS/src/sql/Pg/upgrade/0117.data.org-setting-notes-require-initials.sql new file mode 100644 index 0000000000..9bb2d07116 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0117.data.org-setting-notes-require-initials.sql @@ -0,0 +1,11 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0117'); -- phasefx + +INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES +( 'ui.circ_and_cat.notes.require_initials', + oils_i18n_gettext('ui.circ_and_cat.notes.require_initials', 'GUI: Require staff initials for entry/edit of item and patron notes.', 'coust', 'label'), + oils_i18n_gettext('ui.circ_and_cat.notes.require_initials', 'Appends staff initials and edit date into note content.', 'coust', 'description'), + 'bool' ); + +COMMIT; diff --git a/Open-ILS/xul/staff_client/server/cat/copy_notes.xul b/Open-ILS/xul/staff_client/server/cat/copy_notes.xul index 1d9d0b5cf6..a3dd7b2b9a 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_notes.xul +++ b/Open-ILS/xul/staff_client/server/cat/copy_notes.xul @@ -159,35 +159,36 @@ <rows> \ <row><label value="' + $('catStrings').getString('staff.cat.copy_notes.new_note.public') + '"/><checkbox id="pub" name="fancy_data" checked="false"/></row> \ <row><label value="' + $('catStrings').getString('staff.cat.copy_notes.new_note.title') + '"/><textbox id="title" name="fancy_data" context="clipboard"/></row> \ - <row><label value="' + $('catStrings').getString('staff.cat.copy_notes.new_note.note') + '"/><textbox multiline="true" id="note" name="fancy_data" context="clipboard"/></row> \ - <row><spacer/><hbox> \ + <row><label value="' + $('catStrings').getString('staff.cat.copy_notes.new_note.note') + '"/><textbox multiline="true" id="note" name="fancy_data" context="clipboard"/></row>'; + var show_initials = String( g.data.hash.aous['ui.circ_and_cat.notes.require_initials'] ) == 'true'; + if (show_initials) { + xml += '<row><label value="'+$("catStrings").getString('staff.cat.copy_notes.new_note.initials')+'"/><textbox id="initials" name="fancy_required_data" context="clipboard"/></row>'; + } + xml += '<row><spacer/><hbox> \ <button label="' + $('catStrings').getString('staff.cat.copy_notes.new_note.cancel.label') + '" name="fancy_cancel" accesskey="' + $('catStrings').getString('staff.cat.copy_notes.new_note.cancel.accesskey') + '"/> \ <button label="' + $('catStrings').getString('staff.cat.copy_notes.new_note.add_note.label') + '" accesskey="' + $('catStrings').getString('staff.cat.copy_notes.new_note.add_note.accesskey') + '" name="fancy_submit"/></hbox></row> \ </rows></grid></groupbox>'; - //g.data.init({'via':'stash'}); - //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml'); JSAN.use('util.window'); var win = new util.window(); var fancy_prompt_data = win.open( urls.XUL_FANCY_PROMPT, - //+ '?xml_in_stash=temp_note_xml' - //+ '&focus=' + window.escape('title') - //+ '&title=' + window.escape('Add Note'), 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'focus' : 'title', 'title' : $('catStrings').getString('staff.cat.copy_notes.new_note.add_note.label') } ); - //g.data.init({'via':'stash'}); if (fancy_prompt_data.fancy_status == 'complete') { //alert(js2JSON(g.data.fancy_prompt_data)); var note = new acpn(); note.isnew(1); note.title( fancy_prompt_data.title ); + if (fancy_prompt_data.initials) { + fancy_prompt_data.note = fancy_prompt_data.note + + $("commonStrings").getFormattedString('staff.initials.format',[fancy_prompt_data.initials,util.date.formatted_date(new Date(),'%F')]); + } note.value( fancy_prompt_data.note ); note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() ); note.owning_copy( g.copy_id ); var r = g.network.simple_request('FM_ACPN_CREATE',[ ses(), note ]); if (typeof r.ilsevent != 'undefined') throw(r); setTimeout(function() { - alert($('catStrings').getString('staff.cat.copy_notes.new_note.success')); refresh();},0 ); } diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties index 7312dafd07..13dc92ae29 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -211,11 +211,11 @@ staff.cat.copy_notes.new_note.label=New Note staff.cat.copy_notes.new_note.public=Public? staff.cat.copy_notes.new_note.title=Title staff.cat.copy_notes.new_note.note=Note +staff.cat.copy_notes.new_note.initials=Initials staff.cat.copy_notes.new_note.cancel.label=Cancel staff.cat.copy_notes.new_note.cancel.accesskey=C staff.cat.copy_notes.new_note.add_note.label=Add Note staff.cat.copy_notes.new_note.add_note.accesskey=A -staff.cat.copy_notes.new_note.success=Note added. staff.cat.copy_notes.new_note.error=The note was not likely created. staff.cat.copy_summary.copy_id=Copy ID = %1$s staff.cat.copy_summary.total_circs.label=Total Circs diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties index 018fcda21c..03b1174b8f 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties @@ -27,6 +27,8 @@ openils.global_util.clipboard=Copied "%1$s" to clipboard. openils.global_util.content_window_jsobject.error=Error with get_contentWindow(%1$s) and wrappedJSObject: %2$s openils.global_util.content_window.error=Error with get_contentWindow(%1$s): %2$s openils.global_util.font_size.error=Error adjusting the font size: %1$s +# Appended to notes with certain settings enabled. First position is staff initials, and second position is a date for when the initials were added. +staff.initials.format= [ %1$s %2$s ] staff.acp_label_barcode=Barcode staff.acp_label_call_number=Call Number staff.acp_label_circ_as_type=Circulate As Type diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 9567f08577..771e28ceef 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -259,12 +259,12 @@ staff.patron.info_notes.new_note.label=New Note staff.patron.info_notes.new_note.patron_visible.value=Patron Visible? staff.patron.info_notes.new_note.title.value=Title staff.patron.info_notes.new_note.note.value=Note +staff.patron.info_notes.new_note.initials.value=Initials staff.patron.info_notes.new_note.cancel.label=Cancel staff.patron.info_notes.new_note.cancel.accesskey=C staff.patron.info_notes.new_note.add.label=Add Note staff.patron.info_notes.new_note.add.accesskey=A staff.patron.info_notes.new_note.add_note_title=Add Note -staff.patron.info_notes.new_note.add_note_title=Note added. staff.patron.info_notes.new_note.note_not_created=The note was not likely created. staff.patron.info_stat_cats.retrieve_fleshed_patron.failed=Failed to retrieve patron stat cats. staff.patron.info_stat_cats.render_stat_cats.opac_visible=OPAC Visible diff --git a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js index 5445826c47..5a4fff06b1 100644 --- a/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js +++ b/Open-ILS/xul/staff_client/server/patron/edit_standing_penalty.js @@ -93,7 +93,8 @@ function edit_penalty_init() { if (initials_tb.value == '') { initials_tb.focus(); return; } else { - note = note + ' - ' + initials_tb.value; + JSAN.use('util.date'); + note = note + commonStrings.getFormattedString('staff.initials.format',[initials_tb.value,util.date.formatted_date(new Date(),'%F')]); } } update_modal_xulG( diff --git a/Open-ILS/xul/staff_client/server/patron/info_notes.xul b/Open-ILS/xul/staff_client/server/patron/info_notes.xul index 65789536ae..f856cba5f6 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_notes.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_notes.xul @@ -192,18 +192,17 @@ xml += '<label value="'+$("patronStrings").getString('staff.patron.info_notes.new_note.patron_visible.value')+'"/><checkbox id="pub" name="fancy_data"/></row>'; xml += '<row><label value="'+$("patronStrings").getString('staff.patron.info_notes.new_note.title.value')+'"/><textbox id="title" name="fancy_data" context="clipboard"/></row>'; xml += '<row><label value="'+$("patronStrings").getString('staff.patron.info_notes.new_note.note.value')+'"/><textbox multiline="true" id="note" name="fancy_data" context="clipboard"/></row>'; + var show_initials = String( g.data.hash.aous['ui.circ_and_cat.notes.require_initials'] ) == 'true'; + if (show_initials) { + xml += '<row><label value="'+$("patronStrings").getString('staff.patron.info_notes.new_note.initials.value')+'"/><textbox id="initials" name="fancy_required_data" context="clipboard"/></row>'; + } xml += '<row><spacer/><hbox><button label="'+$("patronStrings").getString('staff.patron.info_notes.new_note.cancel.label')+'" name="fancy_cancel"'; xml += ' accesskey="'+$("patronStrings").getString('staff.patron.info_notes.new_note.cancel.accesskey')+'"/>'; xml += '<button label="'+$("patronStrings").getString('staff.patron.info_notes.new_note.add.label')+'"'; xml += ' accesskey="'+$("patronStrings").getString('staff.patron.info_notes.new_note.add.accesskey')+'" name="fancy_submit"/></hbox></row></rows></grid></groupbox>'; - //g.data.init({'via':'stash'}); - //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml'); JSAN.use('util.window'); var win = new util.window(); var fancy_prompt_data = win.open( urls.XUL_FANCY_PROMPT, - //+ '?xml_in_stash=temp_note_xml' - //+ '&focus=' + window.escape('title') - //+ '&title=' + window.escape('Add Note'), 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'focus' : 'title', 'title' : $("patronStrings").getString('staff.patron.info_notes.new_note.add_note_title') } ); @@ -212,6 +211,10 @@ var note = new aun(); note.isnew(1); note.title( fancy_prompt_data.title ); + if (fancy_prompt_data.initials) { + fancy_prompt_data.note = fancy_prompt_data.note + + $("commonStrings").getFormattedString('staff.initials.format',[fancy_prompt_data.initials,util.date.formatted_date(new Date(),'%F')]); + } note.value( fancy_prompt_data.note ); note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() ); note.usr( g.patron_id ); @@ -219,7 +222,6 @@ if (typeof r.ilsevent != 'undefined') throw(r); setTimeout(function(){ g.new_note = true; - alert($("patronStrings").getString('staff.patron.info_notes.new_note.add_note_title')); refresh(); },0); } diff --git a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js index d3c56ec0f6..c1ac8aab4e 100644 --- a/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js +++ b/Open-ILS/xul/staff_client/server/patron/new_standing_penalty.js @@ -75,7 +75,8 @@ function new_penalty_init() { if (initials_tb.value == '') { initials_tb.focus(); return; } else { - note = note + ' - ' + initials_tb.value; + JSAN.use('util.date'); + note = note + commonStrings.getFormattedString('staff.initials.format',[initials_tb.value,util.date.formatted_date(new Date(),'%F')]); } } update_modal_xulG( -- 2.11.0