{
'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?'
}
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]);
};
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) {
}
};
+ 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);
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({
<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>