[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. 3a36550a2172683f16a271e3070e35690cf59014
Evergreen Git
git at git.evergreen-ils.org
Mon Jun 13 15:07:02 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_0 has been updated
via 3a36550a2172683f16a271e3070e35690cf59014 (commit)
from 131957cd2676b17085905e5e10be87234c563bf9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3a36550a2172683f16a271e3070e35690cf59014
Author: Dan Wells <dbw2 at calvin.edu>
Date: Tue Jun 7 12:06:57 2011 -0400
Support for required fields in Serial Control editors
Adds a basic check for any fields marked as 'required', and alerts and
prevents submitting if they are blank.
Signed-off-by: Dan Wells <dbw2 at calvin.edu>
diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
index be7fef6..2b01ddb 100644
--- a/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
+++ b/Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
@@ -77,6 +77,7 @@ staff.serial.manage_subs.delete_ssub.confirm=Are you sure you would like to dele
staff.serial.manage_subs.delete_ssub.confirm.plural=Are you sure you would like to delete these %1$s subscriptions?
staff.serial.manage_subs.delete_ssub.title=Delete Subscriptions?
staff.serial.manage_subs.delete_ssub.override=Override Delete Failure? Doing so will delete all related data as well!
+staff.serial.required_fields_alert=These fields are required:
batch_receive.bib_lookup.empty=Enter a search term.
batch_receive.bib_lookup.multiple=Multiple matching records found. Please use a more specific identifier, or use the catalog to find the exact record you want.
batch_receive.bib_lookup.not_found=No matching records found with any subscriptions attached.
diff --git a/Open-ILS/xul/staff_client/server/serial/editor_base.js b/Open-ILS/xul/staff_client/server/serial/editor_base.js
index efc08fd..2d5ae08 100644
--- a/Open-ILS/xul/staff_client/server/serial/editor_base.js
+++ b/Open-ILS/xul/staff_client/server/serial/editor_base.js
@@ -249,6 +249,7 @@ serial.editor_base = {
'editor_base_summarize' : function(my_fms) {
var obj = this;
+ var fm_type = obj.fm_type;
/******************************************************************************************************/
/* Setup */
@@ -262,6 +263,8 @@ serial.editor_base = {
/******************************************************************************************************/
/* Loop through the field names */
+ obj.missing_required = [];
+
for (var i = 0; i < obj.field_names.length; i++) {
var field_name = obj.field_names[i][0];
@@ -269,6 +272,7 @@ serial.editor_base = {
var attr = obj.field_names[i][1].attr;
var value_key = obj.field_names[i][1].value_key;
var dropdown_key = obj.field_names[i][1].dropdown_key;
+ var required = obj.field_names[i][1].required;
obj.summary[ field_name ] = {};
/******************************************************************************************************/
@@ -293,9 +297,14 @@ serial.editor_base = {
} else if (value_key) {
obj.editor_values[value_key] = value;
}
+ if (required && value == "") {
+ obj.missing_required.push(fieldmapper.IDL.fmclasses[fm_type].field_map[field_name].label); //TODO: consider applying a style
+ }
+
if (value == "") {
value = $('serialStrings').getString('serial.editor_base.unset');
}
+
} catch(E) {
obj.error.sdump('D_ERROR','Attempted ' + cmd + '\n' + E + '\n');
}
@@ -313,6 +322,7 @@ serial.editor_base = {
}
}
}
+
obj.error.sdump('D_TRACE','summary = ' + js2JSON(obj.summary) + '\n');
},
@@ -540,11 +550,16 @@ serial.editor_base = {
'editor_base_save' : function(update_method) {
var obj = this;
var fm_type_plural = obj.fm_type_plural;
- var fm_type= obj.fm_type;
+ var fm_type = obj.fm_type;
try {
if (obj.handle_update) {
try {
+ if (obj.missing_required.length > 0) {
+ alert($('serialStrings').getString('staff.serial.required_fields_alert') + obj.missing_required.join(', '));
+ return; //stop submission
+ }
+
//send fms to the update function
var r = obj.network.request(
'open-ils.serial',
diff --git a/Open-ILS/xul/staff_client/server/serial/scap_editor.js b/Open-ILS/xul/staff_client/server/serial/scap_editor.js
index e92e354..32b127c 100644
--- a/Open-ILS/xul/staff_client/server/serial/scap_editor.js
+++ b/Open-ILS/xul/staff_client/server/serial/scap_editor.js
@@ -83,7 +83,8 @@ serial.scap_editor.prototype = {
'type',
{
input: 'c = function(v){ obj.apply("type",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ ["basic", "basic"], ["index", "index"], ["supplement", "supplement"] ] ); x.setAttribute("value",obj.editor_values.type); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- value_key: 'type'
+ value_key: 'type',
+ required: true
}
],
[
@@ -99,7 +100,8 @@ serial.scap_editor.prototype = {
'pattern_code',
{
input: 'c = function(v){ obj.apply("pattern_code",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("multiline",true); x.setAttribute("cols",40); x.setAttribute("value",obj.editor_values.pattern_code); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- value_key: 'pattern_code'
+ value_key: 'pattern_code',
+ required: true
}
]
]
diff --git a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
index 142899e..780ad86 100644
--- a/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
+++ b/Open-ILS/xul/staff_client/server/serial/sdist_editor.js
@@ -155,7 +155,8 @@ serial.sdist_editor.prototype = {
'label',
{
input: 'c = function(v){ obj.apply("label",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("value",obj.editor_values.label); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
- value_key: 'label'
+ value_key: 'label',
+ required: true
}
],
[
@@ -239,6 +240,7 @@ serial.sdist_editor.prototype = {
};
for (i in obj.panes_and_field_names) {
obj.panes_and_field_names[obj.xul_id_prefix + i] = obj.panes_and_field_names[i];
+ delete obj.panes_and_field_names[i];
}
},
-----------------------------------------------------------------------
Summary of changes:
.../server/locale/en-US/serial.properties | 1 +
.../xul/staff_client/server/serial/editor_base.js | 17 ++++++++++++++++-
.../xul/staff_client/server/serial/scap_editor.js | 6 ++++--
.../xul/staff_client/server/serial/sdist_editor.js | 4 +++-
4 files changed, 24 insertions(+), 4 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list