Commit Graph

48 Commits

Author SHA1 Message Date
David Bomba 6e35257e9d Updated task validation 2025-11-26 17:09:05 +11:00
David Bomba ae4bee9e2c Fixes for task validation 2025-11-26 16:56:50 +11:00
David Bomba 8a169c4774 fix: Improve time_log validation to detect and reject invalid formats
Problem:
Users were sending time_log data as associative arrays with keys
like 'start_time', 'end_time', 'date', 'billable' instead of the
expected flat array format [int, int, string, bool].

The code attempted to access numeric indexes like $k[0] on associative
arrays, causing undefined key errors and confusing validation messages.

Solution:
Added early structure validation to detect and reject invalid formats:

1. Check if entry is an array
2. Detect associative arrays (has string keys)
3. Ensure numeric indexes [0] and [1] exist before type checking
4. Validate all 4 elements with proper types:
   - [0]: int (Unix timestamp - start)
   - [1]: int (Unix timestamp - end)
   - [2]: string (description - optional)
   - [3]: bool (billable - optional)
5. Improved error messages that clearly explain expected format

Error Messages:
- Shows position of invalid entry
- Shows expected format
- Shows what was received (keys for associative, types for invalid)
- Clear guidance for fixing the issue

Example Error:
"Time log entry at position 0 uses invalid format. Expected:
[unix_start, unix_end, description, billable]. Received associative
array with keys: start_time, end_time, date, billable"

Files modified:
- app/Http/Requests/Task/StoreTaskRequest.php
- app/Http/Requests/Task/UpdateTaskRequest.php
2025-11-26 05:26:55 +00:00
David Bomba 2ed4beb6e2 Fixes for invoicing projects from react where custom values are not passed across to the invoice 2025-08-26 20:33:52 +10:00
David Bomba 0c7c23a662 Add filter for irregular task time_log shapes 2025-08-24 19:30:14 +10:00
David Bomba 890aee5f97 Fixes for tests 2025-07-01 15:35:28 +10:00
David Bomba 7e286283c1 Check data script for tasks 2025-07-01 15:12:52 +10:00
David Bomba 7c9a86267c Additional validation rules for tasks 2025-07-01 11:52:20 +10:00
David Bomba 0d96e989f5 Refactor for document / file validation 2025-04-26 10:15:23 +10:00
David Bomba 780dda4957 Updated copyright doc blocks 2025-02-17 11:11:38 +11:00
David Bomba 552d596eae Style fixes 2024-11-20 11:15:49 +11:00
David Bomba d22c9a3bd9 Static analysis 2024-07-11 15:53:18 +10:00
David Bomba 72aadc0c16 php-cs-fixer 2024-06-14 17:09:44 +10:00
David Bomba 56fc585828 Fixes for validation 2024-04-19 14:26:15 +10:00
David Bomba f65567a637 Update copyright 2024-04-12 14:15:41 +10:00
David Bomba 08eb30785d Add .env var for extensions 2024-03-19 10:46:57 +11:00
David Bomba a5fd1dc5ea Improvements for validation 2024-02-17 05:57:15 +11:00
David Bomba 40086db271 cs fixer 2024-01-14 15:05:00 +11:00
David Bomba b2b8494971 Add columns for tasks 2023-11-27 21:26:56 +11:00
David Bomba f7340d6114 PHP CS Fixer 2023-11-26 18:41:42 +11:00
David Bomba 60e7460a3f Merge v5-dev 2023-11-14 08:59:42 +11:00
David Bomba 3b4ff74c1a Fixes for v5-dev merge 2023-11-13 15:50:08 +11:00
David Bomba 4cbf10096b Updates for task time log parsing 2023-11-10 10:09:27 +11:00
David Bomba 33585c65c4 php cs fixes 2023-10-26 13:57:44 +11:00
David Bomba 184adcad8f Return 2023-10-25 20:44:34 +11:00
David Bomba bc0690fafc Fixes for time log validation 2023-10-25 20:41:03 +11:00
David Bomba b9457d72e2 Working on conversion of quotes to projects 2023-09-07 14:51:42 +10:00
David Bomba a368daac09 Fixes for task status id set on creation 2023-09-07 14:20:32 +10:00
David Bomba 3081907cad Additional logic for task validation 2023-06-22 11:54:11 +10:00
David Bomba 5a42b89d55 cs fixer 2023-03-18 18:24:56 +11:00
David Bomba 6e983cb506 update upload mime checks 2023-02-27 20:12:59 +11:00
David Bomba 4babfbb651 php-cs-fixer 2023-02-16 12:36:09 +11:00
David Bomba ebf99689d1 Add checks for time logs 2023-02-08 10:59:36 +11:00
David Bomba 6c86d7151a Update copyright year 2023-01-29 09:21:40 +11:00
= 77d489211e Fixes for task requests 2022-08-22 07:53:15 +10:00
David Bomba e1fd87d174 Add validation for task time logs 2022-08-18 13:29:18 +10:00
David Bomba 3e916e0f1f Fixes for tests 2022-06-24 11:55:41 +10:00
Shift 19080933b6
Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions.

You may customize the code style applied by adding a [PHP CS Fixer][1] or [PHP CodeSniffer][2] ruleset to your project root. Feel free to use [Shift's Laravel ruleset][3] to help you get started.

For more information on customizing the code style applied by Shift, [watch this short video][4].

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://github.com/squizlabs/PHP_CodeSniffer
[3]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
[4]: https://laravelshift.com/videos/shift-code-style
2022-06-21 09:57:17 +00:00
David Bomba 6f491dfb92 Update Copyright text 2022-04-27 13:20:41 +10:00
David Bomba 36f6cbbcc9 Update license in codebase 2021-06-16 16:58:16 +10:00
David Bomba 934610a01c Update copyright + version bump + set canadian dollar symbol to $ 2021-01-04 08:54:54 +11:00
Benjamin Beganović ae88d5e08e php-cs-fixer format 2020-11-25 15:19:52 +01:00
David Bomba ae44b9c032 Version bump + linking tasks expenses with invoices 2020-11-01 18:53:43 +11:00
David Bomba e455ec47e6 Fixes for unique task number " 2020-10-30 22:47:12 +11:00
David Bomba 8cf55010c6 Fixes for tasks 2020-10-29 20:56:37 +11:00
David Bomba c1c8b6c14e Change start_time datatype 2020-10-29 20:40:13 +11:00
David Bomba 1b2922b57c credit payment type 2020-10-26 11:58:08 +11:00
David Bomba 71535c0e41 Add tasks to API 2020-10-13 07:42:02 +11:00