<!-- <option mask='' value='batch_apply_funds'>[% l('Apply Funds to Selected Items') %]</option> XXX moving to batch updater -->
<option mask='ao|gs|vp' value='cancel_lineitems'>[% l('Cancel Selected Line Items') %]</option>
<option mask='po|ao|gs|vp' value='apply_claim_policy'>[% l('Apply Claim Policy to Selected Line Items') %]</option><!-- can the functionality desired here be covered by the next thing? -->
- <option mask='po|ao|gs|vp' value='change_claim_policy'>[% l('Change Claim Policy for Selected Line Items') %]</option>
<option mask='ao|gs|vp' value='receive_lineitems' id='receive_lineitems' disabled='disabled'>[% l('Mark Selected Line Items as Received') %]</option>
<option mask='ao|gs|vp' value='rollback_receive_lineitems' id='rollback_receive_lineitems' disabled='disabled'>[% l('Un-Receive Selected Line Items') %]</option>
<option mask='ao|gs|vp' value='batch_create_invoice'>[% l('Create Invoice From Selected Line Items') %]</option>
<span name='pl' class='hidden'> | <a title='[% l('Select List') %]' name='pl_link' href='javascript:void(0);'>❖ </a></span>
<span name='po' class='hidden'> | <a title='[% l('Purchase Order') %]' name='po_link' href='javascript:void(0);'>⌘ </a></span>
<span name="show_requests"> | <a title='[% l('Patron Requests') %]' name="show_requests_link" href="javascript:void(0);">[% l('requests') %]</a></span>
+ <span name="claim_policy" class="hidden"> | [% l("claim policy:") %] <span name="claim_policy_name"></span></span>
<span name='pro' class='hidden'> | <a title='[% l('Provider') %]' name='pro_link' href='javascript:void(0);'>⍟ </a></span>
<span name='queue' class='hidden'> | <a title='[% l('Import Queue') %]' name='queue_link' href='javascript:void(0);'>[% l('➬ queue') %]</a></span>
</td>
<option name='action_new_invoice' disabled='disabled'>[% l('New Invoice') %]</option>
<option name='action_link_invoice' disabled='disabled'>[% l('Link to Invoice') %]</option>
<option name='action_view_invoice' disabled='disabled'>[% l('View Invoice(s)') %]</option>
- <option name='action_view_claim_policy'>[% l('Apply Claim Policy') %]</option>
<option name='action_manage_claims'>[% l('Claims') %]</option>
<option name='action_view_history'>[% l('View History') %]</option>
</select>
dojo.require('dijit.form.Textarea');
dojo.require('dijit.Tooltip');
dojo.require('dijit.ProgressBar');
+dojo.require('dojox.timing.doLater');
dojo.require('openils.acq.Lineitem');
dojo.require('openils.acq.PO');
dojo.require('openils.acq.Picklist');
};
this.setClaimPolicyControl = function(li, row) {
- if (!self.claimPolicyPicker) {
- self.claimPolicyPicker = true; /* prevents a race condition */
+ if (!self._claimPolicyPickerLoading) {
+ self._claimPolicyPickerLoading = true;
+
new openils.widget.AutoFieldWidget({
"parentNode": "acq-lit-li-claim-policy",
"fmClass": "acqclp",
"selfReference": true,
"dijitArgs": {"required": true}
- }).build(function(w) { self.claimPolicyPicker = w; });
+ }).build(
+ function(w) { self.claimPolicyPicker = w; }
+ );
}
- if (!row) row = this._findLiRow(li);
-
- var actViewPolicy = nodeByName("action_view_claim_policy", row);
- if (li.claim_policy())
- actViewPolicy.innerHTML = localeStrings.CHANGE_CLAIM_POLICY;
-
- if (!actViewPolicy.onclick) {
- actViewPolicy.onclick = function() {
- if (li.claim_policy())
- self.claimPolicyPicker.attr("value", li.claim_policy());
- liClaimPolicyDialog.show();
- liClaimPolicySave.onClick = function() {
- self.changeClaimPolicy(
- [li], self.claimPolicyPicker.attr("value"),
- function() {
- self.setClaimPolicyControl(li, row);
- self.reconsiderClaimControl(li, row);
- liClaimPolicyDialog.hide();
- }
- );
- }
- };
+ /* dojox.timing.doLater() is the best thing ever. Resource not yet
+ * ready? Just repeat my whole method when it is. */
+ if (dojox.timing.doLater(self.claimPolicyPicker)) {
+ return;
+ } else {
+ if (!row)
+ row = self._findLiRow(li);
+
+ if (li.claim_policy()) {
+ /* This Dojo data dance is necessary to get a whole fieldmapper
+ * object based on a claim policy ID, since we alreay have the
+ * widget thing loaded with all that data, and can thereby
+ * avoid another request to the server. */
+ self.claimPolicyPicker.store.fetchItemByIdentity({
+ "identity": li.claim_policy(),
+ "onItem": function(a) {
+ var policy = (new acqclp()).fromStoreItem(a);
+ var span = nodeByName("claim_policy", row);
+ var inner = nodeByName("claim_policy_name", row);
+
+ openils.Util.show(span, "inline");
+ inner.innerHTML = policy.name();
+ },
+ "onError": function(e) {
+ console.error(e);
+ }
+ });
+ } else {
+ openils.Util.hide(nodeByName("claim_policy", row));
+ nodeByName("claim_policy_name", row).innerHTML = "";
+ }
}
};
this.maybeCancelLineitems();
break;
- case "change_claim_policy":
+ case "apply_claim_policy":
var li_list = this.getSelected();
this.claimPolicyPicker.attr("value", null);
liClaimPolicyDialog.show();
openils.Util.timeStamp(PO.order_date(), {formatLength:'short'})
]
);
- if(po_state == "on-order" || po_state == "cancelled") {
- dojo.removeAttr('receive_po', 'disabled');
- } else if(po_state == "received") {
- dojo.removeAttr('rollback_receive_po', 'disabled');
- }
+ /* These are handled another way now */
+// if (po_state == "on-order" || po_state == "cancelled") {
+// dojo.removeAttr('receive_lineitems', 'disabled');
+// } else if(po_state == "received") {
+// dojo.removeAttr('rollback_receive_lineitems', 'disabled');
+// }
/* cancel widgets only make sense for activate (ordered) POs */
makeCancelWidget(