@fluxhub/fluxhub-lib 19.0.235 → 19.0.237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ import { AES } from 'crypto-ts';
10
10
  import * as i1 from '@angular/platform-browser';
11
11
  import * as i3 from '@ngx-translate/core';
12
12
  import { TranslateModule } from '@ngx-translate/core';
13
- import { Observable, Subject, forkJoin, of, throwError, BehaviorSubject } from 'rxjs';
13
+ import { Observable, Subject, of, forkJoin, throwError, BehaviorSubject } from 'rxjs';
14
14
  import * as i5$1 from '@angular/forms';
15
15
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
16
16
  import * as i5 from '@angular/common';
@@ -27461,6 +27461,26 @@ class WkfService {
27461
27461
  cur_user(opts) {
27462
27462
  return (opts && opts.username) || this.app_s.user || '';
27463
27463
  }
27464
+ /**
27465
+ * Riga di log sul documento (`wkf_workflow`), la stessa tabella del log del form:
27466
+ * le operazioni sulle attivita' devono comparire nel dialog LOGS come quelle del
27467
+ * motore, altrimenti una pratica avanzata da un'applicazione esterna risulta
27468
+ * mossa "da sola".
27469
+ *
27470
+ * Il dialog rende `operazione (stato_attuale)`: qui il titolo dell'attivita' va
27471
+ * nel secondo campo, cosi' la riga si legge come le altre ("... (ATTESA SCHEDA
27472
+ * TECNICA)"). Il log e' accessorio: un suo errore non deve far fallire
27473
+ * l'operazione, quindi l'errore viene assorbito.
27474
+ */
27475
+ log_task_op(id_applicativo, id_documento, operazione, task, username) {
27476
+ return this.q('INSERT_WORKFLOW_LOG', [
27477
+ id_applicativo,
27478
+ this.cur_user({ username }),
27479
+ operazione,
27480
+ (task && task.title) || '',
27481
+ id_documento,
27482
+ ], ['string', 'string', 'string', 'string', 'string']).pipe(catchError(() => of(null)));
27483
+ }
27464
27484
  dev_mode() {
27465
27485
  return this.app_s.dev_mode != null && this.app_s.dev_mode == '1';
27466
27486
  }
@@ -27564,10 +27584,14 @@ class WkfService {
27564
27584
  */
27565
27585
  claim_task(id_applicativo, id_documento, task, step, username) {
27566
27586
  const me = this.cur_user({ username });
27567
- return this.q('INSERT_IGNORE_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, step], ['string', 'string', 'string', 'int']).pipe(switchMap(() => this.q('CLAIM_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, me], ['string', 'string', 'string', 'string'])), switchMap(() => this.q('SELECT_WKF_DOC_TASK_OWNER', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string'])), map((r) => {
27587
+ return this.q('INSERT_IGNORE_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, step], ['string', 'string', 'string', 'int']).pipe(switchMap(() => this.q('CLAIM_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid, me], ['string', 'string', 'string', 'string'])), switchMap(() => this.q('SELECT_WKF_DOC_TASK_OWNER', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string'])), switchMap((r) => {
27568
27588
  const a = this.rows(r);
27569
27589
  const owner = a.length > 0 ? a[0].preso_da || '' : '';
27570
- return { ok: owner === me, owner: owner, task: task };
27590
+ const res = { ok: owner === me, owner: owner, task: task };
27591
+ // Si logga solo chi ha vinto la corsa: chi l'ha persa non ha preso in carico nulla.
27592
+ if (!res.ok)
27593
+ return of(res);
27594
+ return this.log_task_op(id_applicativo, id_documento, 'Presa in carico', task, username).pipe(map(() => res));
27571
27595
  }));
27572
27596
  }
27573
27597
  /**
@@ -27581,11 +27605,23 @@ class WkfService {
27581
27605
  task.uiid,
27582
27606
  this.cur_user({ username }),
27583
27607
  nota == null ? null : nota,
27584
- ], ['string', 'string', 'string', 'string', 'string']).pipe(map((r) => r != null && r.result_msg == 'OK'));
27608
+ ], ['string', 'string', 'string', 'string', 'string']).pipe(switchMap((r) => {
27609
+ const ok = r != null && r.result_msg == 'OK';
27610
+ if (!ok)
27611
+ return of(false);
27612
+ // La nota di chiusura entra nel log: e' il "perche'" della chiusura, e chi
27613
+ // legge il log non ha sotto gli occhi il pannello delle attivita'.
27614
+ return this.log_task_op(id_applicativo, id_documento, 'Conclusione' + (nota != null && ('' + nota).trim() !== '' ? ': ' + nota : ''), task, username).pipe(map(() => true));
27615
+ }));
27585
27616
  }
27586
27617
  /** Riapre un task chiuso, azzerando anche la presa in carico. */
27587
- reopen_task(id_applicativo, id_documento, task) {
27588
- return this.q('REOPEN_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string']).pipe(map((r) => r != null && r.result_msg == 'OK'));
27618
+ reopen_task(id_applicativo, id_documento, task, username) {
27619
+ return this.q('REOPEN_WKF_DOC_TASK', [id_applicativo, id_documento, task.uiid], ['string', 'string', 'string']).pipe(switchMap((r) => {
27620
+ const ok = r != null && r.result_msg == 'OK';
27621
+ if (!ok)
27622
+ return of(false);
27623
+ return this.log_task_op(id_applicativo, id_documento, 'Riapertura', task, username).pipe(map(() => true));
27624
+ }));
27589
27625
  }
27590
27626
  /**
27591
27627
  * Segnala a exec_wkf la chiusura di un task: sblocco dei task dipendenti,
@@ -29221,11 +29257,22 @@ class FHWorkflowView {
29221
29257
  });
29222
29258
  }
29223
29259
  });
29260
+ // Filtro per canale con la STESSA regola dell'avanzamento (vedi b_canale in
29261
+ // wkf-form-data): se NESSUN attore dello step ha un context, lo step non e'
29262
+ // configurato per canale e il canale del documento non deve filtrare niente.
29263
+ // Pretendendo l'uguaglianza esatta, un documento con canale valorizzato e uno
29264
+ // step senza context perdeva TUTTI gli attori e il picker restava vuoto.
29265
+ let b_canale = false;
29266
+ for (let i = 0; i < arrAutori.length; i++)
29267
+ if (arrAutori[i].context != null && arrAutori[i].context != '')
29268
+ b_canale = true;
29224
29269
  let arrAutori_temp = [];
29225
29270
  for (let i = 0; i < arrAutori.length; i++) {
29226
29271
  if (this.get_grid().sRow.canale == null ||
29227
29272
  this.get_grid().sRow.canale == '' ||
29228
- this.get_grid().sRow.canale == arrAutori[i].context) {
29273
+ !b_canale ||
29274
+ this.get_grid().sRow.canale == arrAutori[i].context ||
29275
+ arrAutori[i].context == '*SYSTEM') {
29229
29276
  let b_x = false;
29230
29277
  arrAutori_temp.map((v) => {
29231
29278
  if (v.nc == arrAutori[i].nc &&
@@ -30740,6 +30787,13 @@ class win_conferma_v2 {
30740
30787
  comm_notrequired = 0;
30741
30788
  mobile = false;
30742
30789
  buttons = [];
30790
+ /**
30791
+ * Riga "Assegnata a: <nomi>" sopra il commento. Acceso di default (comportamento
30792
+ * storico); si spegne passando `show_utenti: false` nei data del dialog, cioe' dal
30793
+ * form della pratica con `FHWorkflowForm.show_assegnatari = false`, quando il cliente
30794
+ * non vuole che chi avanza veda a chi finisce la pratica.
30795
+ */
30796
+ show_utenti = true;
30743
30797
  constructor(dialogRef, m_appService, toastr, _tsr, data) {
30744
30798
  this.dialogRef = dialogRef;
30745
30799
  this.m_appService = m_appService;
@@ -30757,6 +30811,8 @@ class win_conferma_v2 {
30757
30811
  this.lbl = data.lbl;
30758
30812
  if (data.utenti != null)
30759
30813
  this.utenti = data.utenti.split(';').join(', ');
30814
+ if (data.show_utenti != null)
30815
+ this.show_utenti = data.show_utenti;
30760
30816
  if (data.icon != null)
30761
30817
  this.icon = data.icon;
30762
30818
  if (data.color_font != null)
@@ -30841,14 +30897,14 @@ class win_conferma_v2 {
30841
30897
  <br />
30842
30898
  <div>
30843
30899
  <div
30844
- *ngIf="mobile && utenti.toLocaleLowerCase().indexOf('system') == -1"
30900
+ *ngIf="show_utenti && mobile && utenti.toLocaleLowerCase().indexOf('system') == -1"
30845
30901
  style="font-size:10px"
30846
30902
  >
30847
30903
  {{ 'Assegnata a' | translate }}: {{ utenti }}
30848
30904
  </div>
30849
30905
  <h3
30850
30906
  *ngIf="
30851
- !mobile && utenti.toLocaleLowerCase().indexOf('system') == -1
30907
+ show_utenti && !mobile && utenti.toLocaleLowerCase().indexOf('system') == -1
30852
30908
  "
30853
30909
  >
30854
30910
  {{ 'Assegnata a' | translate }}: {{ utenti }}
@@ -30903,14 +30959,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
30903
30959
  <br />
30904
30960
  <div>
30905
30961
  <div
30906
- *ngIf="mobile && utenti.toLocaleLowerCase().indexOf('system') == -1"
30962
+ *ngIf="show_utenti && mobile && utenti.toLocaleLowerCase().indexOf('system') == -1"
30907
30963
  style="font-size:10px"
30908
30964
  >
30909
30965
  {{ 'Assegnata a' | translate }}: {{ utenti }}
30910
30966
  </div>
30911
30967
  <h3
30912
30968
  *ngIf="
30913
- !mobile && utenti.toLocaleLowerCase().indexOf('system') == -1
30969
+ show_utenti && !mobile && utenti.toLocaleLowerCase().indexOf('system') == -1
30914
30970
  "
30915
30971
  >
30916
30972
  {{ 'Assegnata a' | translate }}: {{ utenti }}
@@ -32796,6 +32852,19 @@ class FHWorkflowForm {
32796
32852
  reject_back_ground_color = '#f44336';
32797
32853
  b_init_next = false;
32798
32854
  sort_field = '';
32855
+ /**
32856
+ * Riga "Assegnata a: <nomi>" nel dialog "Conferma Avanzamento".
32857
+ *
32858
+ * Default acceso: chi avanza vede a chi sta passando la pratica (comportamento
32859
+ * storico, i portali gia' in produzione non cambiano da soli). Va spento nel form
32860
+ * della pratica (`this.show_assegnatari = false;`) quando i destinatari dello step
32861
+ * successivo non devono essere visibili a chi avanza.
32862
+ *
32863
+ * Non tocca il dialog di "Conferma Assegnazione" (assegnazione manuale), dove i
32864
+ * nomi sono l'oggetto stesso della scelta, ne' il testo di stato scritto sul
32865
+ * documento e nei log.
32866
+ */
32867
+ show_assegnatari = true;
32799
32868
  // --- Step in modalita' task (step_mode='T') --------------------------------
32800
32869
  // 'A' = avanzamento manuale (comportamento storico), 'T' = task paralleli:
32801
32870
  // il pulsante Procedi sparisce e l'avanzamento scatta alla chiusura
@@ -33474,6 +33543,7 @@ class FHWorkflowForm {
33474
33543
  commento_default: '',
33475
33544
  comm_notrequired: o.comments_opt,
33476
33545
  utenti: sp,
33546
+ show_utenti: this.show_assegnatari,
33477
33547
  },
33478
33548
  });
33479
33549
  dialogRef.afterClosed().subscribe((result) => {
@@ -35219,6 +35289,8 @@ class FHWorkflowForm {
35219
35289
  ? d.result_data[0].preso_da || ''
35220
35290
  : '';
35221
35291
  const ok = owner === this.app_s.user;
35292
+ if (ok)
35293
+ this.log_task_op('Presa in carico', task);
35222
35294
  this.load_step_tasks(() => {
35223
35295
  if (done)
35224
35296
  done(ok, owner);
@@ -35227,6 +35299,25 @@ class FHWorkflowForm {
35227
35299
  });
35228
35300
  });
35229
35301
  }
35302
+ /**
35303
+ * Riga di log sul documento per un'operazione di attività (`wkf_workflow`, la
35304
+ * stessa tabella del log del motore). Il dialog LOGS rende `operazione
35305
+ * (stato_attuale)`: nel secondo campo va il titolo dell'attività, così la riga si
35306
+ * distingue dalla presa in carico del documento, che lì mette lo stato.
35307
+ */
35308
+ log_task_op(operazione, task) {
35309
+ const p = new QParam();
35310
+ p.sql = 'INSERT_WORKFLOW_LOG';
35311
+ p.types = ['string', 'string', 'string', 'string', 'string'];
35312
+ p.values = [
35313
+ this.id_applicativo,
35314
+ this.app_s.user,
35315
+ operazione,
35316
+ (task && task.title) || '',
35317
+ this.id_documento,
35318
+ ];
35319
+ this.m_dataService.doQuery(p).subscribe();
35320
+ }
35230
35321
  /**
35231
35322
  * Rilascia la presa in carico. `force` (supervisori) sblocca anche i task presi
35232
35323
  * in carico da altri: serve per i lock rimasti appesi.
@@ -35240,7 +35331,10 @@ class FHWorkflowForm {
35240
35331
  p.types = force
35241
35332
  ? ['string', 'string', 'string']
35242
35333
  : ['string', 'string', 'string', 'string'];
35243
- this.m_dataService.doQuery(p).subscribe(() => this.load_step_tasks());
35334
+ this.m_dataService.doQuery(p).subscribe(() => {
35335
+ this.log_task_op(force ? 'Presa in carico rilasciata (forzata)' : 'Presa in carico rilasciata', task);
35336
+ this.load_step_tasks();
35337
+ });
35244
35338
  }
35245
35339
  /**
35246
35340
  * Chiude un task. Richiede la presa in carico (`task.mine`): la UPDATE porta
@@ -35290,6 +35384,9 @@ class FHWorkflowForm {
35290
35384
  this.m_dataService.doQuery(p).subscribe((data) => {
35291
35385
  if (data == null || data.result_msg != 'OK')
35292
35386
  return;
35387
+ // La nota di chiusura entra nel log: e` il "perche`" della chiusura, e chi legge
35388
+ // il log non ha sotto gli occhi il pannello delle attività.
35389
+ this.log_task_op('Conclusione' + (nota != null && ('' + nota).trim() !== '' ? ': ' + nota : ''), task);
35293
35390
  // Ricarico dal DB invece di aggiornare in locale: `locked` degli altri task
35294
35391
  // dipende da questo, e un altro utente puo' aver chiuso qualcosa nel frattempo.
35295
35392
  // L'avanzamento automatico lo decide load_step_tasks (vedi li'): se lo step avanza