From c154d87409da9926303ab004a075bbfacd771651 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 4 Aug 2010 22:28:34 +0000 Subject: [PATCH] add Required to copy stat cat editor, add User Summary to patron stat cat editor for initial stat cat creation, and fix a bug where editing an existing copy stat cat would attempt to set usr_summary. Modified behavior a bit so that an update is attempted whenever the user presses update, and not just if data is changed (this was me punting instead of trying to modify the test for both copy and patron stat cats) git-svn-id: svn://svn.open-ils.org/ILS/trunk@17084 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../OpenILS/Application/Storage/CDBI/asset.pm | 2 +- Open-ILS/web/opac/locale/en-US/lang.dtd | 3 + .../staff_client/server/admin/stat_cat_editor.js | 69 +++++++++++++++++----- .../server/admin/stat_cat_editor.xhtml | 25 ++++++++ 4 files changed, 82 insertions(+), 17 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm index e2609ea29..63c894db4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/asset.pm @@ -56,7 +56,7 @@ use base qw/asset/; __PACKAGE__->table( 'asset_stat_cat' ); __PACKAGE__->columns( Primary => qw/id/ ); -__PACKAGE__->columns( Essential => qw/owner name opac_visible/ ); +__PACKAGE__->columns( Essential => qw/owner name opac_visible required/ ); #------------------------------------------------------------------------------- package asset::stat_cat_entry; diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index fd4d28a50..a1413abe0 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1906,6 +1906,8 @@ + + @@ -1920,6 +1922,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js index 992e1507c..ae896a73c 100644 --- a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js +++ b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js @@ -140,10 +140,13 @@ function scDraw( type, cats ) { hideMe($('sc_none')); unHideMe($('sc_table')); - if(type == 'actor') + if(type == ACTOR) { unHideMe($('sc_usr_summary_label')); - else + hideMe($('sc_required_label')); + } else { + unHideMe($('sc_required_label')); hideMe($('sc_usr_summary_label')); + } scCounter = 0; for( var c in cats ) scInsertCat( tbody, cats[c], type ); @@ -168,13 +171,19 @@ function scInsertCat( tbody, cat, type ) { else unHideMe($n(row, 'sc_opac_invisible')); - if(type == 'actor') { + if(type == ACTOR) { if(isTrue(cat.usr_summary())) unHideMe($n(row, 'sc_usr_summary_on')); else unHideMe($n(row, 'sc_usr_summary')); + hideMe($n(row, 'sc_required_td')); } else { + if(isTrue(cat.required())) + unHideMe($n(row, 'sc_required_on')); + else + unHideMe($n(row, 'sc_required')); + hideMe($n(row, 'sc_usr_summary_td')); } @@ -270,6 +279,20 @@ function scBuildNew() { var libSel = $('sc_owning_lib_selector'); var typeSel = $('sc_type_selector'); var type = getSelectorVal(typeSel); + switch(type) { + case ACTOR: + hideMe($('required_td1')); + hideMe($('required_td2')); + unHideMe($('usr_summary_td1')); + unHideMe($('usr_summary_td2')); + break; + case ASSET: + hideMe($('usr_summary_td1')); + hideMe($('usr_summary_td2')); + unHideMe($('required_td1')); + unHideMe($('required_td2')); + break; + } var org_list = PERMS[type].create_stat_cat; if(org_list.length == 0) { /* no create perms */ $('sc_new').disabled = true; @@ -287,11 +310,21 @@ function scNew() { var type = getSelectorVal($('sc_type_selector')); var visible = 0; + var required = 0; + var usr_summary = 0; if( $('sc_make_opac_visible').checked) visible = 1; + if( $('sc_make_required').checked) required = 1; + if( $('sc_make_usr_summary').checked) usr_summary = 1; var cat; - if( type == ACTOR ) cat = new actsc(); - if( type == ASSET ) cat = new asc(); + if( type == ACTOR ) { + cat = new actsc(); + cat.usr_summary( usr_summary ); + } + if( type == ASSET ) { + cat = new asc(); + cat.required( required ); + } cat.opac_visible(visible); cat.name(name); @@ -320,11 +353,16 @@ function scEdit( tbody, type, cat ) { $n(row, 'sc_edit_name').value = cat.name(); - if(type == 'actor') { + if(type == ACTOR) { var cb = $n(row, 'sc_edit_usr_summary'); cb.checked = isTrue(cat.usr_summary()); + hideMe($n(row, 'sc_edit_required_td')); + unHideMe($n(row, 'sc_edit_usr_summary_td')); } else { + var cb = $n(row, 'sc_edit_required'); + cb.checked = isTrue(cat.required()); hideMe($n(row, 'sc_edit_usr_summary_td')); + unHideMe($n(row, 'sc_edit_required_td')); } var name = $n(row, 'sc_edit_cancel'); @@ -382,23 +420,22 @@ function scEditGo( type, cat, row, selector ) { if(!name) return false; - var isvisible = false; - if( cat.opac_visible() != 0 && cat.opac_visible() != '0' ) isvisible = true; - var usr_summary = $n(row, 'sc_edit_usr_summary').checked; - - if( (name == cat.name()) && - (visible == isvisible) && - (newlib == cat.owner()) && - (usr_summary == isTrue(cat.usr_summary())) ) - return true; + var required = $n(row, 'sc_edit_required').checked; cat.name( name ); cat.owner( newlib ); cat.entries(null); cat.opac_visible(0); if( visible ) cat.opac_visible(1); - cat.usr_summary( (usr_summary) ? 1 : 0 ); + switch(type) { + case ACTOR: + cat.usr_summary( (usr_summary) ? 1 : 0 ); + break; + case ASSET: + cat.required( (required) ? 1 : 0 ); + break; + } var req = new Request( SC_UPDATE.replace(/TYPE/,type), session, cat ); req.send(true); diff --git a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.xhtml b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.xhtml index e9f63620a..c9c1e0923 100644 --- a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.xhtml @@ -83,6 +83,23 @@ + &staff.server.admin.stat_cat.required; + + &staff.server.admin.stat_cat.on; + + &staff.server.admin.stat_cat.off; + + + &staff.server.admin.stat_cat.usr_summary; + + &staff.server.admin.stat_cat.on; + + &staff.server.admin.stat_cat.off; + + + + + @@ -129,6 +146,7 @@ &staff.server.admin.stat_cat.name.label; &staff.server.admin.stat_cat.owning_library.label; &staff.server.admin.stat_cat.opac_visibility.label; + &staff.server.admin.stat_cat.required.label; &staff.server.admin.stat_cat.usr_summary.label; &staff.server.admin.stat_cat.entries.label; &staff.server.admin.stat_cat.add_entry; @@ -145,6 +163,10 @@ &staff.server.admin.stat_cat.on; &staff.server.admin.stat_cat.off; + + &staff.server.admin.stat_cat.on; + &staff.server.admin.stat_cat.off; + &staff.server.admin.stat_cat.on; &staff.server.admin.stat_cat.off; @@ -198,6 +220,9 @@ + + + -- 2.11.0