Correcciones y Avances en el Boilerplate

GitHub commit banner

Correcciones y Avances en el Boilerplate

En este commit, nuestro desarrollador ha hecho algunas correcciones importantes para mejorar la estructura del proyecto boilerplate de julio101290. Entre las modificaciones se encuentran ajustes en los archivos .gitignore, project.properties, project.xml y el archivo de controlador AvancesActividadesController.php.

📁 julio101290/boilerplateProjects

🔧 Commit  5b3fdfe2

Corrections, show correct advances

📁 Repositorio julio101290/boilerplateProjects
🔑 SHA 5b3fdfe2c4716b6cb11fa5415f5840e054104d40
✍️ Autor Julio Cesar Leyva Rodriguez <juliocesarleyvarodriguez@hotmail.com>
🕐 Fecha 2026-06-09T16:07:52Z
📊 Cambios 4 archivo(s)  ·  +60   -33  ·  93 líneas

📂 Archivos modificados (4)

📄 .gitignore ➕ añadido +1 -0
🖥️ Diff — GITIGNORE
@@ -0,0 +1 @@
+/nbproject/private/
📄 nbproject/project.properties ➕ añadido +7 -0
🖥️ Diff — PROPERTIES
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_84
+source.encoding=UTF-8
+src.dir=src
+tags.asp=false
+tags.short=false
+web.root=.
📄 nbproject/project.xml ➕ añadido +9 -0
🖥️ Diff — XML
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.php.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/php-project/1">
+ <name>julio101290/boilerplateprojects</name>
+ </data>
+ </configuration>
+</project>
📄 src/Controllers/AvancesActividadesController.php ✏️ modificado +43 -33
🖥️ Diff — PHP
@@ -189,41 +189,49 @@ public function save() {
}
public function ctrGetAvances($id) {
-
helper('auth');
- $userName = user()->username;
- $idUser = user()->id;
- $datos = $this->request->getPost();
-
- $auth = service('authentication');
- if (!$auth->check()) {
-
- echo "No ha iniciado Session";
- return;
+ if (!service('authentication')->check()) {
+ return $this->response->setJSON(['error' => 'No ha iniciado sesión']);
}
+
$request = service('request');
+ $fields = ['id', 'idActividad', 'fecha', 'descripcion', 'porcentaje', 'horas', 'created_at', 'updated_at', 'deleted_at'];
+
+ // --- Asegurar que $id es numérico ---
+ $id = (int) $id;
+ if ($id <= 0) {
+ return $this->response->setJSON([
+ 'draw' => (int) $request->getPost('draw'),
+ 'recordsTotal' => 0,
+ 'recordsFiltered' => 0,
+ 'data' => [],
+ ]);
+ }
+
+ // --- Total de registros sin filtro de búsqueda ---
+ $totalRecords = $this->avancesActividades
+ ->where('deleted_at', null)
+ ->where('idActividad', $id)
+ ->countAllResults(); // resetea el builder
+ // --- Construir la consulta para datos paginados ---
$builder = $this->avancesActividades
- ->select('id, idActividad, fecha, descripcion, porcentaje, horas, created_at, updated_at, deleted_at')
+ ->select($fields)
->where('deleted_at', null)
->where('idActividad', $id);
- // Parámetros de DataTables
+ // Parámetros DataTables
$search = $request->getPost('search')['value'] ?? '';
- $start = (int) $request->getPost('start') ?? 0;
- $length = (int) $request->getPost('length') ?? 10;
+ $start = (int) ($request->getPost('start') ?? 0);
+ $length = (int) ($request->getPost('length') ?? 10);
$orderCol = $request->getPost('order')[0]['column'] ?? 0;
$orderDir = $request->getPost('order')[0]['dir'] ?? 'asc';
- $columns = $request->getPost('columns');
-

… diff truncado a 60 líneas

🔗 Ver commit completo en GitHub →

⚡ César Systems — Blog técnico automatizado

Comentarios

Entradas populares