Sfoglia il codice sorgente

Formatos de fechas

alejandro.lara 1 anno fa
parent
commit
515731adf8
2 ha cambiato i file con 25 aggiunte e 15 eliminazioni
  1. 12 6
      action/solicitud_insert.php
  2. 13 9
      action/solicitud_update.php

+ 12 - 6
action/solicitud_insert.php

@@ -67,6 +67,9 @@ $hora = $hora_ini.":".$min_ini.":00";
 
 switch($tipo){
     case 1://Reposición
+        $fecha_nueva = $fecha;
+        $fecha_clase = $fecha_falta;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
@@ -82,27 +85,30 @@ switch($tipo){
             echo intval($dia)." != ".intval($dia_falta);*/
             exit();
         }
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
-        $fecha_clase = date('d/m/Y', strtotime($fecha_falta));
+        
     break;
     case 2://Cambio
+        $fecha_nueva = $fecha_cambio;
+
         $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
         $dia_falta = date('w', strtotime($fecha_cambio));
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_cambio));
     break;
     case 3://Solicitud de espacio
+        $fecha_nueva = $fecha;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
     break;
     case 4://Cambio permanente
+        $fecha_nueva = $fecha_new;
+        $fecha_clase = $fecha_cambio;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
+        $fecha_cambio =  DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
 
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
-        $fecha_clase = date('d/m/Y', strtotime($fecha_cambio));
     break;
 }
 

+ 13 - 9
action/solicitud_update.php

@@ -64,6 +64,9 @@ $hora = $hora_ini.":".$min_ini.":00";
 
 switch($tipo){
     case 1://Reposición
+        $fecha_nueva = $fecha;
+        $fecha_clase = $fecha_falta;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
@@ -79,27 +82,28 @@ switch($tipo){
             echo intval($dia)." != ".intval($dia_falta);*/
             exit();
         }
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
-        $fecha_clase = date('d/m/Y', strtotime($fecha_falta));
+        
     break;
     case 2://Cambio
+        $fecha_nueva = $fecha_cambio;
+
         $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d');
         $dia_falta = date('w', strtotime($fecha_cambio));
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_cambio));
     break;
     case 3://Solicitud de espacio
+        $fecha_nueva = $fecha;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
     break;
     case 4://Cambio permanente
+        $fecha_nueva = $fecha_new;
+        $fecha_clase = $fecha_cambio;
+
         $fecha_new =  DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora;
         $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo;
         $dia_new = date('w', strtotime($fecha_new));
-
-        $fecha_nueva = date('d/m/Y', strtotime($fecha_new));
-        $fecha_clase = date('d/m/Y', strtotime($fecha_cambio));
     break;
 }
 
@@ -164,11 +168,11 @@ switch($tipo){
     break;
     case 4:
         $db_params=[
-            "id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
+            "id"=>$id, ":f_falta"=>$fecha_clase, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof,
             ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula,
             ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo
         ];
-        $query = ":id, NULL, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL";
+        $query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL";
         $asunto = "Solicitud - Cambio permanente";
         $texto = "<p>Se actualizó una solicitud de asignación de salón permanente.</p>";
         $texto .= "<p><b>".mb_strtoupper($materia_rs["materia_nombre"])."</b> del día <b>".$fecha_clase." a las ".$hora_orig." hrs. </b> se propone cambiar para el <b>".$fecha_nueva." a las ".$hora." hrs.</b>";