Compare commits

..

No commits in common. "5ba6404b846c0cc219522f53ec15e0b60125990b" and "6f0cc5916230949d110eb878566f8d1983c64273" have entirely different histories.

13 changed files with 59 additions and 50 deletions

View file

@ -1,9 +1,3 @@
0.9.0
* Display a localized warning on Customers without a Mailbox.
* Drop the (not working) ability to link a Customer to multiple Mailboxes.
* Improve routes overrides.
0.8.1 0.8.1
* Fix filtering by Mailbox when getting Customers for a non-admin User. * Fix filtering by Mailbox when getting Customers for a non-admin User.

View file

@ -1,8 +1,4 @@
<?php <?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
return [ return [
'name' => 'MMFRestrictedCustomers' 'name' => 'MMFRestrictedCustomers'

View file

@ -68,7 +68,7 @@ class CrmController extends BaseCrmController {
} }
if ($fail || $validator->fails()) { if ($fail || $validator->fails()) {
return redirect()->route('crm.create_customer') return redirect()->route('mmfrestrictedcustomers.create_customer')
->withErrors($validator) ->withErrors($validator)
->withInput(); ->withInput();
} }

View file

@ -14,8 +14,10 @@ Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'na
Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax'); Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax');
// Crm module // Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() { Route::group([ 'roles' => ['user', 'admin'] ], function() {
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('crm.create_customer'); Route::get('/customers/new', CrmController::class . '@createCustomer')->name('mmfrestrictedcustomers.create_customer');
Route::post('/customers/new', CrmController::class . '@createCustomerSave'); Route::post('/customers/new', CrmController::class . '@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => CrmController::class . '@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => CrmController::class . '@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => CrmController::class . '@ajax', 'laroute' => true])->name('crm.ajax'); Route::post('/crm/ajax', ['uses' => CrmController::class . '@ajax', 'laroute' => true])->name('crm.ajax');
}); });
}); });

View file

@ -1,8 +1,4 @@
<?php <?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace Modules\MMFRestrictedCustomers\Providers; namespace Modules\MMFRestrictedCustomers\Providers;
@ -28,7 +24,7 @@ class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
public function boot() { public function boot() {
$this->registerConfig(); $this->registerConfig();
$this->registerViews(); $this->registerViews();
$this->registerTranslations(); $this->registerFactories();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations'); $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->commands([ $this->commands([
FetchEmails::class, FetchEmails::class,
@ -120,7 +116,7 @@ class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
* @return void * @return void
*/ */
public function registerTranslations() { public function registerTranslations() {
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'mmfrestrictedcustomers'); $this->loadJsonTranslationsFrom(__DIR__ .'/../Resources/lang');
} }
/** /**

View file

@ -37,11 +37,11 @@ You have been warned.
Download the [release tarball] and extract its content into `Modules/MMFRestrictedCustomers`. Download the [release tarball] and extract its content into `Modules/MMFRestrictedCustomers`.
[release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.9.0.tar.gz [release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.8.1.tar.gz
``` ```
wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.9.0.tar.gz -O freescout-restricted-customers-0.9.0.tar.gz wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.8.1.tar.gz -O freescout-restricted-customers-0.8.1.tar.gz
tar xf freescout-restricted-customers-0.9.0.tar.gz -C Modules tar xf freescout-restricted-customers-0.8.1.tar.gz -C Modules
mv Modules/freescout-restricted-customers Modules/MMFRestrictedCustomers mv Modules/freescout-restricted-customers Modules/MMFRestrictedCustomers
``` ```
@ -53,8 +53,8 @@ git clone https://port.numenaute.org/MMF/freescout-restricted-customers.git Modu
### Edit the application routes ### Edit the application routes
Routes set in Freescout itself can not be automatically overridden. Routes set in other modules or in Freescout itself can not be automatically overridden.
Overriding them has to be done manually, in the following file: Overriding them has to be done manually, in the three following files.
#### routes/web.php #### routes/web.php
@ -80,6 +80,48 @@ Route::get('/customers/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers
Route::post('/customers/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax'); Route::post('/customers/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
``` ```
#### Modules/Crm/Http/routes.php
The following list of routes:
```php
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\Crm\Http\Controllers'], function()
{
Route::get('/customers/new', 'CrmController@createCustomer')->name('crm.create_customer');
Route::post('/customers/new', 'CrmController@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => 'CrmController@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => 'CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => 'CrmController@ajax', 'laroute' => true])->name('crm.ajax');
});
```
should be replaced with:
```php
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\MMFRestrictedCustomers\Http\Controllers'], function()
{
Route::get('/customers/new', 'CrmController@createCustomer')->name('mmfrestrictedcustomers.create_customer');
Route::post('/customers/new', 'CrmController@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\Modules\Crm\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => 'CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => 'CrmController@ajax', 'laroute' => true])->name('crm.ajax');
});
```
#### Modules/Crm/Providers/CrmServiceProvider.php
At line 173, this route call:
```php
$html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('crm.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>';
```
should be replaced with:
```php
$html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('mmfrestrictedcustomers.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>';
```
### Edit the artisan commands ### Edit the artisan commands
Console commands set in other modules or in Freescout itself can not be automatically overridden. Console commands set in other modules or in Freescout itself can not be automatically overridden.

View file

@ -1,9 +0,0 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
return [
'no-mailbox' => 'Warning: no mailbox.',
];

View file

@ -1,9 +0,0 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
return [
'no-mailbox' => 'Attention: pas de boîte mail liée.',
];

View file

@ -6,7 +6,7 @@
<a href="{{ Eventy::filter('customer.card.url', route('customers.update', ['id' => $customer->id]), $customer) }}" class="card hover-shade" @action('customer.card.link', $customer) > <a href="{{ Eventy::filter('customer.card.url', route('customers.update', ['id' => $customer->id]), $customer) }}" class="card hover-shade" @action('customer.card.link', $customer) >
<img src="{{ $customer->getPhotoUrl() }}" /> <img src="{{ $customer->getPhotoUrl() }}" />
@if ($customer->mailbox_id == null) @if ($customer->mailbox_id == null)
<p style="font-size:12px; color: red;">{{ __('mmfrestrictedcustomers::customers.no-mailbox') }}</p> <p style="font-size:12px; color: red;">{{ __('Warning: no mailbox') }}</p>
@endif @endif
<h4 title="{{ $customer->first_name }} {{ $customer->last_name }}">{{ $customer->first_name }} {{ $customer->last_name }}</h4> <h4 title="{{ $customer->first_name }} {{ $customer->last_name }}">{{ $customer->first_name }} {{ $customer->last_name }}</h4>
<p class="text-truncate"><small>{{ $customer->getEmailOrPhone() }}</small></p> <p class="text-truncate"><small>{{ $customer->getEmailOrPhone() }}</small></p>

View file

@ -34,6 +34,7 @@
</div> </div>
</div> </div>
</div> </div>
<p class="block-help"><a href="#" class="multi-add" tabindex="-1">{{ __('Add a mailbox') }}</a></p>
</div> </div>
@include('partials/field_error', ['field'=>'mailbox']) @include('partials/field_error', ['field'=>'mailbox'])
</div> </div>

View file

@ -1,7 +1,7 @@
{ {
"name": "millions-missing-france/freescout-restricted-customers", "name": "millions-missing-france/freescout-restricted-customers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes", "description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.9.0", "version": "0.8.1",
"type": "library", "type": "library",
"license": ["AGPL-3.0-only"], "license": ["AGPL-3.0-only"],
"authors": [ "authors": [

View file

@ -2,7 +2,7 @@
"name": "MMFRestrictedCustomers", "name": "MMFRestrictedCustomers",
"alias": "mmfrestrictedcustomers", "alias": "mmfrestrictedcustomers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes", "description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.9.0", "version": "0.8.1",
"detailsUrl": "", "detailsUrl": "",
"author": "Millions Missing FRANCE", "author": "Millions Missing FRANCE",
"authorUrl": "info@millionsmissing.fr", "authorUrl": "info@millionsmissing.fr",
@ -10,7 +10,7 @@
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"keywords": [], "keywords": [],
"active": 0, "active": 0,
"order": 1, "order": 0,
"providers": [ "providers": [
"Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider" "Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider"
], ],

View file

@ -1,8 +1,4 @@
<?php <?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -17,5 +13,5 @@
*/ */
if (!app()->routesAreCached()) { if (!app()->routesAreCached()) {
require __DIR__ . '/Http/routes.php'; require __DIR__ . '/Http/routes.php';
} }