From f0ab78fe2f5896a891ef8614f4b5b23f9f59d754 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 9 May 2011 18:27:42 +0000 Subject: [PATCH] Invoice from LI seeds invoice data * When creating a new invoice from a lineitem, seed the invoice with provider data from the lineitem. * Make money textbox's a little larger to accommodate larger sums without scrolling * Truncate long titles in lineitem summary view git-svn-id: svn://svn.open-ils.org/ILS/trunk@20448 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/css/skin/default/acq.css | 1 + Open-ILS/web/js/dojo/openils/acq/Lineitem.js | 9 ++++++++- Open-ILS/web/js/ui/default/acq/invoice/view.js | 20 +++++++++++++++++--- .../web/templates/default/acq/invoice/view.tt2 | 10 +++++----- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Open-ILS/web/css/skin/default/acq.css b/Open-ILS/web/css/skin/default/acq.css index 664976e..7844e17 100644 --- a/Open-ILS/web/css/skin/default/acq.css +++ b/Open-ILS/web/css/skin/default/acq.css @@ -214,6 +214,7 @@ span[name="notes_alert_flag"] {color: #c00;font-weight: bold;font-size: 110%;mar .acq-link-invoice-dialog td,.acq-link-invoice-dialog th {padding-top: 10px;} .acq-invoice-paid-col {background : #E0E0E0; text-align: center;} .acq-invoice-center-col { text-align: center; } +.acq-invoice-money { width: 7em; } .acq-lineitem-summary { font-weight: bold; } .acq-lineitem-summary-extra { padding-left: 10px; } diff --git a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js index a52c6c7..4d0ec80 100644 --- a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js +++ b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js @@ -181,7 +181,14 @@ openils.acq.Lineitem.fetchAndRender = function(liId, args, callback) { liLink, (po) ? 'foo' : '', // forces class='hiddenfoo' i.e. not hidden (pl) ? 'foo' : '', // ditto - ] + ], + function(str) { + // prevent long titles from filling up the page + var truncSize = 100; + if(str.length > truncSize) + str = str.substring(0, truncSize) + '...'; + return str; + } ); callback(lineitem, displayString); diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js index 38465b9..e7068b1 100644 --- a/Open-ILS/web/js/ui/default/acq/invoice/view.js +++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js @@ -133,9 +133,22 @@ function doAttachLi() { //var invoiceArgs = {provider : lineitem.provider(), shipper : lineitem.provider()}; if(cgi.param('create')) { - var invoiceArgs = {}; - invoicePane = drawInvoicePane(dojo.byId('acq-view-invoice-div'), null, invoiceArgs); + + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.lineitem.retrieve.authoritative'], + { + params : [openils.User.authtoken, attachLi, {clear_marc:1}], + oncomplete : function(r) { + var li = openils.Util.readResponse(r); + invoicePane = drawInvoicePane( + dojo.byId('acq-view-invoice-div'), null, + {provider : li.provider(), shipper : li.provider()} + ); + } + } + ); } + var entry = new fieldmapper.acqie(); entry.id(virtualId--); entry.isnew(true); @@ -283,7 +296,7 @@ function addInvoiceItem(item) { if(field == 'title' || field == 'author') { //args = {style : 'width:10em'}; } else if(field == 'cost_billed' || field == 'amount_paid') { - args = {required : true, style : 'width: 6em'}; + args = {required : true, style : 'width: 8em'}; } registerWidget( item, @@ -430,6 +443,7 @@ function addInvoiceEntry(entry) { ['inv_item_count', 'phys_item_count', 'cost_billed', 'amount_paid'], function(field) { var dijitArgs = {required : true, constraints : {min: 0}, style : 'width:6em'}; + if(!field.match(/count/)) dijitArgs.style = 'width:9em'; if(entry.isnew() && field == 'phys_item_count') { // by default, attempt to pay for all non-canceled and as-of-yet-un-invoiced items var count = Number(li.order_summary().item_count() || 0) - diff --git a/Open-ILS/web/templates/default/acq/invoice/view.tt2 b/Open-ILS/web/templates/default/acq/invoice/view.tt2 index 526577c..05920f5 100644 --- a/Open-ILS/web/templates/default/acq/invoice/view.tt2 +++ b/Open-ILS/web/templates/default/acq/invoice/view.tt2 @@ -90,7 +90,7 @@ - + Total Total Balance @@ -98,7 +98,7 @@ - + -
-
-
+
+
+
-- 1.7.2.5