Skip to content

Commit

Permalink
Normalizzazione file custom
Browse files Browse the repository at this point in the history
  • Loading branch information
Dasc3er committed Jun 26, 2018
1 parent f3c62c2 commit 625b9eb
Show file tree
Hide file tree
Showing 41 changed files with 258 additions and 317 deletions.
12 changes: 2 additions & 10 deletions bug.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@

$pageTitle = tr('Bug');

if (file_exists($docroot.'/include/custom/top.php')) {
include $docroot.'/include/custom/top.php';
} else {
include $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

if (empty($mail['from_address']) || empty($mail['server'])) {
echo '
Expand Down Expand Up @@ -194,8 +190,4 @@
<script type="text/javascript" charset="utf-8" src="'.App::getPaths()['js'].'/ckeditor/ckeditor.js'.'"></script>';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include $docroot.'/include/custom/bottom.php';
} else {
include $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
12 changes: 2 additions & 10 deletions controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
redirect(ROOTDIR.'/index.php');
}

if (file_exists($docroot.'/include/custom/top.php')) {
include $docroot.'/include/custom/top.php';
} else {
include $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

// Lettura parametri iniziali del modulo
$module = Modules::get($id_module);
Expand Down Expand Up @@ -89,8 +85,4 @@
// Widget in basso
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "right", "place": "controller" )}';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include $docroot.'/include/custom/bottom.php';
} else {
include $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
12 changes: 2 additions & 10 deletions editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
redirect(ROOTDIR.'/index.php');
}

if (file_exists($docroot.'/include/custom/top.php')) {
include $docroot.'/include/custom/top.php';
} else {
include $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

// Lettura parametri iniziali del modulo
$module = Modules::get($id_module);
Expand Down Expand Up @@ -308,8 +304,4 @@ function(data) {
</script>
<?php

if (file_exists($docroot.'/include/custom/bottom.php')) {
include $docroot.'/include/custom/bottom.php';
} else {
include $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
22 changes: 7 additions & 15 deletions include/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@

$pageTitle = tr('Configurazione');

if (file_exists($docroot.'/include/custom/top.php')) {
include_once $docroot.'/include/custom/top.php';
} else {
include_once $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

// Controllo sull'esistenza di nuovi parametri di configurazione
if (post('db_host') !== null) {
Expand Down Expand Up @@ -238,15 +234,15 @@
return result;
});
$("#install").on("click", function(){
if($(this).closest("form").parsley().validate()){
prev_html = $("#install").html();
$("#install").html("<i class=\'fa fa-spinner fa-pulse fa-fw\'></i> '.tr("Attendere").'...");
$("#install").prop(\'disabled\', true);
$("#test").prop(\'disabled\', true);
$("#config_form").submit();
}
Expand All @@ -263,14 +259,14 @@
data: {
test: 1,
},
type: "post",
type: "post",
success: function(data){
data = parseFloat(data.trim());
$("#test").html(prev_html);
$("#test").prop(\'disabled\', false);
$("#install").prop(\'disabled\', false);
if(data == 0){
swal("'.tr('Errore della configurazione').'", "'.tr('La configurazione non è corretta').'.", "error");
} else if(data == 1){
Expand Down Expand Up @@ -583,10 +579,6 @@
</div>';
}

if (file_exists($docroot.'/include/custom/bottom.php')) {
include_once $docroot.'/include/custom/bottom.php';
} else {
include_once $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');

exit();
18 changes: 3 additions & 15 deletions include/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,7 @@
if (Update::isUpdateLocked() && filter('force') === null) {
$pageTitle = tr('Aggiornamento in corso!');

if (file_exists($docroot.'/include/custom/top.php')) {
include_once $docroot.'/include/custom/top.php';
} else {
include_once $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

echo '
<div class="box box-center box-danger box-solid text-center">
Expand All @@ -137,11 +133,7 @@
</div>
</div>';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include_once $docroot.'/include/custom/bottom.php';
} else {
include_once $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');

exit();
}
Expand All @@ -151,11 +143,7 @@
$button = !$dbo->isInstalled() ? tr('Installa!') : tr('Aggiorna!');
$pageTitle = !$dbo->isInstalled() ? tr('Installazione') : tr('Aggiornamento');

if (file_exists($docroot.'/include/custom/top.php')) {
include_once $docroot.'/include/custom/top.php';
} else {
include_once $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

echo '
<div class="box box-center-large box-warning text-center">
Expand Down
12 changes: 2 additions & 10 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@

$pageTitle = tr('Login');

if (file_exists($docroot.'/include/custom/top.php')) {
include_once $docroot.'/include/custom/top.php';
} else {
include_once $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

// Controllo se è una beta e in caso mostro un warning
if (str_contains($version, 'beta')) {
Expand Down Expand Up @@ -175,8 +171,4 @@ function brute() {
});
</script>';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include_once $docroot.'/include/custom/bottom.php';
} else {
include_once $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
12 changes: 2 additions & 10 deletions info.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

$paths = App::getPaths();

if (file_exists($docroot.'/include/custom/top.php')) {
include $docroot.'/include/custom/top.php';
} else {
include $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

echo '
<div class="box">
Expand Down Expand Up @@ -168,8 +164,4 @@
</div>
</div>';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include $docroot.'/include/custom/bottom.php';
} else {
include $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
12 changes: 2 additions & 10 deletions log.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

$pageTitle = tr('Log');

if (file_exists($docroot.'/include/custom/top.php')) {
include $docroot.'/include/custom/top.php';
} else {
include $docroot.'/include/top.php';
}
include_once App::filepath('include|custom|', 'top.php');

echo '
<div class="box">
Expand Down Expand Up @@ -81,8 +77,4 @@
</div>
<!-- /.box -->';

if (file_exists($docroot.'/include/custom/bottom.php')) {
include $docroot.'/include/custom/bottom.php';
} else {
include $docroot.'/include/bottom.php';
}
include_once App::filepath('include|custom|', 'bottom.php');
18 changes: 8 additions & 10 deletions modules/anagrafiche/plugins/statistiche.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

include_once __DIR__.'/../../../core.php';

include_once Modules::filepath('Preventivi', 'modutil.php');

// Interventi
if (in_array('Cliente', explode(',', $records[0]['tipianagrafica']))) {
//Clienti
$rsi = $dbo->fetchArray('SELECT ragione_sociale, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS data, (SELECT SUM(prezzo_ore_consuntivo+prezzo_km_consuntivo+prezzo_dirittochiamata) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS totale FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica WHERE in_interventi.idanagrafica='.prepare($id_record));

}else if (in_array('Tecnico', explode(',', $records[0]['tipianagrafica']))) {

//Tecnici
$rsi = $dbo->fetchArray('SELECT ragione_sociale, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS data, (SELECT SUM(prezzo_ore_consuntivo+prezzo_km_consuntivo+prezzo_dirittochiamata) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id AND in_interventi_tecnici.idtecnico = '.prepare($id_record).' ) AS totale FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN in_interventi_tecnici ON in_interventi.id = in_interventi_tecnici.idintervento WHERE in_interventi_tecnici.idtecnico='.prepare($id_record));

//Clienti
$rsi = $dbo->fetchArray('SELECT ragione_sociale, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS data, (SELECT SUM(prezzo_ore_consuntivo+prezzo_km_consuntivo+prezzo_dirittochiamata) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS totale FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica WHERE in_interventi.idanagrafica='.prepare($id_record));
} elseif (in_array('Tecnico', explode(',', $records[0]['tipianagrafica']))) {
//Tecnici
$rsi = $dbo->fetchArray('SELECT ragione_sociale, (SELECT MIN(orario_inizio) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id) AS data, (SELECT SUM(prezzo_ore_consuntivo+prezzo_km_consuntivo+prezzo_dirittochiamata) FROM in_interventi_tecnici WHERE idintervento=in_interventi.id AND in_interventi_tecnici.idtecnico = '.prepare($id_record).' ) AS totale FROM in_interventi INNER JOIN an_anagrafiche ON in_interventi.idanagrafica=an_anagrafiche.idanagrafica INNER JOIN in_interventi_tecnici ON in_interventi.id = in_interventi_tecnici.idintervento WHERE in_interventi_tecnici.idtecnico='.prepare($id_record));
}
$totale_interventi = 0;
$data_start = strtotime('now');
Expand Down Expand Up @@ -51,13 +50,12 @@

// Preventivi
$rsi = $dbo->fetchArray('SELECT co_preventivi.id AS idpreventivo, data_accettazione AS data, ragione_sociale, budget FROM co_preventivi INNER JOIN an_anagrafiche ON co_preventivi.idanagrafica=an_anagrafiche.idanagrafica WHERE co_preventivi.idanagrafica='.prepare($id_record));
include_once $docroot.'/modules/preventivi/modutil.php';
$totale_preventivi = 0;
$data_start = strtotime('now');

for ($i = 0; $i < count($rsi); ++$i) {
//$totale_preventivi += $rsi[$i]['budget'];
$totale_preventivi += get_imponibile_preventivo($rsi[$i]['idpreventivo']);
$totale_preventivi += get_imponibile_preventivo($rsi[$i]['idpreventivo']);
// Calcolo data più bassa per la ricerca
if (strtotime($rsi[$i]['data']) < $data_start) {
$data_start = strtotime($rsi[$i]['data']);
Expand Down
6 changes: 3 additions & 3 deletions modules/articoli/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

include_once __DIR__.'/../../core.php';

// Necesario per funzione \Util\Ini::getList
include_once Modules::filepath('MyImpianti', 'modutil.php');

$_SESSION['superselect']['id_categoria'] = $records[0]['id_categoria'];

?><form action="" method="post" id="edit-form" enctype="multipart/form-data">
Expand Down Expand Up @@ -183,9 +186,6 @@
<div class="panel-body">
<?php

/* necesario per funzione \Util\Ini::getList */
include $docroot.'/modules/my_impianti/modutil.php';

echo '
<div class="row">
<div class="col-md-4">
Expand Down
3 changes: 2 additions & 1 deletion modules/articoli/import.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

include_once __DIR__.'/../../core.php';
include_once $docroot.'/modules/articoli/modutil.php';

include_once Modules::filepath('Articoli', 'modutil.php');

switch (post('op')) {
case 'example':
Expand Down
2 changes: 1 addition & 1 deletion modules/automezzi/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include_once __DIR__.'/../../core.php';

// Necessaria per la funzione add_movimento_magazzino
include_once $docroot.'/modules/articoli/modutil.php';
include_once Modules::filepath('Articoli', 'modutil.php');

switch (post('op')) {
case 'update':
Expand Down
2 changes: 1 addition & 1 deletion modules/contratti/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include_once __DIR__.'/../../core.php';

include_once $docroot.'/modules/fatture/modutil.php';
include_once Modules::filepath('Fatture di vendita', 'modutil.php');

switch (post('op')) {
case 'add':
Expand Down
2 changes: 1 addition & 1 deletion modules/contratti/plugins/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include_once __DIR__.'/../../../core.php';

include_once $docroot.'/modules/fatture/modutil.php';
include_once Modules::filepath('Fatture di vendita', 'modutil.php');

switch (post('op')) {
/*
Expand Down
18 changes: 9 additions & 9 deletions modules/contratti/plugins/ajax_articoli.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

include_once __DIR__.'/../../../core.php';

include_once $docroot.'/modules/articoli/modutil.php';
include_once Modules::filepath('Articoli', 'modutil.php');

//$query = 'SELECT *, (SELECT codice FROM mg_articoli WHERE id=mg_articoli_interventi.idarticolo) AS codice, mg_articoli_interventi.id AS idriga, (SELECT prc_guadagno FROM mg_listini WHERE id=(SELECT idlistino_vendite FROM an_anagrafiche WHERE idanagrafica=(SELECT idanagrafica FROM in_interventi WHERE id=mg_articoli_interventi.idintervento) ) ) AS prc_guadagno FROM mg_articoli_interventi WHERE idintervento='.prepare($id_record).' '.Modules::getAdditionalsQuery('Magazzino');
//$rs = $dbo->fetchArray($query);

if (!empty($get['idcontratto_riga']))
$idcontratto_riga = $get['idcontratto_riga'];
if (!empty($get['idcontratto_riga'])) {
$idcontratto_riga = $get['idcontratto_riga'];
}

$query = 'SELECT * FROM co_righe_contratti_articoli WHERE id_riga_contratto='.prepare($idcontratto_riga).' '.Modules::getAdditionalsQuery('Magazzino').' ORDER BY id ASC';
$rs = $dbo->fetchArray($query);


if (!empty($rs)) {
echo '
<table class="table table-striped table-condensed table-hover table-bordered">
Expand Down Expand Up @@ -135,14 +135,14 @@
<button type="button" class="btn btn-info btn-xs" data-toggle="tooltip" onclick="launch_modal(\''.tr('Modifica articoli').'\', \''.$rootdir.'/modules/fatture/add_serial.php?id_module='.$id_module.'&id_record='.$id_record.'&idarticolo='.$r['idriga'].'&idriga='.$r['id'].'\', 1);"><i class="fa fa-barcode"></i></button>';
}*/

if (empty($readonly)) {
echo '
if (empty($readonly)) {
echo '
<button type="button" class="btn btn-warning btn-xs" data-title="'.tr('Modifica spesa').'" onclick="launch_modal(\'Modifica spesa\', \''.$rootdir.'/modules/contratti/plugins/add_articolo.php?id_module='.$id_module.'&id_record='.$id_record.'&idriga='.$r['id'].'\', 1, \'#bs-popup2\');" >
<i class="fa fa-edit"></i></button>
<button type="button" class="btn btn-danger btn-xs" data-toggle="tooltip" title="'.tr('Elimina materiale').'" onclick="if(confirm(\''.tr('Eliminare questo materiale?').'\') ){ ritorna_al_magazzino(\''.$r['id'].'\'); }"><i class="fa fa-angle-double-left"></i> <i class="fa fa-truck"></i></button>';
}
echo '
}

echo '
</td>';
}
echo '
Expand Down
4 changes: 2 additions & 2 deletions modules/contratti/plugins/contratti.consuntivo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

include_once __DIR__.'/../../../core.php';
include_once $docroot.'/modules/interventi/modutil.php';

include_once Modules::filepath('Interventi', 'modutil.php');

/*
CONSUNTIVO
Expand Down Expand Up @@ -276,7 +277,6 @@

$diff = sum($budget, -$totale_addebito);


if ($diff > 0) {
$bilancio = '<span class="text-success"><big>'.Translator::numberToLocale($diff).' &euro;</big></span>';
} elseif ($diff < 0) {
Expand Down
Loading

0 comments on commit 625b9eb

Please sign in to comment.