diff --git a/NOTICE b/NOTICE index fd3894d3522..2438a35595a 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache OFBiz Copyright 2001-2016 The Apache Software Foundation -This product includes software developed by +This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/README.md b/README.md index 3a959ddd370..d3cc231dbc7 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,38 @@ For more details about OFBiz please visit the OFBiz Documentation page: System requirements ------------------- -The only requirement to run OFBiz is to have the Java Development Kit (JDK) +The first requirement to run OFBiz is to have the Java Development Kit (JDK) version 8 installed on your system (not just the JRE, but the full JDK) which you can download from the below link. -[JDK download](http://www.oracle.com/technetwork/java/javase/downloads/index.html) +[JDK download](https://adoptopenjdk.net/) + +[To know more about the JDK](https://medium.com/@javachampions/java-is-still-free-2-0-0-6b9aa8d6d244) + +The second requirement is to setup the Gradle wrapper files that are used +to build the system. +In order to fulfill this requirement, you can run the following command: + +MS Windows: +`init-gradle-wrapper` + +Unix-like OS: +`gradle/init-gradle-wrapper.sh` + +The script will download all the Gradle wrapper files required to build the system. +Alternatively, after you have Gradle installed: + +[Installing Gradle](https://docs.gradle.org/current/userguide/installation.html) + +you can setup the Gradle wrapper for OFBiz by executing the following from +the command line at the OFBiz top level directory (folder): + +`gradle wrapper --gradle-version 2.13` >_Note_: if you are using Eclipse, make sure of running the appropriate Eclipse command `gradlew eclipse` before creating the project in Eclipse. This command will prepare OFBiz for Eclipse with the correct classpath and settings -by creating the.classpath and .project files. +by creating the .classpath and .project files. Security ------------------- @@ -262,6 +284,14 @@ You can also offset the port, for example: `gradlew "ofbizBackground --start --portoffset 10000"` +#### Passing JVM runtime options to OFBiz + +You can pass JVM runtime options by specifying the project property `-PjvmArgs`. + +`gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx2048M" -Dsome.parameter=hello` + +If you do not specify `jvmArgs`, a default of `-Xms128M -Xmx1024M` is set. + * * * * * * * * * * * * ### Data loading tasks diff --git a/README.md.html b/README.md.html new file mode 100644 index 00000000000..16ded87b7e0 --- /dev/null +++ b/README.md.html @@ -0,0 +1,347 @@ + + + + + + + README + + + + + +

Apache OFBiz®

+

Welcome to Apache OFBiz®! A powerful top level Apache software project. OFBiz is an Enterprise Resource Planning (ERP) System written in Java and houses a large set of libraries, entities, services and features to run all aspects of your business.

+

For more details about OFBiz please visit the OFBiz Documentation page:

+

OFBiz documentation

+

OFBiz License

+

System requirements

+

The first requirement to run OFBiz is to have the Java Development Kit (JDK) version 8 installed on your system (not just the JRE, but the full JDK) which you can download from the below link.

+

JDK download

+

To know more about the JDK

+

The second requirement is to setup the Gradle wrapper files that are used to build the system. In order to fulfill this requirement, you can run the following command:

+

MS Windows: init-gradle-wrapper

+

Unix-like OS: ./gradle/init-gradle-wrapper

+

The script will download all the Gradle wrapper files required to build the system. Alternatively, after you have Gradle installed:

+

Installing Gradle

+

you can setup the Gradle wrapper for OFBiz by executing the following from the command line at the OFBiz top level directory (folder):

+

gradle wrapper --gradle-version 2.13

+
+

Note: if you are using Eclipse, make sure of running the appropriate Eclipse command gradlew eclipse before creating the project in Eclipse. This command will prepare OFBiz for Eclipse with the correct classpath and settings by creating the .classpath and .project files.

+
+

Security

+

You can trust the OFBiz Project Management Committee members and committers do their best to keep OFBiz secure from external exploits, and fix vulnerabilities as soon as they are known. Despite these efforts, if ever you find and want to report a security issue, please report at: security @ ofbiz.apache.org, before disclosing them in a public forum.

+
+

Note: Be sure to read this Wiki page if ever you plan to use RMI, JNDI, JMX or Spring and maybe other Java classes OFBiz does not use Out Of The Box (OOTB): The infamous Java serialization vulnerability

+
+

You can find more information about security in OFBiz at Keeping OFBiz secure

+

Quick start

+

To quickly install and fire-up OFBiz, please follow the below instructions from the command line at the OFBiz top level directory (folder)

+

Prepare OFBiz:

+

Note: Depending on your Internet connection speed it might take a long time for this step to complete if you are using OFBiz for the first time as it needs to download all dependencies. So please be patient!

+

MS Windows: gradlew cleanAll loadDefault

+

Unix-like OS: ./gradlew cleanAll loadDefault

+

Start OFBiz:

+

MS Windows: gradlew ofbiz

+

Unix-like OS: ./gradlew ofbiz

+

Visit OFBiz through your browser:

+

Order Back Office

+

Accounting Back Office

+

Administrator interface

+

You can log in with the user admin and password ofbiz.

+
+

Note: the default configuration uses an embedded Java database (Apache Derby) and embedded application server components such as Apache Tomcat®, Apache Geronimo (transaction manager), etc.

+
+
+

Build system syntax

+

All build tasks are executed using the Gradle build system which is embedded in OFBiz. To execute build tasks go to OFBiz top-level directory (folder) and execute tasks from there.

+

Operating System Syntax

+

The syntax for tasks differ slightly between windows and Unix-like systems

+ +

For the rest of this document, we will use the windows syntax, if you are on a Unix-like system, you need to add the ./ to gradlew

+

Types of tasks in Gradle

+

There are two types of tasks designed for OFBiz in Gradle:

+ +

Tips:

+ +

Example standard tasks

+

gradlew build

+

gradlew cleanAll loadDefault testIntegration

+

Example OFBiz server tasks

+

gradlew "ofbiz --help"

+

gradlew "ofbizDebug --test"

+

gradlew "ofbizBackground --start --portoffset 10000"

+

gradlew "ofbiz --shutdown --portoffset 10000"

+

gradlew ofbiz (default is –start)

+

Example mixed tasks (standard and OFBiz server)

+

gradlew cleanAll loadDefault "ofbiz --start"

+
+

Quick reference

+

You can use the below common list of tasks as a quick reference for controlling the system. This document uses the windows task syntax, if you are on a Unix-like system, you need to add the ./ to gradlew i.e. ./gradlew

+
+

Help tasks

+

List OFBiz server commands

+

List all available commands to control the OFBiz server

+

gradlew "ofbiz --help"

+

List build tasks

+

List all available tasks from the build system

+

gradlew tasks

+

List build projects

+

List all available projects in the build system

+

gradlew projects

+

Gradle build system help

+

Show usage and options for the Gradle build system

+

gradlew --help

+
+

Server command tasks

+

Start OFBiz

+

gradlew "ofbiz --start"

+

start is the default server task so this also works:

+

gradlew ofbiz

+

Shutdown OFBiz

+

gradlew "ofbiz --shutdown"

+

Get OFBiz status

+

gradlew "ofbiz --status"

+

Force OFBiz shutdown

+

Terminate all running OFBiz server instances by calling the appropriate operating system kill command. Use this command to force OFBiz termination if the –shutdown command does not work. Usually this is needed when in the middle of data loading or testing in OFBiz.

+

Warning: Be careful in using this command as force termination might lead to inconsistent state / data

+

gradlew terminateOfbiz

+

Start OFBiz in remote debug mode

+

Starts OFBiz in remote debug mode and waits for debugger or IDEs to connect on port 5005

+

gradlew "ofbizDebug --start"

+

OR

+

gradlew ofbizDebug

+

Start OFBiz on a different port

+

Start OFBiz of the network port offsetted by the range provided in the argument to –portoffset

+

gradlew "ofbiz --start --portoffset 10000"

+

Start OFBiz in the background

+

Start OFBiz in the background by forking it to a new process and redirecting the output to runtime/logs/console.log

+

gradlew "ofbizBackground --start"

+

OR

+

gradlew ofbizBackground

+

You can also offset the port, for example:

+

gradlew "ofbizBackground --start --portoffset 10000"

+

Passing JVM runtime options to OFBiz

+

You can pass JVM runtime options by specifying the project property -PjvmArgs.

+

gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx2048M" -Dsome.parameter=hello

+

If you do not specify jvmArgs, a default of -Xms128M -Xmx1024M is set.

+
+

Data loading tasks

+

OFBiz contains the following data reader types:

+ +

you can choose which data readers to pass in the following syntax:

+

gradlew "ofbiz --load-data readers=<readers-here-comma-separated>"

+

Example:

+

gradlew "ofbiz --load-data readers=seed,seed-initial,ext,ext-demo"

+

Load default OFBiz data

+

Loads default data set; meant for initial loading of generic OFBiz data. Can be applied for development, testing, demonstration, etc. purposes. Be aware that executing this task can result in your data being overwritten in your database of choice. Use with caution in production environments. The default data set is defined by datasource using the read-data attribute, followed by the name of the data set, into the datasource element of the ‘entityengine.xml’ file.

+

gradlew loadDefault

+

OR

+

gradlew "ofbiz --load-data"

+

Load seed data

+

Load ONLY the seed data (not seed-initial, demo, ext* or anything else); meant for use after an update of the code to reload the seed data as it is generally maintained along with the code and needs to be in sync for operation

+

gradlew "ofbiz --load-data readers=seed"

+

load ext data

+

Load seed, seed-initial and ext data; meant for manual/generic testing, development, or going into production with a derived system based on stock OFBiz where the ext data basically replaces the demo data

+

gradlew "ofbiz --load-data readers=seed,seed-initial,ext"

+

load ext test data

+

Load seed, seed-initial, ext and ext-test data; meant for automated testing with a derived system based on stock OFBiz

+

gradlew "ofbiz --load-data readers=seed,seed-initial,ext,ext-test"

+

load data from an entity file

+

Load data from an XML file holding entity data.

+

gradlew "ofbiz --load-data file=foo/bar/FileNameHere.xml"

+

create a new tenant

+

Create a new tenant in your environment, create the delegator, load initial data with admin-user and password (needs multitenant=Y in general.properties). The following project parameters are passed:

+ +

gradlew createTenant -PtenantId=mytenant

+

gradlew createTenant -PtenantId=mytenant -PtenantName="My Name" -PdomainName=com.example -PtenantReaders=seed,seed-initial,ext -PdbPlatform=M -PdbIp=127.0.0.1 -PdbUser=mydbuser -PdbPassword=mydbpass

+

If run successfully, the system creates a new tenant having:

+ +

load data for a specific tenant

+

Load data for one specific tenant in a multitenant environment. Note that you must set multitenant=Y in general.properties and the following project parameters are passed:

+ +

gradlew loadTenant -PtenantId=mytenant

+

gradlew loadTenant -PtenantId=mytenant -PtenantReaders=seed,seed-initial,demo -PtenantComponent=base

+
+

Testing tasks

+

Execute all unit tests

+

gradlew test

+

Execute all integration tests

+

gradlew testIntegration

+

OR

+

gradlew 'ofbiz --test'

+

Execute an integration test case

+

run a test case, in this example the componnet is “entity” and the case name is “entity-tests”

+

gradlew "ofbiz --test component=entity --test case=entity-tests"

+

Execute an integration test case in debug mode

+

listens on port 5005

+

gradlew "ofbizDebug --test component=entity --test case=entity-tests"

+

Execute an integration test suite

+

gradlew "ofbiz --test component=widget --test suitename=org.apache.ofbiz.widget.test.WidgetMacroLibraryTests"

+

Execute an integration test suite in debug mode

+

listens on port 5005

+

gradlew "ofbizDebug --test component=widget --test suitename=org.apache.ofbiz.widget.test.WidgetMacroLibraryTests"

+
+

Miscellaneous tasks

+

Launch a graphical user interface of Gradle

+

This is a very convenient feature of Gradle which allows the user to interact with Gradle through a swing GUI. You can save frequently used commands in a list of favorites for frequent reuse.

+

gradlew --gui

+

Run all tests on a clean system

+

gradlew cleanAll loadDefault testIntegration

+

Clean all generated artifacts

+

gradlew cleanAll

+

Refresh the generated artifacts

+

gradlew clean build

+

Create an admin user account

+

Create an admin user with login name MyUserName and default password with value “ofbiz”. Upon first login OFBiz will request changing the default password

+

gradlew loadAdminUserLogin -PuserLoginId=MyUserName

+

Compile Java using Xlint output

+

Xlint prints output of all warnings detected by the compiler

+

gradlew -PXlint build

+

Run OWASP tool to identify dependency vulnerabilities (CVEs)

+

The below command activates a gradle plugin (OWASP) and Identifies and reports known vulnerabilities (CVEs) in OFBiz library dependencies. This command takes a long time to execute because it needs to download all plugin dependencies and the CVE identification process is also time consuming

+

gradlew -PenableOwasp dependencyCheck

+

Setup eclipse project for OFBiz

+

Thanks to some gradle magic, setting up OFBiz on eclipse is very easy. All you need is to execute one command and then you can import the project to eclipse. This command will generate the necessary .classpath and .project files for eclipse.

+

gradlew eclipse

+
+

OFBiz plugin system

+

OFBiz provides an extension mechanism through plugins. Plugins are standard OFBiz components that reside in the specialpurpose directory. Plugins can be added manually or fetched from a maven repository. The standard tasks for managing plugins are listed below.

+
+

Note: OFBiz plugin versions follow Semantic Versioning 2.0.0

+
+

Pull (download and install) a plugin automatically

+

Download a plugin with all its dependencies (plugins) and install them one-by-one starting with the dependencies and ending with the plugin itself.

+

gradlew pullPlugin -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"

+

If the plugin resides in a custom maven repository (not jcenter or localhost) then you can use specify the repository using below command:

+

gradlew pullPlugin -PrepoUrl="http://www.example.com/custom-maven" -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"

+

If you need username and password to access the custom repository:

+

gradlew pullPlugin -PrepoUrl="http://www.example.com/custom-maven" -PrepoUser=myuser -PrepoPassword=mypassword -PdependencyId="org.apache.ofbiz.plugin:myplugin:0.1.0"

+

Install a plugin

+

If you have a plugin called mycustomplugin and want to install it in OFBiz follow the below instructions:

+ +

gradlew installPlugin -PpluginId=myplugin

+

The above commands achieve the following:

+ +

Uninstall a plugin

+

If you have an existing plugin called mycustomplugin and you wish to uninstall run the below command

+

gradlew uninstallPlugin -PpluginId=myplugin

+

The above commands achieve the following:

+ +

Remove a plugin

+

Calls uninstallPlugin on an existing plugin and then delete it from the file-system

+

gradlew removePlugin -PpluginId=myplugin

+

Create a new plugin

+

Create a new plugin. The following project parameters are passed:

+ +

gradlew createPlugin -PpluginId=myplugin

+

gradlew createPlugin -PpluginId=myplugin -PpluginResourceName=MyPlugin -PwebappName=mypluginweb -PbasePermission=MYSECURITY

+

The above commands achieve the following:

+ +

Push a plugin to a repository

+

This task publishes an OFBiz plugin into a maven package and then uploads it to a maven repository. Currently, pushing is limited to localhost maven repository (work in progress). To push a plugin the following parameters are passed:

+ +

gradlew pushPlugin -PpluginId=myplugin

+

gradlew pushPlugin -PpluginId=mycompany -PpluginGroup=com.mycompany.ofbiz.plugin -PpluginVersion=1.2.3 -PpluginDescription="Introduce special functionality X"

+
+

Useful Tips

+

Gradle tab-completion on Unix-like systems:

+

To get tab completion (auto complete gradle commands by pressing tab) you can download the script from the below link and place it in the appropriate location for your system.

+

Gradle tab completion

+

For example, on debian based systems, you can use the following command:

+

sudo curl -L -s https://gist.github.com/nolanlawson/8694399/raw/gradle-tab-completion.bash -o /etc/bash_completion.d/gradle-tab-completion.bash

+

Crypto notice

+

This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country’s laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See http://www.wassenaar.org/ for more information.

+

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

+

The following provides more details on the included cryptographic software:

+ + + diff --git a/applications/accounting/config/AccountingErrorUiLabels.xml b/applications/accounting/config/AccountingErrorUiLabels.xml index 0b8e04e0351..40c1348a673 100644 --- a/applications/accounting/config/AccountingErrorUiLabels.xml +++ b/applications/accounting/config/AccountingErrorUiLabels.xml @@ -769,6 +769,10 @@ Validation Failed - invalid values + + No authentification result available. Payment preference can't be checked. + Es ist kein Authentifizierungsergebnis vorhanden. Die Zahlungsmethode kann nicht überprüft werden. + فشل في تنفيذ خدمة CreatePaymentFromPreference Ausführen des Service CreatePaymentFromPreference fehlgeschlagen diff --git a/applications/accounting/config/AccountingUiLabels.xml b/applications/accounting/config/AccountingUiLabels.xml index e248afa84b0..a8da7b1aa9d 100644 --- a/applications/accounting/config/AccountingUiLabels.xml +++ b/applications/accounting/config/AccountingUiLabels.xml @@ -1478,6 +1478,9 @@ 支付的发票明细 支付的發票細項 + + Approved by + الإجمالي الكلي الموافق عليه Genehmigte Gesamtsumme @@ -4641,6 +4644,9 @@ 借记 借記 + + Debit not equal to credit + المدين أو الدائن للحساب Soll oder Haben der Bilanz @@ -5463,6 +5469,9 @@ 从定单创建定单明细账单时出错 從訂單新建細項帳單時出錯 + + Exchange Rate + الحقل نهاية الحياة المتوقعة فارغ في بيانات الأصل الثابت Das Feld erwartetes End of Life bei den Anlage-Daten ist leer. @@ -11185,6 +11194,9 @@ 会员必须是一个内部团体(在会员角色中设置) 團體必須是一個單位組織(在團體角色中設置) + + Party Name + إضافة دور طرف جديد Neue Akteurs-Rolle hinzufügen @@ -13425,6 +13437,9 @@ 卡上前缀 卡上字首 + + Prepared by + التسوية البنكية السابقة vorherige Kontenabstimmung @@ -13815,6 +13830,9 @@ 税率 稅率 + + Received by + استلام دفعة Zahlung erhalten diff --git a/applications/accounting/data/DemoTaxAuthority.xml b/applications/accounting/data/DemoTaxAuthority.xml index c0de542a407..c0a0d84150c 100644 --- a/applications/accounting/data/DemoTaxAuthority.xml +++ b/applications/accounting/data/DemoTaxAuthority.xml @@ -213,12 +213,12 @@ - + - + @@ -248,7 +248,7 @@ - + diff --git a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy b/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy index 53d05c68723..58e060bcf29 100644 --- a/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy +++ b/applications/accounting/groovyScripts/reports/GlAccountTrialBalance.groovy @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - +import com.ibm.icu.util.Calendar import org.apache.ofbiz.accounting.util.UtilAccounting import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilNumber diff --git a/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy b/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy new file mode 100644 index 00000000000..acd1e4d296e --- /dev/null +++ b/applications/accounting/groovyScripts/reports/InvoiceAcctgTransEntryParameters.groovy @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.util.EntityUtil + +invoiceId = parameters.invoiceId +userLoginId = userLogin.userLoginId +userLogin = delegator.findOne("UserLogin", UtilMisc.toMap("userLoginId", userLoginId), false) +userLoginNameView = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", userLogin.get("partyId")), false) +userLoginName = userLoginNameView.getString("firstName") + " " + userLoginNameView.getString("lastName") +dateFormatter = new java.text.SimpleDateFormat("dd MMMMM yyyy") + +invoice = delegator.findOne("Invoice", UtilMisc.toMap("invoiceId", invoiceId), false) +if (invoice) { + context.invoiceDescription = invoice.get("description") + context.invoiceTypeDescription = invoice.getRelatedOne("InvoiceType", false).get("description") + context.statusDescription = invoice.getRelatedOne("StatusItem", false).get("description") + context.invoiceDate = invoice.get("invoiceDate") + context.referenceNumber = invoice.get("referenceNumber") +} +partyId = null +if ("PURCHASE_INVOICE".equals(invoice.get("invoiceTypeId")) || "PURCHASE_INVOICE".equals(invoice.getRelatedOne("InvoiceType", false).get("parentTypeId"))) { + partyId = invoice.get("partyIdFrom") +} else { + partyId = invoice.get("partyId") +} +partyName = "" +partyNameView = delegator.findOne("PartyNameView", UtilMisc.toMap("partyId", partyId), false) +if (partyNameView.get("firstName")) { + partyName += partyNameView.get("firstName") + " " +} +if (partyNameView.get("lastName")) { + partyName += partyNameView.get("lastName") + " " +} +if (partyNameView.get("groupName")) { + partyName += partyNameView.get("groupName") + " " +} + +orderBy = UtilMisc.toList("acctgTransId", "acctgTransEntrySeqId") +conds = [] +conds.add(EntityCondition.makeCondition("invoiceId", EntityOperator.EQUALS, invoiceId)) +conds.add(EntityCondition.makeCondition("paymentId", EntityOperator.EQUALS, null)) +invoiceAcctgTransAndEntries = delegator.findList("AcctgTransAndEntries", EntityCondition.makeCondition(conds), null, orderBy, null, false) +context.invoiceAcctgTransAndEntries = invoiceAcctgTransAndEntries +context.partyName = partyName +context.partyId = partyId \ No newline at end of file diff --git a/applications/accounting/minilang/UpgradeServices.xml b/applications/accounting/minilang/UpgradeServices.xml index 951c4d7df07..28247fc9be5 100644 --- a/applications/accounting/minilang/UpgradeServices.xml +++ b/applications/accounting/minilang/UpgradeServices.xml @@ -53,7 +53,7 @@ under the License. - + @@ -72,7 +72,7 @@ under the License. - + diff --git a/applications/accounting/minilang/admin/AcctgAdminServices.xml b/applications/accounting/minilang/admin/AcctgAdminServices.xml index b78c9f8f151..bc234dcdcde 100644 --- a/applications/accounting/minilang/admin/AcctgAdminServices.xml +++ b/applications/accounting/minilang/admin/AcctgAdminServices.xml @@ -35,7 +35,7 @@ under the License. - + diff --git a/applications/accounting/minilang/agreement/AgreementServices.xml b/applications/accounting/minilang/agreement/AgreementServices.xml index 9feb276db71..a4c32b16232 100644 --- a/applications/accounting/minilang/agreement/AgreementServices.xml +++ b/applications/accounting/minilang/agreement/AgreementServices.xml @@ -57,6 +57,7 @@ under the License. + diff --git a/applications/accounting/minilang/budget/BudgetServices.xml b/applications/accounting/minilang/budget/BudgetServices.xml index 77fe74d3f0d..942fd3d6c45 100644 --- a/applications/accounting/minilang/budget/BudgetServices.xml +++ b/applications/accounting/minilang/budget/BudgetServices.xml @@ -24,7 +24,7 @@ under the License. - + diff --git a/applications/accounting/minilang/finaccount/FinAccountServices.xml b/applications/accounting/minilang/finaccount/FinAccountServices.xml index c59e298655a..12ad4d2c4ec 100644 --- a/applications/accounting/minilang/finaccount/FinAccountServices.xml +++ b/applications/accounting/minilang/finaccount/FinAccountServices.xml @@ -35,7 +35,7 @@ under the License. - + @@ -211,7 +211,7 @@ under the License. - + @@ -756,7 +756,7 @@ under the License. - + @@ -775,7 +775,7 @@ under the License. - + @@ -839,7 +839,7 @@ under the License. - + @@ -858,7 +858,7 @@ under the License. - + diff --git a/applications/accounting/minilang/fixedasset/FixedAssetServices.xml b/applications/accounting/minilang/fixedasset/FixedAssetServices.xml index 13a9b82e664..10af8a27882 100644 --- a/applications/accounting/minilang/fixedasset/FixedAssetServices.xml +++ b/applications/accounting/minilang/fixedasset/FixedAssetServices.xml @@ -186,7 +186,7 @@ under the License. - + @@ -263,7 +263,7 @@ under the License. - + @@ -402,6 +402,9 @@ under the License. + + + @@ -478,7 +481,13 @@ under the License. - + + + + + + + diff --git a/applications/accounting/minilang/invoice/InvoiceServices.xml b/applications/accounting/minilang/invoice/InvoiceServices.xml index e50ca794036..6de926d5ffd 100644 --- a/applications/accounting/minilang/invoice/InvoiceServices.xml +++ b/applications/accounting/minilang/invoice/InvoiceServices.xml @@ -145,7 +145,7 @@ under the License. - + @@ -213,7 +213,7 @@ under the License. - + @@ -225,7 +225,7 @@ under the License. - + @@ -272,7 +272,7 @@ under the License. - + @@ -306,7 +306,7 @@ under the License. - + @@ -450,7 +450,7 @@ under the License. - + @@ -556,7 +556,7 @@ under the License. - + @@ -942,7 +942,7 @@ under the License. - + @@ -961,7 +961,7 @@ under the License. - + diff --git a/applications/accounting/minilang/ledger/GeneralLedgerServices.xml b/applications/accounting/minilang/ledger/GeneralLedgerServices.xml index 554217a4f27..be2271346fa 100644 --- a/applications/accounting/minilang/ledger/GeneralLedgerServices.xml +++ b/applications/accounting/minilang/ledger/GeneralLedgerServices.xml @@ -403,7 +403,7 @@ under the License. - + @@ -415,7 +415,7 @@ under the License. - + @@ -1856,23 +1856,29 @@ under the License. + + + + + - + @@ -1883,21 +1889,37 @@ under the License. + + + + + + + + + - + + + + + + + + @@ -2017,6 +2039,8 @@ under the License. + @@ -2030,6 +2054,7 @@ under the License. + @@ -2050,7 +2075,14 @@ under the License. + + + + + + + @@ -2071,9 +2103,16 @@ under the License. + + + + + + + - + @@ -2171,6 +2210,8 @@ under the License. + @@ -2185,6 +2226,7 @@ under the License. + @@ -2218,6 +2260,12 @@ under the License. + + + + + + @@ -2234,6 +2282,12 @@ under the License. + + + + + + @@ -2241,10 +2295,6 @@ under the License. - - - diff --git a/applications/accounting/minilang/payment/PaymentMethodServices.xml b/applications/accounting/minilang/payment/PaymentMethodServices.xml index 938dd4e9fa3..406df9c8cc5 100644 --- a/applications/accounting/minilang/payment/PaymentMethodServices.xml +++ b/applications/accounting/minilang/payment/PaymentMethodServices.xml @@ -22,7 +22,7 @@ under the License. xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> - + @@ -82,7 +82,7 @@ under the License. - + @@ -91,7 +91,7 @@ under the License. - + diff --git a/applications/accounting/minilang/payment/PaymentServices.xml b/applications/accounting/minilang/payment/PaymentServices.xml index aa137e1f7ae..3e4e74ff8bc 100644 --- a/applications/accounting/minilang/payment/PaymentServices.xml +++ b/applications/accounting/minilang/payment/PaymentServices.xml @@ -742,7 +742,7 @@ under the License. - + @@ -988,7 +988,7 @@ under the License. - + @@ -1161,7 +1161,7 @@ under the License. - + @@ -1180,7 +1180,7 @@ under the License. - + diff --git a/applications/accounting/minilang/rate/RateServices.xml b/applications/accounting/minilang/rate/RateServices.xml index 14eb1971e0f..9063feb73fa 100644 --- a/applications/accounting/minilang/rate/RateServices.xml +++ b/applications/accounting/minilang/rate/RateServices.xml @@ -346,7 +346,7 @@ under the License. - + diff --git a/applications/accounting/minilang/test/AutoInvoiceTests.xml b/applications/accounting/minilang/test/AutoInvoiceTests.xml index 77ea06f1508..7b6b21d3428 100644 --- a/applications/accounting/minilang/test/AutoInvoiceTests.xml +++ b/applications/accounting/minilang/test/AutoInvoiceTests.xml @@ -295,9 +295,11 @@ under the License. - - - + + + + + @@ -311,8 +313,8 @@ under the License. - - + + diff --git a/applications/accounting/minilang/test/AutoPaymentTests.xml b/applications/accounting/minilang/test/AutoPaymentTests.xml index cab7d0d1878..13c316a9e30 100644 --- a/applications/accounting/minilang/test/AutoPaymentTests.xml +++ b/applications/accounting/minilang/test/AutoPaymentTests.xml @@ -469,9 +469,10 @@ under the License. - + + - + @@ -484,8 +485,8 @@ under the License. - - + + diff --git a/applications/accounting/servicedef/secas_invoice.xml b/applications/accounting/servicedef/secas_invoice.xml index d5128e4a5b8..0bb63ff5626 100644 --- a/applications/accounting/servicedef/secas_invoice.xml +++ b/applications/accounting/servicedef/secas_invoice.xml @@ -37,13 +37,13 @@ under the License. - - + + - - + + diff --git a/applications/accounting/servicedef/secas_payment.xml b/applications/accounting/servicedef/secas_payment.xml index 3541843cd7c..c82be644a15 100644 --- a/applications/accounting/servicedef/secas_payment.xml +++ b/applications/accounting/servicedef/secas_payment.xml @@ -69,14 +69,14 @@ under the License. - - + + - - + + diff --git a/applications/accounting/servicedef/services_agreement.xml b/applications/accounting/servicedef/services_agreement.xml index c7385c2faf8..a00b16d8c5e 100644 --- a/applications/accounting/servicedef/services_agreement.xml +++ b/applications/accounting/servicedef/services_agreement.xml @@ -29,14 +29,14 @@ under the License. - + Update an Agreement - + @@ -62,7 +62,7 @@ under the License. - + @@ -70,7 +70,7 @@ under the License. - + Remove an AgreementItem @@ -104,14 +104,14 @@ under the License. - + Update an AgreementTerm - + Delete an AgreementTerm diff --git a/applications/accounting/servicedef/services_invoice.xml b/applications/accounting/servicedef/services_invoice.xml index 1b506a443ed..5a55b91eeee 100644 --- a/applications/accounting/servicedef/services_invoice.xml +++ b/applications/accounting/servicedef/services_invoice.xml @@ -56,8 +56,8 @@ under the License. - - + + @@ -80,8 +80,8 @@ under the License. - - + + @@ -117,7 +117,7 @@ under the License. - + @@ -125,7 +125,7 @@ under the License. - + @@ -429,7 +429,7 @@ under the License. - + @@ -439,7 +439,7 @@ under the License. - + diff --git a/applications/accounting/servicedef/services_ledger.xml b/applications/accounting/servicedef/services_ledger.xml index 70992c84b75..b4fb6ad80bf 100644 --- a/applications/accounting/servicedef/services_ledger.xml +++ b/applications/accounting/servicedef/services_ledger.xml @@ -30,7 +30,7 @@ under the License. Create a GlAccount record - + diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java index 8b6ba7675a9..71ad1646a98 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java @@ -273,7 +273,7 @@ public static Map finAccountPreAuth(DispatchContext dctx, Map createInvoiceForOrder(DispatchContext dctx, Ma if (billFromVendor != null) { List billingContactMechs = billFromVendor.getRelatedOne("Party", false).getRelated("PartyContactMechPurpose", UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION"), null, false); if (UtilValidate.isNotEmpty(billingContactMechs)) { - payToAddress = EntityUtil.getFirst(billingContactMechs); + payToAddress = EntityUtil.getFirst(EntityUtil.filterByDate(billingContactMechs)); } } } else { @@ -1205,19 +1205,24 @@ public static Map setInvoicesToReadyFromShipment(DispatchContext // 2. For every order check the invoice // 2.a If the invoice is in In-Process status, then move its status to ready and capture the payment. // 2.b If the invoice is in status other then IN-Process, skip this. These would be already paid and captured. - + GenericValue shipment = null; try { - EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); + shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting Shipment entity for shipment " + shipmentId, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingTroubleGettingShipmentEntity", UtilMisc.toMap("shipmentId", shipmentId), locale)); } + if (shipment == null) { + Debug.logError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale)); + } + List itemIssuances = new LinkedList(); try { itemIssuances = EntityQuery.use(delegator).select("orderId", "shipmentId") - .from("ItemIssuance").orderBy("orderId").distinct().queryList(); + .from("ItemIssuance").where("shipmentId", shipmentId).orderBy("orderId").distinct().queryList(); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting issued items from shipments", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java index a08d5f4e5e4..1927483bbae 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java @@ -511,10 +511,7 @@ public static BigDecimal getInvoiceCurrencyConversionRate(GenericValue invoice) if (UtilValidate.isNotEmpty(party) && party.getString("baseCurrencyUomId") != null) { otherCurrencyUomId = party.getString("baseCurrencyUomId"); } else { - otherCurrencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", delegator); - } - if (otherCurrencyUomId == null) { - otherCurrencyUomId = "USD"; // final default + otherCurrencyUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); } } catch (GenericEntityException e) { Debug.logError(e, "Trouble getting database records....", module); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java index d72e9f300aa..3934a8af5e8 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java @@ -66,7 +66,7 @@ public static Map createGiftCertificate(DispatchContext dctx, Ma GenericValue userLogin = (GenericValue) context.get("userLogin"); String productStoreId = (String) context.get("productStoreId"); BigDecimal initialAmount = (BigDecimal) context.get("initialAmount"); - + String currency = (String) context.get("currency"); String partyId = (String) context.get("partyId"); if (UtilValidate.isEmpty(partyId)) { partyId = "_NA_"; @@ -113,7 +113,14 @@ public static Map createGiftCertificate(DispatchContext dctx, Ma acctCtx.put("userLogin", userLogin); acctResult = dispatcher.runSync("createFinAccount", acctCtx); } else { - acctResult = dispatcher.runSync("createFinAccountForStore", UtilMisc.toMap("productStoreId", productStoreId, "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId, "userLogin", userLogin)); + Map createAccountCtx = new HashMap(); + createAccountCtx.put("ownerPartyId", partyId); + createAccountCtx.put("finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId); + createAccountCtx.put("productStoreId", productStoreId); + createAccountCtx.put("currencyUomId", currency); + createAccountCtx.put("finAccountName", accountName + "for party ["+partyId+"]"); + createAccountCtx.put("userLogin", userLogin); + acctResult = dispatcher.runSync("createFinAccountForStore", createAccountCtx); if (acctResult.get("finAccountId") != null) { finAccountId = cardNumber = (String) acctResult.get("finAccountId"); } @@ -270,7 +277,7 @@ public static Map redeemGiftCertificate(DispatchContext dctx, Ma } // validate the amount - if (amount.compareTo(BigDecimal.ZERO) < 0) { + if (amount.compareTo(ZERO) < 0) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "AccountingFinAccountMustBePositive", locale)); } @@ -301,9 +308,9 @@ public static Map redeemGiftCertificate(DispatchContext dctx, Ma } // check the actual balance (excluding authorized amounts) and create the transaction if it is sufficient - BigDecimal previousBalance = finAccount.get("actualBalance") == null ? BigDecimal.ZERO : finAccount.getBigDecimal("actualBalance"); + BigDecimal previousBalance = finAccount.get("actualBalance") == null ? ZERO : finAccount.getBigDecimal("actualBalance"); - BigDecimal balance = BigDecimal.ZERO; + BigDecimal balance = ZERO; String refNum = null; Boolean procResult; if (previousBalance.compareTo(amount) >= 0) { @@ -311,7 +318,7 @@ public static Map redeemGiftCertificate(DispatchContext dctx, Ma refNum = GiftCertificateServices.createTransaction(delegator, dispatcher, userLogin, amount, productStoreId, partyId, currencyUom, withdrawl, cardNumber, locale); finAccount.refresh(); - balance = finAccount.get("availableBalance") == null ? BigDecimal.ZERO : finAccount.getBigDecimal("availableBalance"); + balance = finAccount.get("availableBalance") == null ? ZERO : finAccount.getBigDecimal("availableBalance"); procResult = Boolean.TRUE; } catch (GeneralException e) { Debug.logError(e, module); @@ -356,7 +363,7 @@ public static Map checkGiftCertificateBalance(DispatchContext dc // TODO: get the real currency from context // get the balance - BigDecimal balance = finAccount.get("availableBalance") == null ? BigDecimal.ZERO : finAccount.getBigDecimal("availableBalance"); + BigDecimal balance = finAccount.get("availableBalance") == null ? ZERO : finAccount.getBigDecimal("availableBalance"); Map result = ServiceUtil.returnSuccess(); result.put("balance", balance); @@ -923,7 +930,7 @@ public static Map giftCertificatePurchase(DispatchContext dctx, // SC 20060405: Changed to runSync because runAsync kept getting an error: // Problem serializing service attributes (Cannot serialize object of class java.util.PropertyResourceBundle) try { - dispatcher.runSync("sendMailFromScreen", emailCtx); + dispatcher.runAsync("sendMailFromScreen", emailCtx); } catch (GenericServiceException e) { Debug.logError(e, "Problem sending mail", module); // this is fatal; we will rollback and try again later diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java index 73feb6043ff..5b2ade19903 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java @@ -1885,6 +1885,12 @@ public static Map processAuthResult(DispatchContext dctx, Map processCard(Map request, Prop AuthorizeResponse ar = new AuthorizeResponse(httpResponse, apiType); if (ar.isApproved()) { result.put("authResult", Boolean.TRUE); + } + //When the transaction is already expired in Authorize.net, then the response is an error message with reason code 16 (i.e. "The transaction cannot be found"); + // in this case we proceed without generating an error in order to void/cancel the transaction record in OFBiz as well. + //This else if block takes care of the expired transaction. + else if ("VOID".equals(props.get("transType")) && "16".equals(ar.getReasonCode())) { + result.put("authResult", Boolean.TRUE); } else { result.put("authResult", Boolean.FALSE); if (Debug.infoOn()) { diff --git a/applications/accounting/template/reports/InvoiceAcctgTransEntry.fo.ftl b/applications/accounting/template/reports/InvoiceAcctgTransEntry.fo.ftl new file mode 100644 index 00000000000..deb437a4571 --- /dev/null +++ b/applications/accounting/template/reports/InvoiceAcctgTransEntry.fo.ftl @@ -0,0 +1,281 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#-- +Generates PDF of multiple checks in two styles: one check per page, multiple checks per page +Note that this must be customized to fit specific check layouts. The layout here is copied +by hand from a real template using a ruler. +--> +<#escape x as x?xml> + + + + <#-- define the margins of the check layout here --> + + + + + + + + + + + + + + + + + + + + + ${uiLabelMap.FormFieldTitle_invoiceId}: + ${parameters.invoiceId!} + + + ${uiLabelMap.CommonDescription}: + ${invoiceDescription!} + + + ${uiLabelMap.CommonStatus}: + ${statusDescription!} + + + ${uiLabelMap.AccountingReferenceNumber}: + ${referenceNumber!} + + + + + + + + + + + + + ${uiLabelMap.CommonUsername}: + ${userLoginName!} + + + ${uiLabelMap.CommonDate}: + ${invoiceDate?string("dd MMMMM yyyy")} + + + ${uiLabelMap.CommonPartyId}: + ${partyId!} + + + ${uiLabelMap.AccountingPartyName}: + ${partyName!} + + + + + + + + + + + + + + + + + + + ${uiLabelMap.FormFieldTitle_accountCode} + + + ${uiLabelMap.FormFieldTitle_accountName} + + + ${uiLabelMap.AccountingOriginalCurrency} + + + ${uiLabelMap.AccountingExchangeRate} + + + ${uiLabelMap.AccountingDebitFlag} + + + ${uiLabelMap.AccountingCreditFlag} + + + + + <#assign debitTotal = 0/> + <#assign creditTotal = 0/> + <#list invoiceAcctgTransAndEntries as invoiceAcctgTransAndEntry> + + ${invoiceAcctgTransAndEntry.accountCode!} + ${invoiceAcctgTransAndEntry.accountName!} + ${invoiceAcctgTransAndEntry.origCurrencyUomId!} + ${invoiceAcctgTransAndEntry.origAmount!}/${invoiceAcctgTransAndEntry.amount!} ${invoiceAcctgTransAndEntry.origCurrencyUomId!}/${invoiceAcctgTransAndEntry.currencyUomId!} + + + <#if "D"==invoiceAcctgTransAndEntry.debitCreditFlag> + <#assign debitTotal = debitTotal +invoiceAcctgTransAndEntry.amount> + ${invoiceAcctgTransAndEntry.amount!} + + + + + + <#if "C"==invoiceAcctgTransAndEntry.debitCreditFlag> + <#assign creditTotal = creditTotal +invoiceAcctgTransAndEntry.amount> + ${invoiceAcctgTransAndEntry.amount!} + + + + + + + + + <#if debitTotal == creditTotal> + <#assign baseCurrencyUomId = (delegator.findOne("PartyAcctgPreference", {"partyId" : partyId}, true))!> + <#if baseCurrencyUomId?has_content && "THB" == baseCurrencyUomId.baseCurrencyUomId> + <#assign rule = "%bahts-and-stangs"> + <#assign locale = Static["org.apache.ofbiz.base.util.UtilMisc"].parseLocale("th")!/> + <#else> + <#assign rule = "%dollars-and-cents"> + <#assign locale = Static["org.apache.ofbiz.base.util.UtilMisc"].parseLocale("en_us")!/> + + <#assign amount = Static["org.apache.ofbiz.base.util.UtilNumber"].formatRuleBasedAmount(debitTotal, rule, locale).toUpperCase()> + ${uiLabelMap.AccountingTotalCapital} : ${amount!} + <#else> + ${uiLabelMap.AccountingDebitNotEqualCredit} + + + + + ${debitTotal!} + + ${creditTotal!} + + + + + + + + + + + + + + + + + + ${uiLabelMap.AccountingPreparedBy} + + + + + + + + + + + + + + ${uiLabelMap.AccountingApprovedBy} + + + + + + + + + + + + + + ${uiLabelMap.AccountingReceivedBy} + + + + + + + + + + + + + + + + + ${uiLabelMap.CommonDate} + + + + + + + + + + + + + + ${uiLabelMap.CommonDate} + + + + + + + + + + + + + + ${uiLabelMap.CommonDate} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy b/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy index d7192be11f3..370506db46f 100644 --- a/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy +++ b/applications/accounting/webapp/accounting/WEB-INF/actions/agreement/GetPartyNameForDate.groovy @@ -1,5 +1,3 @@ -partyIdFrom = parameters.partyIdFrom -partyIdTo = parameters.partyIdTo if (partyIdFrom) { context.partyNameResultFrom = runService("getPartyNameForDate", [partyId: partyIdFrom, compareDate: agreementDate, lastNameFirst: "Y"]) } diff --git a/applications/accounting/webapp/accounting/WEB-INF/controller.xml b/applications/accounting/webapp/accounting/WEB-INF/controller.xml index 284403b58c1..2ff2e53fe75 100644 --- a/applications/accounting/webapp/accounting/WEB-INF/controller.xml +++ b/applications/accounting/webapp/accounting/WEB-INF/controller.xml @@ -364,6 +364,11 @@ under the License. + + + + + @@ -771,7 +776,7 @@ under the License. - + @@ -2621,6 +2626,7 @@ under the License. + diff --git a/applications/accounting/widget/AgreementForms.xml b/applications/accounting/widget/AgreementForms.xml index d4d62b0190d..b7cccc0b996 100644 --- a/applications/accounting/widget/AgreementForms.xml +++ b/applications/accounting/widget/AgreementForms.xml @@ -287,7 +287,7 @@ under the License. - - + diff --git a/applications/accounting/widget/FieldLookupForms.xml b/applications/accounting/widget/FieldLookupForms.xml index 924c2cd826b..8e629f1b531 100644 --- a/applications/accounting/widget/FieldLookupForms.xml +++ b/applications/accounting/widget/FieldLookupForms.xml @@ -359,8 +359,8 @@ under the License. - diff --git a/applications/accounting/widget/FinAccountForms.xml b/applications/accounting/widget/FinAccountForms.xml index d8eb46471d9..efd67ec3e06 100644 --- a/applications/accounting/widget/FinAccountForms.xml +++ b/applications/accounting/widget/FinAccountForms.xml @@ -123,7 +123,7 @@ under the License. - + @@ -131,7 +131,7 @@ under the License. - + @@ -335,7 +335,7 @@ under the License. - diff --git a/applications/accounting/widget/FixedAssetForms.xml b/applications/accounting/widget/FixedAssetForms.xml index 7d61f6e14f3..289a871c29d 100644 --- a/applications/accounting/widget/FixedAssetForms.xml +++ b/applications/accounting/widget/FixedAssetForms.xml @@ -122,7 +122,8 @@ under the License. - + +
- + diff --git a/applications/accounting/widget/FixedAssetScreens.xml b/applications/accounting/widget/FixedAssetScreens.xml index e872d7c2995..a0f39a1494a 100644 --- a/applications/accounting/widget/FixedAssetScreens.xml +++ b/applications/accounting/widget/FixedAssetScreens.xml @@ -538,7 +538,6 @@ under the License. - diff --git a/applications/accounting/widget/GlForms.xml b/applications/accounting/widget/GlForms.xml index 86a56a7bbe1..b4d36b971a7 100644 --- a/applications/accounting/widget/GlForms.xml +++ b/applications/accounting/widget/GlForms.xml @@ -51,8 +51,8 @@ under the License. - @@ -228,8 +228,8 @@ under the License. - @@ -245,8 +245,8 @@ under the License. - @@ -587,8 +587,8 @@ under the License. - @@ -673,8 +673,8 @@ under the License. - @@ -737,8 +737,8 @@ under the License. - diff --git a/applications/accounting/widget/GlScreens.xml b/applications/accounting/widget/GlScreens.xml index bd849eec898..8c7fc0b987a 100644 --- a/applications/accounting/widget/GlScreens.xml +++ b/applications/accounting/widget/GlScreens.xml @@ -57,7 +57,7 @@ under the License.
- +
@@ -311,7 +311,7 @@ under the License. - +
diff --git a/applications/accounting/widget/GlSetupForms.xml b/applications/accounting/widget/GlSetupForms.xml index 7a3a4f3e0a9..9de25833e01 100644 --- a/applications/accounting/widget/GlSetupForms.xml +++ b/applications/accounting/widget/GlSetupForms.xml @@ -143,6 +143,7 @@ under the License. + @@ -163,18 +164,18 @@ under the License. - - - @@ -1193,7 +1194,7 @@ under the License. - - - - +
diff --git a/applications/party/widget/partymgr/LookupScreens.xml b/applications/party/widget/partymgr/LookupScreens.xml index 98022c2a12f..684106a726d 100644 --- a/applications/party/widget/partymgr/LookupScreens.xml +++ b/applications/party/widget/partymgr/LookupScreens.xml @@ -204,6 +204,9 @@ under the License. + + + @@ -308,6 +311,8 @@ under the License. + + diff --git a/applications/party/widget/partymgr/PartyClassificationScreens.xml b/applications/party/widget/partymgr/PartyClassificationScreens.xml index 979959551bd..ba6347290e0 100644 --- a/applications/party/widget/partymgr/PartyClassificationScreens.xml +++ b/applications/party/widget/partymgr/PartyClassificationScreens.xml @@ -65,7 +65,7 @@ under the License. - + @@ -136,7 +136,7 @@ under the License. - + diff --git a/applications/party/widget/partymgr/PartyForms.xml b/applications/party/widget/partymgr/PartyForms.xml index 54c38eefcb2..9b4aa8cce8c 100644 --- a/applications/party/widget/partymgr/PartyForms.xml +++ b/applications/party/widget/partymgr/PartyForms.xml @@ -32,10 +32,10 @@ under the License. - @@ -80,8 +80,8 @@ under the License.
- - + + @@ -137,7 +137,7 @@ under the License. - + @@ -148,6 +148,7 @@ under the License. + @@ -197,17 +198,17 @@ under the License. - - @@ -227,7 +228,7 @@ under the License. - + @@ -352,7 +353,7 @@ under the License. - + @@ -479,10 +480,10 @@ under the License. - + - + @@ -510,10 +511,10 @@ under the License. - + - + @@ -620,35 +621,35 @@ under the License. - + - + - + - + - + - + - + @@ -783,18 +784,13 @@ under the License. - + - - - - - @@ -812,8 +808,8 @@ under the License. - @@ -842,7 +838,7 @@ under the License. - + @@ -1290,7 +1286,7 @@ under the License.
+ default-table-style="basic-table hover-bar" target="EditPartyIdentification"> diff --git a/applications/party/widget/partymgr/PartyMenus.xml b/applications/party/widget/partymgr/PartyMenus.xml index 18ff7d4d276..8bf1ce04752 100644 --- a/applications/party/widget/partymgr/PartyMenus.xml +++ b/applications/party/widget/partymgr/PartyMenus.xml @@ -123,7 +123,6 @@ - @@ -277,6 +276,7 @@ + @@ -321,6 +321,7 @@ + @@ -730,7 +731,17 @@ - + + + + + + + + + + + diff --git a/applications/party/widget/partymgr/PartyScreens.xml b/applications/party/widget/partymgr/PartyScreens.xml index e4891963eb8..16fa62a9e2d 100644 --- a/applications/party/widget/partymgr/PartyScreens.xml +++ b/applications/party/widget/partymgr/PartyScreens.xml @@ -42,7 +42,7 @@ under the License. - + @@ -567,6 +567,47 @@ under the License. + + +
+ + + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + + + + + +
+
+
diff --git a/applications/party/widget/partymgr/ProfileScreens.xml b/applications/party/widget/partymgr/ProfileScreens.xml index ed1dd7bd2a5..3c4bafea558 100644 --- a/applications/party/widget/partymgr/ProfileScreens.xml +++ b/applications/party/widget/partymgr/ProfileScreens.xml @@ -25,6 +25,9 @@ + + + @@ -41,7 +44,7 @@ - + @@ -524,8 +527,8 @@ - - + +
diff --git a/applications/product/config/ProductPromoUiLabels.xml b/applications/product/config/ProductPromoUiLabels.xml index f79a78d1dcd..7dd85419b9f 100644 --- a/applications/product/config/ProductPromoUiLabels.xml +++ b/applications/product/config/ProductPromoUiLabels.xml @@ -19,67 +19,67 @@ is 等于 - 等于 + 等于 is not 不等于 - 不等于 + 不等于 invalid 无效 - 無效 + 無效 invalid 无效 - 無效 + 無效 invalid 无效 - 無效 + 無效 invalid 无效 - 無效 + 無效 exactly 等于 - 等于 + 等于 anything except 除了 - 除了 + 除了 less than 小于 - 小于 + 小于 less than 小于等于 - 小于等于 + 小于等于 more than 大于 - 大于 + 大于 more than 大于等于 - 大于等于 + 大于等于 - spend ${quantityOperator} $${condValue} - 花费 ${quantityOperator} $${condValue} - 花費 ${quantityOperator} $${condValue} + spend ${quantityOperator} ${condValue} + 花费 ${quantityOperator} ${condValue} + 花費 ${quantityOperator} ${condValue} Applied to party classification - ${partyClassificationsIncluded} @@ -88,73 +88,73 @@ Not applied to party classification - ${partyClassificationsExcluded} - buy ${quantityOperator} $${condValue} of qualifying products - 购买 ${quantityOperator} $${condValue} 的合格产品 - 購買 ${quantityOperator} $${condValue} 的合格產品 + buy ${quantityOperator} ${condValue} of qualifying products + 购买 ${quantityOperator} ${condValue} 的合格产品 + 購買 ${quantityOperator} ${condValue} 的合格產品 - for each $${condValue} or more of qualifying products - 对于每个 $${condValue} 或更多的合格产品 - 對于每個 $${condValue} 或更多的合格產品 + for each ${condValue} or more of qualifying products + 对于每个 ${condValue} 或更多的合格产品 + 對于每個 ${condValue} 或更多的合格產品 buy ${condValue} of qualifying products 购买 ${condValue} 合格产品 - 購買 ${condValue} 合格產品 + 購買 ${condValue} 合格產品 if your account is ${quantityOperator} ${condValue} days old 如果你的账户是 ${quantityOperator} ${condValue} 天 - 如果你的賬戶是 ${quantityOperator} ${condValue} 天 + 如果你的賬戶是 ${quantityOperator} ${condValue} 天 if your account ID ${equalityOperator} ${condValue} 如果你的账户标识 ${equalityOperator} ${condValue} - 如果你的賬戶標識 ${equalityOperator} ${condValue} + 如果你的賬戶標識 ${equalityOperator} ${condValue} if your account ${equalityOperator} part of the group with ID ${condValue} 如果你的账户 ${equalityOperator} 标识为 ${condValue} 的组的一部分 - 如果你的賬戶 ${equalityOperator} 標識為 ${condValue} 的組的一部分 + 如果你的賬戶 ${equalityOperator} 標識為 ${condValue} 的組的一部分 if your account ${equalityOperator} in the role with ID ${condValue} 如果你的账户 ${equalityOperator} 在标识为 ${condValue} 的角色中 - 如果你的賬戶 ${equalityOperator} 在標識為 ${condValue} 的角色中 + 如果你的賬戶 ${equalityOperator} 在標識為 ${condValue} 的角色中 get a free ${productName} [${productId}] 得到一个免费的 ${productName} [${productId}] - 得到一個免費的 ${productName} [${productId}] + 得到一個免費的 ${productName} [${productId}] get free shipping of type ${productId} on carrier ${partyId} 得到免费的货运,类型为 ${productId},承运商为 ${partyId} - 得到免費的貨運,類型為 ${productId},承運商為 ${partyId} + 得到免費的貨運,類型為 ${productId},承運商為 ${partyId} get ${quantity} at ${amount}% discount 得到 ${quantity} 按折扣 ${amount}% - 得到 ${quantity} 按折扣 ${amount}% + 得到 ${quantity} 按折扣 ${amount}% - get ${quantity} at $${amount} off - 得到 ${quantity} 按 $${amount} 扣除 - 得到 ${quantity} 按 $${amount} 扣除 + get ${quantity} at ${amount} off + 得到 ${quantity} 按 ${amount} 扣除 + 得到 ${quantity} 按 ${amount} 扣除 - get ${quantity} for $${amount} - 得到 ${quantity} 按 $${amount} 计算 - 得到 ${quantity} 按 $${amount} 計算 + get ${quantity} for ${amount} + 得到 ${quantity} 按 ${amount} 计算 + 得到 ${quantity} 按 ${amount} 計算 get ${amount}% off your order 得到 ${amount}% 从你的订单扣除 - 得到 ${amount}% 從你的訂單扣除 + 得到 ${amount}% 從你的訂單扣除 - get $${amount} off your order - 得到 $${amount} 从你的订单扣除 - 得到 $${amount} 從你的訂單扣除 + get ${amount} off your order + 得到 ${amount} 从你的订单扣除 + 得到 ${amount} 從你的訂單扣除 \ No newline at end of file diff --git a/applications/product/config/ProductUiLabels.xml b/applications/product/config/ProductUiLabels.xml index 17aea22bf9e..63ba727d07e 100644 --- a/applications/product/config/ProductUiLabels.xml +++ b/applications/product/config/ProductUiLabels.xml @@ -15229,6 +15229,9 @@ 配置选项 配置選項 + + Config Option + Konfigurationen Configurations diff --git a/applications/product/config/freemarkerTransforms.properties b/applications/product/config/freemarkerTransforms.properties index 72c9ae38ea6..18a197a267d 100644 --- a/applications/product/config/freemarkerTransforms.properties +++ b/applications/product/config/freemarkerTransforms.properties @@ -25,4 +25,5 @@ #ofbizCatalogUrl=org.apache.ofbiz.product.category.ftl.CatalogUrlDirective ofbizCatalogAltUrl=org.apache.ofbiz.product.category.ftl.CatalogAltUrlSeoTransform ofbizCatalogUrl=org.apache.ofbiz.product.category.ftl.CatalogUrlSeoTransform +ofbizUrl=org.apache.ofbiz.product.category.ftl.UrlRegexpTransform diff --git a/applications/product/entitydef/eecas.xml b/applications/product/entitydef/eecas.xml index f67c867f231..0c657c2ff82 100644 --- a/applications/product/entitydef/eecas.xml +++ b/applications/product/entitydef/eecas.xml @@ -73,7 +73,7 @@ under the License. - + diff --git a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy index 78ddffc25b6..16f6ffaff19 100644 --- a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy +++ b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy @@ -122,12 +122,19 @@ if (action) { whereConditionsList.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%")) searchParameterString = searchParameterString + "&productId=" + productId } - whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND) + // add statusId in search parametters + if (statusId) { + searchParameterString = searchParameterString + "&statusId=" + statusId; + } + + whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND) beganTransaction = false // get the indexes for the partial list lowIndex = ((viewIndex.intValue() * viewSize.intValue()) + 1) highIndex = (viewIndex.intValue() + 1) * viewSize.intValue() + // add viewSize and viewIndex in search parameters + searchParameterString = searchParameterString + "&VIEW_SIZE=" + viewSize + "&VIEW_INDEX=" + viewIndex; List prods = null try { beganTransaction = TransactionUtil.begin() diff --git a/applications/product/minilang/product/category/CategoryContentServices.xml b/applications/product/minilang/product/category/CategoryContentServices.xml index 39a36b67a25..496ff622cf1 100644 --- a/applications/product/minilang/product/category/CategoryContentServices.xml +++ b/applications/product/minilang/product/category/CategoryContentServices.xml @@ -22,7 +22,7 @@ under the License. xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> - + @@ -41,7 +41,7 @@ under the License. - + diff --git a/applications/product/minilang/product/category/CategoryServices.xml b/applications/product/minilang/product/category/CategoryServices.xml index ec025a982b8..933844438e0 100644 --- a/applications/product/minilang/product/category/CategoryServices.xml +++ b/applications/product/minilang/product/category/CategoryServices.xml @@ -33,7 +33,7 @@ under the License. - + @@ -67,7 +67,7 @@ under the License. - + @@ -145,7 +145,7 @@ under the License. - + @@ -161,7 +161,7 @@ under the License. - + @@ -177,7 +177,7 @@ under the License. - + @@ -189,7 +189,7 @@ under the License. - + @@ -207,7 +207,7 @@ under the License. - + @@ -227,7 +227,7 @@ under the License. - + @@ -246,7 +246,7 @@ under the License. - + @@ -267,7 +267,7 @@ under the License. - + @@ -282,7 +282,7 @@ under the License. - + @@ -577,7 +577,7 @@ under the License. - + @@ -590,7 +590,7 @@ under the License. - + @@ -603,7 +603,7 @@ under the License. - + diff --git a/applications/product/minilang/product/config/ConfigServices.xml b/applications/product/minilang/product/config/ConfigServices.xml index 6be9f22dad9..ced4e32b7bc 100644 --- a/applications/product/minilang/product/config/ConfigServices.xml +++ b/applications/product/minilang/product/config/ConfigServices.xml @@ -23,7 +23,7 @@ under the License. - + diff --git a/applications/product/minilang/product/config/ProductConfigItemContentServices.xml b/applications/product/minilang/product/config/ProductConfigItemContentServices.xml index 1a81f92f076..4894961e260 100644 --- a/applications/product/minilang/product/config/ProductConfigItemContentServices.xml +++ b/applications/product/minilang/product/config/ProductConfigItemContentServices.xml @@ -22,7 +22,7 @@ under the License. xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> - + @@ -41,7 +41,7 @@ under the License. - + diff --git a/applications/product/minilang/product/cost/CostServices.xml b/applications/product/minilang/product/cost/CostServices.xml index df09a77a2f9..ce88ffb9f53 100644 --- a/applications/product/minilang/product/cost/CostServices.xml +++ b/applications/product/minilang/product/cost/CostServices.xml @@ -45,7 +45,7 @@ under the License. - + @@ -109,7 +109,6 @@ under the License. - @@ -119,7 +118,7 @@ under the License. - + @@ -573,7 +572,7 @@ under the License. - + diff --git a/applications/product/minilang/product/feature/ProductFeatureServices.xml b/applications/product/minilang/product/feature/ProductFeatureServices.xml index 835d6bcee2c..8f58a72f93c 100644 --- a/applications/product/minilang/product/feature/ProductFeatureServices.xml +++ b/applications/product/minilang/product/feature/ProductFeatureServices.xml @@ -75,7 +75,7 @@ under the License. - + @@ -88,7 +88,7 @@ under the License. - + diff --git a/applications/product/minilang/product/imagemanagement/ImageManagementServices.xml b/applications/product/minilang/product/imagemanagement/ImageManagementServices.xml index 5cf0d231072..154c302f302 100644 --- a/applications/product/minilang/product/imagemanagement/ImageManagementServices.xml +++ b/applications/product/minilang/product/imagemanagement/ImageManagementServices.xml @@ -147,7 +147,7 @@ under the License. - + diff --git a/applications/product/minilang/product/inventory/InventoryServices.xml b/applications/product/minilang/product/inventory/InventoryServices.xml index ab2ae3c1ad9..c9b8eebeca2 100644 --- a/applications/product/minilang/product/inventory/InventoryServices.xml +++ b/applications/product/minilang/product/inventory/InventoryServices.xml @@ -158,14 +158,14 @@ under the License. - + - + @@ -308,7 +308,7 @@ under the License. - + @@ -339,7 +339,7 @@ under the License. - + @@ -355,7 +355,7 @@ under the License. - + @@ -407,7 +407,7 @@ under the License. - + @@ -425,7 +425,7 @@ under the License. - + @@ -445,7 +445,7 @@ under the License. - + @@ -548,7 +548,7 @@ under the License. - + @@ -562,11 +562,12 @@ under the License. + - + @@ -899,7 +900,7 @@ under the License. - + @@ -1025,6 +1026,9 @@ under the License. + + + diff --git a/applications/product/minilang/product/price/PriceServices.xml b/applications/product/minilang/product/price/PriceServices.xml index b9ecfa78283..bdd91fe6f7f 100644 --- a/applications/product/minilang/product/price/PriceServices.xml +++ b/applications/product/minilang/product/price/PriceServices.xml @@ -32,7 +32,7 @@ under the License. - + @@ -167,7 +167,7 @@ under the License. - + @@ -192,7 +192,7 @@ under the License. - + diff --git a/applications/product/minilang/product/product/CustomerDigitalDownloadServices.xml b/applications/product/minilang/product/product/CustomerDigitalDownloadServices.xml index bb0c54704bc..153670157b9 100644 --- a/applications/product/minilang/product/product/CustomerDigitalDownloadServices.xml +++ b/applications/product/minilang/product/product/CustomerDigitalDownloadServices.xml @@ -23,7 +23,7 @@ under the License. - + @@ -33,7 +33,7 @@ under the License. - + @@ -43,7 +43,7 @@ under the License. - + @@ -59,7 +59,7 @@ under the License. - + @@ -168,7 +168,7 @@ under the License. - + diff --git a/applications/product/minilang/product/product/ProductContentServices.xml b/applications/product/minilang/product/product/ProductContentServices.xml index 141d6c61ea6..39b938d33c5 100644 --- a/applications/product/minilang/product/product/ProductContentServices.xml +++ b/applications/product/minilang/product/product/ProductContentServices.xml @@ -22,7 +22,7 @@ under the License. xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> - + @@ -41,7 +41,7 @@ under the License. - + @@ -51,7 +51,7 @@ under the License. - + diff --git a/applications/product/minilang/product/product/ProductServices.xml b/applications/product/minilang/product/product/ProductServices.xml index e1bddaf3176..3c94c2029aa 100644 --- a/applications/product/minilang/product/product/ProductServices.xml +++ b/applications/product/minilang/product/product/ProductServices.xml @@ -27,7 +27,7 @@ under the License. - + @@ -83,7 +83,7 @@ under the License. - + @@ -420,7 +420,7 @@ under the License. - + @@ -447,7 +447,7 @@ under the License. - + @@ -486,7 +486,7 @@ under the License. - + @@ -509,7 +509,7 @@ under the License. - + @@ -680,6 +680,7 @@ under the License. + @@ -745,7 +746,7 @@ under the License. - + @@ -761,7 +762,7 @@ under the License. - + @@ -773,7 +774,7 @@ under the License. - + @@ -786,7 +787,7 @@ under the License. - + diff --git a/applications/product/minilang/product/promo/PromoServices.xml b/applications/product/minilang/product/promo/PromoServices.xml index 358c16f90a0..8ddeb6af954 100644 --- a/applications/product/minilang/product/promo/PromoServices.xml +++ b/applications/product/minilang/product/promo/PromoServices.xml @@ -23,7 +23,7 @@ under the License. - + diff --git a/applications/product/minilang/product/storage/FacilityContactMechServices.xml b/applications/product/minilang/product/storage/FacilityContactMechServices.xml index 213c04f7f33..ac27d2ad50f 100644 --- a/applications/product/minilang/product/storage/FacilityContactMechServices.xml +++ b/applications/product/minilang/product/storage/FacilityContactMechServices.xml @@ -48,7 +48,7 @@ under the License. - + @@ -72,9 +72,9 @@ under the License. - + - + @@ -144,7 +144,7 @@ under the License. - + @@ -164,7 +164,7 @@ under the License. - + @@ -184,7 +184,7 @@ under the License. - + @@ -214,7 +214,7 @@ under the License. - + @@ -278,7 +278,7 @@ under the License. - + diff --git a/applications/product/minilang/product/storage/StorageServices.xml b/applications/product/minilang/product/storage/StorageServices.xml index a5315463571..a4cd7e26b7c 100644 --- a/applications/product/minilang/product/storage/StorageServices.xml +++ b/applications/product/minilang/product/storage/StorageServices.xml @@ -23,7 +23,7 @@ under the License. - + @@ -63,14 +63,14 @@ under the License. - + - + diff --git a/applications/product/minilang/product/store/ProductStoreServices.xml b/applications/product/minilang/product/store/ProductStoreServices.xml index b763b242a1b..3c524f7d3b6 100644 --- a/applications/product/minilang/product/store/ProductStoreServices.xml +++ b/applications/product/minilang/product/store/ProductStoreServices.xml @@ -49,7 +49,7 @@ under the License. - + @@ -62,7 +62,7 @@ under the License. - + @@ -119,7 +119,7 @@ under the License. - + @@ -478,6 +478,7 @@ under the License. + diff --git a/applications/product/minilang/shipment/issuance/IssuanceServices.xml b/applications/product/minilang/shipment/issuance/IssuanceServices.xml index 24e2cca3da1..56a8a31b4b8 100644 --- a/applications/product/minilang/shipment/issuance/IssuanceServices.xml +++ b/applications/product/minilang/shipment/issuance/IssuanceServices.xml @@ -26,7 +26,7 @@ under the License. - + @@ -87,7 +87,7 @@ under the License. - + @@ -105,6 +105,7 @@ under the License. + @@ -133,6 +134,7 @@ under the License. + diff --git a/applications/product/minilang/shipment/picklist/PicklistServices.xml b/applications/product/minilang/shipment/picklist/PicklistServices.xml index b377f54ad4f..0b700ddd41b 100644 --- a/applications/product/minilang/shipment/picklist/PicklistServices.xml +++ b/applications/product/minilang/shipment/picklist/PicklistServices.xml @@ -188,7 +188,7 @@ under the License. - + @@ -900,7 +900,7 @@ under the License. --> - + @@ -1192,7 +1192,7 @@ under the License. A Map with a List of PicklistItemInfo records keyed by the productId --> - + @@ -1550,12 +1550,12 @@ under the License. - + - + diff --git a/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml b/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml index 2e776124ef6..d442acb7b2b 100644 --- a/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml +++ b/applications/product/minilang/shipment/receipt/ShipmentReceiptServices.xml @@ -21,7 +21,7 @@ under the License. - + @@ -64,7 +64,7 @@ under the License. - + @@ -72,7 +72,7 @@ under the License. - + @@ -363,6 +363,7 @@ under the License. + diff --git a/applications/product/minilang/shipment/shipment/ShipmentServices.xml b/applications/product/minilang/shipment/shipment/ShipmentServices.xml index 78bc658e045..c0a50b8bbf4 100644 --- a/applications/product/minilang/shipment/shipment/ShipmentServices.xml +++ b/applications/product/minilang/shipment/shipment/ShipmentServices.xml @@ -22,7 +22,7 @@ under the License. xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> - + @@ -76,15 +76,15 @@ under the License. - + - + - - + + @@ -114,8 +114,9 @@ under the License. + - + @@ -821,7 +822,7 @@ under the License. - + @@ -834,7 +835,7 @@ under the License. - + @@ -856,7 +857,7 @@ under the License. - + @@ -949,7 +950,7 @@ under the License. - + @@ -974,7 +975,7 @@ under the License. - + @@ -1033,7 +1034,7 @@ under the License. - + @@ -1045,7 +1046,7 @@ under the License. - + @@ -1056,7 +1057,7 @@ under the License. - + @@ -1065,7 +1066,7 @@ under the License. - + @@ -1090,7 +1091,7 @@ under the License. - + @@ -1101,7 +1102,7 @@ under the License. - + @@ -1113,7 +1114,7 @@ under the License. - + @@ -1231,7 +1232,7 @@ under the License. - + @@ -1242,7 +1243,7 @@ under the License. - + @@ -2015,7 +2016,7 @@ under the License. - + diff --git a/applications/product/servicedef/services.xml b/applications/product/servicedef/services.xml index a5c7e1821c1..8a3e6693a8a 100644 --- a/applications/product/servicedef/services.xml +++ b/applications/product/servicedef/services.xml @@ -34,8 +34,8 @@ under the License. - - + + @@ -70,8 +70,8 @@ under the License. - - + + @@ -387,7 +387,7 @@ under the License. - + - + @@ -426,7 +426,7 @@ under the License. - + @@ -436,13 +436,13 @@ under the License. - + - + @@ -942,7 +942,7 @@ under the License. - + @@ -952,7 +952,7 @@ under the License. - + - + - + diff --git a/applications/product/servicedef/services_facility.xml b/applications/product/servicedef/services_facility.xml index 32a2ac359b6..f34d8671a71 100644 --- a/applications/product/servicedef/services_facility.xml +++ b/applications/product/servicedef/services_facility.xml @@ -863,7 +863,6 @@ under the License. - Update an InventoryItemLabel diff --git a/applications/product/servicedef/services_feature.xml b/applications/product/servicedef/services_feature.xml index 286a94bf69a..8e200481664 100644 --- a/applications/product/servicedef/services_feature.xml +++ b/applications/product/servicedef/services_feature.xml @@ -43,7 +43,7 @@ under the License. Create a ProductFeature record - + diff --git a/applications/product/servicedef/services_pricepromo.xml b/applications/product/servicedef/services_pricepromo.xml index ffa63087c43..2c125dea524 100644 --- a/applications/product/servicedef/services_pricepromo.xml +++ b/applications/product/servicedef/services_pricepromo.xml @@ -132,7 +132,7 @@ under the License. - + @@ -140,7 +140,7 @@ under the License. - + diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java index c68525224b4..87aaaf57878 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java @@ -34,7 +34,6 @@ import org.apache.ofbiz.base.util.StringUtil; import org.apache.ofbiz.base.util.UtilCodec; import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.cache.UtilCache; import org.apache.ofbiz.content.content.ContentWorker; @@ -145,25 +144,8 @@ public static void getProductCategoryContentAsText(String productCategoryId, Gen throw new GeneralRuntimeException("Unable to find a delegator to use!"); } - List categoryContentList = EntityQuery.use(delegator).from("ProductCategoryContent").where("productCategoryId", productCategoryId, "prodCatContentTypeId", prodCatContentTypeId).orderBy("-fromDate").cache(cache).queryList(); - categoryContentList = EntityUtil.filterByDate(categoryContentList); - - GenericValue categoryContent = null; - String sessionLocale = locale.toString(); - String fallbackLocale = UtilProperties.getFallbackLocale().toString(); - if ( sessionLocale == null ) sessionLocale = fallbackLocale; - // look up all content found for locale - for( GenericValue currentContent: categoryContentList ) { - GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", currentContent.getString("contentId")).cache(cache).queryOne(); - if ( sessionLocale.equals(content.getString("localeString")) ) { - // valid locale found - categoryContent = currentContent; - break; - } else if ( fallbackLocale.equals(content.getString("localeString")) ) { - // fall back to default locale - categoryContent = currentContent; - } - } + List categoryContentList = EntityQuery.use(delegator).from("ProductCategoryContent").where("productCategoryId", productCategoryId, "prodCatContentTypeId", prodCatContentTypeId).orderBy("-fromDate").cache(cache).filterByDate().queryList(); + GenericValue categoryContent = EntityUtil.getFirst(categoryContentList); if (categoryContent != null) { // when rendering the category content, always include the Product Category and ProductCategoryContent records that this comes from Map inContext = new HashMap(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java index ad4d901e94f..3ef38f64beb 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java @@ -136,10 +136,6 @@ public static Map scaleImageInAllSize(Map context = UtilGenerics.checkMap(request.getParameterMap()); String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", (Delegator) context.get("delegator")), context); File file = new File(imageServerPath + "/preview/" + "/previewImage.jpg"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java index 81bb160dc89..5aff8733084 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java @@ -336,8 +336,8 @@ private static Map scaleImageMangementInAllSize(DispatchContext index = filenameToUse.lastIndexOf("."); String imgExtension = filenameToUse.substring(index + 1); // paths - String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", (Delegator) context.get("delegator")), context); - String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", (Delegator) context.get("delegator")), context); + String imageServerPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", dctx.getDelegator()), context); + String imageServerUrl = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.url", dctx.getDelegator()), context); /* get original BUFFERED IMAGE */ diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java index 5aab66e6a87..ce499ed036d 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ReplaceImage.java @@ -32,13 +32,13 @@ import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.string.FlexibleStringExpander; import org.apache.ofbiz.entity.Delegator; -import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.GenericEntityException; +import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.service.DispatchContext; -import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.GenericServiceException; +import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; public class ReplaceImage{ @@ -68,7 +68,7 @@ public static Map replaceImageToExistImage(DispatchContext dctx, } } else{ - String errMsg = UtilProperties.getMessage(resourceError, "ProductPleaseChooseImageToReplace", locale); + String errMsg = UtilProperties.getMessage(resourceError, "ProductPleaseChooseImageToReplace", locale); Debug.logError(errMsg, module); return ServiceUtil.returnError(errMsg); } @@ -116,17 +116,13 @@ public static Map replaceImageToExistImage(DispatchContext dctx, productContentCtx.put("userLogin", userLogin); dispatcher.runSync("removeProductContentAndImageFile", productContentCtx); } - } catch (GenericEntityException gee) { + } catch (GenericEntityException | GenericServiceException e) { String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale); - Debug.logError(errMsg, module); + Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); - } catch (GenericServiceException gse) { + } catch (Exception e) { String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale); - Debug.logError(errMsg, module); - return ServiceUtil.returnError(errMsg); - } catch (Exception gse) { - String errMsg = UtilProperties.getMessage(resourceError, "ProductCannotReplaceImage", locale); - Debug.logError(errMsg, module); + Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } String successMsg = UtilProperties.getMessage(resource, "ProductReplaceImageSuccessfully", locale); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java index fdea7bfff0e..5aa74914cf6 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java @@ -133,9 +133,9 @@ public static Map prepareInventoryTransfer(DispatchContext dctx, results.put("inventoryItemId", newItem.get("inventoryItemId")); // TODO: how do we get this here: "inventoryTransferId", inventoryTransferId - Map createNewDetailMap = UtilMisc.toMap("availableToPromiseDiff", xferQty, "quantityOnHandDiff", xferQty, + Map createNewDetailMap = UtilMisc.toMap("availableToPromiseDiff", xferQty, "quantityOnHandDiff", xferQty, "accountingQuantityDiff", xferQty, "inventoryItemId", newItem.get("inventoryItemId"), "userLogin", userLogin); - Map createUpdateDetailMap = UtilMisc.toMap("availableToPromiseDiff", negXferQty, "quantityOnHandDiff", negXferQty, + Map createUpdateDetailMap = UtilMisc.toMap("availableToPromiseDiff", negXferQty, "quantityOnHandDiff", negXferQty, "accountingQuantityDiff", negXferQty, "inventoryItemId", inventoryItem.get("inventoryItemId"), "userLogin", userLogin); try { @@ -752,7 +752,7 @@ public static Map getProductInventorySummaryForItems(DispatchCon LocalDispatcher dispatcher = dctx.getDispatcher(); List orderItems = UtilGenerics.checkList(context.get("orderItems")); String facilityId = (String) context.get("facilityId"); - Locale locale = (Locale) context.get(""); + Locale locale = (Locale) context.get("locale"); Map atpMap = new HashMap(); Map qohMap = new HashMap(); Map mktgPkgAtpMap = new HashMap(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index f6bd34a4d20..3299cf98247 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -1031,7 +1031,7 @@ public static boolean checkPriceCondition(GenericValue productPriceCond, String int compare = 0; if ("PRIP_PRODUCT_ID".equals(productPriceCond.getString("inputParamEnumId"))) { - compare = productId.compareTo(productPriceCond.getString("condValue")); + compare = UtilMisc.toList(productId, virtualProductId).contains(productPriceCond.getString("condValue"))? 0: 1; } else if ("PRIP_PROD_CAT_ID".equals(productPriceCond.getString("inputParamEnumId"))) { // if a ProductCategoryMember exists for this productId and the specified productCategoryId String productCategoryId = productPriceCond.getString("condValue"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java index 3ba9f3165f4..522219dff56 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductSearchSession.java @@ -377,7 +377,6 @@ public static final String checkDoKeywordOverride(HttpServletRequest request, Ht HttpSession session = request.getSession(); Delegator delegator = (Delegator) request.getAttribute("delegator"); Map requestParams = UtilHttp.getParameterMap(request); - ProductSearchSession.processSearchParameters(requestParams, request); // get the current productStoreId String productStoreId = ProductStoreWorker.getProductStoreId(request); @@ -509,11 +508,6 @@ public static void processSearchParameters(Map parameters, HttpS Delegator delegator = (Delegator) request.getAttribute("delegator"); Boolean alreadyRun = (Boolean) request.getAttribute("processSearchParametersAlreadyRun"); if (Boolean.TRUE.equals(alreadyRun)) { - // even if already run, check the VIEW_SIZE and VIEW_INDEX again, just for kicks - ProductSearchOptions productSearchOptions = getProductSearchOptions(request.getSession()); - productSearchOptions.setViewIndex((String) parameters.get("VIEW_INDEX")); - productSearchOptions.setViewSize((String) parameters.get("VIEW_SIZE")); - productSearchOptions.setPaging((String) parameters.get("PAGING")); return; } else { request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE); @@ -1229,33 +1223,26 @@ public static List> listCountByFeatureForType(String product dynamicViewEntity.addViewLink("PFAC", "PFC", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productFeatureId")); entityConditionList.add(EntityCondition.makeCondition("pfcProductFeatureTypeId", EntityOperator.EQUALS, productFeatureTypeId)); - EntityListIterator eli = null; - try { - eli = EntityQuery.use(delegator) + List> featureCountList = null; + try (EntityListIterator eli = EntityQuery.use(delegator) .select(UtilMisc.toSet("pfacProductFeatureId", "featureCount", "pfcDescription", "pfcProductFeatureTypeId")) .from(dynamicViewEntity) .where(entityConditionList) .orderBy(productSearchContext.orderByList) .cursorScrollInsensitive() - .queryIterator(); + .queryIterator()) { + + featureCountList = new LinkedList>(); + GenericValue searchResult = null; + while ((searchResult = eli.next()) != null) { + featureCountList.add(UtilMisc.toMap("productFeatureId", (String) searchResult.get("pfacProductFeatureId"), "productFeatureTypeId", (String) searchResult.get("pfcProductFeatureTypeId"), "description", (String) searchResult.get("pfcDescription"), "featureCount", Long.toString((Long) searchResult.get("featureCount")))); + } } catch (GenericEntityException e) { Debug.logError(e, "Error in product search", module); return null; } - List> featureCountList = new LinkedList>(); - GenericValue searchResult = null; - while ((searchResult = eli.next()) != null) { - featureCountList.add(UtilMisc.toMap("productFeatureId", (String) searchResult.get("pfacProductFeatureId"), "productFeatureTypeId", (String) searchResult.get("pfcProductFeatureTypeId"), "description", (String) searchResult.get("pfcDescription"), "featureCount", Long.toString((Long) searchResult.get("featureCount")))); - } - if (eli != null) { - try { - eli.close(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error closing ProductSearch EntityListIterator"); - } - } return featureCountList; } @@ -1308,31 +1295,21 @@ public static long getCountForListPriceRange(BigDecimal priceLow, BigDecimal pri entityConditionList.add(EntityCondition.makeCondition("ppcPrice", EntityOperator.LESS_THAN_EQUAL_TO, priceHigh)); entityConditionList.add(EntityCondition.makeCondition("ppcProductPriceTypeId", EntityOperator.EQUALS, "LIST_PRICE")); - EntityListIterator eli = null; - try { - eli = EntityQuery.use(delegator).select(UtilMisc.toSet(fieldsToSelect)) - .from(dynamicViewEntity) - .where(entityConditionList) - .orderBy(productSearchContext.orderByList) - .cursorScrollInsensitive() - .queryIterator(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error in product search", module); - return 0; - } - - GenericValue searchResult = null; Long priceRangeCount = Long.valueOf(0); - while ((searchResult = eli.next()) != null) { - priceRangeCount = searchResult.getLong("priceRangeCount"); - } - - if (eli != null) { - try { - eli.close(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error closing ProductSearch EntityListIterator"); + try (EntityListIterator eli = EntityQuery.use(delegator) + .select(UtilMisc.toSet(fieldsToSelect)) + .from(dynamicViewEntity) + .where(entityConditionList) + .orderBy(productSearchContext.orderByList) + .cursorScrollInsensitive() + .queryIterator()) { + + GenericValue searchResult = null; + while ((searchResult = eli.next()) != null) { + priceRangeCount = searchResult.getLong("priceRangeCount"); } + } catch (GenericEntityException e) { + Debug.logError(e, "Error in product search", module); } return priceRangeCount; } @@ -1374,31 +1351,21 @@ public static long getCountForProductCategory(String productCategoryId, HttpSess ProductSearch.getAllSubCategoryIds(productCategoryId, productCategoryIdSet, delegator, productSearchContext.nowTimestamp); entityConditionList.add(EntityCondition.makeCondition("pcmcProductCategoryId", EntityOperator.IN, productCategoryIdSet)); - EntityListIterator eli = null; - try { - eli = EntityQuery.use(delegator).select(UtilMisc.toSet(fieldsToSelect)) - .from(dynamicViewEntity) - .where(entityConditionList) - .orderBy(productSearchContext.orderByList) - .cursorScrollInsensitive() - .queryIterator(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error in product search", module); - return 0; - } - - GenericValue searchResult = null; Long categoryCount = Long.valueOf(0); - while ((searchResult = eli.next()) != null) { - categoryCount = searchResult.getLong("categoryCount"); - } - - if (eli != null) { - try { - eli.close(); - } catch (GenericEntityException e) { - Debug.logError(e, "Error closing ProductSearch EntityListIterator"); + try (EntityListIterator eli = EntityQuery.use(delegator) + .select(UtilMisc.toSet(fieldsToSelect)) + .from(dynamicViewEntity) + .where(entityConditionList) + .orderBy(productSearchContext.orderByList) + .cursorScrollInsensitive() + .queryIterator()) { + + GenericValue searchResult = null; + while ((searchResult = eli.next()) != null) { + categoryCount = searchResult.getLong("categoryCount"); } + } catch (GenericEntityException e) { + Debug.logError(e, "Error in product search", module); } return categoryCount; } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java index b48ebeb5371..b9e048cf8da 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductWorker.java @@ -487,11 +487,11 @@ public static List>> getSelectableProductFeaturesByTypes * @return a List of ProductFeature GenericValues */ public static List getVariantSelectionFeatures(GenericValue variantProduct) { - if (!"Y".equals(variantProduct.getString("isVariant"))) { + if (variantProduct == null || !"Y".equals(variantProduct.getString("isVariant"))) { return null; } GenericValue virtualProduct = ProductWorker.getParentProduct(variantProduct.getString("productId"), variantProduct.getDelegator()); - if (virtualProduct == null || !"Y".equals(virtualProduct.getString("productId"))) { + if (virtualProduct == null || !"Y".equals(virtualProduct.getString("isVirtual"))) { return null; } // The selectable features from the virtual product diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java index 32880bb2620..29175f35a46 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java @@ -143,8 +143,13 @@ public void addOrIncreaseLine(String orderId, String orderItemSeqId, String ship // find the inventoryItemId to use if (reservations.size() == 1) { GenericValue res = EntityUtil.getFirst(reservations); - int checkCode = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, packageSeqId, update); - this.createPackLineItem(checkCode, res, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, weight, packageSeqId); + BigDecimal resQty = numAvailableItems(res); + + // If reservation has enough for the quantity required + if (resQty.compareTo(quantity) >= 0) { + int checkCode = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, packageSeqId, update); + this.createPackLineItem(checkCode, res, orderId, orderItemSeqId, shipGroupSeqId, productId, quantity, weight, packageSeqId); + } } else { // more than one reservation found Map toCreateMap = new HashMap(); @@ -159,30 +164,36 @@ public void addOrIncreaseLine(String orderId, String orderItemSeqId, String ship continue; } - BigDecimal resQty = res.getBigDecimal("quantity"); - BigDecimal resPackedQty = this.getPackedQuantity(orderId, orderItemSeqId, shipGroupSeqId, productId, res.getString("inventoryItemId"), -1); - if (resPackedQty.compareTo(resQty) >= 0) { - continue; - } else if (!update) { - resQty = resQty.subtract(resPackedQty); - } + BigDecimal resQty = numAvailableItems(res); - BigDecimal thisQty = resQty.compareTo(qtyRemain) > 0 ? qtyRemain : resQty; + if (resQty.compareTo(BigDecimal.ZERO) > 0) { + BigDecimal resPackedQty = this.getPackedQuantity(orderId, orderItemSeqId, shipGroupSeqId, productId, res.getString("inventoryItemId"), -1); + if (resPackedQty.compareTo(resQty) >= 0) { + continue; + } else if (!update) { + resQty = resQty.subtract(resPackedQty); + } - int thisCheck = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty, packageSeqId, update); - switch (thisCheck) { - case 2: - Debug.logInfo("Packing check returned '2' - new pack line will be created!", module); - toCreateMap.put(res, thisQty); - qtyRemain = qtyRemain.subtract(thisQty); - break; - case 1: - Debug.logInfo("Packing check returned '1' - existing pack line has been updated!", module); - qtyRemain = qtyRemain.subtract(thisQty); - break; - case 0: - Debug.logInfo("Packing check returned '0' - doing nothing.", module); - break; + BigDecimal thisQty = resQty.compareTo(qtyRemain) > 0 ? qtyRemain : resQty; + + int thisCheck = this.checkLineForAdd(res, orderId, orderItemSeqId, shipGroupSeqId, productId, thisQty, packageSeqId, update); + switch (thisCheck) { + case 2: + Debug.logInfo("Packing check returned '2' - new pack line will be created!", module); + toCreateMap.put(res, thisQty); + qtyRemain = qtyRemain.subtract(thisQty); + break; + case 1: + Debug.logInfo("Packing check returned '1' - existing pack line has been updated!", module); + qtyRemain = qtyRemain.subtract(thisQty); + break; + case 0: + Debug.logInfo("Packing check returned '0' - doing nothing.", module); + break; + default: + Debug.logInfo("Packing check returned '> 2' or '< 0'", module); + break; + } } } @@ -201,6 +212,20 @@ public void addOrIncreaseLine(String orderId, String orderItemSeqId, String ship this.runEvents(PackingEvent.EVENT_CODE_ADD); } + private BigDecimal numAvailableItems(GenericValue res) { + // In simple situations, the reserved quantity will match the quantity from the order item. + // If there is a back order, quantity from order may exceed quantity currently reserved and on hand. + // resQty should never exceed the quantity from the order item, because that quantity was the quantity reserved in the first place. + BigDecimal notAvailable = res.getBigDecimal("quantityNotAvailable"); + BigDecimal resQty = res.getBigDecimal("quantity"); + + if (notAvailable != null) { + resQty = resQty.subtract(notAvailable); + } + + return resQty; + } + public void addOrIncreaseLine(String orderId, String orderItemSeqId, String shipGroupSeqId, BigDecimal quantity, int packageSeqId) throws GeneralException { this.addOrIncreaseLine(orderId, orderItemSeqId, shipGroupSeqId, null, quantity, packageSeqId, BigDecimal.ZERO, false); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java index b3c0ec43e1e..1806e11e295 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java @@ -294,94 +294,71 @@ public static Map calcShipmentCostEstimate(DispatchContext dctx, List estimateList = new LinkedList(); for (GenericValue thisEstimate: estimates) { - String toGeo = thisEstimate.getString("geoIdTo"); - if (UtilValidate.isNotEmpty(toGeo) && shipAddress ==null) { - // This estimate requires shipping address details. We don't have it so we cannot use this estimate. - continue; - } - List toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator); - // Make sure we have a valid GEOID. - if (UtilValidate.isEmpty(toGeoList) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) || - GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) { - - GenericValue wv = null; - GenericValue qv = null; - GenericValue pv = null; - - try { - wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false); - } catch (GenericEntityException e) { - } - try { - qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false); - } catch (GenericEntityException e) { - } - try { - pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false); - } catch (GenericEntityException e) { + try { + String toGeo = thisEstimate.getString("geoIdTo"); + if (UtilValidate.isNotEmpty(toGeo) && shipAddress ==null) { + // This estimate requires shipping address details. We don't have it so we cannot use this estimate. + continue; } - if (wv == null && qv == null && pv == null) { - estimateList.add(thisEstimate); - } else { - // Do some testing. - boolean useWeight = false; - boolean weightValid = false; - boolean useQty = false; - boolean qtyValid = false; - boolean usePrice = false; - boolean priceValid = false; - - if (wv != null) { - useWeight = true; - BigDecimal min = BigDecimal.ONE.movePointLeft(4); - BigDecimal max = BigDecimal.ONE.movePointLeft(4); - - try { + List toGeoList = GeoWorker.expandGeoGroup(toGeo, delegator); + // Make sure we have a valid GEOID. + if (UtilValidate.isEmpty(toGeoList) || + GeoWorker.containsGeo(toGeoList, shipAddress.getString("countryGeoId"), delegator) || + GeoWorker.containsGeo(toGeoList, shipAddress.getString("stateProvinceGeoId"), delegator) || + GeoWorker.containsGeo(toGeoList, shipAddress.getString("postalCodeGeoId"), delegator)) { + GenericValue wv = thisEstimate.getRelatedOne("WeightQuantityBreak", false); + GenericValue qv = thisEstimate.getRelatedOne("QuantityQuantityBreak", false); + GenericValue pv = thisEstimate.getRelatedOne("PriceQuantityBreak", false); + if (wv == null && qv == null && pv == null) { + estimateList.add(thisEstimate); + } else { + // Do some testing. + boolean useWeight = false; + boolean weightValid = false; + boolean useQty = false; + boolean qtyValid = false; + boolean usePrice = false; + boolean priceValid = false; + + if (wv != null) { + useWeight = true; + BigDecimal min = BigDecimal.ONE.movePointLeft(4); + BigDecimal max = BigDecimal.ONE.movePointLeft(4); min = wv.getBigDecimal("fromQuantity"); max = wv.getBigDecimal("thruQuantity"); - } catch (Exception e) { - } - if (shippableWeight.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableWeight.compareTo(max) <= 0)) { - weightValid = true; + if (shippableWeight.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableWeight.compareTo(max) <= 0)) { + weightValid = true; + } } - } - if (qv != null) { - useQty = true; - BigDecimal min = BigDecimal.ONE.movePointLeft(4); - BigDecimal max = BigDecimal.ONE.movePointLeft(4); - - try { + if (qv != null) { + useQty = true; + BigDecimal min = BigDecimal.ONE.movePointLeft(4); + BigDecimal max = BigDecimal.ONE.movePointLeft(4); min = qv.getBigDecimal("fromQuantity"); max = qv.getBigDecimal("thruQuantity"); - } catch (Exception e) { - } - if (shippableQuantity.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableQuantity.compareTo(max) <= 0)) { - qtyValid = true; + if (shippableQuantity.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableQuantity.compareTo(max) <= 0)) { + qtyValid = true; + } } - } - if (pv != null) { - usePrice = true; - BigDecimal min = BigDecimal.ONE.movePointLeft(4); - BigDecimal max = BigDecimal.ONE.movePointLeft(4); - - try { + if (pv != null) { + usePrice = true; + BigDecimal min = BigDecimal.ONE.movePointLeft(4); + BigDecimal max = BigDecimal.ONE.movePointLeft(4); min = pv.getBigDecimal("fromQuantity"); max = pv.getBigDecimal("thruQuantity"); - } catch (Exception e) { + if (shippableTotal.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableTotal.compareTo(max) <= 0)) { + priceValid = true; + } } - if (shippableTotal.compareTo(min) >= 0 && (max.compareTo(BigDecimal.ZERO) == 0 || shippableTotal.compareTo(max) <= 0)) { - priceValid = true; + // Now check the tests. + if ((useWeight && weightValid) || (useQty && qtyValid) || (usePrice && priceValid)) { + estimateList.add(thisEstimate); } } - // Now check the tests. - if ((useWeight && weightValid) || (useQty && qtyValid) || (usePrice && priceValid)) { - estimateList.add(thisEstimate); - } } + } catch (GenericEntityException e) { + Debug.logError(e, e.getLocalizedMessage(), module); } - } if (estimateList.size() < 1) { @@ -693,9 +670,11 @@ public static Map updateShipmentsFromStaging(DispatchContext dct Locale locale = (Locale) context.get("locale"); Map shipmentMap = new HashMap(); - EntityListIterator eli = null; - try { - eli = EntityQuery.use(delegator).from("OdbcPackageIn").orderBy("shipmentId", "shipmentPackageSeqId", "voidIndicator").queryIterator(); + try (EntityListIterator eli = EntityQuery.use(delegator) + .from("OdbcPackageIn") + .orderBy("shipmentId", "shipmentPackageSeqId", "voidIndicator") + .queryIterator()) { + GenericValue pkgInfo; while ((pkgInfo = eli.next()) != null) { String packageSeqId = pkgInfo.getString("shipmentPackageSeqId"); @@ -802,14 +781,6 @@ public static Map updateShipmentsFromStaging(DispatchContext dct } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); - } finally { - if (eli != null) { - try { - eli.close(); - } catch (GenericEntityException e) { - Debug.logError(e, module); - } - } } // update the status of each shipment diff --git a/applications/product/template/category/EditCategoryProducts.ftl b/applications/product/template/category/EditCategoryProducts.ftl index e232673107b..102906b20a5 100644 --- a/applications/product/template/category/EditCategoryProducts.ftl +++ b/applications/product/template/category/EditCategoryProducts.ftl @@ -74,10 +74,11 @@ under the License. <#if productCategoryMember.thruDate?? && nowTimestamp.after(productCategoryMember.getTimestamp("thruDate"))><#assign hasExpired = true> class="alternate-row"> + <#assign parametersMap = Static['org.apache.ofbiz.base.util.UtilHttp'].urlEncodeArgs(Static['org.apache.ofbiz.base.util.UtilMisc'].toMap('productId', productCategoryMember.productId!))/> <#if (product.smallImageUrl)??> - Small Image + Small Image - <#if product??>${(product.internalName)!} [${(productCategoryMember.productId)!}] + <#if product??>${(product.internalName)!} [${(productCategoryMember.productId)!}] style="color: red;">${(productCategoryMember.fromDate)!} diff --git a/applications/product/template/inventory/ReceiveInventory.ftl b/applications/product/template/inventory/ReceiveInventory.ftl index c821c9c5d4d..91f37ffce00 100644 --- a/applications/product/template/inventory/ReceiveInventory.ftl +++ b/applications/product/template/inventory/ReceiveInventory.ftl @@ -54,7 +54,7 @@ under the License. ${item.orderItemSeqId} ${item.productId?default("Not Found")} ${item.lotId?default("")} - ${item.unitCost?default(0)?string("##0.00")} + <@ofbizAmount amount=item.unitCost?default(0)/> ${item.quantityRejected?default(0)?string.number} ${item.quantityAccepted?string.number} diff --git a/applications/product/template/product/EditProductContent.ftl b/applications/product/template/product/EditProductContent.ftl index bcfda8021d2..fcd0fb9d9d5 100644 --- a/applications/product/template/product/EditProductContent.ftl +++ b/applications/product/template/product/EditProductContent.ftl @@ -45,7 +45,7 @@ under the License. ${uiLabelMap.ProductProductName}   - + diff --git a/applications/product/template/product/ProductBarCode.fo.ftl b/applications/product/template/product/ProductBarCode.fo.ftl index 2655ce7d837..951012bf191 100644 --- a/applications/product/template/product/ProductBarCode.fo.ftl +++ b/applications/product/template/product/ProductBarCode.fo.ftl @@ -38,10 +38,10 @@ under the License. - + 0.75in .375mm - + bottom Helvetica diff --git a/applications/product/template/returns/ReceiveReturn.ftl b/applications/product/template/returns/ReceiveReturn.ftl index 2aa2d88d195..338af862a58 100644 --- a/applications/product/template/returns/ReceiveReturn.ftl +++ b/applications/product/template/returns/ReceiveReturn.ftl @@ -45,7 +45,7 @@ under the License. ${item.returnId} ${item.returnItemSeqId} ${item.productId?default("Not Found")} - ${item.unitCost?default(0)?string("##0.00")} + <@ofbizAmount amount=item.unitCost?default(0)/> ${item.quantityAccepted?string.number} @@ -204,7 +204,7 @@ under the License. ${uiLabelMap.ProductPerUnitPrice} - + diff --git a/applications/product/template/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl b/applications/product/template/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl index b6bab6e4770..aa7d8f7882e 100644 --- a/applications/product/template/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl +++ b/applications/product/template/shipment/ReceiveInventoryAgainstPurchaseOrder.ftl @@ -222,13 +222,19 @@ under the License. - ${uiLabelMap.OrderForceCompletePurchaseOrder} + +
+ + + + +
<#if itemsAvailableToReceive && totalReadyToReceive < totalAvailableToReceive>

${uiLabelMap.ProductReceiveInventoryAddProductToReceive}

diff --git a/applications/product/webapp/catalog/WEB-INF/controller.xml b/applications/product/webapp/catalog/WEB-INF/controller.xml index 9fa30ff2cfc..49099656727 100644 --- a/applications/product/webapp/catalog/WEB-INF/controller.xml +++ b/applications/product/webapp/catalog/WEB-INF/controller.xml @@ -2527,19 +2527,19 @@ under the License. - + - + - + @@ -2551,19 +2551,19 @@ under the License. - + - + - + @@ -2571,19 +2571,19 @@ under the License. - + - + - + diff --git a/applications/product/webapp/facility/WEB-INF/controller.xml b/applications/product/webapp/facility/WEB-INF/controller.xml index 2737051dfd3..2618f72ed09 100644 --- a/applications/product/webapp/facility/WEB-INF/controller.xml +++ b/applications/product/webapp/facility/WEB-INF/controller.xml @@ -827,7 +827,7 @@ under the License. - + diff --git a/applications/product/widget/catalog/ConfigForms.xml b/applications/product/widget/catalog/ConfigForms.xml index ec21442c502..9c618c5aabd 100644 --- a/applications/product/widget/catalog/ConfigForms.xml +++ b/applications/product/widget/catalog/ConfigForms.xml @@ -18,7 +18,7 @@ specific language governing permissions and limitations under the License. --> -
- @@ -219,7 +219,7 @@ under the License. default-table-style="basic-table" odd-row-style="alternate-row" paginate-target="FindProductConfigItems" target="" header-row-style="header-row-2" paginate="true"> - + diff --git a/applications/product/widget/catalog/FieldLookupForms.xml b/applications/product/widget/catalog/FieldLookupForms.xml index ba43f2140e4..3f8e093b97f 100644 --- a/applications/product/widget/catalog/FieldLookupForms.xml +++ b/applications/product/widget/catalog/FieldLookupForms.xml @@ -223,8 +223,8 @@ under the License. - diff --git a/applications/product/widget/catalog/ImageManagementForms.xml b/applications/product/widget/catalog/ImageManagementForms.xml index 6504bedf27e..3891973cd0c 100644 --- a/applications/product/widget/catalog/ImageManagementForms.xml +++ b/applications/product/widget/catalog/ImageManagementForms.xml @@ -100,18 +100,18 @@ under the License. - - @@ -310,9 +310,9 @@ under the License. document.ListImageManage.action='checkAction?productId=${productId}&contentId=${contentId}&dataResourceId=${dataResourceId}'; document.ListImageManage.submit();"> - @@ -765,8 +765,8 @@ under the License. - diff --git a/applications/product/widget/catalog/PriceForms.xml b/applications/product/widget/catalog/PriceForms.xml index 3eb69c5e70c..08b34eebcc1 100644 --- a/applications/product/widget/catalog/PriceForms.xml +++ b/applications/product/widget/catalog/PriceForms.xml @@ -56,12 +56,12 @@ - - + + - diff --git a/applications/product/widget/catalog/ProdCatalogForms.xml b/applications/product/widget/catalog/ProdCatalogForms.xml index 35354476e74..dfa2b32ea65 100644 --- a/applications/product/widget/catalog/ProdCatalogForms.xml +++ b/applications/product/widget/catalog/ProdCatalogForms.xml @@ -70,7 +70,7 @@ under the License. - + @@ -79,10 +79,10 @@ under the License. - + - + diff --git a/applications/product/widget/catalog/ProductForms.xml b/applications/product/widget/catalog/ProductForms.xml index a86a03c9622..9b378332d04 100644 --- a/applications/product/widget/catalog/ProductForms.xml +++ b/applications/product/widget/catalog/ProductForms.xml @@ -78,10 +78,10 @@ under the License. - + - + @@ -112,7 +112,7 @@ under the License. - + @@ -124,7 +124,7 @@ under the License. - + @@ -140,9 +140,9 @@ under the License. - @@ -157,7 +157,7 @@ under the License. - + @@ -231,7 +231,7 @@ under the License. - + @@ -241,21 +241,21 @@ under the License. - + - + - + - + - + @@ -281,7 +281,7 @@ under the License. - + @@ -940,12 +940,14 @@ under the License. + - + @@ -1005,8 +1007,8 @@ under the License. - @@ -1033,8 +1035,8 @@ under the License. - @@ -1308,7 +1310,7 @@ under the License. - @@ -1436,7 +1438,7 @@ under the License. - diff --git a/applications/product/widget/catalog/ProductScreens.xml b/applications/product/widget/catalog/ProductScreens.xml index fe30a232c01..3665f5af125 100644 --- a/applications/product/widget/catalog/ProductScreens.xml +++ b/applications/product/widget/catalog/ProductScreens.xml @@ -96,9 +96,6 @@ under the License.
- - - @@ -109,9 +106,6 @@ under the License. - - -
diff --git a/applications/product/widget/catalog/PromoForms.xml b/applications/product/widget/catalog/PromoForms.xml index 92ed8dc25b1..9308d914f5f 100644 --- a/applications/product/widget/catalog/PromoForms.xml +++ b/applications/product/widget/catalog/PromoForms.xml @@ -49,13 +49,13 @@ under the License. "; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // #11217 - WebKit loses check when the name is after the checked attribute - fragment.appendChild( div ); - div.innerHTML = ""; - - // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 - // old WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - support.noCloneEvent = true; - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Execute the test only if not already executed in another module. - if (support.deleteExpando == null) { - // Support: IE<9 - support.deleteExpando = true; - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - } - - // Null elements to avoid leaks in IE. - fragment = div = input = null; -})(); - - -(function() { - var i, eventName, - div = document.createElement( "div" ); - - // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) - for ( i in { submit: true, change: true, focusin: true }) { - eventName = "on" + i; - - if ( !(support[ i + "Bubbles" ] = eventName in window) ) { - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) - div.setAttribute( eventName, "t" ); - support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; - } - } - - // Null elements to avoid leaks in IE. - div = null; -})(); - - -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnotwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && jQuery.acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && - jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - /* jshint eqeqeq: false */ - for ( ; cur != this; cur = cur.parentNode || this ) { - /* jshint eqeqeq: true */ - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return jQuery.nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && ( - // Support: IE < 9 - src.returnValue === false || - // Support: Android < 4.0 - src.getPreventDefault && src.getPreventDefault() ) ? - returnTrue : - returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this, - attaches = jQuery._data( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - jQuery._removeData( doc, fix ); - } else { - jQuery._data( doc, fix, attaches ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
", "
" ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - col: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -// Support: IE<8 -// Manipulating tables requires a tbody -function manipulationTarget( elem, content ) { - return jQuery.nodeName( elem, "table" ) && - jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? - - elem.getElementsByTagName("tbody")[0] || - elem.appendChild( elem.ownerDocument.createElement("tbody") ) : - elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!support.noCloneEvent || !support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - deletedIds.push( id ); - } - } - } - } - } -}); - -jQuery.fn.extend({ - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - append: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip( arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - remove: function( selector, keepData /* Internal Use Only */ ) { - var elem, - elems = selector ? jQuery.filter( selector, this ) : this, - i = 0; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map(function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var arg = arguments[ 0 ]; - - // Make the changes, replacing each context element with the new content - this.domManip( arguments, function( elem ) { - arg = this.parentNode; - - jQuery.cleanData( getAll( this ) ); - - if ( arg ) { - arg.replaceChild( elem, this ); - } - }); - - // Force removal if there was no new content (e.g., from empty arguments) - return arg && (arg.length || arg.nodeType) ? this : this.remove(); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, callback ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, self.html() ); - } - self.domManip( args, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( this[i], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - - -var iframe, - elemdisplay = {}; - -/** - * Retrieve the actual display of a element - * @param {String} name nodeName of the element - * @param {Object} doc Document object - */ -// Called only from within defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - - // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle ? - - // Use of this method is a temporary fix (more like optmization) until something better comes along, - // since it was removed from specification and supported only in FF - window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); - - // We don't have any data stored on the element, - // so use "detach" method as fast way to get rid of the element - elem.detach(); - - return display; -} - -/** - * Try to determine the default display value of an element - * @param {String} nodeName - */ -function defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - - // Use the already-created iframe if possible - iframe = (iframe || jQuery( "