Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/90 error occurs on receive shipment #134

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ app.grails.version=1.3.7
app.name=openboxes
app.revisionNumber=11160
app.servlet.version=2.4
app.version=0.7.5
app.version=0.7.6
plugins.barcode4j=0.2.1
plugins.bubbling=2.1.4
plugins.clickstream=0.2.0
Expand Down
6 changes: 3 additions & 3 deletions grails-app/conf/DataSource.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ environments {
dataSource {
//dbCreate = "update"
url = "jdbc:mysql:https://localhost:3306/openboxes_dev?autoReconnect=true&zeroDateTimeBehavior=convertToNull&sessionVariables=storage_engine=InnoDB"
loggingSql = true
format_sql = true
use_sql_comments = true
loggingSql = false
format_sql = false
use_sql_comments = false
}
}
test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.apache.commons.lang.StringEscapeUtils
import org.pih.warehouse.core.Comment
import org.pih.warehouse.core.Document
import org.pih.warehouse.core.Location
import org.pih.warehouse.core.User
import org.pih.warehouse.shipping.Shipment
import org.pih.warehouse.shipping.ShipmentItem

Expand All @@ -37,17 +38,25 @@ class OrderController {
def status = params.status ? Enum.valueOf(OrderStatus.class, params.status) : null
def statusStartDate = params.statusStartDate ? Date.parse("MM/dd/yyyy", params.statusStartDate) : null
def statusEndDate = params.statusEndDate ? Date.parse("MM/dd/yyyy", params.statusEndDate) : null
def orderedBy = params.orderedById ? User.get(params.orderedById) : null

def orders = orderService.getOrdersPlacedByLocation(destination, origin, status, statusStartDate, statusEndDate)
def orders = orderService.getOrdersPlacedByLocation(destination, origin, orderedBy, status, statusStartDate, statusEndDate)

// sort by order date
orders = orders.sort( { a, b ->
return b.dateOrdered <=> a.dateOrdered
} )

def totalPrice = 0.00
if (orders) {
totalPrice = orders.sum { it.totalPrice() }
}

def orderedByList = orders.collect { it.orderedBy }.unique()

[ orders:orders, origin:origin?.id, destination:destination?.id,
status:status, statusStartDate:statusStartDate, statusEndDate:statusEndDate,
suppliers : suppliers
suppliers : suppliers, totalPrice:totalPrice, orderedByList: orderedByList
]
}

Expand Down
34 changes: 17 additions & 17 deletions grails-app/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ default.lastUpdated.year.label = {0} Year(s)

default.layout.label = Layout
default.lbs.label = lbs
default.list.label = List {0}
default.list.label = {0}
default.locale.label = Locale
default.login.label = Login
default.logout.label = Log out
Expand Down Expand Up @@ -1057,8 +1057,8 @@ month.11.label = November
month.12.label = December

# Order messages
order.label = Purchase order
orders.label = Purchase orders
order.label = Purchase Order
orders.label = Purchase Orders
orders.none.message = No purchase orders match the given criteria
order.addProduct.label = Add a product
order.addComment.label = Add comment
Expand All @@ -1072,7 +1072,7 @@ order.complete.label = Complete
order.confirmOrderReceipt.label = Confirm purchase order receipt
order.continueToOrderSummary.label = Continue to purchase order summary >
order.create.label = Create purchase order
order.dateOrdered.label = Date ordered
order.dateOrdered.label = Ordered on
order.deleteOrder.label = Delete purchase order
order.description.label = Description
order.description.placeholder = Briefly describe what was purchased
Expand Down Expand Up @@ -1140,13 +1140,13 @@ order.view.label = View purchase or
order.viewDetails.label = View purchase order details
order.youAreAboutToCreateANewShipment.message = You are about to create a new shipment of type <b>{0}</b> being sent from <b>{1}</b> to be received by <b>{2}</b> on <b>{3}</b>

order.wizard.createOrder.label = Create order
order.wizard.showOrder.label = Show order
order.wizard.editOrder.label = Edit order
order.wizard.addItems.label = Add line items
order.wizard.placeOrder.label = Place order
order.wizard.printOrder.label = Print order
order.wizard.receiveOrder.label = Receive order
order.wizard.createOrder.label = Create Purchase Order
order.wizard.showOrder.label = Show Order Details
order.wizard.editOrder.label = Edit Order Details
order.wizard.addItems.label = Edit Line Items
order.wizard.placeOrder.label = Place Order
order.wizard.printOrder.label = Print Order
order.wizard.receiveOrder.label = Receive Shipment

# Order Command messages
orderCommand.deliveredOn.invalid.mustOccurOnOrAfterShippedOn = Property [{0}] of class [{1}] with value [{2}] must occur on or after Shipped On date [{4}]
Expand Down Expand Up @@ -1385,14 +1385,14 @@ report.includeChildren.label = Include child categories
report.initialQuantity.label = Start
report.incomingTransferQuantity.label = Xfer
report.incomingTotalQuantity.label = Total
report.incomingQuantity.label = Incoming (+)
report.incomingQuantity.label = Inbound (+)
report.label = Reporting
report.location.label = Location
report.lotNumber.label = Lot number
report.number.label = No.
report.options.label = Options
report.origin.label = Origin
report.outgoingQuantity.label = Outgoing (-)
report.outgoingQuantity.label = Outbound (-)
report.outgoingTotalQuantity.label = Total
report.outgoingTransferQuantity.label = Xfer
report.insertPageBreakBetweenCategories.label = Insert page break between categories (for PDF export only)
Expand Down Expand Up @@ -1740,8 +1740,8 @@ shipping.couldNotRemoveContainerFromShipment.message = Could not remove packing
shipping.couldNotRemoveDocumentFromShipment.message = Could not remove document {0} from shipment
shipping.couldNotRemoveEventFromShipment.message = Could not remove event {0} from shipment
shipping.couldNotRemoveItemFromContainer.message = Could not remove item {0} from packing unit
shipping.createIncomingShipment.label = Create incoming shipment
shipping.createOutgoingShipment.label = Create outgoing shipment
shipping.createIncomingShipment.label = Create inbound shipment
shipping.createOutgoingShipment.label = Create outbound shipment
shipping.creditStockOnReceipt.label = Yes, add these items to <b>{0}</b> inventory.
shipping.date.label = Date
shipping.debitStockOnSend.message = Debit stock upon sending shipment.
Expand Down Expand Up @@ -1786,8 +1786,8 @@ shipping.itemSearch.label = Search inventory by produ
shipping.itemsInShipmentWillBeDebited.message = Stock for the <b>{0} items</b> in the shipment will be debited from {1}'s inventory.
shipping.itemsInShipmentWillNotBeDebited.message = Stock for the <b>{0} items</b> in the shipment will not be debited from {1}'s inventory.
shipping.label = Shipping
shipping.listIncoming.label = List incoming shipments to this location
shipping.listOutgoing.label = List outgoing shipments from this location
shipping.listIncoming.label = Inbound Shipments
shipping.listOutgoing.label = Outbound Shipments
shipping.markAsReceived.label = Mark as received
shipping.modifiedQuantityOfExistingShipment.message = Modified quantity of existing shipment item {0} from {1} to {2}
shipping.mostRecent.label = Recent shipping from {0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ class OrderService {
def identifierService
def inventoryService

List<Order> getOrdersPlacedByLocation(Location orderPlacedBy, Location orderPlacedWith, OrderStatus status, Date orderedFromDate, Date orderedToDate) {
List<Order> getOrdersPlacedByLocation(Location orderPlacedBy, Location orderPlacedWith, User orderedBy, OrderStatus status, Date orderedFromDate, Date orderedToDate) {
def orders = Order.withCriteria {
and {
eq("destination", orderPlacedBy)
if (orderPlacedWith) { eq("origin", orderPlacedWith) }
if (status) { eq("status", status) }
if (orderedFromDate) { ge("dateOrdered", orderedFromDate) }
if (orderedToDate) { le("dateOrdered", orderedToDate) }
if (orderedBy) { eq("orderedBy", orderedBy)}
}
}
return orders
Expand Down Expand Up @@ -172,8 +173,8 @@ class OrderService {

// FIXME
// receiptInstance.validate() && !receiptInstance.hasErrors()
if (!receiptInstance.hasErrors() && receiptInstance.save()) {
shipmentService.receiveShipment(shipmentInstance, "", orderCommand?.currentUser, orderCommand?.currentLocation, true);
if (!receiptInstance.hasErrors() && receiptInstance.save()) {
shipmentService.receiveShipment(shipmentInstance?.id, null, orderCommand?.currentUser?.id, orderCommand?.currentLocation?.id, true);
}
else {
throw new ShipmentException(message: "Unable to save receipt ", shipment: shipmentInstance)
Expand Down
6 changes: 6 additions & 0 deletions grails-app/views/layouts/custom.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<link rel="stylesheet" href="${createLinkTo(dir:'js/jquery.nailthumb',file:'jquery.nailthumb.1.1.css')}" type="text/css" media="all" />
<link rel="stylesheet" href="${createLinkTo(dir:'js/chosen',file:'chosen.css')}" type="text/css" media="all" />
<%--<link rel="stylesheet" href="${createLinkTo(dir:'js/feedback',file:'feedback.css')}" type="text/css" media="all" />--%>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/css/jquery.dataTables.css" type="text/css" media="all" />


<!-- Include javascript files -->
<g:javascript library="application"/>
Expand Down Expand Up @@ -153,6 +155,7 @@
<script src="${createLinkTo(dir:'js/', file:'underscore-min.js')}" type="text/javascript" ></script>
<script src="${createLinkTo(dir:'js/chosen/', file:'chosen.jquery.min.js')}" type="text/javascript" ></script>
<script src="${createLinkTo(dir:'js/feedback/', file:'feedback.js')}" type="text/javascript" ></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.js" type="text/javascript" ></script>
<!-- JIRA Issue Collector -->
<g:if test="${session.user && Boolean.valueOf(grailsApplication.config.openboxes.jira.issue.collector.enabled)}">
<script type="text/javascript" src="${grailsApplication.config.openboxes.jira.issue.collector.url}"></script>
Expand Down Expand Up @@ -414,6 +417,9 @@
event.preventDefault();
});

$('.dataTable').dataTable({
"bJQueryUI": true
});
});
</script>

Expand Down
145 changes: 145 additions & 0 deletions grails-app/views/order/_filters.gsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@

<div>
<g:form id="listForm" action="list" method="GET">
<g:hiddenField name="type" value="${params.type}"/>
<g:hiddenField name="max" value="${params.max?:10 }"/>
<div class="box">
<h2><warehouse:message code="default.filters.label"/></h2>
<table>
<%--
<tr>
<td>
<label class="block">${warehouse.message(code:'default.searchTerms.label', default: "Search terms")}</label>
<div>
<g:textField name="terms"
value="${params.terms}"
style="width: 100%;"
placeholder="${warehouse.message(code:'order.searchTerms.label', default: 'Search by PO number, description, item name')}"
class="text medium"/>
</div>
</td>
</tr>

<tr class="prop">
<td>
<label class="block">${warehouse.message(code: 'order.orderNumber.label')}</label>
<div>
<g:textField class="text" id="orderNumber" name="orderNumber" value="${params.orderNumber}" readonly="readonly" style="width: 100%;"
onclick="alert('This filter is not currently supported.');"/>

</div>
</td>
</tr>
--%>
<%--
<tr class="prop">
<td>
<label>Total price</label>
<div>
<g:textField class="text" id="totalPrice" name="totalPrice" value="${params.totalPrice}" style="width: 100%;"
readonly="readonly" size="10" onclick="alert('This filter is not currently supported.')"/>
</div>
</td>
</tr>
--%>

<tr class="prop">
<td>
<label class="block">${warehouse.message(code: 'order.status.label')}</label>
<div>
<g:select id="status" name="status"
from="${org.pih.warehouse.order.OrderStatus.list()}" class="chzn-select-deselect"
optionValue="${{format.metadata(obj:it)}}" value="${status}"
noSelection="['':warehouse.message(code:'default.all.label')]" />

</div>
</td>
</tr>

<tr class="prop">
<td>
<label><warehouse:message code="order.destination.label"/></label>
<div>
<g:select id="destination" name="destination" class="chzn-select-deselect"
from="${[session.warehouse]}"
optionKey="id" optionValue="name" value="${session.warehouse.id}"/>
</div>
</td>
</tr>

<tr class="prop">
<td>
<label><warehouse:message code="order.origin.label"/></label>
<div>
<g:select id="origin" name="origin" class="chzn-select-deselect"
from="${suppliers}"
optionKey="id" optionValue="name" value="${origin}"
noSelection="['':warehouse.message(code:'default.all.label')]" />
</div>
</td>
</tr>

<tr class="prop">
<td>
<label><warehouse:message code="order.orderedBy.label"/></label>
<div>
<g:select id="orderedById" name="orderedById" class="chzn-select-deselect"
from="${orderedByList}"
optionKey="id" optionValue="name" value="${params?.orderedById}"
noSelection="['':warehouse.message(code:'default.all.label')]" />
</div>
</td>
</tr>

<tr class="prop">
<td>

<label class="block">${warehouse.message(code: 'default.lastUpdateAfter.label', default: 'Last updated after')}</label>
<div>
<g:jqueryDatePicker id="statusStartDate" name="statusStartDate" placeholder="Start date" size="40" numberOfMonths="2" changeMonthAndYear="false"
value="${statusStartDate}" format="MM/dd/yyyy"/>
</div>
<a href="javascript:void(0);" id="clearStartDate">clear</a>
</td>
</tr>
<tr class="prop">
<td>
<label class="block">${warehouse.message(code: 'default.lastUpdatedBefore.label', default: 'Last updated before')}</label>
<div>
<g:jqueryDatePicker id="statusEndDate" name="statusEndDate" placeholder="End date" size="40" numberOfMonths="2" changeMonthAndYear="true"
value="${statusEndDate}" format="MM/dd/yyyy"/>
</div>
<a href="javascript:void(0);" id="clearEndDate">clear</a>


</td>
</tr>




<tr class="prop">
<td colspan="2">
<div class="center">

<button type="submit" class="button icon search" name="search" value="true">
<warehouse:message code="default.search.label"/>
</button>

<g:link controller="order" action="list" class="button icon reload">
<warehouse:message code="default.button.cancel.label"/>
</g:link>
</div>
</td>
</tr>
</table>
</div>
</g:form>
</div>







15 changes: 7 additions & 8 deletions grails-app/views/order/_summary.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
</div>
</g:if>
--%>
<div class="summary">

<div class="summary box">
<g:if test="${orderInstance?.id}">
<g:set var="isAddingComment" value="${request.request.requestURL.toString().contains('addComment')}"/>
<g:set var="isAddingDocument" value="${request.request.requestURL.toString().contains('addDocument')}"/>
Expand All @@ -69,21 +70,19 @@
</td>
<td>
<div class="title">
<g:link controller="order" action="show" id="${orderInstance?.id}">${orderInstance?.description}</g:link>
<g:link controller="order" action="show" id="${orderInstance?.id}">
<small><warehouse:message code="order.label"/> ${orderInstance?.orderNumber}</small>
${orderInstance?.description}</g:link>
</div>
<div class="subtitle">
<g:link controller="order" action="show" id="${orderInstance?.id}"><warehouse:message code="order.label"/> ${orderInstance?.orderNumber}</g:link>
</div>

</td>
<td class="top right" width="1%">
<div class="tag tag-alert">
<format:metadata obj="${orderInstance?.status}"/>
</div>
</td>

</tr>
<tr class="odd prop">
<tr class=" prop">
<td></td>
<td>
<div>
Expand Down Expand Up @@ -250,4 +249,4 @@



</div>
</div>
Loading