The PO creation dialog box now has a checkbox for "prepayment required." This
will be checked or unchecked automatically when choosing a vendor from the
above dropdown based on whether that vendor's "prepayment required" value is
true. The user can override the default value for a vendor, but will face a
confirmation dialog about it.
The PO viewing interface shows whether or not a PO is marked "prepayment
required," and if it is, when the user wishes to activate the PO, there will
be another confirmation dialog reminding the user to deal with payment.
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15937
dcc99617-32d9-48b4-a31d-
7c20da2025e4
my %pargs = (ordering_agency => $e->requestor->ws_ou); # default
$pargs{provider} = $po->provider if $po->provider;
$pargs{ordering_agency} = $po->ordering_agency if $po->ordering_agency;
+ $pargs{prepayment_required} = $po->prepayment_required
+ if $po->prepayment_required;
$po = create_purchase_order($mgr, %pargs) or return $e->die_event;
my $li_ids = $$args{lineitems};
.oils-acq-po-records-author-row td { padding-left: 30px; }
.oils-acq-po-records-phys_desc-row td { padding-left: 30px; }
.oils-acq-po-records-phys_desc-row {}
+.oils-acq-po-prepay { font-weight: bold; color: #c00; }
#oils-acq-po-paging-block { width: 50%; text-align: left;}
#oils-acq-po-actions-block { width: 50%; text-align: right;}
'LI_CANCEL_CONFIRM': "Are you SURE you want to cancel this line item?",
'LID_CANCEL_CONFIRM': "Are you SURE you want to cancel this copy?",
'CANCEL_REASON': "Cancel reason",
- 'CANCEL': "Cancel"
+ 'CANCEL': "Cancel",
+ 'YES': "Yes",
+ 'NO' : "No",
+ 'VENDOR_SAYS_PREPAY_NOT_NEEDED': "The selected vendor does not necessarily require prepayment, according\nto records. Require prepayment on this PO anyway?",
+ 'VENDOR_SAYS_PREPAY_NEEDED': "The selected vendor requires prepayment, according to records.\nProceed anyway without required prepayment on this PO?",
+ 'PREPAYMENT_REQUIRED_REMINDER': "This PO requires prepayment. Are you certain you're ready to activate it?"
}
});
acqLitCreatePoSubmit.onClick = function() {
- acqLitPoCreateDialog.hide();
- self._createPO(acqLitPoCreateDialog.getValues());
+ if (self._confirmPoPrepaySituation()) {
+ acqLitPoCreateDialog.hide();
+ self._createPO(acqLitPoCreateDialog.getValues());
+ } else {
+ return false;
+ }
}
acqLitSavePlButton.onClick = function() {
}
}
- if (note.vendor_public() == "t")
+ if (openils.Util.isTrue(note.vendor_public()))
nodeByName("vendor_public", row).innerHTML =
localeStrings.VENDOR_PUBLIC;
}
}
+ this._updateCreatePoPrepayCheckbox = function(prepay) {
+ var prepay = openils.Util.isTrue(prepay);
+ this._prepayRequiredByVendor = prepay;
+ dijit.byId("acq-lit-po-prepay").attr("checked", prepay);
+ };
+
+ this._confirmPoPrepaySituation = function() {
+ var want_prepay = dijit.byId("acq-lit-po-prepay").attr("checked");
+ if (want_prepay != this._prepayRequiredByVendor) {
+ return confirm(
+ want_prepay ?
+ localeStrings.VENDOR_SAYS_PREPAY_NOT_NEEDED :
+ localeStrings.VENDOR_SAYS_PREPAY_NEEDED
+ );
+ } else {
+ return true;
+ }
+ };
+
this.applySelectedLiAction = function(action) {
var self = this;
switch(action) {
fmClass : 'acqpo',
searchFilter: {"active": "t"},
parentNode : dojo.byId('acq-lit-po-provider'),
+ dijitArgs : {
+ "onChange": function() {
+ if (this.item) {
+ self._updateCreatePoPrepayCheckbox(
+ this.item.prepayment_required
+ );
+ }
+ }
+ }
});
widget.build(
function(w) { self.createPoProviderSelector = w; }
var po = new fieldmapper.acqpo();
po.provider(this.createPoProviderSelector.attr('value'));
po.ordering_agency(this.createPoAgencySelector.attr('value'));
+ po.prepayment_required(fields.prepayment_required[0] ? true : false);
var selected = this.getSelected( (fields.create_from == 'all') );
if(selected.length == 0) return;
nodeByName("value", row).innerHTML = note.value();
- if (note.vendor_public() == "t")
+ if (openils.Util.isTrue(note.vendor_public()))
nodeByName("vendor_public", row).innerHTML =
localeStrings.VENDOR_PUBLIC;
}
}
+function makePrepayWidget(node, prepay) {
+ if (prepay) {
+ openils.Util.addCSSClass(node, "oils-acq-po-prepay");
+ node.innerHTML = localeStrings.YES;
+ } else {
+ openils.Util.removeCSSClass(node, "oils-acq-po-prepay");
+ node.innerHTML = localeStrings.NO;
+ }
+}
+
function makeCancelWidget(node, labelnode) {
openils.Util.hide("acq-po-choose-cancel-reason");
dojo.byId("acq-po-view-total-enc").innerHTML = PO.amount_encumbered();
dojo.byId("acq-po-view-total-spent").innerHTML = PO.amount_spent();
dojo.byId("acq-po-view-state").innerHTML = PO.state(); // TODO i18n
+ makePrepayWidget(
+ dojo.byId("acq-po-view-prepay"),
+ openils.Util.isTrue(PO.prepayment_required())
+ );
makeCancelWidget(
dojo.byId("acq-po-view-cancel-reason"),
dojo.byId("acq-po-cancel-label")
}
function activatePo() {
+ if (
+ openils.Util.isTrue(PO.prepayment_required()) &&
+ !confirm(localeStrings.PREPAYMENT_REQUIRED_REMINDER)
+ ) return false;
+
progressDialog.show(true);
try {
fieldmapper.standardRequest(
<td><div name='provider' id='acq-lit-po-provider'/></td>
</tr>
<tr>
+ <td>Prepayment Required</td>
+ <td><input id="acq-lit-po-prepay" name="prepayment_required" dojoType="dijit.form.CheckBox"/></td>
+ </tr>
+ <tr>
<td>All Lineitems</td>
<td><input checked='checked' name='create_from' value='all' dojoType='dijit.form.RadioButton'/></td>
</tr>
<tr><td>Total Encumbered</td><td>$<span id='acq-po-view-total-enc'/></td></tr>
<tr><td>Total Spent</td><td>$<span id='acq-po-view-total-spent'/></td></tr>
<tr><td>Status</td><td><span id='acq-po-view-state'/></td></tr>
+ <tr><td>Prepayment Required?</td><td><span id="acq-po-view-prepay"/></td></tr>
<tr>
<td id="acq-po-cancel-label"></td>
<td>