Working on email reports

This commit is contained in:
David Bomba 2023-12-11 13:14:05 +11:00
parent 1126c8518f
commit 4c4d18fbe8
4 changed files with 51 additions and 47 deletions

View File

@ -47,7 +47,7 @@ class StoreSchedulerRequest extends Request
'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'], 'parameters.end_date' => ['bail', 'sometimes', 'date:Y-m-d', 'required_if:parameters.date_rate,custom', 'after_or_equal:parameters.start_date'],
'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'], 'parameters.entity' => ['bail', 'sometimes', 'string', 'in:invoice,credit,quote,purchase_order'],
'parameters.entity_id' => ['bail', 'sometimes', 'string'], 'parameters.entity_id' => ['bail', 'sometimes', 'string'],
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,client,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'], 'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
'parameters.date_key' => ['bail','sometimes', 'string'], 'parameters.date_key' => ['bail','sometimes', 'string'],
'parameters.status' => ['bail','sometimes', 'string', 'in:all,draft,paid,unpaid,overdue'], 'parameters.status' => ['bail','sometimes', 'string', 'in:all,draft,paid,unpaid,overdue'],
]; ];
@ -67,6 +67,10 @@ class StoreSchedulerRequest extends Request
$input['frequency_id'] = 0; $input['frequency_id'] = 0;
} }
if(isset($input['parameters']) && isset($input['parameters']['clients'])) {
$input['parameters']['clients'] = [];
}
$this->replace($input); $this->replace($input);
} }
} }

View File

@ -63,6 +63,10 @@ class UpdateSchedulerRequest extends Request
$input['frequency_id'] = 0; $input['frequency_id'] = 0;
} }
if(isset($input['parameters']) && isset($input['parameters']['clients'])) {
$input['parameters']['clients'] = [];
}
$this->replace($input); $this->replace($input);

View File

@ -70,7 +70,7 @@ class EmailReport
'report_keys' => [] 'report_keys' => []
]; ];
if (count($this->scheduler->parameters['clients']) >= 1) { if (isset($this->scheduler->parameters['clients']) && count($this->scheduler->parameters['clients']) >= 1) {
$data['clients'] = $this->transformKeys($this->scheduler->parameters['clients']); $data['clients'] = $this->transformKeys($this->scheduler->parameters['clients']);
} }

86
composer.lock generated
View File

@ -485,16 +485,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.293.5", "version": "3.293.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "f2002e52b382b45231da3f9552033f769acfebd8" "reference": "3bf86ba8b9bbea2b298f89e6f5edc58de276690b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f2002e52b382b45231da3f9552033f769acfebd8", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3bf86ba8b9bbea2b298f89e6f5edc58de276690b",
"reference": "f2002e52b382b45231da3f9552033f769acfebd8", "reference": "3bf86ba8b9bbea2b298f89e6f5edc58de276690b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -574,9 +574,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.293.5" "source": "https://github.com/aws/aws-sdk-php/tree/3.293.7"
}, },
"time": "2023-12-06T19:09:15+00:00" "time": "2023-12-08T19:11:21+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -6576,16 +6576,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.72.0", "version": "2.72.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "a6885fcbad2ec4360b0e200ee0da7d9b7c90786b" "reference": "2b3b3db0a2d0556a177392ff1a3bf5608fa09f78"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a6885fcbad2ec4360b0e200ee0da7d9b7c90786b", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/2b3b3db0a2d0556a177392ff1a3bf5608fa09f78",
"reference": "a6885fcbad2ec4360b0e200ee0da7d9b7c90786b", "reference": "2b3b3db0a2d0556a177392ff1a3bf5608fa09f78",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6679,7 +6679,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-28T10:13:25+00:00" "time": "2023-12-08T23:47:49+00:00"
}, },
{ {
"name": "nette/schema", "name": "nette/schema",
@ -6831,16 +6831,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.17.1", "version": "v4.18.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6881,9 +6881,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0"
}, },
"time": "2023-08-13T19:53:39+00:00" "time": "2023-12-10T21:03:43+00:00"
}, },
{ {
"name": "nunomaduro/termwind", "name": "nunomaduro/termwind",
@ -13841,23 +13841,23 @@
}, },
{ {
"name": "tijsverkoyen/css-to-inline-styles", "name": "tijsverkoyen/css-to-inline-styles",
"version": "2.2.6", "version": "v2.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
"reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c" "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/c42125b83a4fa63b187fdf29f9c93cb7733da30c", "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/83ee6f38df0a63106a9e4536e3060458b74ccedb",
"reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c", "reference": "83ee6f38df0a63106a9e4536e3060458b74ccedb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-libxml": "*", "ext-libxml": "*",
"php": "^5.5 || ^7.0 || ^8.0", "php": "^5.5 || ^7.0 || ^8.0",
"symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0" "symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10" "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10"
@ -13888,9 +13888,9 @@
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"support": { "support": {
"issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues",
"source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.6" "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.2.7"
}, },
"time": "2023-01-03T09:29:04+00:00" "time": "2023-12-08T13:03:43+00:00"
}, },
{ {
"name": "turbo124/beacon", "name": "turbo124/beacon",
@ -15263,16 +15263,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.40.2", "version": "v3.41.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "4344562a516b76afe8f2d64b2e52214c30d64ed8" "reference": "8b6ae8dcbaf23f09680643ab832a4a3a260265f6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/4344562a516b76afe8f2d64b2e52214c30d64ed8", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/8b6ae8dcbaf23f09680643ab832a4a3a260265f6",
"reference": "4344562a516b76afe8f2d64b2e52214c30d64ed8", "reference": "8b6ae8dcbaf23f09680643ab832a4a3a260265f6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15302,8 +15302,6 @@
"php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
"phpspec/prophecy": "^1.17",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^9.6",
"symfony/phpunit-bridge": "^6.3.8 || ^7.0", "symfony/phpunit-bridge": "^6.3.8 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0" "symfony/yaml": "^5.4 || ^6.0 || ^7.0"
@ -15344,7 +15342,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.40.2" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.41.1"
}, },
"funding": [ "funding": [
{ {
@ -15352,7 +15350,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-12-03T09:21:33+00:00" "time": "2023-12-10T19:59:27+00:00"
}, },
{ {
"name": "hamcrest/hamcrest-php", "name": "hamcrest/hamcrest-php",
@ -15633,16 +15631,16 @@
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
"version": "1.6.6", "version": "1.6.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/mockery/mockery.git", "url": "https://github.com/mockery/mockery.git",
"reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06",
"reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15655,9 +15653,7 @@
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8.5 || ^9.6.10", "phpunit/phpunit": "^8.5 || ^9.6.10",
"psalm/plugin-phpunit": "^0.18.4", "symplify/easy-coding-standard": "^12.0.8"
"symplify/easy-coding-standard": "^11.5.0",
"vimeo/psalm": "^4.30"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -15714,7 +15710,7 @@
"security": "https://github.com/mockery/mockery/security/advisories", "security": "https://github.com/mockery/mockery/security/advisories",
"source": "https://github.com/mockery/mockery" "source": "https://github.com/mockery/mockery"
}, },
"time": "2023-08-09T00:03:52+00:00" "time": "2023-12-10T02:24:34+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
@ -16071,16 +16067,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.47", "version": "1.10.48",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39" "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6",
"reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -16129,7 +16125,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-12-01T15:19:17+00:00" "time": "2023-12-08T14:34:28+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",