From 75d1773d541f7e4eeabcf41aa02f4d5d5734ea17 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 23 Jun 2006 21:46:40 +0000 Subject: [PATCH] added in_house flag editing git-svn-id: svn://svn.open-ils.org/ILS/trunk@4768 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../xul/staff_client/server/admin/non_cat_types.js | 38 ++++++++++++++------- .../staff_client/server/admin/non_cat_types.xhtml | 39 ++++++++++++++++++---- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/admin/non_cat_types.js b/Open-ILS/xul/staff_client/server/admin/non_cat_types.js index d9dce429ca..757c2a009e 100644 --- a/Open-ILS/xul/staff_client/server/admin/non_cat_types.js +++ b/Open-ILS/xul/staff_client/server/admin/non_cat_types.js @@ -49,7 +49,9 @@ function ncCreateNew() { var org = getSelectorVal($('nc_new_owner')); var time = $('nc_new_interval_count').value; var type = getSelectorVal($('nc_new_interval_type')); - var req = new Request(CREATE_NON_CAT_TYPE, SESSION, name, org, time + ' ' + type ); + var inh = $('nc_new_inhouse').checked ? 1 : null; + + var req = new Request(CREATE_NON_CAT_TYPE, SESSION, name, org, time + ' ' + type, inh ); req.send(true); var res = req.result(); if(checkILSEvent(res)) throw res; @@ -79,9 +81,11 @@ function ncDisplayTypes(r) { var org = findOrgUnit( type.owning_lib() ); var row = rowTemplate.cloneNode(true); + row.id = 'nc_row_' + type.id(); $n(row, 'nc_name').appendChild(text(type.name())); $n(row, 'nc_owner').appendChild(text(org.name())); + $n(row, 'nc_inhouse').checked = isTrue(type.in_house()); var idata = _splitInterval(type.circ_duration()); $n(row, 'nc_interval_count').value = idata[0]; @@ -97,21 +101,26 @@ function _splitInterval( interval ) { interval = interval.split(/ /); var time = interval[0]; var type = interval[1]; - if( time.match(/:/) ) return [ time.replace(/(\d{2}):\d{2}:\d{2}/,'$1'), 'hours' ]; - if( type.match(/h/) ) return [ time, 'hours' ]; - if( type.match(/d/) ) return [ time, 'days' ]; - if( type.match(/w/) ) return [ time, 'weeks' ]; - if( type.match(/m/) ) return [ time, 'months' ]; + + if( time.match(/:/) ) { + var d = time.split(/:/); + if(d[0] == '00') return [ d[1], 'minutes' ]; + if(d[0] != '00' && d[1] != '00') + return [ parseInt(d[1]) + (d[0]*60), 'minutes' ]; + return [ d[0], 'hours' ] + } + + if( type.match(/mi/i) ) return [ time, 'minutes' ]; + if( type.match(/h/i) ) return [ time, 'hours' ]; + if( type.match(/d/i) ) return [ time, 'days' ]; + if( type.match(/w/i) ) return [ time, 'weeks' ]; + if( type.match(/mo/i) ) return [ time, 'months' ]; } function ncSetRowCallbacks( type, owner, tbody, row ) { checkDisabled( $n(row, 'nc_edit'), owner, 'UPDATE_NON_CAT_TYPE'); - /* - mydepth = findOrgDepth( PERMS['DELETE_NON_CAT_TYPE'] ); - if( mydepth != -1 && mydepth <= tdepth ) $n(row, 'nc_delete').disabled = false; - */ checkDisabled( $n(row, 'nc_delete'), owner, 'DELETE_NON_CAT_TYPE' ); $n(row, 'nc_edit').onclick = @@ -132,11 +141,15 @@ function ncEditType( tbody, row, type ) { $n(row, 'nc_edit_interval_count').value = idata[0]; setSelector( $n(row, 'nc_edit_interval_type'), idata[1]); + $n(row, 'nc_edit_inhouse').checked = isTrue(type.in_house()); + $n(row, 'nc_edit_owner').appendChild(text( findOrgUnit(type.owning_lib()).name() )); + $n(row, 'nc_edit_submit').onclick = function() { var name = $n(row, 'nc_edit_name').value; var time = $n(row, 'nc_edit_interval_count').value; var tp = getSelectorVal($n(row, 'nc_edit_interval_type')); - ncEditSubmit( type, name, time + ' ' + tp ); + var inh = $n(row, 'nc_edit_inhouse').checked ? 't' : 'f'; + ncEditSubmit( type, name, time + ' ' + tp, inh ); }; $n(row, 'nc_edit_cancel').onclick = @@ -150,10 +163,11 @@ function ncEditType( tbody, row, type ) { name.select(); } -function ncEditSubmit( type, name, interval ) { +function ncEditSubmit( type, name, interval, inhouse ) { if(!name) return; type.name(name); type.circ_duration(interval); + type.in_house(inhouse); var req = new Request( UPDATE_NON_CAT_TYPE, SESSION, type ); req.send(true); var res = req.result(); diff --git a/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml b/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml index ef5da6064a..dd16ec144f 100644 --- a/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml @@ -35,22 +35,27 @@
- +
- + + @@ -65,6 +70,7 @@ + @@ -74,14 +80,18 @@ + @@ -92,22 +102,33 @@
Create a new non-cataloged type
Create a new non-cataloged type
- + Circulate In-House? + (??) + +
Name Owning Location DurationCirculate In House Edit Delete
- + + +
- + + + + + +
+ + + - + + + @@ -121,6 +142,12 @@ Are you sure you wish to delete the select non cataloged type? + + If the 'In-House' flag is set on a non-cataloged type, items that circulate as + that type will create "In-House" circulations. This is ideal for computer use, + room "rentals", etc. + + -- 2.11.0