| 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 | $refcons = $args.refcons; |
| 11 | $geto = $args.geto; |
| 12 | $generics = var[ $_Portal ][ 'Generics' ]; |
| 13 | $getons = var[ $_Portal ][ 'Getons' ]; |
| 14 | $validacions = var[ $_Portal ][ 'Validacions' ]; |
| 15 | }", |
| 16 | "messages": [ |
| 17 | { |
| 18 | "app": "state", |
| 19 | "state": "{ |
| 20 | if ( $refcons == 'Portal' ) { |
| 21 | response[ '_Acces' ] = $generics._Acces; |
| 22 | response[ '_Getons' ] = $generics._Getons; |
| 23 | response[ '_Validacions' ] = $generics._Validacions; |
| 24 | response[ '_FRO' ] = $generics._FRO; |
| 25 | response[ '_FOP' ] = $generics._FOP; |
| 26 | response[ '_FDIP' ] = $generics._FDIP; |
| 27 | response[ '_Estels' ] = $generics._Estels; |
| 28 | response[ 'Interval' ] = $generics.Interval; |
| 29 | response[ 'Lapse' ] = $generics.Lapse; |
| 30 | response[ '_Transfer' ] = $generics._Transfer; |
| 31 | response[ '_Capacitacio' ] = $generics._Capacitacio; |
| 32 | response[ '_Avis' ] = $generics._Avis; |
| 33 | response[ 'Import_Activacio' ] = $generics.Import_Activacio; |
| 34 | response[ 'Import_Subscripcio' ] = $generics.Import_Subscripcio; |
| 35 | response[ 'Import_Renovacio' ] = $generics.Import_Activacio; |
| 36 | response[ 'Taxa_Conversio' ] = $generics.Taxa_Conversio; |
| 37 | response[ 'Factor_Conversio' ] = $generics.Factor_Conversio; |
| 38 | response[ 'Cicles_Latencia' ] = $generics.Cicles_Latencia; |
| 39 | response[ '_AUT_0' ] = $generics._AUT_0; |
| 40 | response[ '_AUT_A' ] = $generics._AUT_A; |
| 41 | response[ '_AUT_B' ] = $generics._AUT_B; |
| 42 | response[ '_AUT_C' ] = $generics._AUT_C; |
| 43 | response[ 'Darrer_Portal' ] = $generics.Darrer_Portal; |
| 44 | } |
| 45 | if ( $refcons == 'Darrera_Proposta' ) { |
| 46 | $ref_ordinal = 'ordinal_proposta_' || $args.ref; |
| 47 | $ordinals = var[ $_Portal ][ 'Ordinals' ]; |
| 48 | $ordinal = $ordinals[ $ref_ordinal ]; |
| 49 | $propostes = var[ $_Portal ][ 'Propostes' ]; |
| 50 | $id_proposta = 'proposta_' || $args.ref || '_' || $ordinal; |
| 51 | $proposta = $propostes[ $id_proposta ]; |
| 52 | |
| 53 | if ( $proposta ) { |
| 54 | $data_confirmacio = $proposta.temps + $generics.Lapse; |
| 55 | |
| 56 | response[ 'ref darrera proposta per a' || $args.ref ] = $id_proposta; |
| 57 | response[ 'ref del param proposat' ] = $proposta.ref; |
| 58 | response[ 'valor del param proposat' ] = $proposta.val; |
| 59 | response[ 'proposant' ] = $proposta.proposant; |
| 60 | response[ 'data de la proposta' ] = |
| 61 | timestamp_to_string( $proposta.temps ); |
| 62 | response[ 'data inici confirmacio' ] = |
| 63 | timestamp_to_string( $data_confirmacio ); |
| 64 | |
| 65 | $valor_actual = $generics[ $proposta.ref ]; |
| 66 | $coincident = |
| 67 | $valor_actual AND $valor_actual == $proposta.val ? 'SÍ' : 'NO'; |
| 68 | response[ 'valor actual coincident amb el proposat' ] = $coincident; |
| 69 | response[ 'valor actual' ] = $valor_actual; |
| 70 | |
| 71 | $validacio = $validacions[ $id_proposta ]; |
| 72 | response[ 'proposta validada' ] = |
| 73 | $validacio ? timestamp_to_string( $validacio ) : 'NO'; |
| 74 | } else { |
| 75 | response[ 'No hi ha cap proposta per a aquest param genèric' ] = $id_proposta; |
| 76 | } |
| 77 | } |
| 78 | if ( $refcons == 'Validacio' ) { |
| 79 | $data_validacio = $validacions[ $args.id ]; |
| 80 | response[ 'Proposta' ] = $args.id; |
| 81 | response[ 'Validada' ] = |
| 82 | $data_validacio ? timestamp_to_string( $data_validacio ) : 'NO'; |
| 83 | } |
| 84 | if ( $refcons == 'Dades_Geto' ) { |
| 85 | $_Getons = $generics._Getons; |
| 86 | $estat = data_feed[[oracles = $_Portal, feed_name = $args.id ]]; |
| 87 | $dades_registre = $getons[ $args.id ]; |
| 88 | response[ 'Id getó' ] = $args.id; |
| 89 | response[ 'Estat' ] = $estat; |
| 90 | response[ 'Proposant' ] = $dades_registre.proposant; |
| 91 | response[ 'Confirmant' ] = $dades_registre.confirmant; |
| 92 | response[ 'Data' ] = timestamp_to_string( $dades_registre.temps ); |
| 93 | $_Perfils = var[ $_Getons ][ '_Perfils' ]; |
| 94 | $perfil = var[ $_Perfils ][ $args.id ]; |
| 95 | response[ '_FOG' ] = $perfil._FOG; |
| 96 | response[ '_AUT_A' ] = $perfil._AUT_A; |
| 97 | response[ '_AUT_B' ] = $perfil._AUT_B; |
| 98 | response[ '_AUT_C' ] = $perfil._AUT_C; |
| 99 | response[ 'factor conversio' ] = $perfil.factor_conversio; |
| 100 | response[ 'import activacio' ] = $perfil.import_activacio; |
| 101 | response[ 'import subscripcio' ] = $perfil.import_subscripcio; |
| 102 | response[ 'import renovacio' ] = $perfil.import_renovacio; |
| 103 | response[ 'taxa conversio' ] = $perfil.taxa_conversio; |
| 104 | response[ 'derivacio a FOG' ] = $perfil.derivacio_aFOG; |
| 105 | response[ 'activacions restringides' ] = $perfil.activacions_restringides; |
| 106 | response[ 'subscripcions restringides' ] = $perfil.subscripcions_restringides; |
| 107 | response[ 'recepcions restringides' ] = $perfil.recepcions_restringides; |
| 108 | response[ 'conversions restringides' ] = $perfil.conversions_restringides; |
| 109 | response[ 'valors esmenables' ] = $perfil.valors_esmenables; |
| 110 | response[ 'llistats editables' ] = $perfil.llistats_editables; |
| 111 | response[ 'bloqueig possible' ] = $perfil.bloqueig_possible; |
| 112 | } |
| 113 | if ( $refcons == 'Dades_Node' ) { |
| 114 | $_AA = $generics._Transfer; |
| 115 | $activacio = var[ $_AA ][ 'activacio_' || $args.adr || '_en_' || $geto ]; |
| 116 | $subscripcio = var[ $_AA ][ 'subscripcio_' || $args.adr || '_en_' || $geto ]; |
| 117 | $cicle_renovacio = var[ $_AA ][ 'renovacio_' || $args.adr__ || '_' || $geto ]; |
| 118 | $cicle_renovacio = var[ $_AA ][ 'cicle_' || $args.adr ]; |
| 119 | $total_Derivacions = var[ $_AA ][ 'total_Derivacions_de_' || $args.adr || '_en_' || $geto ]; |
| 120 | |
| 121 | $_Avis = $generics._Avis; |
| 122 | $avis = var[ $_Avis ][ 'Avis_' || $args.adr || '_' || $geto ]; |
| 123 | response[ 'Nom Activació' ] = $activacio.nom; |
| 124 | response[ 'Escala Activació' ] = $activacio.escala; |
| 125 | response[ 'Nom Subscripció' ] = $subscripcio.nom; |
| 126 | response[ '% Derivació a FOP' ] = $subscripcio.aFOP; |
| 127 | response[ 'Cicle Subscripció' ] = $subscripcio.cicle; |
| 128 | response[ 'Cicle Renovació' ] = $cicle_renovacio; |
| 129 | response[ 'Total Derivacions a FOP' ] = $total_Derivacions; |
| 130 | if ( !! $avis.operatiu ) { response[ 'Avís' ] = $avis.text; } |
| 131 | } |
| 132 | if ( $refcons == 'Totals' ) { |
| 133 | $_AA = $generics._Transfer; |
| 134 | $total_activacions = var[ $_AA ][ 'total_Activacions' || '_en_' || $geto ]; |
| 135 | $total_subscripcions = var[ $_AA ][ 'total_Subscripcions' || '_en_' || $geto ]; |
| 136 | $total_renovacions = var[ $_AA ][ 'total_Renovacions' || '_en_' || $geto ]; |
| 137 | $total_compensacions = var[ $_AA ][ 'total_Compensacions' || '_en_' || $geto ] ; |
| 138 | $total_derivacions = var[ $_AA ][ 'total_Derivacions' || '_en_' || $geto ]; |
| 139 | $total_diposits = var[ $_AA ][ 'total_Diposits' || '_en_' || $geto ]; |
| 140 | $total_liquidacions = var[ $_AA ][ 'total_Liquidacions' || '_en_' || $geto ]; |
| 141 | response[ 'Total Activacions' ] = $total_activacions; |
| 142 | response[ 'Total Subscripcions' ] = $total_subscripcions; |
| 143 | response[ 'Total Renovacions' ] = $total_renovacions; |
| 144 | response[ 'Total Compensacions' ] = $total_compensacions; |
| 145 | response[ 'Total Derivacions' ] = $total_derivacions; |
| 146 | response[ 'Total Diposits' ] = $total_diposits; |
| 147 | response[ 'Total Liquidacions' ] = $total_liquidacions; |
| 148 | } |
| 149 | if ( $refcons == 'Cicle_actual' ) { |
| 150 | $_AA = $generics._Transfer; |
| 151 | $cicle_actual = var[ $_AA ][ 'cicle_actual']; |
| 152 | $data_cicle_actual = var[ $_AA ][ 'data_cicle_actual']; |
| 153 | $data_cicle_anterior = var[ $_AA ][ 'data_cicle_anterior']; |
| 154 | $interval = var[ $_AA ][ 'Interval']; |
| 155 | response[ 'Cicle Actual' ] = $cicle_actual; |
| 156 | response[ 'Data Cicle Actual' ] = timestamp_to_string( $data_cicle_actual ); |
| 157 | response[ 'Data Cicle Anterior' ] = timestamp_to_string( $data_cicle_anterior ); |
| 158 | response[ 'Data Cicle Actual milisegons' ] = $data_cicle_actual; |
| 159 | response[ 'Data Cicle Anterior milisegons' ] = $data_cicle_anterior; |
| 160 | response[ 'Interval' ] = $interval; |
| 161 | } |
| 162 | if ( $refcons == '_Avis' ) { |
| 163 | $_AA = $generics._Avis; |
| 164 | $avis = var[ $_AA ][ 'Avis_' || $args.adr || '_' || $geto ]; |
| 165 | response[ 'Actuant' ] = $avis.actuant; |
| 166 | response[ 'Text' ] = $avis.text; |
| 167 | response[ 'Rebot' ] = $avis.rebot; |
| 168 | response[ 'Operatiu' ] = $avis.operatiu; |
| 169 | if ( !! $avis.data ) { |
| 170 | response[ 'Data' ] = timestamp_to_string( $avis.data ); |
| 171 | } |
| 172 | } |
| 173 | if ( $refcons == 'Capacitacio' ) { |
| 174 | $_AA = $generics._Capacitacio; |
| 175 | $ref = $args.tipus || '_' || $args.adr || '_' || $geto; |
| 176 | $capacitacio = var[ $_AA ][ $ref ]; |
| 177 | response[ 'Ref Capacitacio' ] = $ref; |
| 178 | response[ 'Ordinal' ] = $capacitacio.ordinal; |
| 179 | response[ 'Data' ] = timestamp_to_string( $capacitacio.data ); |
| 180 | response[ 'Estat' ] = $capacitacio.estat; |
| 181 | response[ 'Capacitadora' ] = $capacitacio.capacitadora; |
| 182 | } |
| 183 | }" |
| 184 | } |
| 185 | ] |
| 186 | } |
| 187 | ] |