| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | $nom_AA = 'Consultes'; |
| 6 | $versio = '0.1'; |
| 7 | |
| 8 | $args = trigger.data; |
| 9 | $_Portal = $args._Portal; |
| 10 | }", |
| 11 | "messages": [ |
| 12 | { |
| 13 | "app": "state", |
| 14 | "state": "{ |
| 15 | if ( $args.ref == 'Portal' ) { |
| 16 | response[ '_Acces' ] = var[ $_Portal ][ '_Acces' ]; |
| 17 | response[ '_Getons' ] = var[ $_Portal ][ '_Getons' ]; |
| 18 | response[ '_Validacions' ] = var[ $_Portal ][ '_Validacions' ]; |
| 19 | response[ '_FRO' ] = var[ $_Portal ][ '_FRO' ]; |
| 20 | response[ '_FOP' ] = var[ $_Portal ][ '_FOP' ]; |
| 21 | response[ '_FDIP' ] = var[ $_Portal ][ '_FDIP' ]; |
| 22 | response[ '_Estels' ] = var[ $_Portal ][ 'id_Estels' ]; |
| 23 | response[ 'interval' ] = var[ $_Portal ][ 'interval' ]; |
| 24 | response[ 'lapse' ] = var[ $_Portal ][ 'lapse' ]; |
| 25 | response[ '_Transfer' ] = var[ $_Portal ][ '_Transfer' ]; |
| 26 | response[ '_Capacitacio' ] = var[ $_Portal ][ '_Capacitacio' ]; |
| 27 | response[ '_Avis' ] = var[ $_Portal ][ '_Avis' ]; |
| 28 | response[ 'Import_Activacio' ] = var[ $_Portal ][ 'Import_Activacio' ]; |
| 29 | response[ 'Import_Subscripcio' ] = var[ $_Portal ][ 'Import_Subscripcio' ]; |
| 30 | response[ 'Import_Renovacio' ] = var[ $_Portal ][ 'Import_Activacio' ]; |
| 31 | response[ 'Taxa_Conversio' ] = var[ $_Portal ][ 'Taxa_Conversio' ]; |
| 32 | response[ 'Factor_Conversio' ] = var[ $_Portal ][ 'Factor_Conversio' ]; |
| 33 | response[ 'Cicles_Latencia' ] = var[ $_Portal ][ 'Cicles_Latencia' ]; |
| 34 | response[ '_AUT_0' ] = var[ $_Portal ][ '_AUT_0' ]; |
| 35 | response[ '_AUT_A' ] = var[ $_Portal ][ '_AUT_A' ]; |
| 36 | response[ '_AUT_B' ] = var[ $_Portal ][ '_AUT_B' ]; |
| 37 | response[ '_AUT_C' ] = var[ $_Portal ][ '_AUT_C' ]; |
| 38 | } |
| 39 | if ( $args.ref == 'Cicle_actual' ) { |
| 40 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 41 | $cicle_actual = var[ $_AA ][ 'cicle_actual']; |
| 42 | $data_cicle_actual = var[ $_AA ][ 'data_cicle_actual']; |
| 43 | $data_cicle_anterior = var[ $_AA ][ 'data_cicle_anterior']; |
| 44 | $interval = var[ $_AA ][ 'interval'];response[ 'Cicle Actual' ] = $cicle_actual; |
| 45 | response[ 'Data Cicle Actual' ] = timestamp_to_string( $data_cicle_actual, 'datetime' ); |
| 46 | response[ 'Data Cicle Anterior' ] = timestamp_to_string( $data_cicle_anterior, 'datetime' ); |
| 47 | response[ 'Data Cicle Actual milisegons' ] = $data_cicle_actual; |
| 48 | response[ 'Data Cicle Anterior milisegons' ] = $data_cicle_anterior; |
| 49 | response[ 'Interval' ] = $interval; |
| 50 | } |
| 51 | if ( $args.ref == 'Dades_Node' ) { |
| 52 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 53 | $activacio = var[ $_AA ][ 'activacio_' || $args.adr || '_en_' || $args.geto ]; |
| 54 | $subscripcio = var[ $_AA ][ 'subscripcio_' || $args.adr || '_en_' || $args.geto ]; |
| 55 | $cicle_renovacio = var[ $_AA ][ 'renovacio_' || $args.adr__ || '_' || $args.geto ]; |
| 56 | $cicle_renovacio = var[ $_AA ][ 'cicle_' || $args.adr ]; |
| 57 | $total_Derivacions = var[ $_AA ][ 'total_Derivacions_de_' || $args.adr || '_en_' || $args.geto ]; |
| 58 | |
| 59 | $_Avis = var[ $_Portal ][ '_Avis' ]; |
| 60 | $avis = var[ $_Avis ][ 'Avis_' || $args.adr || '_' || $args.geto ]; |
| 61 | response[ 'Nom Activació' ] = $activacio.nom; |
| 62 | response[ 'Escala Activació' ] = $activacio.escala; |
| 63 | response[ 'Nom Subscripció' ] = $subscripcio.nom; |
| 64 | response[ '% Derivació a FOP' ] = $subscripcio.aFOP; |
| 65 | response[ 'Cicle Subscripció' ] = $subscripcio.cicle; |
| 66 | response[ 'Cicle Renovació' ] = $cicle_renovacio; |
| 67 | response[ 'Total Derivacions a FOP' ] = $total_Derivacions; |
| 68 | if ( !! $avis.operatiu ) { response[ 'Avís' ] = $avis.text; } |
| 69 | } |
| 70 | if ( $args.ref == 'Totals' ) { |
| 71 | $_AA = var[ $_Portal ][ '_Transfer' ]; |
| 72 | $total_activacions = var[ $_AA ][ 'total_Activacions' || '_en_' || $args.geto ]; |
| 73 | $total_subscripcions = var[ $_AA ][ 'total_Subscripcions' || '_en_' || $args.geto ]; |
| 74 | $total_renovacions = var[ $_AA ][ 'total_Renovacions' || '_en_' || $args.geto ]; |
| 75 | $total_compensacions = var[ $_AA ][ 'total_Compensacions' || '_en_' || $args.geto ] ; |
| 76 | $total_derivacions = var[ $_AA ][ 'total_Derivacions' || '_en_' || $args.geto ]; |
| 77 | $total_diposits = var[ $_AA ][ 'total_Diposits' || '_en_' || $args.geto ]; |
| 78 | $total_liquidacions = var[ $_AA ][ 'total_Liquidacions' || '_en_' || $args.geto ]; |
| 79 | response[ 'Total Activacions' ] = $total_activacions; |
| 80 | response[ 'Total Subscripcions' ] = $total_subscripcions; |
| 81 | response[ 'Total Renovacions' ] = $total_renovacions; |
| 82 | response[ 'Total Compensacions' ] = $total_compensacions; |
| 83 | response[ 'Total Derivacions' ] = $total_derivacions; |
| 84 | response[ 'Total Diposits' ] = $total_diposits; |
| 85 | response[ 'Total Liquidacions' ] = $total_liquidacions; |
| 86 | } |
| 87 | if ( $args.ref == '_Avis' ) { |
| 88 | $_AA = var[ $_Portal ][ '_Avis' ]; |
| 89 | $avis = var[ $_AA ][ 'Avis_' || $args.adr || '_' || $args.geto ]; |
| 90 | response[ 'Actuant' ] = $avis.actuant; |
| 91 | response[ 'Text' ] = $avis.text; |
| 92 | response[ 'Rebot' ] = $avis.rebot; |
| 93 | response[ 'Operatiu' ] = $avis.operatiu; |
| 94 | if ( !! $avis.data ) { |
| 95 | response[ 'Data' ] = timestamp_to_string( $avis.data, 'datetime' ); |
| 96 | } |
| 97 | } |
| 98 | if ( $args.ref == 'Capacitacio' ) { |
| 99 | $_AA = var[ $_Portal ][ '_Capacitacio' ]; |
| 100 | $ref = $args.tipus || '_' || $args.adr || '_' || $args.geto; |
| 101 | $capacitacio = var[ $_AA ][ $ref ]; |
| 102 | response[ 'Ref Capacitacio' ] = $ref; |
| 103 | response[ 'Ordinal' ] = $capacitacio.ordinal; |
| 104 | response[ 'Data' ] = timestamp_to_string( $capacitacio.data, 'datetime' ); |
| 105 | response[ 'Estat' ] = $capacitacio.estat; |
| 106 | response[ 'Capacitadora' ] = $capacitacio.capacitadora; |
| 107 | } |
| 108 | }" |
| 109 | } |
| 110 | ] |
| 111 | } |
| 112 | ] |