简体   繁体   中英

How can I hide ticket status in hybris?

How to hide ticket status in hybris? OTTB in hybris there is 3 statuses (open, in process, close ). I add my custom status Rejected . Logic which hybris do is when create one ticket from storefront, then when login in backoffice as 'CustomerSupportAgent' in ticket tab when click on created ticket I can see 3 statuses ( In process, close, and my custom status Rejected ), and when I change status from In process to Close then I see 2 statuses Close and Reopen . I want when my status is In proceess and click Rejected to see Rejected and In process or Reopen , but Close status to be not visible.

Hybris do spring mapping to make this visible.

<alias name="csTicketStateTransitionMap" alias="ticketStateTransitionMap"/>
    <util:map id="csTicketStateTransitionMap">
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.NEW"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </util:list>
        </entry>
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </util:list>
        </entry>
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
            </util:list>
        </entry>
    </util:map>

When I add my logic for Rejected

<alias name="csTicketStateTransitionMap" alias="ticketStateTransitionMap"/>
    <util:map id="csTicketStateTransitionMap">
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.NEW"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </util:list>
        </entry>
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </util:list>
        </entry>

//here I add like hybris logic when click Rejected to see Reopen or In process but not Close
<entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.REJECTED"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
            </util:list>
        </entry>
        <entry>
            <key>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.CLOSED"/>
            </key>
            <util:list>
                <util:constant static-field="de.hybris.platform.ticket.enums.CsTicketState.OPEN"/>
            </util:list>
        </entry>
    </util:map>

But it doesn't work. Why?

What I actually do:

I use B2B recept and I have my custom addon 'customerticketingaddon' which requires-extension name="customerticketingfacades"

in my customerticketingaddon-items.xml I add my custom status in CsTicketState

<enumtype code="CsTicketState" autocreate="false" generate="false" dynamic="true">
            <value code="Rejected"/>
</enumtype>

Then in my cusomerticketingaddon-spring.xml I do the mapping which I showed above.

First of all, ensure that you are using backoffice spring context to define your bean.

Hybris-way to extend map beans is to use Map Extender backoffice functionality - https://help.hybris.com/1811/hcd/94ac56a0aa9f486490bbe1251d994457.html#loio83afe1e428384fa881d687b0baa6ea48

cng:map-extender provides an ability to put and remove map entries.

Take a look at the example from ruleenginebackoffice-backoffice-spring

Original bean definition

    <alias name="defaultBackofficeCronJobHistoryIncludes" alias="backofficeCronJobHistoryIncludes"/>
<util:map id="defaultBackofficeCronJobHistoryIncludes" key-type="java.lang.String"
          value-type="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
    <entry key="syncProcesses">
        <bean class="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
            <property name="jobTypeCode" value="#{T(de.hybris.platform.catalog.model.SyncItemJobModel)._TYPECODE}"/>
        </bean>
    </entry>
    <entry key="excelImportProcesses">
        <bean class="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
            <property name="jobTypeCode" value="#{T(com.hybris.backoffice.model.ExcelImportJobModel)._TYPECODE}"/>
        </bean>
    </entry>
    <entry key="auditReportGeneratorProcess">
        <bean class="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
            <property name="cronJobTypeCode" value="#{T(de.hybris.platform.auditreport.model.CreateAuditReportCronJobModel)._TYPECODE}"/>
        </bean>
    </entry>

</util:map>

Extended using

    <cng:map-extender bean="backofficeCronJobHistoryIncludes" xmlns:cng="http://www.hybris.com/cockpitng/spring">
    <cng:put key-type="java.lang.String" value-type="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
        <entry key="ruleEngineProcesses">
            <bean class="de.hybris.platform.servicelayer.cronjob.CronJobHistoryInclude">
                <property name="jobTypeCode" value="RuleEngineJob"/>
            </bean>
        </entry>
    </cng:put>
</cng:map-extender>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM