Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…9535-47bb-0310-9956-ffa450edef68
  • Loading branch information
JacquesLeRoux committed Nov 13, 2013
1 parent 500f6b3 commit e60e809
Show file tree
Hide file tree
Showing 21 changed files with 258 additions and 42 deletions.
2 changes: 2 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<classpathentry kind="lib" path="specialpurpose/lucene/lib/lucene-analyzers-common-4.5.1.jar"/>
<classpathentry kind="lib" path="specialpurpose/lucene/lib/lucene-core-4.5.1.jar"/>
<classpathentry kind="lib" path="specialpurpose/lucene/lib/lucene-queryparser-4.5.1.jar"/>
<classpathentry kind="lib" path="specialpurpose/solr/lib/solr-solrj-4.4.0.jar"/>
<classpathentry excluding="org/ofbiz/accounting/thirdparty/cybersource/**|org/ofbiz/accounting/thirdparty/verisign/**|org/ofbiz/accounting/thirdparty/worldpay/**|org/ofbiz/accounting/thirdparty/paypal/PayPalServices.java|org/ofbiz/accounting/thirdparty/orbital/**|org/ofbiz/accounting/thirdparty/securepay/**|org/ofbiz/accounting/thirdparty/ideal/**" kind="src" path="applications/accounting/src"/>
<classpathentry excluding="org/ofbiz/content/openoffice/|org/ofbiz/content/report/" kind="src" path="applications/content/src"/>
<classpathentry kind="src" path="applications/manufacturing/src"/>
Expand Down Expand Up @@ -202,6 +203,7 @@
<classpathentry kind="src" path="specialpurpose/pos/src"/>
<classpathentry kind="src" path="specialpurpose/projectmgr/src"/>
<classpathentry kind="src" path="specialpurpose/webpos/src"/>
<classpathentry kind="src" path="specialpurpose/solr/src"/>
<classpathentry kind="src" path="specialpurpose/lucene/src"/>
<classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
Expand Down
43 changes: 28 additions & 15 deletions .project
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ofbiz</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<name>ofbizClean</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.rubypeople.rdt.core.rubybuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.rubypeople.rdt.core.rubynature</nature>
</natures>
<linkedResources>
<link>
<name>specialpurpose/pos/lib/jcl.jar</name>
<type>2</type>
<locationURI>zip:/?file:/D:/workspace/ofbizClean/specialpurpose/pos/lib/jcl.jar</locationURI>
</link>
</linkedResources>
</projectDescription>
1 change: 1 addition & 0 deletions applications/accounting/data/AccountingTypeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ under the License.
<PaymentMethodType description="Gift Card" paymentMethodTypeId="GIFT_CARD"/>
<PaymentMethodType description="Gift Certificate" paymentMethodTypeId="GIFT_CERTIFICATE"/>
<PaymentMethodType description="Cash" paymentMethodTypeId="CASH"/>
<PaymentMethodType description="Pin" paymentMethodTypeId="PIN"/>
<PaymentMethodType description="Electronic Funds Transfer" paymentMethodTypeId="EFT_ACCOUNT"/>
<PaymentMethodType description="Financial Account" paymentMethodTypeId="FIN_ACCOUNT"/>
<PaymentMethodType description="Personal Check" paymentMethodTypeId="PERSONAL_CHECK"/>
Expand Down
2 changes: 1 addition & 1 deletion applications/accounting/servicedef/services_agreement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ under the License.
<permission-service service-name="acctgAgreementPermissionCheck" main-action="UPDATE"/>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<override name="textData" allow-html="any"/>
<override name="textData" allow-html="safe"/>
</service>
<service name="cancelAgreement" default-entity-name="Agreement" engine="simple"
location="component://accounting/script/org/ofbiz/accounting/agreement/AgreementServices.xml" invoke="cancelAgreement" auth="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Manager;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.core.JreMemoryLeakPreventionListener;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.core.StandardEngine;
import org.apache.catalina.core.StandardHost;
Expand Down Expand Up @@ -205,7 +206,18 @@ public void init(String[] args, String name, String configFile) throws Container
if (useNaming) {
tomcat.enableNaming();
}


// https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener
// <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses
// the context class loader to load a singleton as this will cause a memory leak if a web application class loader happens
// to be the context class loader at the time.>>
// http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?view=annotate
JreMemoryLeakPreventionListener jreMemoryLeakPreventionListener = new JreMemoryLeakPreventionListener();
// Mostly use default config, but some cases here
jreMemoryLeakPreventionListener.setAppContextProtection(true); // True is the default for Java 1.6, use false for Java from 1.7.0_02 onwards (see sources above)
jreMemoryLeakPreventionListener.setGcDaemonProtection(false); // False because of https://mail-archives.apache.org/mod_mbox/tomcat-users/201008.mbox/%[email protected]%3E
jreMemoryLeakPreventionListener.setUrlCacheProtection(false); // False to keep the URLConnection cache, moot point

// configure JNDI in the StandardServer
StandardServer server = (StandardServer) tomcat.getServer();
try {
Expand Down
18 changes: 13 additions & 5 deletions framework/service/src/org/ofbiz/service/ModelService.java
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,18 @@ public void validate(Map<String, Object> context, String mode, Locale locale) th
// required and type validation complete, do allow-html validation
if ("IN".equals(mode)) {
List<String> errorMessageList = FastList.newInstance();
for (ModelParam modelParam : this.contextInfo.values()) {
// the param is a String, allow-html is not any, and we are looking at an IN parameter during input parameter validation
if (context.get(modelParam.name) != null && ("String".equals(modelParam.type) || "java.lang.String".equals(modelParam.type))
&& !"any".equals(modelParam.allowHtml) && ("INOUT".equals(modelParam.mode) || "IN".equals(modelParam.mode))) {
for (ModelParam modelParam: this.contextInfo.values()) {
if (context.get(modelParam.name) != null &&
("String".equals(modelParam.type) || "java.lang.String".equals(modelParam.type)) &&
!"any".equals(modelParam.allowHtml) &&
("INOUT".equals(modelParam.mode) || "IN".equals(modelParam.mode))) {
// the param is a String, allow-html is none or safe, and we are looking at an IN parameter during input parameter validation
String value = (String) context.get(modelParam.name);
StringUtil.checkStringForHtmlStrictNone(modelParam.name, value, errorMessageList);
if ("none".equals(modelParam.allowHtml)) {
StringUtil.checkStringForHtmlStrictNone(modelParam.name, value, errorMessageList);
} else if ("safe".equals(modelParam.allowHtml)) {
StringUtil.checkStringForHtmlSafeOnly(modelParam.name, value, errorMessageList);
}
}
}
if (errorMessageList.size() > 0) {
Expand Down Expand Up @@ -920,6 +926,8 @@ private Map<String, Object> makePrefixMap(Map<String, ? extends Object> source,
String key = entry.getKey();
if (key.startsWith(param.stringMapPrefix)) {
paramMap.put(key, entry.getValue());
key=key.replace(param.stringMapPrefix,"");
paramMap.put(key, entry.getValue());
}
}
return paramMap;
Expand Down
2 changes: 2 additions & 0 deletions specialpurpose/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ specialpurpose/googlecheckout/lib/checkout-sdk-0.8.8.jar
specialpurpose/lucene/lib/lucene-analyzers-common-4.5.1.jar
specialpurpose/lucene/lib/lucene-core-4.5.1.jar
specialpurpose/lucene/lib/lucene-queryparser-4.5.1.jar
specialpurpose/solr/libsolr-solrj-4.4.0.jar
specialpurpose/solr/webapp/WEB-INF/lib/*.jar (covered by specialpurpose/solr/webapp/META-INF/NOTICE.txt)

=========================================================================
Apache License
Expand Down
1 change: 1 addition & 0 deletions specialpurpose/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
example/build.xml
"/>
</project>
<!-- ,solr/build.xml -->
1 change: 1 addition & 0 deletions specialpurpose/component-load.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ under the License.
<load-component component-location="birt"/>
<load-component component-location="example"/>
<load-component component-location="exampleext"/>
<load-component component-location="solr"/>
<!-- <load-component component-location="jetty"/> -->
</component-loader>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (webPosSession) {
}

context.cashAmount = BigDecimal.ZERO;
context.pinAmount = BigDecimal.ZERO;
context.checkAmount = BigDecimal.ZERO;
context.giftAmount = BigDecimal.ZERO;
context.creditAmount = BigDecimal.ZERO;
Expand All @@ -61,6 +62,9 @@ if (shoppingCart) {
if ("CASH".equals(paymentInfo.paymentMethodTypeId)) {
context.cashAmount = new BigDecimal((context.cashAmount).add(amount));
}
else if ("PIN".equals(paymentInfo.paymentMethodTypeId)) {
context.pinAmount = new BigDecimal((context.pinAmount).add(amount));
}
else if ("PERSONAL_CHECK".equals(paymentInfo.paymentMethodTypeId)) {
context.checkAmount = new BigDecimal((context.checkAmount).add(amount));
}
Expand Down
7 changes: 7 additions & 0 deletions specialpurpose/webpos/webapp/webpos/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,13 @@
<response name="error" type="request" value="json"/>
</request-map>

<request-map uri="PayPin">
<security https="false" auth="true"/>
<event type="simple" path="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payPin"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>

<request-map uri="PayCheck">
<security https="false" auth="true"/>
<event type="simple" path="component://webpos/script/org/ofbiz/webpos/event/PaymentEvents.xml" invoke="payCheck"/>
Expand Down
8 changes: 3 additions & 5 deletions specialpurpose/webpos/webapp/webpos/cart/ShowCart.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ under the License.
<table class="basic-table" cellspacing="1" cellpadding="1">
<input type="hidden" id="totalDue" value="${totalDue}"/>
<input type="hidden" id="totalCash" value="${cashAmount}"/>
<input type="hidden" id="totalPin" value="${pinAmount}"/>
<input type="hidden" id="totalCheck" value="${checkAmount}"/>
<input type="hidden" id="totalGift" value="${giftAmount}"/>
<input type="hidden" id="totalCredit" value="${creditAmount}"/>
<input type="hidden" id="totalDueFormatted" value="<@ofbizCurrency amount=totalDue isoCode=shoppingCart.getCurrency()/>"/>
<input type="hidden" id="totalCashFormatted" value="<@ofbizCurrency amount=cashAmount isoCode=shoppingCart.getCurrency()/>"/>
<input type="hidden" id="totalPinFormatted" value="<@ofbizCurrency amount=pinAmount isoCode=shoppingCart.getCurrency()/>"/>
<input type="hidden" id="totalCheckFormatted" value="<@ofbizCurrency amount=checkAmount isoCode=shoppingCart.getCurrency()/>"/>
<input type="hidden" id="totalGiftFormatted" value="<@ofbizCurrency amount=giftAmount isoCode=shoppingCart.getCurrency()/>"/>
<input type="hidden" id="totalCreditFormatted" value="<@ofbizCurrency amount=creditAmount isoCode=shoppingCart.getCurrency()/>"/>
Expand Down Expand Up @@ -104,11 +106,7 @@ under the License.
<#else>
<#assign parentProductId = cartLine.getProductId()/>
</#if>
<#assign smallImageUrl = Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(cartLine.getProduct(), "SMALL_IMAGE_URL", locale, dispatcher)?if_exists>
<#if !smallImageUrl?string?has_content><#assign smallImageUrl = "/images/defaultImage.jpg"></#if>
<#if smallImageUrl?string?has_content>
<img src="<@ofbizContentUrl>${requestAttributes.contentPathPrefix?if_exists}${smallImageUrl}</@ofbizContentUrl>" align="left" class="cssImgSmall" />
</#if>

<#-- end code to display a small image of the product -->
${cartLine.getProductId()} - ${cartLine.getName()?if_exists} : ${cartLine.getDescription()?if_exists}
<#else>
Expand Down
1 change: 1 addition & 0 deletions specialpurpose/webpos/webapp/webpos/images/js/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function hideOverlayDiv() {
jQuery('#payCheck').hide();
jQuery('#payGiftCard').hide();
jQuery('#payCreditCard').hide();
jQuery('#paPin').hide();
jQuery('#openTerminal').hide();
jQuery('#closeTerminal').hide();
jQuery('#paidOutAndIn').hide();
Expand Down
99 changes: 99 additions & 0 deletions specialpurpose/webpos/webapp/webpos/images/js/PayPin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
jQuery(document).ready(function() {
jQuery('#removePinTotalPaid').click(function(event) {
pleaseWait('Y');
var param = 'clearPin=Y&clearCheck=N&clearGift=N&clearCredit=N';
jQuery.ajax({url: 'ClearPayment',
data: param,
type: 'post',
async: false,
success: function(data) {
getResultOfPinClearPayment(data);
},
error: function(data) {
getResultOfPinClearPayment(data);
}
});
pleaseWait('N');
productToSearchFocus();
return false;
});

jQuery('#amoutPin').keypress(function(event) {
code = event.keyCode ? event.keyCode : event.which;
if (code.toString() == 13) {
payPinConfirm();
return false;
}
if (code.toString() == 27) {
productToSearchFocus();
return false;
}
});

jQuery('#payPinConfirm').click(function(event) {
payPinConfirm();
return false;
});

jQuery('#payPinCancel').click(function(event) {
productToSearchFocus();
return false;
});
});

function payPinConfirm() {
pleaseWait('Y');
var param = 'amoutPin=' + jQuery('#amoutPin').val();
jQuery.ajax({url: 'PayPin',
data: param,
type: 'post',
async: false,
success: function(data) {
getResultOfPayPin(data);
},
error: function(data) {
getResultOfPayPin(data);
}
});
pleaseWait('N');
}

function payPin(cleanErrors) {
if (cleanErrors == undefined) {
cleanErrors = "Y";
}
if (cleanErrors == "Y") {
hideOverlayDiv();
jQuery('#payPinFormServerError').html("");
jQuery('#amoutPin').val("");
}
jQuery('#cashTotalDue').html(jQuery('#totalDueFormatted').val());
jQuery('#cashTotalPaid').html(jQuery('#totalPinFormatted').val());
jQuery('#payPin').show();
jQuery('#amoutPin').focus();
return false;
}

function getResultOfPayPin(data) {
var serverError = getServerError(data);
if (serverError != "") {
jQuery('#payPinFormServerError').html(serverError);
payPin('N');
} else {
clearErrorMessages();
updateCart();
productToSearchFocus();
}
}

function getResultOfPinClearPayment(data) {
var serverError = getServerError(data);
if (serverError != "") {
jQuery('#errors').fadeIn('slow', function() {
jQuery('#errors').html(serverError);
});
} else {
clearErrorMessages();
updateCart();
}
}
18 changes: 13 additions & 5 deletions specialpurpose/webpos/webapp/webpos/images/webpos.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ under the License.
.pos-cart-odd {
background-color: white;
overflow: auto;
vertical-align: top;
}
.pos-cart-odd:hover {
background-color: #FFFCCF;
Expand All @@ -66,6 +67,7 @@ under the License.
.pos-cart-even {
background-color: #eeeeee;
overflow: auto;
vertical-align: top;
}
.pos-cart-even:hover {
background-color: #FFFCCF;
Expand Down Expand Up @@ -247,7 +249,7 @@ input[type="text"]:focus, input[type="password"]:focus {
#SearchSalesRepsList {
border: 1px solid #0099CC;
overflow: auto;
height: 120px;
height: 110px;
}
#SearchSalesReps {
height: 110px;
Expand All @@ -271,7 +273,7 @@ input[type="text"]:focus, input[type="password"]:focus {
background-color: #fece2f;
}
#CenterBar {
margin-top: 33px;
margin-top: 15px;
height: auto;
}
.leftCenterBar {
Expand All @@ -287,23 +289,29 @@ input[type="text"]:focus, input[type="password"]:focus {
.centerCenterBar {
margin-left: 24em;
margin-right: 24em;
padding-top: 1px;
padding-left: 2px;
padding-right: 2px;
padding-bottom: 1px;
width: auto;
}
#CartHeader {
height: 100px;
width: 100%;
}
#Cart {
height: 460px;
height: 280px;
width: 100%;
}
.basic-table .CartHead {
height: 30px;
}
.basic-table .CartBody {
height: 400px;
height: 220px;
overflow-x: hidden;
overflow-y: auto;
overflow-y: scroll;
vertical-align: top;

}
.basic-table .CartFoot {
height: 30px;
Expand Down
Loading

0 comments on commit e60e809

Please sign in to comment.