@fluxhub/fluxhub-lib 19.0.236 → 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 &&
@@ -35242,6 +35289,8 @@ class FHWorkflowForm {
35242
35289
  ? d.result_data[0].preso_da || ''
35243
35290
  : '';
35244
35291
  const ok = owner === this.app_s.user;
35292
+ if (ok)
35293
+ this.log_task_op('Presa in carico', task);
35245
35294
  this.load_step_tasks(() => {
35246
35295
  if (done)
35247
35296
  done(ok, owner);
@@ -35250,6 +35299,25 @@ class FHWorkflowForm {
35250
35299
  });
35251
35300
  });
35252
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
+ }
35253
35321
  /**
35254
35322
  * Rilascia la presa in carico. `force` (supervisori) sblocca anche i task presi
35255
35323
  * in carico da altri: serve per i lock rimasti appesi.
@@ -35263,7 +35331,10 @@ class FHWorkflowForm {
35263
35331
  p.types = force
35264
35332
  ? ['string', 'string', 'string']
35265
35333
  : ['string', 'string', 'string', 'string'];
35266
- 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
+ });
35267
35338
  }
35268
35339
  /**
35269
35340
  * Chiude un task. Richiede la presa in carico (`task.mine`): la UPDATE porta
@@ -35313,6 +35384,9 @@ class FHWorkflowForm {
35313
35384
  this.m_dataService.doQuery(p).subscribe((data) => {
35314
35385
  if (data == null || data.result_msg != 'OK')
35315
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);
35316
35390
  // Ricarico dal DB invece di aggiornare in locale: `locked` degli altri task
35317
35391
  // dipende da questo, e un altro utente puo' aver chiuso qualcosa nel frattempo.
35318
35392
  // L'avanzamento automatico lo decide load_step_tasks (vedi li'): se lo step avanza