Bug fix: force#DiskToDbResourceAndPublish
Showing
1 changed file
with
38 additions
and
38 deletions
... | @@ -683,51 +683,51 @@ Find the email templates in the productStore, for each email template in the pro | ... | @@ -683,51 +683,51 @@ Find the email templates in the productStore, for each email template in the pro |
683 | <set field="dbResourceToUpdateText" from="dbResourceToUpdate.getText()"/> | 683 | <set field="dbResourceToUpdateText" from="dbResourceToUpdate.getText()"/> |
684 | <set field="childText" from="child.getText()"/> | 684 | <set field="childText" from="child.getText()"/> |
685 | 685 | ||
686 | <set field="updatedText" from="false"/> | ||
686 | <if condition="dbResourceToUpdateText != childText"><then> | 687 | <if condition="dbResourceToUpdateText != childText"><then> |
687 | <script><![CDATA[ | 688 | <script><![CDATA[ |
688 | dbResourceToUpdate.putText(childText) | 689 | dbResourceToUpdate.putText(childText) |
690 | updatedText = true | ||
689 | ]]></script> | 691 | ]]></script> |
690 | <set field="versionName" from="dbResourceToUpdate.getCurrentVersion()?.getVersionName()"/> | ||
691 | <if condition="!versionName"> | ||
692 | <log level="warn" message="No version name found for dbresource ${dbResourceToUpdate.location}"/> | ||
693 | <continue/> | ||
694 | </if> | ||
695 | <if condition="updateEmailTemplate"> | ||
696 | <entity-find entity-name="moqui.basic.email.EmailTemplate" list="emailTemplateList" for-update="true"> | ||
697 | <econditions combine="or"> | ||
698 | <econdition field-name="grapesLocation" from="dbResourceToUpdate.location"/> | ||
699 | <econdition field-name="htmlLocation" from="dbResourceToUpdate.location"/> | ||
700 | </econditions> | ||
701 | <select-field field-name="emailTemplateId,grapesPublishedVersionName,htmlPublishedVersionName,grapesLocation,htmlLocation"/> | ||
702 | <order-by field-name="-lastUpdatedStamp"/> | ||
703 | </entity-find> | ||
704 | <if condition="emailTemplateList.size() == 0"> | ||
705 | <log level="warn" message="No email template found for dbresource ${dbResourceToUpdate.location}"/> | ||
706 | <continue/> | ||
707 | </if> | ||
708 | |||
709 | <iterate list="emailTemplateList" entry="emailTemplate"> | ||
710 | <set field="logText" value="At emailTemplate ${emailTemplate.emailTemplateId},"/> | ||
711 | <if condition="emailTemplate.grapesLocation == dbResourceToUpdate.location"> | ||
712 | <set field="emailTemplate.grapesPublishedVersionName" from="versionName"/> | ||
713 | <set field="updatedEmailTemplateList" from="updatedEmailTemplateList + [emailTemplate:emailTemplate,location:emailTemplate.grapesLocation,versionName:versionName,grapesOrHtml:'grapes']"/> | ||
714 | <set field="updatedEmailTemplate" from="true"/> | ||
715 | <set field="logText" from="logText + ' updating grapesPublishedVersionName to ' + versionName"/> | ||
716 | </if> | ||
717 | <if condition="emailTemplate.htmlLocation == dbResourceToUpdate.location"> | ||
718 | <set field="emailTemplate.htmlPublishedVersionName" from="versionName"/> | ||
719 | <set field="updatedEmailTemplateList" from="updatedEmailTemplateList + [emailTemplate:emailTemplate,location:emailTemplate.htmlLocation,versionName:versionName,grapesOrHtml:'html']"/> | ||
720 | <set field="updatedEmailTemplate" from="true"/> | ||
721 | <set field="logText" from="logText + ' updating htmlPublishedVersionName to ' + versionName"/> | ||
722 | </if> | ||
723 | <log level="info" message="${logText}"/> | ||
724 | <entity-update value-field="emailTemplate"/> | ||
725 | </iterate> | ||
726 | </if> | ||
727 | </then><else> | 692 | </then><else> |
728 | <log level="info" message="Not updating from disk because file at ${child.location} and dbresource at ${dbResourceToUpdate.location} are the same"/> | ||
729 | </else></if> | 693 | </else></if> |
730 | 694 | ||
695 | <set field="versionName" from="dbResourceToUpdate.getCurrentVersion()?.getVersionName()"/> | ||
696 | <if condition="!versionName"> | ||
697 | <log level="warn" message="No version name found for dbresource ${dbResourceToUpdate.location}"/> | ||
698 | <continue/> | ||
699 | </if> | ||
700 | <if condition="updateEmailTemplate"> | ||
701 | <entity-find entity-name="moqui.basic.email.EmailTemplate" list="emailTemplateList" for-update="true"> | ||
702 | <econditions combine="or"> | ||
703 | <econdition field-name="grapesLocation" from="dbResourceToUpdate.location"/> | ||
704 | <econdition field-name="htmlLocation" from="dbResourceToUpdate.location"/> | ||
705 | </econditions> | ||
706 | <select-field field-name="emailTemplateId,grapesPublishedVersionName,htmlPublishedVersionName,grapesLocation,htmlLocation"/> | ||
707 | <order-by field-name="-lastUpdatedStamp"/> | ||
708 | </entity-find> | ||
709 | <if condition="emailTemplateList.size() == 0"> | ||
710 | <log level="warn" message="No email template found for dbresource ${dbResourceToUpdate.location}"/> | ||
711 | <continue/> | ||
712 | </if> | ||
713 | |||
714 | <iterate list="emailTemplateList" entry="emailTemplate"> | ||
715 | <set field="logText" value="At emailTemplate ${emailTemplate.emailTemplateId},"/> | ||
716 | <if condition="emailTemplate.grapesLocation == dbResourceToUpdate.location && emailTemplate.grapesPublishedVersionName != versionName"> | ||
717 | <set field="emailTemplate.grapesPublishedVersionName" from="versionName"/> | ||
718 | <set field="updatedEmailTemplateList" from="updatedEmailTemplateList + [emailTemplate:emailTemplate,location:emailTemplate.grapesLocation,versionName:versionName,grapesOrHtml:'grapes']"/> | ||
719 | <set field="updatedEmailTemplate" from="true"/> | ||
720 | <set field="logText" from="logText + ' updating grapesPublishedVersionName to ' + versionName"/> | ||
721 | </if> | ||
722 | <if condition="emailTemplate.htmlLocation == dbResourceToUpdate.location && emailTemplate.htmlPublishedVersionName != versionName"> | ||
723 | <set field="emailTemplate.htmlPublishedVersionName" from="versionName"/> | ||
724 | <set field="updatedEmailTemplateList" from="updatedEmailTemplateList + [emailTemplate:emailTemplate,location:emailTemplate.htmlLocation,versionName:versionName,grapesOrHtml:'html']"/> | ||
725 | <set field="updatedEmailTemplate" from="true"/> | ||
726 | <set field="logText" from="logText + ' updating htmlPublishedVersionName to ' + versionName"/> | ||
727 | </if> | ||
728 | <entity-update value-field="emailTemplate"/> | ||
729 | </iterate> | ||
730 | </if> | ||
731 | </iterate> | 731 | </iterate> |
732 | </actions> | 732 | </actions> |
733 | </service> | 733 | </service> | ... | ... |
-
Please register or sign in to post a comment