"DUPE_PO_NAME_MSG" : "This name is already in use by another PO",
"DUPE_PO_NAME_LINK" : "View PO",
"PO_NAME_OPTIONAL" : "${0} (optional)",
+ "FINALIZE_PO" : "Finalize this blanket PO?\nThis will disencumber all blanket charges and mark the PO as received",
"LI_EXISTING_COPIES" : "There are ${0} existing copies for this bibliographic record at this location",
"LI_CREATING_ASSETS" : "Creating bib, call number, and copy records...",
"PO_ACTIVATING" : "Activating purchase order...",
} else {
if (PO.order_date()) {
dojo.byId("acq-po-activate-checking").innerHTML = localeStrings.PO_ALREADY_ACTIVATED;
+ checkCouldBlanketFinalize();
} else {
dojo.byId("acq-po-activate-checking").innerHTML = localeStrings.NO;
}
);
}
+function checkCouldBlanketFinalize() {
+
+ if (PO.state() == 'received') return;
+
+ var inv_types = [];
+
+ // get the unique set of invoice item type IDs
+ PO.po_items().forEach(function(item) {
+ if (inv_types.indexOf(item.inv_item_type()) == -1)
+ inv_types.push(item.inv_item_type());
+ });
+
+ if (inv_types.length == 0) return;
+
+ pcrud.search('aiit',
+ {code : inv_types, blanket : 't'}, {
+ oncomplete : function(r) {
+ r = openils.Util.readResponse(r);
+ if (r.length == 0) return;
+ openils.Util.show(dojo.byId('acq-po-finalize-links'), 'inline');
+ }
+ });
+}
+
function checkCouldActivatePo() {
var d = dojo.byId("acq-po-activate-checking");
var a = dojo.byId("acq-po-activate-links"); /* <span> not <a> now, but no diff */
);
}
+function finalizePo() {
+
+ if (!confirm(localeStrings.FINALIZE_PO)) return;
+
+ finalizePoButton.attr('disabled', true);
+
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.purchase_order.blanket.finalize'],
+ { async : true,
+ params : [openils.User.authtoken, PO.id()],
+ oncomplete : function(r) {
+ if (openils.Util.readResponse(r) == 1)
+ location.href = location.href;
+ }
+ }
+ );
+}
+
function activatePo(noAssets) {
activatePoButton.attr("disabled", true);
activatePoNoAssetsButton.attr("disabled", true);