openstamanager/templates/prima_nota/init.php

49 lines
1.6 KiB
PHP
Raw Normal View History

<?php
/*
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
* Copyright (C) DevCode s.n.c.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Util\Query;
2024-03-05 16:01:45 +01:00
use Models\Module;
include_once __DIR__.'/../../core.php';
2024-03-05 16:01:45 +01:00
$structure = Module::find((new Module())->getByName('Prima nota')->id_record);
2023-08-04 14:54:28 +02:00
if (!empty($_SESSION['superselect']['mastrini'])) {
$id_record = $_SESSION['superselect']['mastrini'];
2023-08-04 14:54:28 +02:00
$where = 'co_movimenti.idmastrino IN ('.implode(',', $id_record).')';
$id_record = json_decode($righe);
unset($_SESSION['superselect']['mastrini']);
2023-08-04 14:54:28 +02:00
} else {
$where = 'co_movimenti.idmastrino='.prepare($id_record);
}
// RISULTATI VISIBILI
2024-01-15 15:30:45 +01:00
Query::setSegments(false);
$query = Query::getQuery($structure, $where, 0, []);
2024-03-05 16:01:45 +01:00
$query = Modules::replaceAdditionals($structure->id, $query);
2023-08-04 14:54:28 +02:00
$query = str_replace('1=1', '1=1 AND '.$where, $query);
$records = Query::executeAndCount($query);
$campi = [];
2023-08-04 14:54:28 +02:00
foreach ($records['results'][0] as $key => $value) {
$campi[] = $key;
}
2023-08-04 14:54:28 +02:00
unset($campi[0]);