mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:34:33 -04:00
Add statement date range to the statement
This commit is contained in:
parent
b7a49b97cd
commit
9628580be0
@ -91,6 +91,10 @@ class ActivityController extends BaseController
|
|||||||
->take($default_activities);
|
->take($default_activities);
|
||||||
|
|
||||||
if ($request->has('react')) {
|
if ($request->has('react')) {
|
||||||
|
|
||||||
|
if(!auth()->user()->isAdmin())
|
||||||
|
return response()->json(['data' => []], 200);
|
||||||
|
|
||||||
$system = ctrans('texts.system');
|
$system = ctrans('texts.system');
|
||||||
|
|
||||||
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
$data = $activities->cursor()->map(function ($activity) use ($system) {
|
||||||
|
@ -16,6 +16,7 @@ use App\Factory\BankTransactionRuleFactory;
|
|||||||
use App\Filters\BankTransactionFilters;
|
use App\Filters\BankTransactionFilters;
|
||||||
use App\Filters\BankTransactionRuleFilters;
|
use App\Filters\BankTransactionRuleFilters;
|
||||||
use App\Helpers\Bank\Yodlee\Yodlee;
|
use App\Helpers\Bank\Yodlee\Yodlee;
|
||||||
|
use App\Http\Requests\BankTransactionRule\BulkBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\CreateBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\CreateBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\DestroyBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\DestroyBankTransactionRuleRequest;
|
||||||
use App\Http\Requests\BankTransactionRule\EditBankTransactionRuleRequest;
|
use App\Http\Requests\BankTransactionRule\EditBankTransactionRuleRequest;
|
||||||
@ -472,25 +473,21 @@ class BankTransactionRuleController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function bulk()
|
public function bulk(BulkBankTransactionRuleRequest $request)
|
||||||
{
|
{
|
||||||
$action = request()->input('action');
|
$action = $request->input('action');
|
||||||
|
|
||||||
if(!in_array($action, ['archive', 'restore', 'delete']))
|
$ids = $request->input('ids');
|
||||||
return response()->json(['message' => 'Unsupported action.'], 400);
|
|
||||||
|
|
||||||
$ids = request()->input('ids');
|
|
||||||
|
|
||||||
$bank_transaction_rules = BankTransactionRule::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
|
$bank_transaction_rules = BankTransactionRule::withTrashed()
|
||||||
|
->whereIn('id', $this->transformKeys($ids))
|
||||||
$bank_transaction_rules->each(function ($bank_transaction_rule, $key) use ($action) {
|
->company()
|
||||||
if (auth()->user()->can('edit', $bank_transaction_rule)) {
|
->cursor()
|
||||||
$this->bank_transaction_repo->{$action}($bank_transaction_rule);
|
->each(function ($bank_transaction_rule, $key) use ($action) {
|
||||||
}
|
$this->bank_transaction_repo->{$action}($bank_transaction_rule);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Need to understand which permission are required for the given bulk action ie. view / edit */
|
/* Need to understand which permission are required for the given bulk action ie. view / edit */
|
||||||
|
|
||||||
return $this->listResponse(BankTransactionRule::withTrashed()->whereIn('id', $this->transformKeys($ids))->company());
|
return $this->listResponse(BankTransactionRule::withTrashed()->whereIn('id', $this->transformKeys($ids))->company());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ class ShowActivityRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('view', Activity::class);
|
return auth()->user()->isAdmin();
|
||||||
|
// return auth()->user()->can('view', Activity::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Requests\BankTransactionRule;
|
||||||
|
|
||||||
|
use App\Http\Requests\Request;
|
||||||
|
|
||||||
|
class BulkBankTransactionRuleRequest extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize() : bool
|
||||||
|
{
|
||||||
|
return auth()->user()->isAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ids' => 'required|bail|array',
|
||||||
|
'action' => 'in:archive,restore,delete'
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -280,8 +280,10 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
if ($this->type === 'statement') {
|
if ($this->type === 'statement') {
|
||||||
|
|
||||||
$s_date = $this->translateDate(now(), $this->client->date_format(), $this->client->locale());
|
// $s_date = $this->translateDate(now(), $this->client->date_format(), $this->client->locale());
|
||||||
|
|
||||||
|
$s_date = $this->translateDate($this->options['start_date'], $this->client->date_format(), $this->client->locale()) . " - " . $this->translateDate($this->options['end_date'], $this->client->date_format(), $this->client->locale());
|
||||||
|
|
||||||
return [
|
return [
|
||||||
['element' => 'tr', 'properties' => ['data-ref' => 'statement-label'], 'elements' => [
|
['element' => 'tr', 'properties' => ['data-ref' => 'statement-label'], 'elements' => [
|
||||||
['element' => 'th', 'properties' => [], 'content' => ""],
|
['element' => 'th', 'properties' => [], 'content' => ""],
|
||||||
|
@ -45,4 +45,15 @@ class ActivityApiTest extends TestCase
|
|||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testActivityGetWithReact()
|
||||||
|
{
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->get('/api/v1/activities?react=true');
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,44 @@ class BankTransactionRuleTest extends TestCase
|
|||||||
$this->withoutExceptionHandling();
|
$this->withoutExceptionHandling();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testBankRuleBulkActions()
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'action' => 'archive',
|
||||||
|
'ids' => [$this->bank_transaction_rule]
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/bank_transaction_rules/bulk', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'ids' => [$this->bank_transaction_rule->hashed_id],
|
||||||
|
'action' => 'restore'
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/bank_transaction_rules/bulk', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'ids' => [$this->bank_transaction_rule->hashed_id],
|
||||||
|
'action' => 'delete'
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/bank_transaction_rules/bulk', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testValidationContainsRule()
|
public function testValidationContainsRule()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ class BankTransactionTest extends TestCase
|
|||||||
])->post('/api/v1/bank_transactions/bulk', $data)
|
])->post('/api/v1/bank_transactions/bulk', $data)
|
||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'ids' => [$this->bank_integration->hashed_id],
|
'ids' => [$this->bank_integration->hashed_id],
|
||||||
'action' => 'delete'
|
'action' => 'delete'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user