[open-ils-commits] r14328 - in trunk/Open-ILS/web: js/dojo/openils/acq/nls js/ui/default/acq/common templates/default/acq/common (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Oct 9 11:28:55 EDT 2009
Author: erickson
Date: 2009-10-09 11:28:52 -0400 (Fri, 09 Oct 2009)
New Revision: 14328
Modified:
trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
when adding copies to a lineitem, you can now choose the total count instead of having to X copies
Modified: trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js 2009-10-09 12:50:16 UTC (rev 14327)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js 2009-10-09 15:28:52 UTC (rev 14328)
@@ -1,5 +1,6 @@
{
'CREATE_PO_ASSETS_CONFIRM' : "This will create bibliographic, call number, and copy records for this purchase order in the ILS.\n\nContinue?",
'ROLLBACK_PO_RECEIVE_CONFIRM' : "This will rollback receipt of all copies for this purchase order.\n\nContinue?",
- 'XUL_RECORD_DETAIL_PAGE' : 'Record Details'
+ 'XUL_RECORD_DETAIL_PAGE' : 'Record Details',
+ 'DELETE_LI_COPIES_CONFIRM' : 'This will delete the last ${0} copies in the table. Proceed?'
}
Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-10-09 12:50:16 UTC (rev 14327)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js 2009-10-09 15:28:52 UTC (rev 14328)
@@ -492,6 +492,7 @@
acqLitSaveCopies.onClick = function() { self.saveCopyChanges(liId) };
acqLitBatchUpdateCopies.onClick = function() { self.batchCopyUpdate() };
+ acqLitCopyCountInput.attr('value', '0');
while(this.copyTbody.childNodes[0])
this.copyTbody.removeChild(this.copyTbody.childNodes[0]);
@@ -572,11 +573,29 @@
};
this._drawCopies = function(li) {
+ var self = this;
+
+ // this button sets the total number of copies for a given lineitem
acqLitAddCopyCount.onClick = function() {
var count = acqLitCopyCountInput.attr('value');
- for(var i = 0; i < count; i++)
+
+ // add new rows
+ while(self.copyCount() < count)
self.addCopy(li);
+
+ // delete rows if necessary
+ var diff = self.copyCount() - count;
+ if(diff > 0) {
+ var rows = dojo.query('tr', self.copyTbody).reverse().slice(0, diff);
+ if(confirm(dojo.string.substitute(localeStrings.DELETE_LI_COPIES_CONFIRM, [diff]))) {
+ dojo.forEach(rows, function(row) {self.deleteCopy(row); });
+ } else {
+ acqLitCopyCountInput.attr('value', self.copyCount()+'');
+ }
+ }
}
+
+
if(li.lineitem_details().length > 0) {
dojo.forEach(li.lineitem_details(),
function(copy) {
@@ -588,6 +607,15 @@
}
};
+ this.copyCount = function() {
+ var count = 0;
+ for(var id in this.copyCache) {
+ if(!this.copyCache[id].isdeleted())
+ count++;
+ }
+ return count;
+ }
+
this.virtCopyId = -1;
this.addCopy = function(li, copy) {
var row = this.copyRow.cloneNode(true);
@@ -605,6 +633,8 @@
row.setAttribute('copy_id', copy.id());
self.copyWidgetCache[copy.id()] = {};
+ acqLitCopyCountInput.attr('value', self.copyCount()+'');
+
dojo.forEach(liDetailFields,
function(field) {
var widget = new openils.widget.AutoFieldWidget({
Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-10-09 12:50:16 UTC (rev 14327)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2 2009-10-09 15:28:52 UTC (rev 14328)
@@ -170,9 +170,9 @@
<td style='text-align:left;'>
<div dojoType='dijit.form.Button' id='acq-lit-copies-back-button'>↖ Return</div>
<span style='margin-left:10px;padding-left:10px;border-left:2px solid #aaa;'>
- Add items:
+ Item Count:
<input dojoType='dijit.form.NumberTextBox' jsId='acqLitCopyCountInput'
- constraints="{min:1,max:1000,places:0}" style='width:40px' value='1'></input>
+ constraints="{min:0,max:1000,places:0}" style='width:40px' value='0'></input>
<div dojoType='dijit.form.Button' jsId='acqLitAddCopyCount'>Go</div>
</span>
</td>
More information about the open-ils-commits
mailing list