Correzioni minori JS e stile del codice

This commit is contained in:
Dasc3er 2021-09-20 12:06:30 +02:00 committed by Thomas Zilio
parent 2f8f472fe8
commit aa337d4164
49 changed files with 107 additions and 108 deletions

View File

@ -79,7 +79,7 @@ switch (filter('op')) {
case 'active_users':
$posizione = get('id_module');
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$posizione .= ', '.get('id_record');
}

View File

@ -64,7 +64,7 @@ $(document).ready(function () {
url: table.ajax.url(),
data: params,
type: 'GET',
dataType: "json",
dataType: "JSON",
success: function (response) {
var row_ids = response.data.map(function (a) {
return a.id;

View File

@ -141,7 +141,7 @@ function aggiungiAllegato(gestione) {
form.ajaxSubmit({
url: globals.rootdir + "/actions.php",
data: data,
type: "post",
type: "POST",
uploadProgress: function (event, position, total, percentComplete) {
$(id + " #upload").prop("disabled", true).html(percentComplete + "%").removeClass("btn-success").addClass("btn-info");
},

View File

@ -491,7 +491,7 @@ function getTable(selector) {
return $.ajax({
url: globals.rootdir + "/ajax.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: this.id_module,
id_plugin: this.id_plugin,

View File

@ -50,7 +50,7 @@ function submitAjax(form, data, callback, errorCallback) {
$(form).ajaxSubmit({
url: globals.rootdir + "/actions.php",
data: data,
type: "post",
type: "POST",
success: function (data) {
let response = data.trim();

View File

@ -22,7 +22,7 @@
function startHooks() {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
type: "GET",
data: {
op: "hooks",
},
@ -58,7 +58,7 @@ function startHooks() {
function startHook(hook, init) {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
type: "GET",
data: {
op: "hook-lock",
id: hook.id,
@ -94,7 +94,7 @@ function startHook(hook, init) {
function executeHook(hook, token) {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
type: "GET",
data: {
op: "hook-execute",
id: hook.id,
@ -127,7 +127,7 @@ function executeHook(hook, token) {
function updateHook(hook) {
$.ajax({
url: globals.rootdir + "/ajax.php",
type: "get",
type: "GET",
data: {
op: "hook-response",
id: hook.id,

View File

@ -299,7 +299,7 @@ if (empty($creation) && (!file_exists('config.inc.php') || !$valid_config)) {
data: {
test: 1,
},
type: "post",
type: "POST",
success: function(data){
data = parseFloat(data.trim());

View File

@ -165,7 +165,7 @@ function search(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
type: "POST",
data: {
id_module: globals.id_module,
op: "check",

View File

@ -378,7 +378,7 @@ echo '
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -187,7 +187,7 @@ if (!empty($numero_documenti)) {
iban: iban.get(),
},
type: 'GET',
dataType: "json",
dataType: "JSON",
success: function (response) {
compilaCampi(response);
},
@ -221,7 +221,7 @@ if (!empty($numero_documenti)) {
id_nazione: id_nazione.get(),
},
type: 'GET',
dataType: "json",
dataType: "JSON",
success: function (response) {
compilaCampi(response);
},

View File

@ -31,7 +31,7 @@ if (isset($id_original)) {
echo base_path().'/controller.php?id_module='.$id_module;
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
echo '&id_record='.$id_record;
}
}
@ -61,8 +61,7 @@ if (isset($id_original)) {
<div class="col-md-12 text-right">
<?php
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
?>
$has_access = \Util\Query::checkAccess($id_record); ?>
<button type="submit" class="btn btn-success"><i class="fa fa-save"></i> <?php echo tr('Salva'); ?></button>
<?php
} else {

View File

@ -22,7 +22,7 @@ include_once __DIR__.'/../../core.php';
switch (filter('op')) {
case 'update':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$database->update('mg_causali_movimenti', [
'nome' => post('nome'),
'tipo_movimento' => post('tipo_movimento'),
@ -48,7 +48,7 @@ switch (filter('op')) {
case 'delete':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$dbo->query('DELETE FROM `mg_causali_movimenti` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [

View File

@ -280,7 +280,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -62,7 +62,7 @@ switch (filter('op')) {
case 'update':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$idstatoddt = post('idstatoddt');
$idpagamento = post('idpagamento');
$numero_esterno = post('numero_esterno');

View File

@ -338,7 +338,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -74,12 +74,12 @@ $idtipodocumento = $dbo->selectOne('co_tipidocumento', ['id'], [
{[ "type": "select", "label": "<?php echo tr('Sezionale'); ?>", "name": "id_segment", "required": 1, "values": "query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module='<?php echo $id_module; ?>' ORDER BY name", "value": "<?php echo $_SESSION['module_'.$id_module]['id_segment']; ?>" ]}
</div>
</div>
<div id="info" class="hidden">
<div class="row">
<div class="col-md-6 ">
<div id="info-title-bozza" class="box">
<div class="box-header with-border">
<h3 class="box-title"><?php echo tr('Fatture in stato Bozza del cliente'); ?></h3>
<div class="box-tools pull-right">
@ -131,14 +131,14 @@ $(document).ready(function () {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_anagrafica: data.id,
op: "fatture_bozza",
},
success: function (results) {
$("#info").removeClass("box-info");
$("#info").removeClass("box-warning");
if (results.length === 0){
@ -162,7 +162,7 @@ $(document).ready(function () {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_anagrafica: data.id,

View File

@ -786,7 +786,7 @@ if ($dir == 'uscita' && $fattura->isFE()) {
$(document).ready(function() {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
type: "POST",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -439,7 +439,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -47,8 +47,9 @@ class Scadenze
$this->fattura = $fattura;
}
public function getGruppo(){
if (isset($this->gruppo)){
public function getGruppo()
{
if (isset($this->gruppo)) {
return $this->gruppo;
}
@ -56,7 +57,7 @@ class Scadenze
$this->gruppo = Gruppo::where('id_documento', '=', $this->fattura->id)->first();
// Generazione Gruppo Scadenza associato alla Fattura
if (empty($this->gruppo)){
if (empty($this->gruppo)) {
$this->gruppo = Gruppo::build($this->fattura->getReference(), $this->fattura);
}

View File

@ -59,7 +59,7 @@ include_once __DIR__.'/../../core.php';
$("#example").click(function() {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
type: "POST",
data: {
op: "example",
id_module: globals.id_module,

View File

@ -194,7 +194,7 @@ function importPage(page) {
$("#edit-form").ajaxSubmit({
url: globals.rootdir + "/actions.php",
data: data,
type: "post",
type: "POST",
success: function(data) {
data = JSON.parse(data);

View File

@ -314,7 +314,7 @@ function add_tecnici(id_tecnico) {
op: "add_sessione",
id_tecnico: id_tecnico,
},
type: "post",
type: "POST",
success: function() {
caricaTecnici();
caricaCosti();
@ -343,7 +343,7 @@ function elimina_sessione(id_sessione) {
op: "delete_sessione",
id_sessione: id_sessione,
},
type: "post",
type: "POST",
success: function() {
caricaTecnici();
caricaCosti();

View File

@ -253,7 +253,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -91,7 +91,7 @@ switch (filter('op')) {
case 'delete':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$dbo->query('UPDATE `co_iva` SET deleted_at = NOW() WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo', [

View File

@ -30,9 +30,6 @@ if (setting('Attiva scorciatoie da tastiera')) {
?>
<form action="" method="post" id="add-form">
<input type="hidden" name="op" value="add">
<input type="hidden" name="backto" value="record-edit">
@ -104,14 +101,14 @@ echo '
<script>
// Lettura codici da lettore barcode
$(document).unbind("keyup");
$("#modals > div").on( "shown.bs.modal", function(){';
$("#modals > div").on("shown.bs.modal", function(){';
if (setting('Attiva scorciatoie da tastiera')) {
echo 'EnableHotkeys()';
}
echo '
echo '
$("#barcode").focus();
});
$(document).on("keyup", function (event) {
if ($(":focus").is("input, textarea")) {
return;
@ -120,8 +117,8 @@ echo '
let key = window.event ? event.keyCode : event.which; // IE vs Netscape/Firefox/Opera
$("#articolo-missing").addClass("hidden");
let barcode = $("#barcode");
if ( barcode.val() == "" && $("#idarticolo").val() == null && key === 13 ){
if (barcode.val() == "" && $("#idarticolo").val() == null && key === 13) {
swal("'.tr('Inserisci barcode o seleziona un articolo').'", "", "warning");
}
else if (key === 13) {
@ -134,13 +131,13 @@ echo '
}
});
function abilitaSede(id){
function abilitaSede(id) {
$(id).removeClass("disabled")
.attr("disabled", false)
.attr("required", true);
}
function disabilitaSede(id){
function disabilitaSede(id) {
$(id).addClass("disabled")
.attr("disabled", true)
.attr("required", false);
@ -273,19 +270,19 @@ echo '
hotkeys("f7,f8,f9,f10", function(event, handler) {
switch (handler.key) {
case "f7":
case "f7":
event.preventDefault();
$("#barcode").focus();
break;
case "f8":
case "f8":
event.preventDefault();
input("causale").set("1");
break;
case "f9":
case "f9":
event.preventDefault();
input("causale").set("2");
break;
case "f10":
case "f10":
event.preventDefault();
input("causale").set("3");
break;

View File

@ -57,7 +57,7 @@ switch (post('op')) {
case 'update':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$idstatoordine = post('idstatoordine');
$idpagamento = post('idpagamento');
$idsede = post('idsede');

View File

@ -367,7 +367,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -60,7 +60,7 @@ foreach ($primo_livello as $conto_primo) {
<div class="box conto1">
<div class="box-header">
<h3 class="box-title">
'.$titolo.'
'.$titolo.'
<button type="button" class="btn btn-xs btn-primary" data-toggle="tooltip" title="'.tr('Aggiungi un nuovo conto...').'" onclick="aggiungiConto('.$conto_primo['id'].', 2)">
<i class="fa fa-plus-circle"></i>
</button>
@ -451,7 +451,7 @@ echo '
$.ajax({
url: "'.$structure->fileurl('dettagli_conto.php').'",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_conto: id_conto,

View File

@ -52,7 +52,7 @@ switch (post('op')) {
case 'update':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$preventivo->idstato = post('idstato');
$preventivo->nome = post('nome');
$preventivo->idanagrafica = post('idanagrafica');

View File

@ -347,7 +347,7 @@ function rimuoviRiga(button) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "POST",
dataType: "json",
dataType: "JSON",
data: {
id_module: globals.id_module,
id_record: globals.id_record,

View File

@ -66,7 +66,7 @@ switch (filter('op')) {
case 'delete':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$dbo->query('DELETE FROM `co_ritenutaacconto` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [

View File

@ -66,7 +66,7 @@ switch (filter('op')) {
case 'delete':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$dbo->query('DELETE FROM `co_ritenuta_contributi` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [

View File

@ -66,7 +66,7 @@ switch (filter('op')) {
case 'delete':
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$dbo->query('DELETE FROM `co_rivalse` WHERE `id`='.prepare($id_record));
flash()->info(tr('Tipologia di _TYPE_ eliminata con successo!', [

View File

@ -45,18 +45,18 @@ if (!empty($documento)) {
echo '
<div class="row">
<div class="col-md-4">
<h4>' . tr('Documento') . '</h4>
' . Modules::link($documento->getModule(), $documento->id, $documento->getReference()) . '
<h4>'.tr('Documento').'</h4>
'.Modules::link($documento->getModule(), $documento->id, $documento->getReference()).'
</div>
<div class="col-md-4">
<h4>' . ($documento->direzione == 'entrata' ? tr('Cliente') : tr('Fornitore')) . '</h4>
' . Modules::link('Anagrafiche', $documento->anagrafica->id, $documento->anagrafica->ragione_sociale) . '
<h4>'.($documento->direzione == 'entrata' ? tr('Cliente') : tr('Fornitore')).'</h4>
'.Modules::link('Anagrafiche', $documento->anagrafica->id, $documento->anagrafica->ragione_sociale).'
</div>
<div class="col-md-4">
<h4>' . tr('Netto a pagare') . '</h4>
' . moneyFormat($documento->netto) . '
<h4>'.tr('Netto a pagare').'</h4>
'.moneyFormat($documento->netto).'
</div>
</div>
@ -149,17 +149,17 @@ echo '
<tbody id="scadenze">';
foreach ($scadenze as $i => $scadenza) {
if ($scadenza['da_pagare'] == $scadenza['pagato']) {
$class = 'success';
} elseif (abs($scadenza['pagato']) == 0) {
$class = 'danger';
} elseif (abs($scadenza['pagato']) <= abs($scadenza['da_pagare'])) {
$class = 'warning';
} else {
$class = 'danger';
}
if ($scadenza['da_pagare'] == $scadenza['pagato']) {
$class = 'success';
} elseif (abs($scadenza['pagato']) == 0) {
$class = 'danger';
} elseif (abs($scadenza['pagato']) <= abs($scadenza['da_pagare'])) {
$class = 'warning';
} else {
$class = 'danger';
}
echo '
echo '
<tr class="'.$class.'">
<input type="hidden" name="id_scadenza['.$i.']" value="'.$scadenza['id'].'">

View File

@ -54,9 +54,9 @@ class Gruppo extends Model
/**
* Metodo per la gestione dei trigger alla modifica delle scadenze del gruppo.
* @param Scadenza $trigger
*/
public function triggerScadenza(Scadenza $trigger){
public function triggerScadenza(Scadenza $trigger)
{
$this->totale_pagato = $this->scadenze()->sum('pagato');
$this->save();
}
@ -65,7 +65,8 @@ class Gruppo extends Model
* Metodo per rimuovere completamente le scadenze associate al gruppo.
* Da utilizzare per le Fatture.
*/
public function rimuoviScadenze() {
public function rimuoviScadenze()
{
$this->scadenze()->delete();
}

View File

@ -40,7 +40,7 @@ class Stat {
$.ajax({
url: this.calendar.info.url + "/" + this.file,
type: "get",
type: "GET",
data: data,
success: function(data){
callback(data)

View File

@ -26,7 +26,7 @@ switch (post('op')) {
$i = 0;
foreach ($id_records as $id_record) {
if (isset($id_record)) {
$has_access = \Util\Query::checkAccess($id_record);
$has_access = \Util\Query::checkAccess($id_record);
$mail = Mail::find($id_record);
if (empty($mail->sent_at)) {
$mail->delete();

View File

@ -33,7 +33,7 @@ function formatBytes(a,b=2){if(0===a)return"0 Bytes";const c=0>b?0:b,d=Math.floo
$(document).ready(function() {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: '.$module->id.',
op: "sizes",

View File

@ -134,7 +134,7 @@ function testQuery(){
$.ajax({
url: "'.base_path().'/actions.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&op=test",
cache: false,
type: "post",
type: "POST",
processData: false,
contentType: false,
dataType : "html",

View File

@ -198,8 +198,8 @@ if ($fattura !== null) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
dataType: "json",
type: "POST",
dataType: "JSON",
data: {
op: "send",
id_module: "'.$id_module.'",
@ -239,7 +239,7 @@ if ($fattura !== null) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
type: "POST",
data: {
op: "verify",
id_module: "'.$id_module.'",

View File

@ -115,8 +115,8 @@ function gestioneRicevuta(button, name, type) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
dataType: "json",
type: "POST",
dataType: "JSON",
data: {
op: "gestione_ricevuta",
id_module: "'.$id_module.'",

View File

@ -46,7 +46,7 @@ function compile(btn) {
url: globals.rootdir + "/actions.php",
cache: false,
type: "GET",
dataType: "json",
dataType: "JSON",
data: {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
@ -93,7 +93,7 @@ function compilaRiferimenti(btn) {
url: globals.rootdir + "/actions.php",
cache: false,
type: "GET",
dataType: "json",
dataType: "JSON",
data: {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",

View File

@ -46,7 +46,7 @@ echo '
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
},
type: "post",
type: "POST",
success: function(data){
data = JSON.parse(data);
@ -170,7 +170,7 @@ function importAll(btn) {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
},
type: "post",
type: "POST",
success: function(data){
data = JSON.parse(data);
@ -179,7 +179,7 @@ function importAll(btn) {
data.forEach(function(element) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",

View File

@ -70,7 +70,7 @@ function skip() {
function cleanup(){
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
@ -81,7 +81,7 @@ function cleanup(){
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",

View File

@ -133,7 +133,7 @@ function import_fe(button, file, data_registrazione) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
@ -176,7 +176,7 @@ function process_fe(button, file) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
@ -204,7 +204,7 @@ function delete_fe(button, file_id) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',

View File

@ -188,7 +188,7 @@ function upload(btn) {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
},
type: "post",
type: "POST",
success: function(data){
importMessage(data);
@ -246,7 +246,7 @@ function importAll(btn) {
id_module: "'.$id_module.'",
id_plugin: "'.$id_plugin.'",
},
type: "post",
type: "POST",
success: function(data){
data = JSON.parse(data);

View File

@ -87,7 +87,7 @@ function import_fe(button, file) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
@ -120,7 +120,7 @@ function delete_fe(button, file_id) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',
@ -148,7 +148,7 @@ function process_fe(button, file) {
$.ajax({
url: globals.rootdir + "/actions.php",
type: "get",
type: "GET",
data: {
id_module: globals.id_module,
id_plugin: '.$id_plugin.',

View File

@ -126,7 +126,7 @@ class HTMLWrapper implements WrapperInterface
$.ajax({
url: globals.rootdir + "/actions.php",
type: "post",
type: "POST",
data: {
id_module: "'.$id_module.'",
id_record: "'.$id_record.'",

View File

@ -326,11 +326,12 @@ class Query
/**
* Controlla se l'utente ha accesso a un record specifico seguendo la query principale del modulo.
*
* @return bool
* @throws \Exception
*
* @return bool
*/
public static function checkAccess($id_record){
public static function checkAccess($id_record)
{
self::setSegments(false);
$query = self::getQuery(Modules::getCurrent(), [
'id' => $id_record,