Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
137 righe
5.1 KiB
137 righe
5.1 KiB
<?php |
|
|
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
if($_SESSION["utente"]->permission($radice, $_GET["fascicolo"])) { |
|
|
|
$npa = NuovaPiattaformaAppalti::init($_GET["fascicolo"]); |
|
|
|
$return = [ |
|
"draw" => (int) $_GET["draw"], |
|
"recordsTotal" => (int) 0, |
|
"recordsFiltered" => (int) 0 |
|
]; |
|
|
|
$count = "SELECT COUNT(b_npa_lotti.codice)"; |
|
$select = "SELECT b_npa_lotti.*"; |
|
$from = "FROM b_npa_lotti"; |
|
$where = "WHERE codice_npa = :codice_npa"; |
|
$bind = [":codice_npa" => $npa->fascicolo["codice"]]; |
|
|
|
$result = $pdo->go("{$count} {$from} {$where}", $bind); |
|
if($result->rowCount() > 0) { |
|
|
|
$join = null; |
|
$return["recordsTotal"] = $result->fetch(PDO::FETCH_COLUMN, 0); |
|
if(! empty($_GET["cerca"])) { |
|
$bind[":ricerca"] = "%{$_GET["cerca"]}%"; |
|
$clauses[] = "b_npa_lotti.cig LIKE :ricerca"; |
|
} |
|
|
|
if(! empty($npa->fascicolo["modulo_riferimento"]) && ! empty($npa->fascicolo["id_riferimento"])) { |
|
switch($npa->fascicolo["modulo_riferimento"]) { |
|
case 'gare': |
|
$select = "{$select}, b_gare_lotti.numero, b_gare_lotti.oggetto"; |
|
$join = "JOIN b_gare_lotti ON b_gare_lotti.codice = b_npa_lotti.lotto_riferimento"; |
|
if(! empty($_GET["cerca"])) { |
|
$clauses[] = "b_gare_lotti.oggetto LIKE :ricerca"; |
|
$clauses[] = "b_gare_lotti.descrizione LIKE :ricerca"; |
|
$clauses[] = "b_gare_lotti.numero LIKE :ricerca"; |
|
} |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
|
|
if(!empty($clauses)) { |
|
$clauses = "(" . implode(") OR (", $clauses) . ")"; |
|
$where = "{$where} AND ($clauses)"; |
|
} |
|
|
|
$dir = "ASC"; |
|
if(! empty($_GET["order"]) && $_GET["order"][0]["dir"] == "desc") { |
|
$dir = "DESC"; |
|
} |
|
|
|
$order = "ORDER BY b_npa_lotti.codice {$dir}"; |
|
switch($_GET["order"][0]["column"]) { |
|
case "2": $order = "ORDER BY b_simog_lotti.cig {$dir}"; break; |
|
} |
|
|
|
$result = $pdo->go("{$select} {$from} {$join} {$where} {$order}", $bind); |
|
if($result->rowCount() > 0) { |
|
|
|
// Verifica se l'utente ha un ruolo (deleghe NPA) per accedere al fascicolo dell'operatore economico |
|
$fvoe = false; |
|
if(! empty($_SESSION["utente"]) && $_SESSION["utente"]->authenticationLevel >= 2) { |
|
|
|
$utente = $_SESSION["utente"]->getInfo()["cf"]; |
|
$cfs = $npa->getUserFromRole(DelegheRoles::ANY, RoleSyncBehaviour::NEVER_SYNC); |
|
if(in_array($utente, $cfs)) { |
|
|
|
$fvoe = true; |
|
|
|
} |
|
|
|
} |
|
|
|
$return["recordsFiltered"] = $result->rowCount(); |
|
while($lot = $result->fetch(PDO::FETCH_ASSOC)) { |
|
|
|
$cig = $lot["cig"]; |
|
$status = "primary"; |
|
$linkBDNCP = ""; |
|
if(empty($cig)) { |
|
$cig = __("CIG MANCANTE"); |
|
$status = "warning"; |
|
} else { |
|
$linkBDNCP = NuovaPiattaformaAppalti::getBDNCPLink($cig); |
|
} |
|
|
|
// $id = "LOT-" . str_pad($lot["numero"], 4, "0", STR_PAD_LEFT); |
|
|
|
$row = []; |
|
$row[0] = "<div class='status_flag bg-{$status}'></div>"; |
|
$row[1] = "<div class='badge badge-{$status} uppercase'><h6 class='m-0 px-2'>{$cig}</h6></div>"; |
|
if (!empty($linkBDNCP)) { |
|
$row[1] .= "<small><a href='{$linkBDNCP}' target='_blank'>Link BDNCP <i class=\"fa fa-external-link-square-alt\"></i></a></small>"; |
|
} |
|
// $row[2] = "<strong>{$id}</strong><br><small>{$lot["descrizione"]}</small>"; |
|
$row[2] = $lot["oggetto"] ?? "Lotto #{$lot["codice"]}"; |
|
ob_start(); |
|
?> |
|
<div class="w-100 text-right"> |
|
<? if($_SESSION["utente"]->permission("fvoe") && $npa->hasLockOnPartecipanti(false, true, $lot["codice"])) : ?> |
|
<? if($fvoe) : ?> |
|
<button class="btn btn-primary btn-sm" onclick="showModalWithURL(`/backend/npa/ajax/fvoe.php?codice=<?= $npa->fascicolo['codice'] ?>&codice_lotto=<?= $lot['codice'] ?>`)"> |
|
<i class="fas fa-archive mr-2"></i> <?= __("FVOE") ?> <i>(BETA)</i> |
|
</button> |
|
<? else : ?> |
|
<button class="btn btn-light btn-sm" onclick="swal({type: 'warning', title: js_dict.attenzione, text: 'Per continuare, accedi con SPID e verifica di avere una delega ANAC di tipo DRP2 o DRP3.'})"> |
|
<i class="fas fa-times-circle mr-2 text-danger"></i><span class="text-danger"><?= __("FVOE") ?> <i>(BETA)</i></span> |
|
</button> |
|
<? endif; ?> |
|
<? endif; ?> |
|
<a href="/backend/npa/lotti/panel.php?codice_lotto=<?= $lot["codice"] ?>&codice_fascicolo=<?= $npa->fascicolo["codice"] ?>" class="btn btn-info btn-sm"> |
|
<span class='fa fa-th mr-2'></span><span class="uppercase"><?= __("PANNELLO") ?></span> |
|
</a> |
|
</div> |
|
<? |
|
$row[3] = ob_get_clean(); |
|
|
|
$return["data"][] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
echo json_encode($return); |
|
die(); |
|
|
|
} |
|
|
|
HTTPStatus(403);
|