permission($radice,$_POST["codice_simog"],$id_modulo) && tokenVerify()) { $anac = anac::init($_POST["codice_simog"]); if (!empty($anac)) { if (!$anac->checkLock($id_modulo)) { $lotto = $anac->getLotti($_POST["codice_lotto"])[0] ?? false; if (!empty($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_simog WHERE codice_lotto = :codice",[":codice"=>$lotto["codice"]]); foreach($partecipanti AS $partecipante) { if (!empty($raggruppamenti[$partecipante["codice_fiscale"]])) { $partecipante["raggruppamento"] = $raggruppamenti[$partecipante["codice_fiscale"]]; } if (!$anac->savePartecipante($partecipante,$lotto["codice"])) { $errors[] = __("Errore nel salvataggio del partecipante") . ": " . $partecipante["ragione_sociale"]; } } } if (empty($errors)) { ?>