-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
AD_Process
from AD_Process_Trl
if trl is in base language
#10232 Signed-off-by: TheBestPessimist <cristian@tbp.land>
- Loading branch information
1 parent
2f68520
commit 495f66f
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...empiere.adempiere/base/src/main/java/de/metas/translation/interceptor/AD_Process_Trl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* #%L | ||
* de.metas.adempiere.adempiere.base | ||
* %% | ||
* Copyright (C) 2020 metas GmbH | ||
* %% | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as | ||
* published by the Free Software Foundation, either version 2 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public | ||
* License along with this program. If not, see | ||
* <http://www.gnu.org/licenses/gpl-2.0.html>. | ||
* #L% | ||
*/ | ||
|
||
package de.metas.translation.interceptor; | ||
|
||
import de.metas.i18n.Language; | ||
import de.metas.process.AdProcessId; | ||
import de.metas.process.IADProcessDAO; | ||
import de.metas.util.Services; | ||
import org.adempiere.ad.modelvalidator.annotations.Interceptor; | ||
import org.adempiere.ad.modelvalidator.annotations.ModelChange; | ||
import org.compiere.model.I_AD_Process; | ||
import org.compiere.model.I_AD_Process_Trl; | ||
import org.compiere.model.ModelValidator; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Interceptor(I_AD_Process_Trl.class) | ||
@Component | ||
public class AD_Process_Trl | ||
{ | ||
final IADProcessDAO processDAO = Services.get(IADProcessDAO.class); | ||
|
||
@SuppressWarnings("ConstantConditions") | ||
@ModelChange(timings = ModelValidator.TYPE_AFTER_CHANGE) | ||
public void updateProcessNameFromTrl(final I_AD_Process_Trl processTrl) | ||
{ | ||
if (!Language.isBaseLanguage(processTrl.getAD_Language())) | ||
{ | ||
return; | ||
} | ||
|
||
final I_AD_Process process = processDAO.getById(AdProcessId.ofRepoId(processTrl.getAD_Process_ID())); | ||
process.setName(processTrl.getName()); | ||
process.setDescription(processTrl.getDescription()); | ||
process.setHelp(processTrl.getHelp()); | ||
processDAO.save(process); | ||
} | ||
} |