$error = true; $configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; include_once($configPath); $id_modulo = "partecipanti"; if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_POST["codice_gara"],$id_modulo) && tokenVerify()) { $gara = gara::init($_POST["codice_gara"],$_POST["codice_round"]); if (!empty($gara) && $gara->setLotto($_POST["codice_lotto"])) { if (!$gara->checkLock($id_modulo)) { if (!empty($gara->lotto)) { $elements = jsonToArray("elements.json"); $uploaded = massiveHelper::getDataFromUpload($elements,$_POST["filechunk"]); if (!empty($uploaded)) { $error = false; if (!empty($uploaded["data"])) { $partecipanti = $uploaded["data"]; $cf = []; $raggruppamenti = []; $errors = []; foreach ($partecipanti AS $partecipante) { if (empty($partecipante["codice_fiscale_capogruppo"])) { $cf[] = $partecipante["codice_fiscale"]; } } foreach ($partecipanti AS $key => $partecipante) { if (!empty($partecipante["codice_fiscale_capogruppo"])) { if (in_array($partecipante["codice_fiscale_capogruppo"],$cf) === false) { $errors[] = $partecipante["codice_fiscale_capogruppo"] . " - " . __("Codice fiscale non presente tra i capogruppo"); } else { if (!empty($partecipante["ruolo"])) { $partecipante["codice_fiscale_impresa"] = $partecipante["codice_fiscale"]; $raggruppamenti[$partecipante["codice_fiscale_capogruppo"]][] = $partecipante; unset($partecipanti[$key]); } else { $errors[] = $partecipante["ragione_sociale"] . " - " . __("Ruolo nel raggruppamento non specificato"); } } } } if (empty($errors)) { $pdo->go("DELETE FROM r_partecipanti_gare WHERE codice_round = :round AND codice_lotto = :codice",[":round"=>$gara->round["codice"],":codice"=>$gara->lotto["codice"]]); foreach($partecipanti AS $partecipante) { if (!empty($raggruppamenti[$partecipante["codice_fiscale"]])) { $partecipante["raggruppamento"] = $raggruppamenti[$partecipante["codice_fiscale"]]; } if (!$gara->savePartecipante($partecipante)) { $errors[] = __("Errore nel salvataggio del partecipante") . ": " . $partecipante["ragione_sociale"]; } } } if (empty($errors)) { ?> } else { alertManager::printAlertBox(__("impossibile continuare")); ?>
| = __("errore") ?> |
| = $errore ?> |