Formattazione codice

This commit is contained in:
Pek5892 2023-09-21 17:34:30 +02:00
parent 2c532f2254
commit 0f5dfcccfd
21 changed files with 58 additions and 69 deletions

View File

@ -65,8 +65,8 @@ if (Auth::check()) {
<style>'.$custom_css.'</style>';
}
// Hooks
echo '
// Hooks
echo '
<script>
$(document).ready(function() {
// Toast
@ -75,18 +75,18 @@ if (Auth::check()) {
// Orologio
clock();';
// Hooks
if (!$config['disable_hooks']) {
echo '
// Hooks
if (!$config['disable_hooks']) {
echo '
setTimeout("startHooks();", 1000);';
}
}
// Abilitazione del cron autonoma
if (!$config['disable_cron']) {
echo '
// Abilitazione del cron autonoma
if (!$config['disable_cron']) {
echo '
$.get(globals.rootdir + "/cron.php");';
}
echo '
}
echo '
});
</script>';
}

View File

@ -39,4 +39,4 @@ if ($module['name'] == 'Preventivi' && $options['op'] == 'manage_descrizione') {
{[ "type": "checkbox", "label": "'.tr('Utilizza come titolo del gruppo').'", "name": "is_titolo", "value": '.json_encode($result['is_titolo']).', "help": "'.tr('').'" ]}
</div>
</div>';
}
}

View File

@ -22,7 +22,7 @@ include_once __DIR__.'/../../core.php';
if ($config['maintenance_ip'] != $_SERVER['REMOTE_ADDR']) {
include_once App::filepath('include|custom|', 'top.php');
$img = App::getPaths()['img'];
echo '
<div class="box box-center-large box-danger">
<div class="box-header with-border text-center">

View File

@ -24,7 +24,6 @@ use API\Interfaces\DeleteInterface;
use API\Interfaces\RetrieveInterface;
use API\Interfaces\UpdateInterface;
use API\Resource;
use Modules;
use Modules\Anagrafiche\Anagrafica;
class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface, UpdateInterface, DeleteInterface
@ -35,13 +34,13 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
$select = [
'an_anagrafiche.*',
'an_nazioni.nome AS nazione'
'an_nazioni.nome AS nazione',
];
$joins[] = [
'an_nazioni',
'an_anagrafiche.id_nazione',
'an_nazioni.id'
'an_nazioni.id',
];
$where[] = ['an_anagrafiche.deleted_at', '=', null];
@ -54,13 +53,13 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
$joins[] = [
'an_tipianagrafiche_anagrafiche',
'an_anagrafiche.idanagrafica',
'an_tipianagrafiche_anagrafiche.idanagrafica'
'an_tipianagrafiche_anagrafiche.idanagrafica',
];
$joins[] = [
'an_tipianagrafiche',
'an_tipianagrafiche_anagrafiche.idtipoanagrafica',
'an_tipianagrafiche.idtipoanagrafica'
'an_tipianagrafiche.idtipoanagrafica',
];
$where[] = ['an_tipianagrafiche.descrizione', '=', $type];
@ -71,9 +70,8 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
'select' => $select,
'joins' => $joins,
'where' => $where,
'order' => $order
'order' => $order,
];
}
public function create($request)

View File

@ -29,7 +29,7 @@ class Sedi extends Resource implements RetrieveInterface
$table = 'an_sedi';
return [
'table' => $table
'table' => $table,
];
}
}

View File

@ -34,21 +34,21 @@ class Articoli extends Resource implements RetrieveInterface, UpdateInterface, C
$select = [
'mg_articoli.*',
'categorie.nome AS categoria',
'sottocategorie.nome AS sottocategoria'
'sottocategorie.nome AS sottocategoria',
];
$joins[] = [
'mg_categorie AS categorie',
'mg_articoli.id_categoria',
'categorie.id'
'categorie.id',
];
$joins[] = [
'mg_categorie AS sottocategorie',
'mg_articoli.id_sottocategoria',
'sottocategorie.id'
'sottocategorie.id',
];
$where[] = ['mg_articoli.deleted_at', '=', NULL ];
$where[] = ['mg_articoli.deleted_at', '=', null];
$whereraw = [];
@ -60,7 +60,7 @@ class Articoli extends Resource implements RetrieveInterface, UpdateInterface, C
'joins' => $joins,
'where' => $where,
'whereraw' => $whereraw,
'order' => $order
'order' => $order,
];
}

View File

@ -127,7 +127,6 @@ class Check extends Model
}
*/
/**
* Rimuove tutte le check di un determinato modulo/plugin e record.
*
@ -137,7 +136,7 @@ class Check extends Model
{
database()->delete('zz_checks', $data);
}
/* Relazioni Eloquent */
public function user()

View File

@ -187,14 +187,13 @@ class Mail extends Model
$id_templates = [];
foreach($templates as $template) {
foreach ($templates as $template) {
$id_templates[] = $template->id;
}
database()->table('em_emails')->where('id_record', $data['id_record'])->whereIn('id_template', $id_templates)->delete();
}
/* Relazioni Eloquent */
public function account()

View File

@ -33,7 +33,7 @@ class Impianti extends Resource implements RetrieveInterface
'my_impianti.idanagrafica',
'my_impianti.matricola',
'my_impianti.nome',
'my_impianti.descrizione'
'my_impianti.descrizione',
];
$where = [];
@ -50,7 +50,7 @@ class Impianti extends Resource implements RetrieveInterface
'where' => $where,
'whereraw' => $whereraw,
'order' => $order,
'group' => $group
'group' => $group,
];
}
}

View File

@ -288,7 +288,6 @@ switch (post('op')) {
// Eliminazione associazione interventi e my_impianti
$dbo->query('DELETE FROM my_impianti_interventi WHERE idintervento='.prepare($id_record));
} catch (InvalidArgumentException $e) {
}
}

View File

@ -37,15 +37,15 @@ class Articoli extends Resource implements RetrieveInterface, CreateInterface
'in_righe_interventi.idarticolo AS id_articolo',
'in_righe_interventi.idintervento AS id_intervento',
'in_righe_interventi.qta',
'in_righe_interventi.created_at as data'
'in_righe_interventi.created_at as data',
];
$where = [['in_righe_interventi.idarticolo', '!=', NULL ], ['in_righe_interventi.idintervento', '=', $request['id_intervento']]];
$where = [['in_righe_interventi.idarticolo', '!=', null], ['in_righe_interventi.idintervento', '=', $request['id_intervento']]];
return [
'table' => $table,
'select' => $select,
'where' => $where
'where' => $where,
];
}
@ -66,4 +66,3 @@ class Articoli extends Resource implements RetrieveInterface, CreateInterface
$articolo->save();
}
}

View File

@ -25,7 +25,6 @@ use Models\Upload;
class Firma extends Resource implements UpdateInterface
{
// TODO: Da rivedere con upload in base64
public function update($request)
{

View File

@ -31,7 +31,7 @@ class Impianti extends Resource implements RetrieveInterface, CreateInterface
$select = [
'idimpianto AS id_impianto',
'idintervento AS id_intervento'
'idintervento AS id_intervento',
];
$where[] = ['my_impianti_interventi.idintervento', '=', $request['id_intervento']];
@ -39,7 +39,7 @@ class Impianti extends Resource implements RetrieveInterface, CreateInterface
return [
'table' => $table,
'select' => $select,
'where' => $where
'where' => $where,
];
}

View File

@ -24,7 +24,6 @@ use API\Interfaces\RetrieveInterface;
use API\Interfaces\UpdateInterface;
use API\Resource;
use Auth;
use Modules;
use Modules\Anagrafiche\Anagrafica;
use Modules\Interventi\Intervento;
use Modules\Interventi\Stato;
@ -43,36 +42,36 @@ class Interventi extends Resource implements RetrieveInterface, CreateInterface,
'in_interventi.*',
'MAX(in_interventi_tecnici.orario_fine) as data',
'GROUP_CONCAT(DISTINCT b.ragione_sociale SEPARATOR \', \') AS tecnici',
'in_statiintervento.descrizione AS stato'
'in_statiintervento.descrizione AS stato',
];
$joins[] = [
'in_statiintervento',
'in_interventi.idstatointervento',
'in_statiintervento.idstatointervento'
'in_statiintervento.idstatointervento',
];
$joins[] = [
'an_anagrafiche',
'in_interventi.idanagrafica',
'an_anagrafiche.idanagrafica'
'an_anagrafiche.idanagrafica',
];
$joins[] = [
'in_interventi_tecnici',
'in_interventi_tecnici.idintervento',
'in_interventi.id'
'in_interventi.id',
];
$joins[] = [
'an_anagrafiche as b',
'in_interventi_tecnici.idtecnico',
'b.ragione_sociale'
'b.ragione_sociale',
];
$where = [];
if(!$user->is_admin){
if (!$user->is_admin) {
$where[] = ['in_interventi_tecnici.idtecnico', '=', $user->idanagrafica];
}

View File

@ -52,10 +52,10 @@ switch (filter('op')) {
flash()->info(tr('Campagna newsletter salvata!'));
if($newsletter->state = "OK") {
$newsletter->completed_at = $newsletter -> updated_at;
};
if ($newsletter->state = 'OK') {
$newsletter->completed_at = $newsletter->updated_at;
}
$newsletter->save();
break;

View File

@ -23,7 +23,7 @@ use Modules\Preventivi\Stato;
$id_module = Modules::get('Preventivi')['id'];
$rs = $dbo->fetchArray("SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=co_preventivi.idanagrafica) AS ragione_sociale FROM co_preventivi WHERE idstato IN (SELECT id FROM co_statipreventivi WHERE is_fatturabile = 1) AND default_revision = 1 ORDER BY data_conclusione ASC");
$rs = $dbo->fetchArray('SELECT *, (SELECT ragione_sociale FROM an_anagrafiche WHERE idanagrafica=co_preventivi.idanagrafica) AS ragione_sociale FROM co_preventivi WHERE idstato IN (SELECT id FROM co_statipreventivi WHERE is_fatturabile = 1) AND default_revision = 1 ORDER BY data_conclusione ASC');
if (!empty($rs)) {
echo "
@ -39,7 +39,7 @@ if (!empty($rs)) {
$data_accettazione = ($preventivo['data_accettazione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_accettazione']) : '';
$data_conclusione = ($preventivo['data_conclusione'] != '0000-00-00') ? Translator::dateToLocale($preventivo['data_conclusione']) : '';
$stato_preventivo = Stato::find($preventivo['idstato'])->descrizione;
if (strtotime($preventivo['data_conclusione']) < strtotime(date('Y-m-d')) && $data_conclusione != '') {
$attr = ' class="danger"';
} else {

View File

@ -91,22 +91,22 @@ class Manager
$value = trim($value, ']');
$values = explode(',', $value);
foreach ($values as $value){
foreach ($values as $value) {
// Filtro per LIKE se il valore contiene %
if (string_contains($value, '%')) {
$where[] = [
$key,
'LIKE',
$value
$value,
];
}
// Filtro preciso se il valore non contiene %
else {
$where[] = [
$key,
'=',
$value
$value,
];
}
}
@ -137,7 +137,7 @@ class Manager
'order' => $order,
'page' => $page,
'length' => $length,
'whereraw' => $whereraw
'whereraw' => $whereraw,
]);
$response = $this->getResponse($data);
@ -147,10 +147,10 @@ class Manager
$joins = $response['joins'];
$group = $response['group'];
if(!empty($response['where'])){
if (!empty($response['where'])) {
$where = array_merge($where, $response['where']);
}
if(!empty($response['whereraw'])){
if (!empty($response['whereraw'])) {
$whereraw = $response['whereraw'];
}
@ -180,7 +180,7 @@ class Manager
foreach ($select as $s) {
$query->selectRaw($s);
}
foreach ($joins as $join) {
$query->leftJoin($join[0], $join[1], $join[2]);
}
@ -197,7 +197,6 @@ class Manager
$query->groupBy($group);
}
$count = $query->count();
// Composizione query finale

View File

@ -295,7 +295,7 @@ abstract class Document extends Model implements ReferenceInterface, DocumentInt
$id_fields = [];
foreach($fields as $field) {
foreach ($fields as $field) {
$id_fields[] = $field->id;
}
database()->table('zz_field_record')->where('id_record', $this->id)->whereIn('id_field', $id_fields)->delete();

View File

@ -469,7 +469,7 @@ class Database extends Util\Singleton
$select = !empty($select) ? $select : ['*'];
$statement = Capsule::table($table);
foreach ($joins as $join) {
$statement = $statement->leftJoin($join[0], $join[1], $join[2]);
}
@ -480,7 +480,6 @@ class Database extends Util\Singleton
$statement->where($conditions);
foreach ($select as $s) {
$statement->selectRaw($s);
}

View File

@ -70,7 +70,6 @@ class Note extends Model
database()->delete('zz_notes', $data);
}
/* Relazioni Eloquent */
public function user()

View File

@ -172,7 +172,7 @@ if ($options['pricing']) {
echo "
<th class='text-center' style='width:15%'>".tr('Prezzo unitario', [], ['upper' => true])."</th>
<th class='text-center' style='width:10%'>".tr('IVA', [], ['upper' => true])." (%)</th>
<th class='text-center' style='width:15%'>".($options['hide-total'] ? tr('Importo ivato', [], ['upper' => true]) : tr('Importo', [], ['upper' => true]))."</th>";
<th class='text-center' style='width:15%'>".($options['hide-total'] ? tr('Importo ivato', [], ['upper' => true]) : tr('Importo', [], ['upper' => true])).'</th>';
}
echo '
@ -280,8 +280,8 @@ foreach ($righe as $key => $riga) {
'.Translator::numberToLocale($riga->aliquota->percentuale, 2).'
</td>';
// Imponibile
echo '
// Imponibile
echo '
<td class="text-right" style="vertical-align: middle" >
'.(($options['hide-total'] || $prezzi_ivati) ? moneyFormat($riga->totale) : moneyFormat($riga->totale_imponibile)).'
</td>';