$error = true; $configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; include_once($configPath); if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && tokenVerify()) { $elements = jsonToArray("lotti.json"); $uploaded = massiveHelper::getDataFromUpload($elements,$_POST["filechunk"]); if (!empty($uploaded)) { $error = false; if (!empty($uploaded["data"])) { $error = false; $anni = []; $foundCig = []; $errors = []; foreach($uploaded["data"] AS $lotto) { if (!empty(trim($lotto["cig"])) && str_replace("0","",$lotto) != "") { if (in_array($lotto["cig"],$foundCig) === false) { if (!is_numeric($lotto["annoRiferimento"]) || strlen($lotto["annoRiferimento"]) != 4) $errors[] = $lotto["cig"] . " - " . __("Anno di riferimento non valido"); if (strlen($lotto["cig"]) != 10) $errors[] = $lotto["cig"] . " - " . __("Non valido"); if (!empty($lotto["inizioContratto"])) { $test_arr = explode('/', $lotto["inizioContratto"]); if (count($test_arr) == 3) { if (!checkdate($test_arr[1], $test_arr[0], $test_arr[2])) { $errors[] = $lotto["cig"] . " - " . $lotto["inizioContratto"] . " - " . __("Data inizio contratto non valida"); } } else { $errors[] = $lotto["cig"] . " - " . $lotto["inizioContratto"] . " - " . __("Data inizio contratto non valida"); } } if (!empty($lotto["fineContratto"])) { $test_arr = explode('/', $lotto["fineContratto"]); if (count($test_arr) == 3) { if (!checkdate($test_arr[1], $test_arr[0], $test_arr[2])) { $errors[] = $lotto["cig"] . " - " . $lotto["fineContratto"] . " - " . __("Data fine contratto non valida"); } } else { $errors[] = $lotto["cig"] . " - " . $lotto["fineContratto"] . " - " . __("Data fine contratto non valida"); } } if (!isset($anni[$lotto["annoRiferimento"]])) $anni[$lotto["annoRiferimento"]] = []; $anni[$lotto["annoRiferimento"]][] = $lotto; $foundCig[] = $lotto["cig"]; } else { $errors[] = $lotto["cig"] . " - " . __("Duplicato"); } } } if (empty($errors)) { $_SESSION["importAnac"][$_POST["operationID"]]["lotti"] = $anni; alertManager::printSuccessBox(__("Caricamento effettuato con successo")) ?> } else { alertManager::printAlertBox(__("Impossibile continuare")); ?>
| = __("errore") ?> |
|---|
| = $errore ?> |