$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; include_once($configPath); $error = true; if (!empty($_GET) && !empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"]) && $_SESSION["utente"]->permission("simog") && tokenVerify($_GET["token"]) && $_SESSION["utente"]->unlockSupporto() && !empty($_GET["method"])) { $anac = anac::init($_GET["codice"]); $codice_lotto = $_GET["codice_lotto"] ?? ""; $errors = []; if (!empty($anac)) { $error = false; $method = $_GET["method"]; if (empty($anac->info["id_stazione_appaltante"])) { if (empty($_GET["fromSelectCollaborazione"])) { unset($_SESSION["simog"]["collaborazione"]); } } else { if (!empty($_SESSION["simog"])) { foreach($_SESSION["simog"]["collaborazioni"] AS $collaborazione) { if (!empty($collaborazione["ufficio_id"])) { if ($collaborazione["ufficio_id"] == $anac->info["id_stazione_appaltante"]) { $_SESSION["simog"]["collaborazione"] = $collaborazione; } } } } } if (empty($_SESSION["simog"]["collaborazione"])) { ?> } else { $data = $anac->getRequestArray($method,$codice_lotto); if (!empty($data)) { include($beRoot."/anac/ws/simog.class.php"); $simog = new simog(); $simog->codice_simog = $anac->info["codice"]; $simog->codice_lotto = $codice_lotto; $simog->index = $_SESSION["simog"]["collaborazione"]["index"]; $simog->ticket = $_SESSION["simog"]["ticket"]; if ($data["method"] != "loaderAppalto") { $return = $simog->sendData($data["method"],$data["data"]); } else { $return = []; if (!empty($data["data"]["trasferimentoDati"]["SchedeEliminate"])) { $eliminate = $data["data"]; unset($eliminate["trasferimentoDati"]["Schede"]); $return[] = $simog->sendData($data["method"],$eliminate); unset($data["data"]["trasferimentoDati"]["SchedeEliminate"]); } $schede = $data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"] ?? []; if (!empty($schede)) { if (count($schede) > 1) { $tipologie = $anac->listSchede($codice_lotto); $cui = $data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"]; unset($data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]); foreach($schede AS $idScheda => $scheda) { if ($idScheda != "CUI") { $sendData = $data; $sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"] = $cui; $sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda] = $scheda; $multiple = []; $multiple["DatiRitardi"] = $tipologie["ritardi"]["XMLelement"]; $multiple["DatiSubappalti"] = $tipologie["subappalti"]["XMLelement"]; $multiple["DatiAvanzamenti"] = $tipologie["avanzamenti"]["XMLelement"]; $multiple["DatiSospensioni"] = $tipologie["sospensione"]["XMLelement"]; $multiple["DatiVarianti"] = $tipologie["varianti"]["XMLelement"]; if (empty($multiple[$idScheda])) { $return[] = $simog->sendData($data["method"],$sendData["data"]); } else { $all = $sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda][$multiple[$idScheda]]; foreach($all AS $element) { $sendData["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"][$idScheda][$multiple[$idScheda]] = $element; $return[] = $simog->sendData($data["method"],$sendData["data"]); } } } } } else { unset($data["data"]["trasferimentoDati"]["Schede"]["SchedaCompleta"]["CUI"]); $return[] = $simog->sendData($data["method"],$data["data"]); } } } if (!empty($return)) { $anac->manageResponse($return,$_GET["method"],$codice_lotto); } else { $errors = array_merge($errors,$simog->errors); } } else { $errors[] = "Impossibile costruire la richiesta"; } } } if (!empty($errors)) { ob_clean(); foreach($errors as $msg) { ?>