Compare commits

..

5 commits

Author SHA1 Message Date
5ba6404b84
0.9.0 release
* Display a localized warning on Customers without a Mailbox.
* Drop the (not working) ability to link a Customer to multiple Mailboxes.
* Improve routes overrides.
2024-07-12 13:01:37 +02:00
c8f0b46a3c
Improve routes overrides 2024-07-12 12:58:38 +02:00
de14ec8221
Add missing copyright statements 2024-07-12 12:36:00 +02:00
1600b9bef2
Drop the ability to link a Customer to multiple Mailboxes
This should not have been included in the edit form, the backend has no support for that yet.
2024-07-12 12:33:28 +02:00
30552e58a5
Add localizations in Customers list view 2024-07-12 12:31:57 +02:00
13 changed files with 50 additions and 59 deletions

View file

@ -1,3 +1,9 @@
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
* Fix filtering by Mailbox when getting Customers for a non-admin User.

View file

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

View file

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

View file

@ -14,10 +14,8 @@ Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'na
Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax');
// Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() {
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('mmfrestrictedcustomers.create_customer');
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('crm.create_customer');
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');
});
});

View file

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

View file

@ -37,11 +37,11 @@ You have been warned.
Download the [release tarball] and extract its content into `Modules/MMFRestrictedCustomers`.
[release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.8.1.tar.gz
[release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/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.8.1.tar.gz -C Modules
wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/0.9.0.tar.gz -O freescout-restricted-customers-0.9.0.tar.gz
tar xf freescout-restricted-customers-0.9.0.tar.gz -C Modules
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
Routes set in other modules or in Freescout itself can not be automatically overridden.
Overriding them has to be done manually, in the three following files.
Routes set in Freescout itself can not be automatically overridden.
Overriding them has to be done manually, in the following file:
#### routes/web.php
@ -80,48 +80,6 @@ Route::get('/customers/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers
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
Console commands set in other modules or in Freescout itself can not be automatically overridden.

View file

@ -0,0 +1,9 @@
<?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

@ -0,0 +1,9 @@
<?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) >
<img src="{{ $customer->getPhotoUrl() }}" />
@if ($customer->mailbox_id == null)
<p style="font-size:12px; color: red;">{{ __('Warning: no mailbox') }}</p>
<p style="font-size:12px; color: red;">{{ __('mmfrestrictedcustomers::customers.no-mailbox') }}</p>
@endif
<h4 title="{{ $customer->first_name }} {{ $customer->last_name }}">{{ $customer->first_name }} {{ $customer->last_name }}</h4>
<p class="text-truncate"><small>{{ $customer->getEmailOrPhone() }}</small></p>

View file

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

View file

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

View file

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

View file

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