Miglioramenti di compatibilità

This commit is contained in:
Thomas Zilio 2018-07-19 12:47:28 +02:00
parent 949a98cf22
commit 857e584a6e
14 changed files with 75 additions and 36 deletions

View File

@ -147,17 +147,26 @@ if (!empty($element['script'])) {
return;
}
// Caricamento helper modulo (verifico se ci sono helper personalizzati)
include_once App::filepath($directory.'|custom|', 'modutil.php');
// Caricamento funzioni del modulo
$modutil = App::filepath($directory.'|custom|', 'modutil.php');
if (!empty($modutil)) {
include_once $modutil;
}
// Lettura risultato query del modulo
include App::filepath($directory.'|custom|', 'init.php');
$init = App::filepath($directory.'|custom|', 'init.php');
if (!empty($init)) {
include_once $init;
}
// Retrocompatibilità
if (!isset($record) && isset($records[0])) {
$record = $records[0];
} elseif (!isset($records[0]) && isset($record)) {
$records = [$record];
} elseif (!isset($record)) {
$record = [];
$records = [$record];
}
// Registrazione del record
@ -170,7 +179,8 @@ if (Modules::getPermission($id_module) == 'rw') {
$id_records = array_filter($id_records, function ($var) {return !empty($var); });
$id_records = array_unique($id_records);
$bulk = include App::filepath($directory.'|custom|', 'bulk.php');
$bulk = App::filepath($directory.'|custom|', 'bulk.php');
$bulk = empty($bulk) ? [] : include $bulk;
$bulk = empty($bulk) ? [] : $bulk;
if (in_array(post('op'), array_keys($bulk))) {

View File

@ -16,4 +16,6 @@ return [
'secure' => isHTTPS(true),
],
'verifyGetFor' => [],
'CSRFP_TOKEN' => '',
'disabledJavascriptMessage' => '',
];

View File

@ -178,7 +178,7 @@ if (!API::isAPIRequest()) {
register_shutdown_function('translateTemplate');
ob_start();
// Compatibilità con le versioni precedenti
// Retrocompatibilità
$_SESSION['infos'] = isset($_SESSION['infos']) ? array_unique($_SESSION['infos']) : [];
$_SESSION['warnings'] = isset($_SESSION['warnings']) ? array_unique($_SESSION['warnings']) : [];
$_SESSION['errors'] = isset($_SESSION['errors']) ? array_unique($_SESSION['errors']) : [];

View File

@ -140,11 +140,12 @@ if (empty($record)) {
<br>';
// Pulsanti personalizzati
ob_start();
include Modules::filepath($id_module, 'buttons.php');
$buttons = ob_get_clean();
$buttons = Modules::filepath($id_module, 'buttons.php');
if (!empty($buttons)) {
ob_start();
include $buttons;
$buttons = ob_get_clean();
echo '
<div class="pull-right" id="pulsanti-modulo">
'.$buttons.'

View File

@ -55,7 +55,7 @@ echo '
</body>
</html>';
// Compatibilità con le versioni precedenti
// Retrocompatibilità
if (!empty($id_record) || basename($_SERVER['PHP_SELF']) == 'controller.php' || basename($_SERVER['PHP_SELF']) == 'index.php') {
unset($_SESSION['infos']);
unset($_SESSION['errors']);

View File

@ -41,14 +41,20 @@ if (!empty($id_plugin)) {
$type = $element['option'];
// Caricamento helper modulo (verifico se ci sono helper personalizzati)
include_once App::filepath($directory.'|custom|', 'modutil.php');
// Caricamento funzioni del modulo
$modutil = App::filepath($directory.'|custom|', 'modutil.php');
if (!empty($modutil)) {
include_once $modutil;
}
// Lettura risultato query del modulo
// include App::filepath($directory.'|custom|', 'init.php');
// Caricamento file aggiuntivo su elenco record
include App::filepath($directory.'|custom|', 'controller_before.php');
$controller_before = App::filepath($directory.'|custom|', 'controller_before.php');
if (!empty($controller_before)) {
include $controller_before;
}
/*
* Datatables con record
@ -222,4 +228,7 @@ elseif ($type == 'custom') {
}
// Caricamento file aggiuntivo su elenco record
include App::filepath($directory.'|custom|', 'controller_after.php');
$controller_after = App::filepath($directory.'|custom|', 'controller_after.php');
if (!empty($controller_after)) {
include $controller_after;
}

View File

@ -310,29 +310,36 @@ if (Auth::check()) {
<div class="box-body">';
}
// Infomazioni
foreach ($messages['info'] as $value) {
echo '
if (!empty($messages['info'])) {
foreach ($messages['info'] as $value) {
echo '
<div class="alert alert-success push">
<i class="fa fa-check"></i> '.$value.'
</div>';
}
}
// Errori
foreach ($messages['error'] as $value) {
echo '
if (!empty($messages['error'])) {
foreach ($messages['error'] as $value) {
echo '
<div class="alert alert-danger push">
<i class="fa fa-times"></i> '.$value.'
</div>';
}
}
// Avvisi
foreach ($messages['warning'] as $value) {
echo '
if (!empty($messages['warning'])) {
foreach ($messages['warning'] as $value) {
echo '
<div class="alert alert-warning push">
<i class="fa fa-warning"></i>
'.$value.'
</div>';
}
}
if (!Auth::check() && (!empty($messages['info']) || !empty($messages['warning']) || !empty($messages['error']))) {

View File

@ -321,15 +321,21 @@ function translateTemplate()
]);
}
// Compatibilità con le versioni precedenti
foreach ($_SESSION['infos'] as $message) {
App::flash()->info($message);
// Retrocompatibilità
if (!empty($_SESSION['infos'])) {
foreach ($_SESSION['infos'] as $message) {
App::flash()->info($message);
}
}
foreach ($_SESSION['warnings'] as $message) {
App::flash()->warning($message);
if (!empty($_SESSION['warnings'])) {
foreach ($_SESSION['warnings'] as $message) {
App::flash()->warning($message);
}
}
foreach ($_SESSION['errors'] as $message) {
App::flash()->error($message);
if (!empty($_SESSION['errors'])) {
foreach ($_SESSION['errors'] as $message) {
App::flash()->error($message);
}
}
// Annullo le notifiche (AJAX)

View File

@ -6,6 +6,8 @@ function submodules($list, $depth = 1)
$id_module = App::getCurrentModule()['id'];
$result = '';
foreach ($list as $sub) {
// STATO
if (!empty($sub['enabled'])) {

View File

@ -26,7 +26,7 @@ if (!$cliente) {
?>
<form action="" method="post" id="edit-form" >
<fieldset <?php echo (!$record['deleted']) ? '' : 'disabled'; ?> >
<fieldset <?php echo (empty($record['deleted_at'])) ? '' : 'disabled'; ?> >
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
@ -433,7 +433,7 @@ if (setting('Azienda predefinita') == $id_record) {
<div class="alert alert-info text-center">'.tr('Per impostare il logo delle stampe, caricare un file con nome "Logo stampe"').'.</div>';
}
if (!$record['deleted']) {
if (empty($record['deleted_at'])) {
//fatture, ddt, preventivi, contratti, ordini, interventi, utenti collegati a questa anagrafica
$elementi = $dbo->fetchArray('SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento`.`descrizione` AS tipo_documento, `co_tipidocumento`.`dir` FROM `co_documenti` JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` WHERE `co_documenti`.`idanagrafica` = '.prepare($id_record).'

View File

@ -211,7 +211,7 @@ switch (filter('op')) {
App::flash()->error(tr('Errore durante esecuzione query di pianificazione. #'.$idcontratto_riga));
}
} else {
App::flash()->warning(tr('Esiste già un promemoria pianificato per il '.readDate($data_richiesta).'.'));
App::flash()->warning(tr('Esiste già un promemoria pianificato per il '.Translator::dateToLocale($data_richiesta).'.'));
}
}
//fine controllo nuova data richiesta

View File

@ -362,7 +362,7 @@ if ($vista == 'mese') {
$('#select-intreventi-pianificare').change(function(){
var mese = $(this).val();
$.get( '<?php echo $rootdir; ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
$.get( '<?php echo $rootdir; ?>/modules/dashboard/actions.php', { op: 'load_intreventi', mese: mese }, function(data){
$('#interventi-pianificare').html(data);
$('#external-events .fc-event').each(function() {
$(this).draggable({
@ -385,7 +385,7 @@ if ($vista == 'mese') {
$('#select-intreventi-pianificare option[value='+mese+']').attr('selected','selected').trigger('change');
$.get( '<?php echo $rootdir; ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
$.get( '<?php echo $rootdir; ?>/modules/dashboard/actions.php', { op: 'load_intreventi', mese: mese }, function(data){
$('#interventi-pianificare').html(data);
$('#external-events .fc-event').each(function() {
$(this).draggable({
@ -625,7 +625,7 @@ if (Modules::getPermission('Interventi') == 'rw') {
editable: true,
eventDrop: function(event,dayDelta,minuteDelta,revertFunc) {
$.get(globals.rootdir + "/modules/dashboard/ajaxreq.php?op=update_intervento&id="+event.id+"&idintervento="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
$.get(globals.rootdir + "/modules/dashboard/actions.php?op=update_intervento&id="+event.id+"&idintervento="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
if( response=="success" ){
data = $.trim(data);
if( data!="ok" ){
@ -640,7 +640,7 @@ if (Modules::getPermission('Interventi') == 'rw') {
});
},
eventResize: function(event,dayDelta,minuteDelta,revertFunc) {
$.get(globals.rootdir + "/modules/dashboard/ajaxreq.php?op=update_intervento&id="+event.id+"&idintervento="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
$.get(globals.rootdir + "/modules/dashboard/actions.php?op=update_intervento&id="+event.id+"&idintervento="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
if( response=="success" ){
data = $.trim(data);
if(data != "ok"){
@ -663,7 +663,7 @@ if (Modules::getPermission('Interventi') == 'rw') {
if (setting('Utilizzare i tooltip sul calendario') == '1') {
?>
$.get(globals.rootdir + "/modules/dashboard/ajaxreq.php?op=get_more_info&id="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
$.get(globals.rootdir + "/modules/dashboard/actions.php?op=get_more_info&id="+event.idintervento+"&timeStart="+moment(event.start).format("YYYY-MM-DD HH:mm")+"&timeEnd="+moment(event.end).format("YYYY-MM-DD HH:mm"), function(data,response){
if( response=="success" ){
data = $.trim(data);
if( data!="ok" ){
@ -695,7 +695,7 @@ if (setting('Utilizzare i tooltip sul calendario') == '1') {
?>
},
events: {
url: globals.rootdir + "/modules/dashboard/ajaxreq.php?op=get_current_month",
url: globals.rootdir + "/modules/dashboard/actions.php?op=get_current_month",
type: 'GET',
error: function() {
alert('<?php echo tr('Errore durante la creazione degli eventi'); ?>');

View File

@ -23,6 +23,8 @@ class FileManager implements ManagerInterface
$options['showpanel'] = isset($options['showpanel']) ? $options['showpanel'] : true;
$options['label'] = isset($options['label']) ? $options['label'] : tr('Nuovo allegato').':';
$options['id_plugin'] = !empty($options['id_plugin']) ? $options['id_plugin'] : null;
// ID del form
$attachment_id = 'attachments_'.$options['id_module'].'-'.$options['id_plugin'];