meveo-org / meveo

meveo core
GNU Affero General Public License v3.0
10 stars 15 forks source link

CET update issue for CrudListenerScripts during upgradation of module installed. #740

Closed masumcse1 closed 1 year ago

masumcse1 commented 1 year ago

issue with CET's CrudListenerScripts if we add a new CET and add a new CrudListenerScript for it, it is not possible to upgrade the module installed on another meveo instance

To Reproduce After install a meveo module which contains a CET then update this CET with a new CrudListenerScript
and push the changes to github then pull from the other meveo instance , it will generate this error. javax.enterprise.event.ObserverException.

Error Log javax.ejb.EJBTransactionRolledbackException: Explicitly joining a JTA transaction requires a JTA transaction be currently active javax.enterprise.event.ObserverException

Caused by: org.meveo.admin.exception.InvalidScriptException: cannot find symbol symbol: method setProid(java.lang.String) location: variable entity of type org.meveo.model.customEntities.Product in file ProductListenerScript.java at line 25

Root cause CustomEntityTemplate updateEntityTemplate(CustomEntityTemplateDto dto, boolean withData). Inside this method , it remove CFT item from a CET object if CustomFieldTemplateDto.setFields is null. When removing the CFT item from CET object .then CRUDeventlistender script is getting compilation failed
and gives error (javax.enterprise.event.ObserverException) . when doing pull request for update a module , firstly it reads json data and convert this data as MeveoModuleItemDto then process this object inside the instlllation function. but when install this CET object , it can not intialize the CustomFieldTemplateDto.setFields .
Here , when update a CET , it contains a logic if CustomFieldTemplateDto.getFields == NUll then it delete all field for this CET . thats why it delete CET object contains all CFT item. so, CRUDeventlistender script complilation also getting failure.

Solution Ned to remove the function block which contains delete CFT logic after CET update . Becuase for git pull process , when update a CET i think should not update/delete it's related CFT .