diff --git a/src-db/database/build.xml b/src-db/database/build.xml index 605968ff4..9c5443972 100644 --- a/src-db/database/build.xml +++ b/src-db/database/build.xml @@ -242,5 +242,12 @@ export.database.structure: Exports the database structure in the xml's files. + + + + + + + diff --git a/src/org/openbravo/service/system/SystemDeleteClientTask.java b/src/org/openbravo/service/system/SystemDeleteClientTask.java new file mode 100644 index 000000000..d842bca42 --- /dev/null +++ b/src/org/openbravo/service/system/SystemDeleteClientTask.java @@ -0,0 +1,34 @@ +package org.openbravo.service.system; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.openbravo.base.exception.OBException; +import org.openbravo.dal.core.DalInitializingTask; +import org.openbravo.dal.service.OBDal; +import org.openbravo.model.ad.system.Client; + +/** + * Performs delete client process. + * + * @author szapata + */ +public class SystemDeleteClientTask extends DalInitializingTask { + private static final Logger log = LogManager.getLogger("SystemDeleteClientTask"); + protected String clientId; + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + @Override + protected void doExecute() { + // Validate module + Client client = OBDal.getInstance().get(Client.class, clientId); + if (client == null) { + throw new OBException("Client not found"); + } + log.info("Deleting Client: {}", client.getName()); + + SystemService.getInstance().deleteClient(client); + } +} diff --git a/src/org/openbravo/service/system/SystemService.java b/src/org/openbravo/service/system/SystemService.java index c613335b2..559365fb0 100644 --- a/src/org/openbravo/service/system/SystemService.java +++ b/src/org/openbravo/service/system/SystemService.java @@ -451,6 +451,7 @@ private void enableConstraints(Platform platform) { addDirectory(dirs, obDir, "/src-db/database/model/"); addModuleDirectories(dirs, obDir, "/modules"); addModuleDirectories(dirs, obDir, "/modules_core"); + addModuleDirectories(dirs, obDir, "/build/etendo/modules"); File[] fileArray = new File[dirs.size()]; for (int i = 0; i < dirs.size(); i++) { fileArray[i] = dirs.get(i); @@ -467,6 +468,8 @@ private void enableConstraints(Platform platform) { platform.enableAllTriggers(con, xmlModel, false); log4j.info(" Enabling foreign keys"); platform.enableAllFK(con, xmlModel, false); + } catch (Exception e) { + e.printStackTrace(); } finally { if (con != null) { platform.returnConnection(con);