Skip to content

Commit

Permalink
Merge branch 'master' into invoice_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
madbob committed Jan 25, 2024
2 parents 585de95 + 7a5a7ce commit d347975
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 48 deletions.
7 changes: 6 additions & 1 deletion code/app/Importers/CSV/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function run($request)
$login = $line[$login_index];

$u = $this->retrieveUser($login, $gas);
$new_user = $u->exists == false;
$new_user = ($u->exists == false);

$contacts = [
'contact_id' => [],
Expand All @@ -213,6 +213,11 @@ public function run($request)
else if ($field == 'password') {
if (filled($value)) {
$u->password = Hash::make($value);

if ($new_user == false) {
\Log::debug('Cambio password utente ' . $u->username . ' durante importazione CSV');
}

$password_defined = true;
}
}
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/AfterNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

class AfterNotification
{
public function __construct()
{
//
}

public function handle(NotificationSent $event)
{
if (hasTrait($event->notification, 'App\Notifications\TemporaryFiles')) {
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/AttachToGas.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

class AttachToGas
{
public function __construct()
{
//
}

public function handle(AttachableToGas $event)
{
$user = Auth::user();
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/BookingModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

class BookingModel
{
public function __construct()
{
//
}

public function handle(BookingDeleting $event)
{
if ($event->booking->status == 'shipped')
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/DeliverBooking.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

class DeliverBooking
{
public function __construct()
{
//
}

private function testShipped($event)
{
$booking = $event->booking;
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/HarvestLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@

class HarvestLogs
{
public function __construct()
{
//
}

public function handle(MessageLogged $event)
{
$harvester = App::make('LogHarvester');
Expand Down
13 changes: 13 additions & 0 deletions code/app/Listeners/LogFailedLogin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Listeners;

use Illuminate\Auth\Events\Failed;

class LogFailedLogin
{
public function handle(Failed $event)
{
\Log::debug('Fallito login utente ' . $event->credentials['username']);
}
}
5 changes: 0 additions & 5 deletions code/app/Listeners/ReviewProductVariantCombos.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@

class ReviewProductVariantCombos
{
public function __construct()
{
//
}

public function handle(VariantChanged $event)
{
$product = $event->variant->product;
Expand Down
5 changes: 0 additions & 5 deletions code/app/Listeners/SlugModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

class SlugModel
{
public function __construct()
{
//
}

private function testUnique($class, $id)
{
$index = 1;
Expand Down
2 changes: 1 addition & 1 deletion code/app/Printers/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function formatTableRows($order, $shipping_place, $status, $fields, &$al
foreach($bookings as $booking) {
$row = UserFormatter::format($booking->user, $fields->user_columns);
$subrow = $this->formatBookingInTable($order, $booking, $status, $all_products);
$row += $subrow;
$row = array_merge($row, $subrow);

$price = $booking->getValue($get_total, true);
$total_price += $price;
Expand Down
12 changes: 11 additions & 1 deletion code/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Illuminate\Database\Eloquent\Model;

use Symfony\Component\Mailer\Bridge\Sendinblue\Transport\SendinblueTransportFactory;
use Symfony\Component\Mailer\Bridge\Scaleway\Transport\ScalewayTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;

use App\Category;
Expand All @@ -20,13 +21,22 @@ public function boot()
Schema::defaultStringLength(191);
// Model::preventLazyLoading();

if (env('MAIL_MAILER') == 'sendinblue') {
$mailer = env('MAIL_MAILER');

if ($mailer == 'sendinblue') {
Mail::extend('sendinblue', function () {
return (new SendinblueTransportFactory)->create(
new Dsn('sendinblue+api', 'default', config('services.sendinblue.key'))
);
});
}
else if ($mailer == 'scaleway') {
Mail::extend('scaleway', function () {
return (new ScalewayTransportFactory)->create(
new Dsn('scaleway+api', 'default', config('mail.mailers.scaleway.username'), config('mail.mailers.scaleway.password'))
);
});
}

/*
Questa va usata solo per una Collection di BookedProductVariant,
Expand Down
3 changes: 3 additions & 0 deletions code/app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
'Illuminate\Auth\Events\Failed' => [
'App\Listeners\LogFailedLogin',
],
'App\Events\SluggableCreating' => [
'App\Listeners\SlugModel',
],
Expand Down
7 changes: 5 additions & 2 deletions code/app/Services/UsersService.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ private function setCommonAttributes($user, $request)
private function updatePassword($user, $request)
{
$user->password = Hash::make($request['password']);
\Log::debug('Cambio password utente ' . $user->username);

if (isset($request['enforce_password_change']) && $request['enforce_password_change'] == 'true') {
$user->enforce_password_change = true;
Expand Down Expand Up @@ -144,7 +145,8 @@ private function updateAccessType($id, $request)
if (isset($request['password']) && !empty($request['password'])) {
$user = $this->show($id);

$this->transformAndSetIfSet($user, $request, 'password', function ($password) {
$this->transformAndSetIfSet($user, $request, 'password', function ($password) use ($user) {
\Log::debug('Cambio password utente ' . $user->username);
return Hash::make($password);
});

Expand Down Expand Up @@ -234,7 +236,8 @@ public function update($id, array $request)
}

if (isset($request['password']) && !empty($request['password'])) {
$this->transformAndSetIfSet($user, $request, 'password', function ($password) {
$this->transformAndSetIfSet($user, $request, 'password', function ($password) use ($user) {
\Log::debug('Cambio password utente ' . $user->username);
return Hash::make($password);
});
}
Expand Down
1 change: 1 addition & 0 deletions code/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"spatie/db-dumper": "^3.0",
"symfony/http-client": "^6.2",
"symfony/psr-http-message-bridge": "^2.1",
"symfony/scaleway-mailer": "^7.0",
"symfony/sendinblue-mailer": "^6.2",
"zetacomponents/archive": "dev-master"
},
Expand Down
8 changes: 7 additions & 1 deletion code/config/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

'default' => env('MAIL_MAILER', 'sendinblue'),
'default' => env('MAIL_MAILER', 'scaleway'),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -54,6 +54,12 @@
'transport' => 'sendinblue',
],

'scaleway' => [
'transport' => 'scaleway',
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
],

'mailgun' => [
'transport' => 'mailgun',
],
Expand Down
11 changes: 5 additions & 6 deletions code/resources/views/dates/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
'label' => _i('ID'),
'field' => 'id',
'type' => 'hidden',
'width' => 0
],
[
'label' => _i('Fornitore'),
'field' => 'target_id',
'type' => 'selectobj',
'width' => 2,
'width' => 15,
'extra' => [
'options' => $suppliers
]
Expand All @@ -37,7 +36,7 @@
'label' => _i('Data'),
'field' => 'date',
'type' => 'datepicker',
'width' => 2,
'width' => 20,
'extra' => [
'defaults_now' => true
]
Expand All @@ -46,19 +45,19 @@
'label' => _i('Ricorrenza'),
'field' => 'recurring',
'type' => 'periodic',
'width' => 3,
'width' => 30,
],
[
'label' => _i('Descrizione'),
'field' => 'description',
'type' => 'text',
'width' => 2,
'width' => 20,
],
[
'label' => _i('Tipo'),
'field' => 'type',
'type' => 'select',
'width' => 2,
'width' => 10,
'extra' => [
'options' => App\Date::types()
]
Expand Down
2 changes: 1 addition & 1 deletion code/resources/views/gdxp/json/supplier.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function serializeTransformations($target, $json_target)
];
if (empty($product->picture) == false) {
$p['attachments'] = [
$p->attachments = [
(object) [
'name' => 'Immagine',
'contents' => base64_encode(file_get_contents(gas_storage_path($product->picture))),
Expand Down

0 comments on commit d347975

Please sign in to comment.