Module Installation
Steps to enable this module in your custom Broadleaf Commerce project
Steps
Step 1 Pull this dependency into your core/pom.xml
:
<dependency>
<groupId>com.broadleafcommerce</groupId>
<artifactId>broadleaf-oms</artifactId>
</dependency>
Data Changes
Schema Changes
To add all of the necessary database tables and columns for this module, please follow the Liquibase update documentation.
Admin Security Changes
The data in the following SQL file is required to establish Admin sections and permissions for this module:
classpath:/config/bc/sql/load_oms_admin_security.sql
classpath:/config/bc/sql/load_oms_reason_codes.sql
This file is automatically included if you have set blPU.hibernate.hbm2ddl.auto=create
and you have not set import.sql.enabled=false
in your properties files. If you are not using Hibernate's auto DDL process and are using Liquibase, you can add a new changeSet
that references this file:
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet author="broadleaf" id="some-unique-id">
<sqlFile path="config/bc/sql/load_oms_admin_security.sql" encoding="utf8" stripComments="true" />
<sqlFile path="config/bc/sql/load_oms_reason_codes.sql" encoding="utf8" stripComments="true" />
</changeSet>
</databaseChangeLog>
Finally, you can unpack the downloaded .jar
file and look at the files in the config/bc/sql
folder to execute this sql manually.
Checkout Controller Changes
OMS allows for CSR's to modify existing orders. This functionality allows CSR's to browse the site and edit order items. However, we do not want to allow CSR's to execute a regular checkout while modifying an existing order. Instead, we want them to be redirected to the CSR review screen to complete the change to the order. In order to facilitate this, we suggest overriding the checkout endpoint and redirecting to the CSR review screen url, like so:
@Controller
public class CheckoutController extends BroadleafCheckoutController {
@RequestMapping("/checkout")
public String checkout(HttpServletRequest request, HttpServletResponse response, Model model,
@ModelAttribute("orderInfoForm") OrderInfoForm orderInfoForm,
@ModelAttribute("shippingInfoForm") ShippingInfoForm shippingForm,
@ModelAttribute("billingInfoForm") BillingInfoForm billingForm,
@ModelAttribute("giftCardInfoForm") GiftCardInfoForm giftCardInfoForm,
@ModelAttribute("customerCreditInfoForm") CustomerCreditInfoForm customerCreditInfoForm,
RedirectAttributes redirectAttributes) {
OMSOrder cart = (OMSOrder) CartState.getCart();
if (request.isUserInRole(OMSCsrToolsController.CSR_ROLE) &&
ChangeOrderStatus.CHANGE_IN_PROCESS.equals(cart.getChangeOrderStatus())) {
return "redirect:/" + OMSCsrToolsController.SECTION_KEY + "/checkout";
} else {
return super.checkout(request, response, model, redirectAttributes);
}
}
}