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.
77 righe
2.4 KiB
77 righe
2.4 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; |
|
include_once($configPath); |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) { |
|
$elements = jsonToArray("elements.json"); |
|
$uploaded = massiveHelper::getDataFromUpload($elements,$_POST["filechunk"]); |
|
if (!empty($uploaded)) { |
|
$error = false; |
|
if (!empty($uploaded["data"])) { |
|
$liquidazioni = $uploaded["data"]; |
|
$errors = []; |
|
$select = $pdo->prepare("SELECT b_simog_lotti.codice, b_simog_lotti.190liquidazioni FROM b_simog_lotti JOIN b_simog ON b_simog_lotti.codice_simog = b_simog.codice WHERE b_simog_lotti.cig = :cig AND b_simog.codice_gestore = :gestore "); |
|
$updateSQL = "UPDATE b_simog_lotti SET 190liquidazioni = :liquidato WHERE codice = :codice "; |
|
$update = $pdo->prepare($updateSQL); |
|
$select->bindValue(":gestore",$_SESSION["ente"]->codice); |
|
foreach ($liquidazioni AS $liquidazione) { |
|
$select->bindValue(":cig",$liquidazione["cig"]); |
|
$select->execute(); |
|
if ($select->rowCount() > 0) { |
|
while($lotto = $select->fetch(PDO::FETCH_ASSOC)) { |
|
$update->bindValue(":codice",$lotto["codice"]); |
|
$update->bindValue(":liquidato",$liquidazione["liquidato"]); |
|
$update->execute(); |
|
if ($update->rowCount() === 0 && $liquidazione["liquidato"] != $lotto["190liquidazioni"]) { |
|
$errors[] = "CIG: " . $liquidazione["cig"] . " - " . __("Aggiornamento fallito"); |
|
} |
|
} |
|
} else { |
|
$errors[] = "CIG: " . $liquidazione["cig"] . " - " . __("Non trovato"); |
|
} |
|
} |
|
if (empty($errors)) { |
|
?> |
|
<script> |
|
swal({title:js_dict["success-msg"],type:"success"}).then(function(){ |
|
window.location.reload(); |
|
}); |
|
</script> |
|
<? |
|
} else { |
|
?> |
|
<div class="table-responsive"> |
|
<table class="table table-striped"> |
|
<thead> |
|
<tr> |
|
<td><?= __("errore") ?></td> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
<? |
|
foreach($errors AS $errore) { |
|
?> |
|
<tr> |
|
<td><strong><?= $errore ?></strong></td> |
|
</tr> |
|
<? |
|
} |
|
?> |
|
</tbody> |
|
</table> |
|
</div> |
|
<? |
|
} |
|
} else { |
|
alertManager::printAlertBox(__("impossibile continuare")); |
|
if (!empty($uploaded["errors"])) { |
|
massiveHelper::printErrors($uploaded["errors"]); |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|