Correzioni sulla modifica dati allegato

This commit is contained in:
Dasc3er 2021-03-08 09:48:22 +01:00
parent aa75c097c4
commit c60b5d0bd9
3 changed files with 17 additions and 2 deletions

View File

@ -35,7 +35,7 @@ echo '
</div>
<div class="col-md-6">
{[ "type": "text", "label": "'.tr('Categoria').'", "name": "categoria_allegato", "value": "'.$allegato->category.'" ]}
{[ "type": "text", "label": "'.tr('Categoria').'", "name": "categoria_allegato", "value": "'.$allegato->category.'", "disabled": "'.intval(in_array($allegato->category, ['Fattura Elettronica'])).'" ]}
</div>
</div>

View File

@ -83,7 +83,7 @@ class FileManager implements ManagerInterface
<div class="box-tools pull-right">';
if (!empty($category)) {
if (!empty($category) && !in_array($category, ['Fattura Elettronica'])) {
$result .= '
<button type="button" class="btn btn-box-tool category-save hide">
<i class="fa fa-check"></i>

View File

@ -32,11 +32,26 @@ class Upload extends Model
protected $file_info;
/**
* @return mixed|string
*/
public function getCategoryAttribute()
{
return $this->attributes['category'] ?: 'Generale';
}
/**
* @param $value
*/
public function setCategoryAttribute($value)
{
if ($value == 'Generale' || $value == ''){
$value = null;
}
$this->attributes['category'] = $value;;
}
/**
* Crea un nuovo upload.
*