<th>
<label for="acq-bu-distribution_formula">[% l("Distribution Formula") %]</label>
</th>
+ <th></th>
+ <th>
+ <span> </span>
+ </th>
+ <th>
+ <label for="acq-batch-create-note-text" class='batch-note'>[% l('Note') %] </label>
+ </th>
+ <th>
+ <span> </span>
+ </th>
+ <th>
+ <label for="acq-batch-lit-alert-alert-text" class='batch-alert'>[% l('Choose alert code ') %] </label>
+ </th>
</tr>
<tr>
<td>
<span id="acq-bu-circ_modifier"></span> OR
</td>
<td>
- <span id="acq-bu-distribution_formula"></span>
+ <span id="acq-bu-distribution_formula"></span>
+ </td>
+ <td> </td>
+ <td> </td>
+ <td>
+ <div id='batch-note-div' class='batch-note' ">
+ <div id = "acg-batch-create-note-text" jsId="acqBatchCreateNoteText" dojoType="dijit.form.Textarea" style="height: 10px; width:15em;" name="note"></div><br>
+ <label for="acq-batch-create-note-vendor-public">[% l('Note is vendor-public') %]</label>
+ <div dojoType="dijit.form.CheckBox" jsId="acqBatchCreateNoteVendorPublic" name="vendor_public" id="acq-batch-create-note-vendor-public"></div>
+ </div>
+ </td>
+ <td>
+ <span> </span>
+ </td>
+ <td>
+ <div id='batch-alert-div' class='batch-alert'">
+ <input id="acq-batch-lit-alert-alert-text" jsId="acqBatchLitAlertAlertText" dojoType="dijit.form.FilteringSelect" labelAttr="code" searchAttr="code" required="true" />
+ <br>
+ <label for="acq-batch-lit-alert-value">[% l('Alert Additional comments') %]</label> <br>
+ <div jsId="acqBatchLitAlertNoteValue" id="acq-batch-lit-alert-value" dojoType="dijit.form.Textarea" style="height: 10px; width:15em;" name="value"></div>
+ <div>
+ </td>
+ <td> </td>
+ <td> </td>
+ <td>
<span dojoType="dijit.form.Button" jsId="acqBatchUpdateApply">[% l("Apply to Selected") %]</span>
</td>
</tr>
dojo.require('dojo.date.locale');
+dojo.require('dojox.validate.check');
dojo.require('dojo.date.stamp');
dojo.require('dijit.form.Button');
dojo.require('dijit.form.TextBox');
alert(localeStrings.NO_LI_TO_UPDATE);
return;
}
+ //Get all li elements on the page
+ var liItems = self.getSelected(true, null, false);
+
+ //Add batch of notes to all list elements
+ dojo.forEach(liItems, function(li) {
+ if(li_id_list.indexOf(JSON.stringify(li.id())) == -1){return;}
+ var value = acqBatchCreateNoteText.attr('value');
+ if(!value) return;
+ var note = new fieldmapper.acqlin();
+ note.isnew(true);
+ note.vendor_public(
+ Boolean(acqBatchCreateNoteVendorPublic.attr('checked'))
+ );
+ note.value(value);
+ note.lineitem(li.id());
+ self.updateLiNotes(li, note, true);
+ });
+ acqBatchCreateNoteVendorPublic.attr("checked", false);
+ acqBatchCreateNoteText.attr("value", "");
+ var alertCodeCheck = true;
+ //Add alerts to all list elements
+ dojo.forEach(liItems, function(li) {
+ if(li_id_list.indexOf(JSON.stringify(li.id())) == -1){return;}
+ if (!acqBatchLitAlertAlertText.item) {
+ if(acqBatchLitAlertNoteValue.attr("value") && alertCodeCheck) {
+ alertCodeCheck = false;
+ alert(localeStrings.ALERT_UNSELECTED);
+ }
+ return;
+ }
+ var alert_text = new fieldmapper.acqliat().fromStoreItem(
+ acqBatchLitAlertAlertText.item
+ );
+
+ var value = acqBatchLitAlertNoteValue.attr("value") || "";
+
+ var note = new fieldmapper.acqlin();
+ note.isnew(true);
+ note.lineitem(li.id());
+ note.value(value);
+ note.alert_text(alert_text);
+
+ self.updateLiNotes(li, note, true);
+ });
+ acqBatchLitAlertNoteValue.attr("value", "");
+ acqBatchLitAlertAlertText.attr("value", "");
+
progressDialog.show(true);
progressDialog.attr("title", localeStrings.LI_BATCH_UPDATE);
}
}
);
+ location.reload(true);
};
};
this.batchUpdateChanges = function() {
var o = {};
+
+ // This will iterate over the batch apply properties, and will create
+ // an array containing values of the form (batchProp:batchValue).
dojo.forEach(
openils.Util.objectProperties(this.batchUpdateWidgets),
openils.Util.show('acq-lit-table-div');
this.focusLi();
this.refreshInlineCopies();
+ this._setBatchAlertStore();
break;
case 'info':
openils.Util.show('acq-lit-info-div');
openils.Util.show(state_cell);
};
+ this._setBatchAlertStore = function() {
+ acqBatchLitAlertAlertText.store = new dojo.data.ItemFileReadStore(
+ {
+ "data": acqliat.toStoreData(
+ this.pcrud.search(
+ "acqliat", {
+ "owning_lib": aou.orgNodeTrail(
+ aou.findOrgUnit(openils.User.user.ws_ou())
+ ).map(function(o) { return o.id(); })
+ }
+ )
+ )
+ }
+ );
+ acqBatchLitAlertAlertText.setValue(); /* make the store "live" */
+ acqBatchLitAlertAlertText._store_ready = true;
+ };
+
this._setAlertStore = function() {
acqLitAlertAlertText.store = new dojo.data.ItemFileReadStore(
/**
* Updates any new/changed/deleted notes on the server
*/
- this.updateLiNotes = function(li, newNote) {
+ this.updateLiNotes = function(li, newNote, isBatch) {
+ isBatch = isBatch || false;
var notes;
if(newNote) {
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem_note.cud.batch'],
- { async : true,
+ { async : !isBatch,
params : [this.authtoken, notes],
onresponse : function(r) {
var resp = openils.Util.readResponse(r);