@fluxhub/fluxhub-lib 19.0.219 → 19.0.221

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.
@@ -32577,6 +32577,14 @@ class FHWorkflowForm {
32577
32577
  }
32578
32578
  }
32579
32579
  this.clevel = this.check_n_levels(this.clevel);
32580
+ UtilityService.dlog('[WKF] doApprova(): clevel', {
32581
+ clevel: this.clevel,
32582
+ stato: this.m_obj?.stato,
32583
+ livs_dello_step: (this.livs || []).filter((l) => Number(l.step) === Number(this.m_obj?.stato)),
32584
+ });
32585
+ if (this.clevel == null) {
32586
+ UtilityService.dlog('[WKF] doApprova(): STOP, clevel NULL: nessun livello dello step corrente combacia con l utente');
32587
+ }
32580
32588
  this.calcolanextandjump();
32581
32589
  }
32582
32590
  wkf_rule_before(transazioni, step, context, oper) {
@@ -32594,10 +32602,17 @@ class FHWorkflowForm {
32594
32602
  }
32595
32603
  p.values = [this.id_applicativo, this.clevel.step];
32596
32604
  p.types = ['string', 'int'];
32605
+ UtilityService.dlog('[WKF] calcolanextandjump()', {
32606
+ sql: p.sql,
32607
+ step: this.clevel?.step,
32608
+ oper: this.oper,
32609
+ b_respingi_button: this.b_respingi_button,
32610
+ });
32597
32611
  this.m_dataService.doQuery(p).subscribe((data) => {
32598
32612
  if (data != null)
32599
32613
  if (data.result_msg == 'OK') {
32600
32614
  let transazioni = data.result_data;
32615
+ UtilityService.dlog('[WKF] transizioni trovate:', transazioni.length, transazioni.map((t) => t.step_d + ' ' + t.description));
32601
32616
  transazioni = this.wkf_rule_before(transazioni, this.clevel.step, this.clevel.context, this.oper);
32602
32617
  if (transazioni.length == 0) {
32603
32618
  this.alert('Nessuna transizione definita dallo step: ' + this.clevel.step, 1);
@@ -33372,17 +33387,23 @@ class FHWorkflowForm {
33372
33387
  this.salva();
33373
33388
  }
33374
33389
  procedi() {
33375
- if (!this.can_save())
33390
+ if (!this.can_save()) {
33391
+ UtilityService.dlog('[WKF] procedi(): STOP, can_save()=false');
33376
33392
  return;
33377
- if (this.b_saving)
33393
+ }
33394
+ if (this.b_saving) {
33395
+ UtilityService.dlog('[WKF] procedi(): STOP, b_saving=true');
33378
33396
  return;
33397
+ }
33379
33398
  this.oper = 'procedi';
33380
33399
  this.btnprocedi = true;
33381
33400
  this.update_status(false, false, null, null, 9);
33382
33401
  if (!this.ck_field('proceed')) {
33402
+ UtilityService.dlog("[WKF] procedi(): STOP, ck_field('proceed')=false");
33383
33403
  this.update_status(true, this.respingi_enabled, null, null, 10);
33384
33404
  return;
33385
33405
  }
33406
+ UtilityService.dlog('[WKF] procedi(): ok, salva()');
33386
33407
  this.salva();
33387
33408
  }
33388
33409
  open_wkf(em, inser_c = false, edit_c = true, show_wkf = true) {
@@ -33592,6 +33613,11 @@ class FHWorkflowForm {
33592
33613
  }
33593
33614
  ok_insert_aggiuntivi() {
33594
33615
  this.b_saving = false;
33616
+ UtilityService.dlog('[WKF] ok_insert_aggiuntivi()', {
33617
+ btnprocedi: this.btnprocedi,
33618
+ b_edit: this.b_edit,
33619
+ prossimo: this.btnprocedi ? 'load_document() -> doApprova()' : 'solo salvataggio',
33620
+ });
33595
33621
  if (!this.btnprocedi) {
33596
33622
  this.alert('DOCUMENTO SALVATO', 0);
33597
33623
  this.after_save();
@@ -34415,6 +34441,34 @@ class FHWorkflowForm {
34415
34441
  this.after_task_change();
34416
34442
  if (after)
34417
34443
  after();
34444
+ // Avanzamento automatico. Sta QUI e non in close_task() perche' load_step_tasks
34445
+ // gira anche all'APERTURA del documento: se l'utente aveva chiuso l'ultimo task e
34446
+ // poi il dialog di scelta transizione con la X, il documento restava fermo con
34447
+ // tutti i task chiusi e senza pulsante Procedi -- bloccato. Riaprendolo, avanza.
34448
+ UtilityService.dlog('[TASK] load_step_tasks', {
34449
+ step_mode: this.step_mode,
34450
+ stato: this.m_obj?.stato,
34451
+ tasks: this.step_tasks.length,
34452
+ tasks_all_done: this.tasks_all_done,
34453
+ b_edit: this.b_edit,
34454
+ b_saving: this.b_saving,
34455
+ btnprocedi: this.btnprocedi,
34456
+ });
34457
+ if (this.step_mode == 'T' &&
34458
+ this.tasks_all_done &&
34459
+ this.b_edit &&
34460
+ !this.b_saving &&
34461
+ !this.btnprocedi) {
34462
+ UtilityService.dlog('[TASK] -> avanzamento automatico: chiamo procedi()');
34463
+ this.procedi();
34464
+ }
34465
+ else if (this.step_mode == 'T' && this.tasks_all_done) {
34466
+ UtilityService.dlog('[TASK] tutti i task chiusi ma NON avanzo', {
34467
+ b_edit: this.b_edit,
34468
+ b_saving: this.b_saving,
34469
+ btnprocedi: this.btnprocedi,
34470
+ });
34471
+ }
34418
34472
  },
34419
34473
  error: () => {
34420
34474
  this.b_tasks_loading = false;
@@ -34506,13 +34560,23 @@ class FHWorkflowForm {
34506
34560
  * `tasks_all_done=true` e avanza il primo autore che apre la pratica.
34507
34561
  */
34508
34562
  close_task(task, nota) {
34563
+ UtilityService.dlog('[TASK] close_task', {
34564
+ title: task?.title,
34565
+ stato: task?.stato,
34566
+ mine: task?.mine,
34567
+ locked: task?.locked,
34568
+ });
34509
34569
  if (task == null || task.stato == 1 || task.locked)
34510
34570
  return false;
34511
- if (Number(task.mine || 0) != 1)
34571
+ if (Number(task.mine || 0) != 1) {
34572
+ UtilityService.dlog('[TASK] close_task: STOP, task non preso in carico');
34512
34573
  return false; // serve la presa in carico
34574
+ }
34513
34575
  const errs = this.ck_task(task.check_key || '');
34514
- if (errs && errs.length > 0)
34576
+ if (errs && errs.length > 0) {
34577
+ UtilityService.dlog('[TASK] close_task: STOP, ck_task', errs);
34515
34578
  return false;
34579
+ }
34516
34580
  const p = new QParam();
34517
34581
  p.sql = 'CLOSE_WKF_DOC_TASK';
34518
34582
  p.values = [
@@ -34528,16 +34592,13 @@ class FHWorkflowForm {
34528
34592
  return;
34529
34593
  // Ricarico dal DB invece di aggiornare in locale: `locked` degli altri task
34530
34594
  // dipende da questo, e un altro utente puo' aver chiuso qualcosa nel frattempo.
34595
+ // L'avanzamento automatico lo decide load_step_tasks (vedi li'): se lo step avanza
34596
+ // ci pensa procedi() -> exec_wkf, che ricalcola lettori e notifiche sullo step di
34597
+ // destinazione, ed e' inutile (e sbagliato) notificare i task di uno step che
34598
+ // stiamo lasciando.
34531
34599
  this.load_step_tasks(() => {
34532
- if (this.tasks_all_done && this.b_edit) {
34533
- // Lo step avanza: ci pensa procedi() -> exec_wkf, che ricalcola lettori e
34534
- // notifiche sullo step di destinazione. Inutile (e sbagliato) notificare i
34535
- // task di uno step che stiamo lasciando.
34536
- this.procedi();
34537
- }
34538
- else {
34600
+ if (!this.tasks_all_done)
34539
34601
  this.notify_task_closed(task.uiid);
34540
- }
34541
34602
  });
34542
34603
  });
34543
34604
  return true;
@@ -35559,6 +35620,8 @@ class FHWorkflowTasksPanel {
35559
35620
  locked_label = 'Si sblocca al completamento di';
35560
35621
  reopen_confirm = 'Vuoi riaprire questa attività?';
35561
35622
  note_label = 'Nota di chiusura';
35623
+ last_task_title = 'Ultima attività dello step';
35624
+ last_task_confirm = "Questa è l'ultima attività obbligatoria dello step: concludendola la pratica avanzerà. Vuoi procedere?";
35562
35625
  // Valori pre-calcolati: MAI getter dinamici nel template (un getter che costruisce
35563
35626
  // array darebbe a *ngFor un riferimento nuovo a ogni change detection).
35564
35627
  tasks = [];
@@ -35644,6 +35707,29 @@ class FHWorkflowTasksPanel {
35644
35707
  this.toastr.error(errs.join(' - '), t.title);
35645
35708
  return;
35646
35709
  }
35710
+ // Ultima attivita' obbligatoria rimasta aperta: chiuderla fa avanzare la pratica,
35711
+ // e l'avanzamento non e' annullabile. Chiediamo conferma PRIMA di chiudere: se
35712
+ // l'utente dice no, il task resta aperto e non succede nulla.
35713
+ if (this.isLastRequiredOpen(t)) {
35714
+ const ref = this.dialog.open(FHWinConfirmComponent, {
35715
+ disableClose: true,
35716
+ data: { title_dialog: this.last_task_title, msg_dialog: this.last_task_confirm },
35717
+ });
35718
+ ref.afterClosed().subscribe((ok) => {
35719
+ if (ok)
35720
+ this.doClose(t);
35721
+ });
35722
+ return;
35723
+ }
35724
+ this.doClose(t);
35725
+ }
35726
+ /** L'unico task obbligatorio ancora aperto e' proprio questo? */
35727
+ isLastRequiredOpen(t) {
35728
+ if (t.required !== 1)
35729
+ return false;
35730
+ return this.tasks.every((x) => x.required !== 1 || x.stato === 1 || x.uiid === t.uiid);
35731
+ }
35732
+ doClose(t) {
35647
35733
  if (t.note_required === 1) {
35648
35734
  const ref = this.dialog.open(FHWinAskBigTextComponent, {
35649
35735
  width: '600px',
@@ -35670,7 +35756,7 @@ class FHWorkflowTasksPanel {
35670
35756
  });
35671
35757
  }
35672
35758
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHWorkflowTasksPanel, deps: [{ token: i1$2.MatDialog }, { token: i3$1.ToastrService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
35673
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label" }, ngImport: i0, template: `
35759
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label", last_task_title: "last_task_title", last_task_confirm: "last_task_confirm" }, ngImport: i0, template: `
35674
35760
  <div class="fh-tasks" *ngIf="dt_agg && dt_agg.step_mode === 'T'">
35675
35761
  <div class="fh-tasks-head">
35676
35762
  <span class="material-symbols-outlined">checklist</span>
@@ -35946,6 +36032,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
35946
36032
  type: Input
35947
36033
  }], note_label: [{
35948
36034
  type: Input
36035
+ }], last_task_title: [{
36036
+ type: Input
36037
+ }], last_task_confirm: [{
36038
+ type: Input
35949
36039
  }] } });
35950
36040
 
35951
36041
  class AuthHttpRequestInterceptor {