$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)) { ?> } else { ?>
| = __("errore") ?> |
| = $errore ?> |