Просмотр исходного кода

+ aggiunta validazione campi email iserimento entrata con ricevuta

ferrari 3 месяцев назад
Родитель
Сommit
b10fd0d185
1 измененных файлов с 12 добавлено и 21 удалено
  1. 12 21
      app/Http/Livewire/RecordIN.php

+ 12 - 21
app/Http/Livewire/RecordIN.php

@@ -957,22 +957,18 @@ class RecordIN extends Component
 
             Log::info("Final amount saved to record: " . $totalNet);
 
-            $receipt_created = true;
             if (!$this->financial_movement) {
                 $payment_method = \App\Models\PaymentMethod::findOrFail($this->payment_method_id);
                 if (!$payment_method->money) {
                     if ($generate && !$no_receipt_causal)
-                        $receipt_created = $this->createReceipt();
+                        $this->createReceipt();
                 }
             }
-
-            if ($receipt_created) {
-                session()->flash('success', 'Movimento aggiornato');
-                $this->resetFields();
-                $this->update = false;
-                $this->isDuplicate = false;
-                $this->emit('setEdit', false);
-            }
+            session()->flash('success', 'Movimento aggiornato');
+            $this->resetFields();
+            $this->update = false;
+            $this->isDuplicate = false;
+            $this->emit('setEdit', false);
         } catch (\Exception $ex) {
             Log::error("Error in update method: " . $ex->getMessage());
             Log::error("Stack trace: " . $ex->getTraceAsString());
@@ -1001,16 +997,13 @@ class RecordIN extends Component
 
             $this->dataId = $newRecord->id;
 
+            $this->createReceipt();
 
-            $receipt_created = $this->createReceipt();
-
-            if ($receipt_created) {
-                session()->flash('success', 'Movimento aggiornato');
-                $this->resetFields();
-                $this->update = false;
-                $this->isDuplicate = false;
-                $this->emit('setEdit', false);
-            }
+            session()->flash('success', 'Movimento aggiornato');
+            $this->resetFields();
+            $this->update = false;
+            $this->isDuplicate = false;
+            $this->emit('setEdit', false);
         } catch (\Exception $ex) {
             session()->flash('error', 'Errore (' . $ex->getMessage() . ')');
         }
@@ -1212,8 +1205,6 @@ class RecordIN extends Component
                 $this->emit('showReceipt', $this->currentReceip->id);
             }
         }
-
-        return true;
     }
 
     public function removeReceipt()