Stable without período in autidoría

This commit is contained in:
2023-08-11 15:41:57 +00:00
parent ec382e989a
commit 3ae35c84f9
14 changed files with 1145 additions and 934 deletions

View File

@@ -1,11 +1,13 @@
<?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$ruta = "../../";
require_once "$ruta/include/bd_pdo.php";
header('Content-Type: application/json');
// json data from service\periodos.v1.php (input)
$data = json_decode(file_get_contents('php://input'), true);
// check if the input is empty
if (is_response_empty($data)) {
@@ -36,14 +38,14 @@ $fin = strtotime($data['fin']);
try {
$result = $db->insert('periodo', [
'id_reference' => $data['IdPeriodo'],
'id_periodo_sgu' => $data['IdPeriodo'],
'periodo_nombre' => "{$data['NombreNivel']}: {$formatter->format($inicio)} - {$formatter->format($fin)} " . date('Y', $inicio),
'nivel_id' => $data['IdNivel'],
'periodo_fecha_inicio' => $data['inicio'],
'periodo_fecha_fin' => $data['fin'],
'estado_id' => 4,
'periodo_clave' => $data['NombrePeriodo']
], ['id_reference']);
], ['id_periodo_sgu']);
} catch (PDOException $th) {
echo json_encode([
'success' => false,

View File

@@ -1,4 +1,8 @@
<?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$ruta = "../";
require_once '../include/bd_pdo.php';
$curl = curl_init();
@@ -8,7 +12,7 @@ curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => [
"token: f65f921264e4ab135472adb5a946212dd4b995d929294afec31eef192b8de8d6a076648906f70012c9803e5918d0fc99499d7d1fb7c998cc06c7a10eef61f66a",
"token: 5b892845736a29b5846073be0a11f0fc87113648aae1e8279830c4bc05f585eba13e0b1b4f0c42a12d694bb8091d23f7564b15f3141768dfa6ed2aa709864986",
"username: SGU_APSA_AUD_ASIST"
],
]);
@@ -24,7 +28,7 @@ if ($err)
$data = json_decode($response, true);
$in_db = array_map(function ($item) use ($db) {
$item['in_db'] = $db->where('id_reference', $item['IdPeriodo'])->has('periodo');
$item['in_db'] = $db->where('id_periodo_sgu', $item['IdPeriodo'])->has('periodo');
return $item;
}, $data);

View File

@@ -1,4 +1,8 @@
<?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$ruta = "../";
require_once '../include/bd_pdo.php';
global $db;
@@ -10,7 +14,7 @@ curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => [
"token: f65f921264e4ab135472adb5a946212dd4b995d929294afec31eef192b8de8d6a076648906f70012c9803e5918d0fc99499d7d1fb7c998cc06c7a10eef61f66a",
"token: 5b892845736a29b5846073be0a11f0fc87113648aae1e8279830c4bc05f585eba13e0b1b4f0c42a12d694bb8091d23f7564b15f3141768dfa6ed2aa709864986",
"username: SGU_APSA_AUD_ASIST"
],
]);
@@ -28,7 +32,7 @@ $json = json_decode($response, true);
$selectedData = array_map(function ($item) use ($db) {
$item['in_db'] = $db->where('carrera_nombre', $item['NombreCarrera'], 'ILIKE')->has('carrera');
$item['linked'] = $db->where('id_referencia', $item['ClaveCarrera'], 'ILIKE')->has('carrera');
$item['linked'] = $db->where('clave_carrera', $item['ClaveCarrera'], 'ILIKE')->has('carrera');
return $item;
}, $json);