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

@ -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

@ -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

@ -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

@ -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

@ -131,7 +131,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,
@ -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

@ -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,7 +101,7 @@ 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()';
}
@ -121,7 +118,7 @@ echo '
$("#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);

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

@ -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

@ -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

@ -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>

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

@ -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,