Skip to content

Commit 2855ea8

Browse files
committed
fix: salvataggio gruppi utenti
1 parent 190e645 commit 2855ea8

2 files changed

Lines changed: 2 additions & 16 deletions

File tree

modules/utenti/actions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
$group = Group::build($nome, $theme, $id_module_start);
4040
$id_record = $dbo->lastInsertedID();
4141
$group->editable = 1;
42-
$group->setTranslation('title', $nome);
4342
$group->save();
4443

4544
if ($id_module_start) {

src/Traits/RecordTrait.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,11 @@ public function save(array $options = [])
7777
if ($this->id && method_exists($this, 'getTranslatedFields')) {
7878
// Lingue aggiuntive disponibili
7979
$langs = Locale::All()->pluck('id')->toArray();
80-
$default_lang = Locale::getDefault();
81-
$other_langs = array_diff($langs, [$default_lang->id]);
8280

8381
// Popolo inizialmente i campi traducibili o allineo quelli uguali
8482
foreach ($this->getTranslatedFields() as $field) {
85-
$value = $this->name;
86-
83+
$value = $this->name?:$this->nome;
84+
8785
foreach ($langs as $id_lang) {
8886
$translation = database()->table($this->table.'_lang')
8987
->select($field)
@@ -94,17 +92,6 @@ public function save(array $options = [])
9492
if ($translation->count() == 0) {
9593
$this->setTranslation($field, $value, $id_lang);
9694
}
97-
98-
// ...altrimenti la aggiorno se è uguale (quindi probabilmente non ancora tradotta)
99-
/*
100-
else{
101-
if ($translation->first()->{$field} == $this->{$field}) {
102-
$translation->update([
103-
$field => $this->{$field},
104-
]);
105-
}
106-
}
107-
*/
10895
}
10996
}
11097
}

0 commit comments

Comments
 (0)