From: senator Date: Tue, 23 Mar 2010 16:00:26 +0000 (+0000) Subject: Acq: optionally mark POs as prepayment_required; show/confirm it where needed X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c777dba27db0208ba30a6095d6a6d53ff5b06a58;p=evergreen%2Fbjwebb.git Acq: optionally mark POs as prepayment_required; show/confirm it where needed 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 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm index 36bf5ef70..d61f720d2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm @@ -1433,6 +1433,8 @@ sub create_purchase_order_api { 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}; diff --git a/Open-ILS/web/css/skin/default/acq.css b/Open-ILS/web/css/skin/default/acq.css index f0d436b5f..d1a2bd41c 100644 --- a/Open-ILS/web/css/skin/default/acq.css +++ b/Open-ILS/web/css/skin/default/acq.css @@ -60,6 +60,7 @@ .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;} diff --git a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js index fdb5b3958..4eeab76cf 100644 --- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js +++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js @@ -32,5 +32,10 @@ '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?" } diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 63849f529..b4f97d404 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -68,8 +68,12 @@ function AcqLiTable() { }); acqLitCreatePoSubmit.onClick = function() { - acqLitPoCreateDialog.hide(); - self._createPO(acqLitPoCreateDialog.getValues()); + if (self._confirmPoPrepaySituation()) { + acqLitPoCreateDialog.hide(); + self._createPO(acqLitPoCreateDialog.getValues()); + } else { + return false; + } } acqLitSavePlButton.onClick = function() { @@ -456,7 +460,7 @@ function AcqLiTable() { } } - if (note.vendor_public() == "t") + if (openils.Util.isTrue(note.vendor_public())) nodeByName("vendor_public", row).innerHTML = localeStrings.VENDOR_PUBLIC; @@ -1485,6 +1489,25 @@ function AcqLiTable() { } } + 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) { @@ -1501,6 +1524,15 @@ function AcqLiTable() { 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; } @@ -1829,6 +1861,7 @@ function AcqLiTable() { 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; diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js index 60c55886d..72e7ce154 100644 --- a/Open-ILS/web/js/ui/default/acq/po/view_po.js +++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js @@ -46,7 +46,7 @@ function AcqPoNoteTable() { 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; @@ -187,6 +187,16 @@ function cancellationUpdater(r) { } } +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"); @@ -246,6 +256,10 @@ function renderPo() { 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") @@ -299,6 +313,11 @@ params: [openils.User.authtoken, {purchase_order:poId}, {flesh_attrs:true, flesh } function activatePo() { + if ( + openils.Util.isTrue(PO.prepayment_required()) && + !confirm(localeStrings.PREPAYMENT_REQUIRED_REMINDER) + ) return false; + progressDialog.show(true); try { fieldmapper.standardRequest( diff --git a/Open-ILS/web/templates/default/acq/common/li_table.tt2 b/Open-ILS/web/templates/default/acq/common/li_table.tt2 index 0600347d3..3617fbbe5 100644 --- a/Open-ILS/web/templates/default/acq/common/li_table.tt2 +++ b/Open-ILS/web/templates/default/acq/common/li_table.tt2 @@ -302,6 +302,10 @@
+ Prepayment Required + + + All Lineitems diff --git a/Open-ILS/web/templates/default/acq/po/view.tt2 b/Open-ILS/web/templates/default/acq/po/view.tt2 index 4c20b5659..4c43c7afc 100644 --- a/Open-ILS/web/templates/default/acq/po/view.tt2 +++ b/Open-ILS/web/templates/default/acq/po/view.tt2 @@ -13,6 +13,7 @@ Total Encumbered$ Total Spent$ Status + Prepayment Required?