вторник, 4 октября 2016 г.

How to add new document into print management module

Hi All!
Recently I've faced with task which I've never done before. It's adding new document into print managment settings for certain module (in my case it was WHS module).
I tried to found any solution or advice in web but it was unsuccessfully.
Finally I found some advice regarding my issue but is was written not so good as for me.
And I decided to keep this solution in my blog so here're we go:

Lets asume that we want to add new document with "DocName" into our print management settings.

What we should do for this?
1) Go to Data Dictionary -> Base enums ->  and find PrintMgmtDocType.
2) Add new enum into this base enum with name "DocName"
3) Go to Classes -> PrintMgmtDocType
4) Find method getDefaultReportFormat()  in this class and add new case statement into it for our enum
5) Add appropriate tableId and FieldId into getQueryRangeFields() and getQueryTableId()  methods for further treatment
6) Next, add a case statement to the method getDocumentTypes() of the class PrintMgmtNode child class, i.e. PrintMgmtNode_CustTable or PrintMgmtNode_Sales or whichever node you want to add it to in the print management hierarchy. In our situation it was class WHSPrintMgmtNode_WHS.

After that you could see your document under WHS print management module settings.
But the thing is you won't be able to add Report  format value untill add it into PrintMgmtReportFormat  table manually (I haven't explanation of this yet).

After you added the value into this table - you'll be able to print your report.
Profit!