Aggiunto evento beforeSend per transazioni ajax
This commit is contained in:
Luca 2019-05-30 17:26:34 +02:00
parent d9b22d99c8
commit aa94ab4440
8 changed files with 34 additions and 20 deletions

View File

@ -1381,6 +1381,13 @@ function message(element) {
crossDomain: true,
url: href,
data: data,
beforeSend: function (response) {
var before = window[data.before];
if (typeof before === 'function') {
before(response);
}
},
success: function (response) {
var callback = window[data.callback];

View File

@ -4,7 +4,7 @@ include_once __DIR__.'/../../../core.php';
switch ($resource) {
case 'clienti':
$query = 'SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale) AS descrizione, idtipointervento_default FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica |where| ORDER BY ragione_sociale';
$query = "SELECT an_anagrafiche.idanagrafica AS id, CONCAT(ragione_sociale, IF(citta IS NULL OR citta = '', '', CONCAT(' (', citta, ')'))) AS descrizione, idtipointervento_default FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica |where| ORDER BY ragione_sociale";
foreach ($elements as $element) {
$filter[] = 'an_anagrafiche.idanagrafica='.prepare($element);

View File

@ -15,7 +15,7 @@ include_once __DIR__.'/../../core.php';
<div class="row">
<div class="col-md-6">
{[ "type": "select", "label": "<?php echo tr('Modulo del template'); ?>", "name": "module", "values": "query=SELECT id, title AS descrizione FROM zz_modules WHERE enabled = 1" ]}
{[ "type": "select", "label": "<?php echo tr('Modulo del template'); ?>", "name": "module", "required": 1 , "values": "query=SELECT id, title AS descrizione FROM zz_modules WHERE enabled = 1" ]}
</div>
<div class="col-md-6">

View File

@ -8,10 +8,10 @@ echo '
<table class="table table-hover table-bordered table-condensed">
<tr>
<th>'.tr('Nome').'</th>
<th width="50">'.tr('Versione').'</th>
<th width="30">'.tr('Stato').'</th>
<th width="30">'.tr('Compatibilità').'</th>
<th width="20">'.tr('Opzioni').'</th>
<th>'.tr('Versione').'</th>
<th>'.tr('Stato').'</th>
<th>'.tr('Compatibilità').'</th>
<th>'.tr('Opzioni').'</th>
</tr>';
$modules = Modules::getHierarchy();
@ -31,9 +31,9 @@ echo '
<table class="table table-hover table-bordered table-condensed">
<tr>
<th>'.tr('Nome').'</th>
<th width="200">'.tr('Posizione').'</th>
<th width="30">'.tr('Stato').'</th>
<th width="30">'.tr('Posizione').'</th>
<th>'.tr('Posizione').'</th>
<th>'.tr('Stato').'</th>
<th>'.tr('Posizione').'</th>
</tr>';
$widgets = $dbo->fetchArray('SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location, help FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC');
@ -83,7 +83,7 @@ foreach ($widgets as $widget) {
echo '
<tr class="'.$class.'">
<td>'.$widget['widget_name'].((!empty($widget['help'])) ? ' <i class="tip fa fa-question-circle-o" class="tip" title="'.$widget['help'].'"</i>' : '').'</td>
<td align="right"><small>'.$location.'</small></td>
<td align="left"><small>'.$location.'</small></td>
<td align="center">'.$stato.'</td>
<td align="center">'.$posizione.'</td>
</tr>';

View File

@ -48,12 +48,12 @@ function submodules($list, $depth = 0)
$result .= '
<tr class="'.$class.'">
<td><small>'.str_repeat('&nbsp;', $depth * 4).'- '.$sub['title'].'</small></td>
<td align="right">'.$sub['version'].'</td>
<td align="left">'.$sub['version'].'</td>
<td align="center">'.$stato.'</td>
<td align="center">'.$compatible.'</td>';
$result .= '
<td>';
<td align="center">';
// Possibilità di disinstallare solo se il modulo non è tra quelli predefiniti
if (empty($sub['default'])) {

View File

@ -42,7 +42,7 @@ class FileManager implements ManagerInterface
<div class="panel-heading">
<h3 class="panel-title">'.tr('Allegati').'</h3>
</div>
<div class="panel-body">';
<div class="panel-body"><div id="loading_'.$attachment_id.'" class="text-center hide" style="position:relative;top:100px;z-index:2;opacity:0.5;" ><i class="fa fa-refresh fa-spin fa-3x fa-fw"></i><span class="sr-only">'.tr("Caricamento...").'</span></div>';
}
$count = 0;
@ -109,7 +109,7 @@ class FileManager implements ManagerInterface
if (!$options['readonly']) {
$result .= '
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="unlink_file" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-callback="reload_'.$attachment_id.'">
<a class="btn btn-xs btn-danger ask" data-backto="record-edit" data-msg="'.tr('Vuoi eliminare questo file?').'" data-op="unlink_file" data-filename="'.$r['filename'].'" data-id_record="'.$r['id_record'].'" data-id_plugin="'.$options['id_plugin'].'" data-before="show_'.$attachment_id.'" data-callback="reload_'.$attachment_id.'">
<i class="fa fa-trash"></i>
</a>';
}
@ -223,8 +223,15 @@ $(document).ready(function(){
});
});
function show_'.$attachment_id.'() {
$("#loading_'.$attachment_id.'").removeClass("hide");
}
function reload_'.$attachment_id.'() {
$("#'.$attachment_id.'").load(globals.rootdir + "/ajax.php?op=list_attachments&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'");
$("#'.$attachment_id.'").load(globals.rootdir + "/ajax.php?op=list_attachments&id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id_plugin='.$options['id_plugin'].'", function() {
$("#loading_'.$attachment_id.'").addClass("hide");
});
}
</script>';

View File

@ -394,7 +394,7 @@ class Update
}
}
asort($results);
$results;
return $results;
}

View File

@ -82,9 +82,9 @@ UPDATE zz_views SET query='IF(`dt_ddt`.`idsede_partenza`=0, "Sede legale",CONCAT
UPDATE `mg_movimenti` SET `idsede_controparte` = (SELECT `idsede_destinazione` FROM `in_interventi` WHERE `in_interventi`.`id` = `mg_movimenti`.`idintervento`) WHERE `idintervento` IS NOT NULL;
-- Aggiorno idsede_azienda e controparte per ddt
UPDATE `mg_movimenti` SET `idsede_controparte` (SELECT `idsede_destinazione` FROM `dt_ddt` WHERE `dt_ddt`.`id` = `mg_movimenti`.`idddt`) WHERE `idddt`!=0;
UPDATE `mg_movimenti` SET `idsede_azienda` (SELECT `idsede_partenza` FROM `dt_ddt` WHERE `dt_ddt`.`id` = `mg_movimenti`.`idddt`) WHERE `idddt`!=0;
UPDATE `mg_movimenti` SET `idsede_controparte` = (SELECT `idsede_destinazione` FROM `dt_ddt` WHERE `dt_ddt`.`id` = `mg_movimenti`.`idddt`) WHERE `idddt`!=0;
UPDATE `mg_movimenti` SET `idsede_azienda` = (SELECT `idsede_partenza` FROM `dt_ddt` WHERE `dt_ddt`.`id` = `mg_movimenti`.`idddt`) WHERE `idddt`!=0;
-- Aggiorno idsede_azienda e controparte per documenti
UPDATE `mg_movimenti` SET `idsede_controparte` (SELECT `idsede_destinazione` FROM `co_documenti` WHERE `co_documenti`.`id` = `mg_movimenti`.`iddocumento`) WHERE `iddocumento`!=0;
UPDATE `mg_movimenti` SET `idsede_azienda` (SELECT `idsede_destinazione` FROM `co_documenti` WHERE `co_documenti`.`id` = `mg_movimenti`.`iddocumento`) WHERE `iddocumento`!=0;
UPDATE `mg_movimenti` SET `idsede_controparte` = (SELECT `idsede_destinazione` FROM `co_documenti` WHERE `co_documenti`.`id` = `mg_movimenti`.`iddocumento`) WHERE `iddocumento`!=0;
UPDATE `mg_movimenti` SET `idsede_azienda` = (SELECT `idsede_destinazione` FROM `co_documenti` WHERE `co_documenti`.`id` = `mg_movimenti`.`iddocumento`) WHERE `iddocumento`!=0;