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.
'editor_base_summarize' : function(my_fms) {
var obj = this;
+ var fm_type = obj.fm_type;
/******************************************************************************************************/
/* Setup */
/******************************************************************************************************/
/* 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];
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 ] = {};
/******************************************************************************************************/
} 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');
}
}
}
}
+
obj.error.sdump('D_TRACE','summary = ' + js2JSON(obj.summary) + '\n');
},
'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',
'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
}
],
[
'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
}
]
]
'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
}
],
[
};
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];
}
},