oe) && $_SESSION['ente']->hasModulo('contratti.documentale')) { $return = array(); $return["draw"] = (int)$_GET["draw"]; $return["recordsTotal"] = (int)0; $return["recordsFiltered"] = (int)0; $contratto = publicStipula::init($_GET['codice_contratto']); $managerRichieste = RichiestaDocumentale::init($contratto); if(!empty($contratto) && !empty($managerRichieste)){ $filters = [ 'codice_oe' => $_SESSION["utente"]->oe['codice'], 'codice_contratto' => $contratto->info['codice'], 'bozza' => 'N' ]; switch($_GET["order"][0]["column"]) { case "0": null ; break; case "1": null; break; case "2": null; break; case "3": null; break; case "4": $orderKey = "timestamp_creazione"; break; } if ($_GET["order"][0]["dir"] == "desc") { $order[$orderKey] = "DESC"; } else { $order[$orderKey] = "ASC"; } $richieste = $managerRichieste->getRichieste($filters, $order); $return["recordsTotal"] = (int)0; $return["recordsFiltered"] = (int)0; if (!empty($richieste)) { $return["recordsTotal"] = (int)count($richieste); $richieste = publicRispostaDocumentale::getBadge($contratto->info['codice'], $richieste, "oe"); $countRecordFiltered = 0; foreach ($richieste as $richiesta) { $documentale = ContrattoDocumentale::getInfo($richiesta['codice_classe_documentale']); $row = array(); $row[] = ""; if( (!empty($richiesta['statoLabel']) && !empty(array_intersect($richiesta['statoLabel'], array('20', '25', '30'))) ) || (!empty($richiesta['statoBadges']) && ($richiesta['statoBadges'][20]['contatori'] > 0 || $richiesta['statoBadges'][25]['contatori'] > 0 || $richiesta['statoBadges'][30]['contatori'] > 0)) ){ $row[] = ""; }else{ $row[] = ""; } $row[] = $documentale->info['titolo'] ?? null; $row[] = $richiesta['bloccante'] == 'S' ? __('Si') : __('No') ; $row[] = mysql2date($richiesta["timestamp_creazione"]); if (!empty($richiesta['statoLabel'])) { $row[] = "". __($richiesta['statoLabel']['titolo']) . ""; }elseif(!empty($richiesta['statoBadges'])){ ob_start(); foreach ($richiesta['statoBadges'] as $stat => $value) { ?> '> ". __('Errore visualizzazione Stati').""; } $row[] = ""; if(!empty($_GET['stato'])){ if (!empty($richiesta['statoLabel']) && $richiesta['statoLabel']['key'] == $_GET['stato'] ) { $countRecordFiltered++; $return["data"][] = $row; }elseif(!empty($richiesta['statoBadges']) && $richiesta['statoBadges'][$_GET['stato']]['contatori'] > 0){ $countRecordFiltered++; $return["data"][] = $row; } }else{ $countRecordFiltered++; $return["data"][] = $row; } } $return["recordsFiltered"] = (int)$countRecordFiltered; } else { $return["data"] = array(); } }else{ $return["data"] = array(); } echo json_encode($return); } ?>