@fluxhub/fluxhub-lib 19.0.220 → 19.0.222
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.
|
@@ -32289,6 +32289,22 @@ class FHWorkflowForm {
|
|
|
32289
32289
|
step_tasks = [];
|
|
32290
32290
|
tasks_all_done = false;
|
|
32291
32291
|
b_tasks_loading = false;
|
|
32292
|
+
/**
|
|
32293
|
+
* Avanzamento innescato dalla chiusura dell'ultimo task, non da un click su Procedi.
|
|
32294
|
+
*
|
|
32295
|
+
* L'utente ha gia' confermato nel pannello delle attivita' ("questa e' l'ultima
|
|
32296
|
+
* attivita' obbligatoria: vuoi procedere?"), quindi il dialog "Conferma Avanzamento"
|
|
32297
|
+
* del motore sarebbe una seconda domanda sulla stessa cosa: lo saltiamo, come se
|
|
32298
|
+
* l'utente avesse premuto OK. Consumato (rimesso a false) al primo uso.
|
|
32299
|
+
*/
|
|
32300
|
+
auto_advance = false;
|
|
32301
|
+
/**
|
|
32302
|
+
* L'utente ha appena chiuso un task dal pannello (dove ha gia' confermato). Distingue
|
|
32303
|
+
* l'avanzamento "appena confermato" da quello di RECUPERO che scatta riaprendo un
|
|
32304
|
+
* documento rimasto fermo con tutti i task chiusi: li' nessuno ha confermato nulla, e
|
|
32305
|
+
* il dialog del motore va mostrato.
|
|
32306
|
+
*/
|
|
32307
|
+
advance_confirmed = false;
|
|
32292
32308
|
/**
|
|
32293
32309
|
* Validazione applicativa alla chiusura di un task.
|
|
32294
32310
|
* La libreria non conosce i campi della pratica: il componente concreto fa
|
|
@@ -32577,6 +32593,14 @@ class FHWorkflowForm {
|
|
|
32577
32593
|
}
|
|
32578
32594
|
}
|
|
32579
32595
|
this.clevel = this.check_n_levels(this.clevel);
|
|
32596
|
+
UtilityService.dlog('[WKF] doApprova(): clevel', {
|
|
32597
|
+
clevel: this.clevel,
|
|
32598
|
+
stato: this.m_obj?.stato,
|
|
32599
|
+
livs_dello_step: (this.livs || []).filter((l) => Number(l.step) === Number(this.m_obj?.stato)),
|
|
32600
|
+
});
|
|
32601
|
+
if (this.clevel == null) {
|
|
32602
|
+
UtilityService.dlog('[WKF] doApprova(): STOP, clevel NULL: nessun livello dello step corrente combacia con l utente');
|
|
32603
|
+
}
|
|
32580
32604
|
this.calcolanextandjump();
|
|
32581
32605
|
}
|
|
32582
32606
|
wkf_rule_before(transazioni, step, context, oper) {
|
|
@@ -32594,10 +32618,17 @@ class FHWorkflowForm {
|
|
|
32594
32618
|
}
|
|
32595
32619
|
p.values = [this.id_applicativo, this.clevel.step];
|
|
32596
32620
|
p.types = ['string', 'int'];
|
|
32621
|
+
UtilityService.dlog('[WKF] calcolanextandjump()', {
|
|
32622
|
+
sql: p.sql,
|
|
32623
|
+
step: this.clevel?.step,
|
|
32624
|
+
oper: this.oper,
|
|
32625
|
+
b_respingi_button: this.b_respingi_button,
|
|
32626
|
+
});
|
|
32597
32627
|
this.m_dataService.doQuery(p).subscribe((data) => {
|
|
32598
32628
|
if (data != null)
|
|
32599
32629
|
if (data.result_msg == 'OK') {
|
|
32600
32630
|
let transazioni = data.result_data;
|
|
32631
|
+
UtilityService.dlog('[WKF] transizioni trovate:', transazioni.length, transazioni.map((t) => t.step_d + ' ' + t.description));
|
|
32601
32632
|
transazioni = this.wkf_rule_before(transazioni, this.clevel.step, this.clevel.context, this.oper);
|
|
32602
32633
|
if (transazioni.length == 0) {
|
|
32603
32634
|
this.alert('Nessuna transizione definita dallo step: ' + this.clevel.step, 1);
|
|
@@ -32820,6 +32851,14 @@ class FHWorkflowForm {
|
|
|
32820
32851
|
sp = sp + ';';
|
|
32821
32852
|
sp = sp + arrAutori[i].nc;
|
|
32822
32853
|
}
|
|
32854
|
+
// Avanzamento automatico: l'utente ha gia' confermato chiudendo l'ultimo task.
|
|
32855
|
+
// Facciamo cio' che farebbe l'OK del dialog, senza mostrarlo.
|
|
32856
|
+
if (this.auto_advance) {
|
|
32857
|
+
this.auto_advance = false;
|
|
32858
|
+
UtilityService.dlog('[TASK] auto_advance: salto Conferma Avanzamento, exec_wkf()');
|
|
32859
|
+
this.exec_wkf(o, this.nlevel, arrAutori, '', this.transizione_info.create_ver, arr_aut_all);
|
|
32860
|
+
return;
|
|
32861
|
+
}
|
|
32823
32862
|
let dialogRef = this.m_dialog.open(win_conferma_v2, {
|
|
32824
32863
|
disableClose: true,
|
|
32825
32864
|
width: '500px',
|
|
@@ -32864,6 +32903,17 @@ class FHWorkflowForm {
|
|
|
32864
32903
|
this.app_s.getState().wkf_doc_info.utenti = sp;
|
|
32865
32904
|
this.app_s.getState().wkf_doc_info.comm_notrequired = this.transizione_info.comments_opt;
|
|
32866
32905
|
|
|
32906
|
+
// Vedi sopra: con l'avanzamento automatico l'utente ha gia' confermato.
|
|
32907
|
+
if (this.auto_advance) {
|
|
32908
|
+
this.auto_advance = false;
|
|
32909
|
+
this.app_s.temp_var4 = '';
|
|
32910
|
+
UtilityService.dlog('[TASK] auto_advance: salto Conferma Avanzamento, OKCOM()');
|
|
32911
|
+
this.arrUsersSelected = arrAutori;
|
|
32912
|
+
this.nota = '';
|
|
32913
|
+
this.OKCOM();
|
|
32914
|
+
return;
|
|
32915
|
+
}
|
|
32916
|
+
|
|
32867
32917
|
let dialogRef = this.m_dialog.open(win_conferma_v2, {
|
|
32868
32918
|
disableClose: true,
|
|
32869
32919
|
width: '500px',
|
|
@@ -33372,17 +33422,23 @@ class FHWorkflowForm {
|
|
|
33372
33422
|
this.salva();
|
|
33373
33423
|
}
|
|
33374
33424
|
procedi() {
|
|
33375
|
-
if (!this.can_save())
|
|
33425
|
+
if (!this.can_save()) {
|
|
33426
|
+
UtilityService.dlog('[WKF] procedi(): STOP, can_save()=false');
|
|
33376
33427
|
return;
|
|
33377
|
-
|
|
33428
|
+
}
|
|
33429
|
+
if (this.b_saving) {
|
|
33430
|
+
UtilityService.dlog('[WKF] procedi(): STOP, b_saving=true');
|
|
33378
33431
|
return;
|
|
33432
|
+
}
|
|
33379
33433
|
this.oper = 'procedi';
|
|
33380
33434
|
this.btnprocedi = true;
|
|
33381
33435
|
this.update_status(false, false, null, null, 9);
|
|
33382
33436
|
if (!this.ck_field('proceed')) {
|
|
33437
|
+
UtilityService.dlog("[WKF] procedi(): STOP, ck_field('proceed')=false");
|
|
33383
33438
|
this.update_status(true, this.respingi_enabled, null, null, 10);
|
|
33384
33439
|
return;
|
|
33385
33440
|
}
|
|
33441
|
+
UtilityService.dlog('[WKF] procedi(): ok, salva()');
|
|
33386
33442
|
this.salva();
|
|
33387
33443
|
}
|
|
33388
33444
|
open_wkf(em, inser_c = false, edit_c = true, show_wkf = true) {
|
|
@@ -33592,6 +33648,11 @@ class FHWorkflowForm {
|
|
|
33592
33648
|
}
|
|
33593
33649
|
ok_insert_aggiuntivi() {
|
|
33594
33650
|
this.b_saving = false;
|
|
33651
|
+
UtilityService.dlog('[WKF] ok_insert_aggiuntivi()', {
|
|
33652
|
+
btnprocedi: this.btnprocedi,
|
|
33653
|
+
b_edit: this.b_edit,
|
|
33654
|
+
prossimo: this.btnprocedi ? 'load_document() -> doApprova()' : 'solo salvataggio',
|
|
33655
|
+
});
|
|
33595
33656
|
if (!this.btnprocedi) {
|
|
33596
33657
|
this.alert('DOCUMENTO SALVATO', 0);
|
|
33597
33658
|
this.after_save();
|
|
@@ -34419,13 +34480,40 @@ class FHWorkflowForm {
|
|
|
34419
34480
|
// gira anche all'APERTURA del documento: se l'utente aveva chiuso l'ultimo task e
|
|
34420
34481
|
// poi il dialog di scelta transizione con la X, il documento restava fermo con
|
|
34421
34482
|
// tutti i task chiusi e senza pulsante Procedi -- bloccato. Riaprendolo, avanza.
|
|
34483
|
+
UtilityService.dlog('[TASK] load_step_tasks', {
|
|
34484
|
+
step_mode: this.step_mode,
|
|
34485
|
+
stato: this.m_obj?.stato,
|
|
34486
|
+
tasks: this.step_tasks.length,
|
|
34487
|
+
tasks_all_done: this.tasks_all_done,
|
|
34488
|
+
b_edit: this.b_edit,
|
|
34489
|
+
b_saving: this.b_saving,
|
|
34490
|
+
btnprocedi: this.btnprocedi,
|
|
34491
|
+
});
|
|
34492
|
+
// NB: non si guarda `btnprocedi`. Quel flag dice "avanzamento gia' tentato" e
|
|
34493
|
+
// viene azzerato solo da evt_salv(): se un tentativo precedente non e' arrivato
|
|
34494
|
+
// in fondo (es. dialog di scelta transizione chiuso con la X) resta true per
|
|
34495
|
+
// sempre e bloccherebbe ogni tentativo successivo -- cioe' proprio il caso che
|
|
34496
|
+
// questo avanzamento automatico deve sbloccare. Il vero "in volo" e' b_saving.
|
|
34497
|
+
// Consumato comunque: se il task chiuso non era l'ultimo, non deve restare acceso
|
|
34498
|
+
// per un avanzamento futuro (magari il recupero all'apertura).
|
|
34499
|
+
const confermato = this.advance_confirmed;
|
|
34500
|
+
this.advance_confirmed = false;
|
|
34422
34501
|
if (this.step_mode == 'T' &&
|
|
34423
34502
|
this.tasks_all_done &&
|
|
34424
34503
|
this.b_edit &&
|
|
34425
|
-
!this.b_saving
|
|
34426
|
-
|
|
34504
|
+
!this.b_saving) {
|
|
34505
|
+
UtilityService.dlog('[TASK] -> avanzamento automatico', {
|
|
34506
|
+
gia_confermato_dall_utente: confermato,
|
|
34507
|
+
});
|
|
34508
|
+
this.auto_advance = confermato;
|
|
34427
34509
|
this.procedi();
|
|
34428
34510
|
}
|
|
34511
|
+
else if (this.step_mode == 'T' && this.tasks_all_done) {
|
|
34512
|
+
UtilityService.dlog('[TASK] tutti i task chiusi ma NON avanzo', {
|
|
34513
|
+
b_edit: this.b_edit,
|
|
34514
|
+
b_saving: this.b_saving,
|
|
34515
|
+
});
|
|
34516
|
+
}
|
|
34429
34517
|
},
|
|
34430
34518
|
error: () => {
|
|
34431
34519
|
this.b_tasks_loading = false;
|
|
@@ -34517,13 +34605,26 @@ class FHWorkflowForm {
|
|
|
34517
34605
|
* `tasks_all_done=true` e avanza il primo autore che apre la pratica.
|
|
34518
34606
|
*/
|
|
34519
34607
|
close_task(task, nota) {
|
|
34608
|
+
UtilityService.dlog('[TASK] close_task', {
|
|
34609
|
+
title: task?.title,
|
|
34610
|
+
stato: task?.stato,
|
|
34611
|
+
mine: task?.mine,
|
|
34612
|
+
locked: task?.locked,
|
|
34613
|
+
});
|
|
34520
34614
|
if (task == null || task.stato == 1 || task.locked)
|
|
34521
34615
|
return false;
|
|
34522
|
-
if (Number(task.mine || 0) != 1)
|
|
34616
|
+
if (Number(task.mine || 0) != 1) {
|
|
34617
|
+
UtilityService.dlog('[TASK] close_task: STOP, task non preso in carico');
|
|
34523
34618
|
return false; // serve la presa in carico
|
|
34619
|
+
}
|
|
34524
34620
|
const errs = this.ck_task(task.check_key || '');
|
|
34525
|
-
if (errs && errs.length > 0)
|
|
34621
|
+
if (errs && errs.length > 0) {
|
|
34622
|
+
UtilityService.dlog('[TASK] close_task: STOP, ck_task', errs);
|
|
34526
34623
|
return false;
|
|
34624
|
+
}
|
|
34625
|
+
// La chiusura parte dal pannello, dove l'utente ha gia' confermato se era l'ultima
|
|
34626
|
+
// attivita' obbligatoria. Se ne segue un avanzamento, non gli si richiede conferma.
|
|
34627
|
+
this.advance_confirmed = true;
|
|
34527
34628
|
const p = new QParam();
|
|
34528
34629
|
p.sql = 'CLOSE_WKF_DOC_TASK';
|
|
34529
34630
|
p.values = [
|
|
@@ -34611,6 +34712,10 @@ class FHWorkflowForm {
|
|
|
34611
34712
|
s_uto = '';
|
|
34612
34713
|
b_respingi_button = false;
|
|
34613
34714
|
return_edit() {
|
|
34715
|
+
// Il documento e' stato caricato in modifica: nessun avanzamento e' in volo.
|
|
34716
|
+
// `btnprocedi` viene altrimenti azzerato solo da evt_salv(), quindi un procedi()
|
|
34717
|
+
// interrotto a meta' (dialog chiuso con la X) lo lascerebbe true per sempre.
|
|
34718
|
+
this.btnprocedi = false;
|
|
34614
34719
|
this.respingi_enabled = false;
|
|
34615
34720
|
this.b_respingi_button = false;
|
|
34616
34721
|
if ((this.app_info.proceed_mode || 'P') == 'R')
|