@@ -14,7 +14,24 @@ cds.once("served", async () => {
1414 for ( let srv of cds . services ) {
1515 // Iterate over all entities in the service
1616 for ( let entity of srv . entities ) {
17-
17+
18+ if ( entity . projection ?. from . ref [ 0 ] === "sap.print.Queues" ) {
19+ const printer = await cds . connect . to ( "print" ) ;
20+
21+ srv . after ( 'READ' , entity , async ( _ , req ) => {
22+ // TODO: make sure the format of all services are the same
23+ const q = await printer . getQueues ( ) ;
24+
25+ q . forEach ( ( item , index ) => {
26+ req . results [ index ] = { ID : item . ID } ;
27+ } ) ;
28+ req . results . $count = q . length ;
29+ return ;
30+
31+ } ) ;
32+
33+ }
34+
1835 // Track the fields holding print configurations
1936 await getFieldsHoldingPrintConfig ( entity ) ;
2037
@@ -42,22 +59,8 @@ cds.once("served", async () => {
4259 if ( boundAction [ '@print' ] ) {
4360
4461 // Track the action parameters holding print configurations
45- await getAnnotatedParamsOfAction ( boundAction ) ;
46- const sourceentity = getQueueValueHelpEntity ( boundAction . params ) ;
47- const printer = await cds . connect . to ( "print" ) ;
48- if ( sourceentity && ! queueValueHelpHandlerRegistered ) {
49- srv . after ( 'READ' , sourceentity , async ( _ , req ) => {
50- // TODO: make sure the format of all services are the same
51- const q = await printer . getQueues ( ) ;
52-
53- q . forEach ( ( item , index ) => {
54- req . results [ index ] = { ID : item . ID } ;
55- } ) ;
56- req . results . $count = q . length ;
57- return ;
62+ getAnnotatedParamsOfAction ( boundAction ) ;
5863
59- } ) ;
60- }
6164 const actionName = boundAction . name . split ( '.' ) . pop ( ) ;
6265
6366 // Register for print related handling
0 commit comments