Skip to content

Commit

Permalink
Merge branch 'master' into aggregations
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Nov 17, 2024
2 parents db49067 + c424667 commit 453643f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
9 changes: 6 additions & 3 deletions code/app/Helpers/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ function allPermissions()
*/
try {
$gas = currentAbsoluteGas();
$gas = $gas->fresh();

if ($gas->multigas) {
$ret['App\Gas']['gas.multi'] = _i('Amministrare la modalità Multi-GAS su questa istanza');
if (isset($gas)) {
$gas = $gas->fresh();

if ($gas->multigas) {
$ret['App\Gas']['gas.multi'] = _i('Amministrare la modalità Multi-GAS su questa istanza');
}
}
}
catch(\Exception $e) {
Expand Down
42 changes: 22 additions & 20 deletions code/app/Jobs/NotifyRemindOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public function __construct($orders_id)
public function handle()
{
$hub = app()->make('GlobalScopeHub');
$gas = $hub->getGasObj();

$aggregate_users = [];

foreach($this->orders_id as $order_id) {
$order = Order::find($order_id);
Expand All @@ -36,26 +33,31 @@ public function handle()
continue;
}

$users = $order->notifiableUsers($gas);
foreach($order->aggregate->gas as $gas) {
$hub->setGas($gas->id);

foreach($users as $user) {
if (isset($aggregate_users[$user->id]) == false) {
$aggregate_users[$user->id] = (object) [
'user' => $user,
'orders' => [],
];
}
$aggregate_users = [];
$users = $order->notifiableUsers($gas);

$aggregate_users[$user->id]->orders[] = $order;
}
}
foreach($users as $user) {
if (isset($aggregate_users[$user->id]) == false) {
$aggregate_users[$user->id] = (object) [
'user' => $user,
'orders' => [],
];
}

foreach($aggregate_users as $auser) {
try {
$auser->user->notify(new RemindOrderNotification($auser->orders));
}
catch(\Exception $e) {
\Log::error('Impossibile inoltrare mail di promemoria ordine: ' . $e->getMessage());
$aggregate_users[$user->id]->orders[] = $order;
}

foreach($aggregate_users as $auser) {
try {
$auser->user->notify(new RemindOrderNotification($auser->orders));
}
catch(\Exception $e) {
\Log::error('Impossibile inoltrare mail di promemoria ordine: ' . $e->getMessage());
}
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion code/resources/views/import/csvmovementsselect.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<th>{{ _i('Data') }}</th>
<th>{{ _i('Utente') }}</th>
<th>{{ _i('Fornitore') }}</th>
<th>{{ _i('Identificativo') }}</th>
<th>{{ _i('Note') }}</th>
<th>
<x-larastrap::select name="type" nprefix="skip" squeeze :options="$types" classes="triggers-all-selects csv_movement_type_select" data-target-class="csv_movement_type_select" />
Expand Down Expand Up @@ -78,6 +79,9 @@
</td>
<td>
<x-larastrap::selectobj name="target_id" npostfix="[]" squeeze :options="$suppliers" :extraitem="_i('Nessuno')" />
</td>
<td>
<x-larastrap::text name="identifier" npostfix="[]" squeeze />
</td>
<td>
<x-larastrap::text name="notes" npostfix="[]" squeeze />
Expand All @@ -91,7 +95,6 @@
<td>
{{ printablePriceCurrency($mov->amount) }}
<x-larastrap::hidden name="amount" npostfix="[]" />
<x-larastrap::hidden name="identifier" npostfix="[]" />
</td>
<td>
<x-larastrap::selectobj name="currency_id" npostfix="[]" squeeze :options="$currencies" classes="csv_movement_currency_select" />
Expand Down

0 comments on commit 453643f

Please sign in to comment.