Skip to content

Commit 2e4c67b

Browse files
author
jefffischer
committed
Merge remote-tracking branch 'remotes/upstream/BroadleafCommerce-4.0.x' into BroadleafCommerce-4.0.x
2 parents 07d7987 + 42b3557 commit 2e4c67b

File tree

288 files changed

+9573
-1561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+9573
-1561
lines changed

admin/broadleaf-admin-functional-tests/pom.xml

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.broadleafcommerce</groupId>
55
<artifactId>admin</artifactId>
6-
<version>4.0.2-SNAPSHOT</version>
6+
<version>4.0.10-SNAPSHOT</version>
77
</parent>
88
<artifactId>broadleaf-admin-functional-tests</artifactId>
99
<name>BroadleafCommerce Admin Functional Tests</name>
@@ -51,20 +51,6 @@
5151
</developers>
5252
<build>
5353
<plugins>
54-
<plugin>
55-
<groupId>org.apache.maven.plugins</groupId>
56-
<artifactId>maven-source-plugin</artifactId>
57-
<version>${maven.source.plugin.version}</version>
58-
<executions>
59-
<execution>
60-
<id>attach-sources</id>
61-
<phase>verify</phase>
62-
<goals>
63-
<goal>jar-no-fork</goal>
64-
</goals>
65-
</execution>
66-
</executions>
67-
</plugin>
6854
<!-- Include Spock specifications, exclude the browser tests
6955
by default -->
7056
<plugin>

admin/broadleaf-admin-module/pom.xml

+1-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<artifactId>admin</artifactId>
66
<groupId>org.broadleafcommerce</groupId>
7-
<version>4.0.2-SNAPSHOT</version>
7+
<version>4.0.10-SNAPSHOT</version>
88
</parent>
99
<artifactId>broadleaf-admin-module</artifactId>
1010
<packaging>jar</packaging>
@@ -51,22 +51,6 @@
5151
</developer>
5252
</developers>
5353
<build>
54-
<plugins>
55-
<plugin>
56-
<groupId>org.apache.maven.plugins</groupId>
57-
<artifactId>maven-source-plugin</artifactId>
58-
<version>${maven.source.plugin.version}</version>
59-
<executions>
60-
<execution>
61-
<id>attach-sources</id>
62-
<phase>verify</phase>
63-
<goals>
64-
<goal>jar-no-fork</goal>
65-
</goals>
66-
</execution>
67-
</executions>
68-
</plugin>
69-
</plugins>
7054
<resources>
7155
<resource>
7256
<directory>src/main/resources/admin_style</directory>

admin/broadleaf-admin-module/src/main/java/org/broadleafcommerce/admin/server/service/AdminCatalogServiceImpl.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
/**
4747
*
48-
* @author Phillip Verheyden
48+
* @author Phillip Verheyden\
4949
*
5050
*/
5151
@Service("blAdminCatalogService")
@@ -74,6 +74,12 @@ public Integer generateSkusFromProduct(Long productId) {
7474
}
7575

7676
List<List<ProductOptionValue>> allPermutations = generatePermutations(0, new ArrayList<ProductOptionValue>(), product.getProductOptions());
77+
78+
// return -2 to indicate that one of the Product Options used in Sku generation has no Allowed Values
79+
if (allPermutations == null) {
80+
return -2;
81+
}
82+
7783
LOG.info("Total number of permutations: " + allPermutations.size());
7884
LOG.info(allPermutations);
7985

@@ -156,6 +162,10 @@ public List<List<ProductOptionValue>> generatePermutations(int currentTypeIndex,
156162
result.addAll(generatePermutations(currentTypeIndex + 1, currentPermutation, options));
157163
return result;
158164
}
165+
// Check to make sure there is at least 1 Allowed Value, else prevent generation
166+
if (currentOption.getAllowedValues().isEmpty()) {
167+
return null;
168+
}
159169
for (ProductOptionValue option : currentOption.getAllowedValues()) {
160170
List<ProductOptionValue> permutation = new ArrayList<ProductOptionValue>();
161171
permutation.addAll(currentPermutation);

admin/broadleaf-admin-module/src/main/java/org/broadleafcommerce/admin/server/service/extension/ProductCustomPersistenceHandlerExtensionHandler.java

+24
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,28 @@ public interface ProductCustomPersistenceHandlerExtensionHandler extends Extensi
4747
* @return
4848
*/
4949
ExtensionResultStatusType manageParentCategoryForUpdate(PersistencePackage persistencePackage, Product product) throws ServiceException;
50+
51+
/**
52+
* Perform any special handling for the remove
53+
*
54+
* @param product
55+
* @return
56+
*/
57+
ExtensionResultStatusType manageRemove(PersistencePackage persistencePackage, Product product) throws ServiceException;
58+
59+
/**
60+
* Setup any special state to influence the fetch results
61+
*
62+
* @return
63+
* @throws ServiceException
64+
*/
65+
ExtensionResultStatusType initiateFetchState() throws ServiceException;
66+
67+
/**
68+
* Cleanup any special state started by {@link #initiateFetchState()}
69+
*
70+
* @return
71+
* @throws ServiceException
72+
*/
73+
ExtensionResultStatusType endFetchState() throws ServiceException;
5074
}

admin/broadleaf-admin-module/src/main/java/org/broadleafcommerce/admin/server/service/handler/CustomerCustomPersistenceHandler.java

+24-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.apache.commons.logging.Log;
2323
import org.apache.commons.logging.LogFactory;
2424
import org.broadleafcommerce.common.exception.ServiceException;
25+
import org.broadleafcommerce.common.persistence.Status;
2526
import org.broadleafcommerce.common.presentation.client.OperationType;
2627
import org.broadleafcommerce.openadmin.dto.Entity;
2728
import org.broadleafcommerce.openadmin.dto.FieldMetadata;
@@ -32,10 +33,12 @@
3233
import org.broadleafcommerce.openadmin.server.service.persistence.module.RecordHelper;
3334
import org.broadleafcommerce.profile.core.dao.RoleDao;
3435
import org.broadleafcommerce.profile.core.domain.Customer;
36+
import org.broadleafcommerce.profile.core.domain.CustomerAddress;
3537
import org.broadleafcommerce.profile.core.service.CustomerService;
3638
import org.springframework.beans.factory.annotation.Value;
3739
import org.springframework.stereotype.Component;
3840

41+
import java.util.List;
3942
import java.util.Map;
4043

4144
import javax.annotation.Resource;
@@ -150,7 +153,27 @@ protected Entity validateUniqueUsername(Entity entity, Customer adminInstance) {
150153
public void remove(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws ServiceException {
151154
Entity entity = persistencePackage.getEntity();
152155
try {
153-
roleDao.removeCustomerRolesByCustomerId(Long.parseLong(entity.findProperty("id").getValue()));
156+
157+
Long customerId = Long.parseLong(entity.findProperty("id").getValue());
158+
159+
Customer customer = customerService.readCustomerById(customerId);
160+
if (Status.class.isAssignableFrom(customer.getClass())) {
161+
((Status) customer).setArchived('Y');
162+
163+
// If the customer has a conditional weave on ArchiveStatus, nothing triggers the delete so other
164+
// normally-cascaded deletes don't happen (like CustomerAddress)
165+
List<CustomerAddress> addressList = customer.getCustomerAddresses();
166+
for (CustomerAddress address : addressList) {
167+
address.setArchived('Y');
168+
}
169+
170+
customer = customerService.saveCustomer(customer);
171+
return;
172+
}
173+
174+
// Remove the customer roles for the customer since it's not cascaded
175+
roleDao.removeCustomerRolesByCustomerId(customerId);
176+
154177
helper.getCompatibleModule(OperationType.BASIC).remove(persistencePackage);
155178
} catch (Exception e) {
156179
LOG.error("Unable to execute persistence activity", e);

0 commit comments

Comments
 (0)