Skip to content

Commit

Permalink
Fix upload allegati
Browse files Browse the repository at this point in the history
  • Loading branch information
Pek5892 committed Apr 5, 2024
1 parent 2d03b1b commit 60282b2
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/modifica_allegato.php
Expand Up @@ -33,7 +33,7 @@
$allegato = Upload::find($id_allegati[0]);
echo '
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome_allegato", "value": "'.$allegato->getTranslation('name').'" ]}
{[ "type": "text", "label": "'.tr('Nome').'", "name": "nome_allegato", "value": "'.$allegato->name.'" ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Categoria').'", "name": "categoria_allegato", "value": "'.$allegato->category.'", "disabled": "'.intval(in_array($allegato->category, ['Fattura Elettronica'])).'" ]}
Expand Down
6 changes: 5 additions & 1 deletion modules/adattatori_archiviazione/actions.php
Expand Up @@ -40,7 +40,11 @@
$adapter->name = post('name');
$adapter->class = '\\Modules\\FileAdapters\\Adapters\\'.post('class');
$adapter->options = post('options');
$adapter->is_default = post('is_default');

if (post('is_default') == 1) {
$dbo->query('UPDATE `zz_storage_adapters` SET `is_default` = 0');
$adapter->is_default = post('is_default');
}

$adapter->save();

Expand Down
2 changes: 1 addition & 1 deletion modules/adattatori_archiviazione/edit.php
Expand Up @@ -34,7 +34,7 @@
</div>

<div class="col-md-2">
{[ "type": "checkbox", "label": "<?php echo tr('Predefinito'); ?>", "name": "is_default", "value": "$is_default$" ]}
{[ "type": "checkbox", "label": "<?php echo tr('Predefinito'); ?>", "name": "is_default", "value": "$is_default$", "extra": "<?php echo $record['is_default'] == 1 ? 'readonly' : ''; ?>" ]}
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion modules/anagrafiche/actions.php
Expand Up @@ -348,7 +348,7 @@

// Operazioni aggiuntive per il logo e filigrana stampe
if (filter('op') == 'aggiungi-allegato' || filter('op') == 'modifica-allegato') {
$nome = $upload->getTranslation('name');
$nome = $upload->name;

$logo_stampe = ['logo stampe', 'logo_stampe', 'logo stampe.jpg', 'logo stampe.png'];
if (in_array(strtolower($nome), $logo_stampe)) {
Expand Down
12 changes: 12 additions & 0 deletions update/2_5_1.php
@@ -0,0 +1,12 @@
<?php

use Modules\FileAdapters\FileAdapter;

include __DIR__.'/core.php';
// Imposto l'adattatore locale di default se non definito
$default = FileAdapter::where('is_default', 1)->first();
if (empty($default)) {
$adapter = FileAdapter::where('name', 'Adattatore locale')->first();
$adapter->is_default = 1;
$adapter->save();
}

0 comments on commit 60282b2

Please sign in to comment.