diff --git a/.htaccess b/.htaccess index b239481..a1614a0 100644 --- a/.htaccess +++ b/.htaccess @@ -22,7 +22,7 @@ RewriteCond %{REQUEST_URI} !^(.*)/resources/(.*) [NC] RewriteCond %{REQUEST_URI} !^(.*)/images/(.*) [NC] RewriteCond %{REQUEST_URI} !^(.*)/posters_images/(.*) [NC] RewriteCond %{REQUEST_URI} !^(.*)/upload/(.*) [NC] -RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [L] +RewriteRule ^([^/]*)/([^/]*)/(.*)$ index.php?module=$1&action=$2&$3 [QSA,L] RewriteRule ^logowanie$ index.php?module=users&action=login_form [L] RewriteRule ^finances/tags.json$ index.php?module=finances&action=tags_json [L] \ No newline at end of file diff --git a/.serena/.gitignore b/.serena/.gitignore new file mode 100644 index 0000000..14d86ad --- /dev/null +++ b/.serena/.gitignore @@ -0,0 +1 @@ +/cache diff --git a/.serena/memories/project_overview.md b/.serena/memories/project_overview.md new file mode 100644 index 0000000..7a87b7d --- /dev/null +++ b/.serena/memories/project_overview.md @@ -0,0 +1,26 @@ +# CRM PRO - Project Overview + +## Purpose +Polish-language CRM for task/project management, client management, finances, work time tracking. + +## Tech Stack +- PHP 7.4, MySQL, Bootstrap 3, jQuery 3.6, PHP templating +- Medoo query builder ($mdb global), RedBean ORM (\R) +- SCSS compiled via VS Code Live Sass Compile + +## Architecture +Layered with ongoing DDD migration: +- `autoload/Controllers/` - new PSR-4, camelCase (TasksController, UsersController, CrmController, FinancesController) +- `autoload/controls/` - legacy snake_case (Site, Users, Wiki, Projects, Tasks, Cron) +- `autoload/factory/` - data access (legacy) +- `autoload/Domain/` - new repositories (Tasks/, Crm/, Finances/, Users/) +- `templates/` - PHP templates via \Tpl::view() + +## Routing +`controls\Site::route()` reads `?module=&action=` params, tries `\Controllers\{Module}Controller::{camelCase}()` first, falls back to `\controls\{Module}::{snake_case}()`. + +## Modules +tasks, projects, work_time, finances, crm, wiki, users, zaplecze + +## Current Permissions +Hardcoded in `controls\Users::permissions()` - array per user ID with module booleans. Returns true by default if no entry found. diff --git a/.serena/memories/style_conventions.md b/.serena/memories/style_conventions.md new file mode 100644 index 0000000..8a6bcf8 --- /dev/null +++ b/.serena/memories/style_conventions.md @@ -0,0 +1,18 @@ +# Code Style & Conventions + +## PHP +- PHP 7.4 compatibility required +- New controllers: `Controllers\{Module}Controller` with camelCase methods +- New domain: `Domain\{Module}\{Name}Repository` with constructor-injected $mdb +- Legacy: `controls\{Module}` and `factory\{Module}` with snake_case +- Templates via `\Tpl::view('module/template', $data_array)` +- XSS protection via `\Tpl::secureHTML()` +- UI language: Polish + +## File Naming +- New: `ClassName.php` +- Legacy: `class.ClassName.php` + +## Spacing Style (from existing code) +- Spaces inside brackets: `$arr[ 'key' ]`, `func( $arg )` +- Allman-ish brace style with opening brace on same line diff --git a/.serena/memories/suggested_commands.md b/.serena/memories/suggested_commands.md new file mode 100644 index 0000000..ac440d2 --- /dev/null +++ b/.serena/memories/suggested_commands.md @@ -0,0 +1,21 @@ +# Suggested Commands + +## Testing +```bash +php tests/run.php +``` + +## Entry Points +- Web: `index.php` (routes via ?module=&action=) +- AJAX: `ajax.php` +- REST API: `api.php` +- Cron: `cron.php` + +## SCSS +Compiled via VS Code Live Sass Compile extension (layout/style.scss -> layout/style.css) + +## Git +Standard git commands (bash shell on Windows) + +## Utils +Use Unix-style commands in bash shell (ls, cat, grep, find, etc.) diff --git a/.serena/project.yml b/.serena/project.yml new file mode 100644 index 0000000..ed0db3e --- /dev/null +++ b/.serena/project.yml @@ -0,0 +1,127 @@ +# the name by which the project can be referenced within Serena +project_name: "crmPRO" + + +# list of languages for which language servers are started; choose from: +# al bash clojure cpp csharp +# csharp_omnisharp dart elixir elm erlang +# fortran fsharp go groovy haskell +# java julia kotlin lua markdown +# matlab nix pascal perl php +# php_phpactor powershell python python_jedi r +# rego ruby ruby_solargraph rust scala +# swift terraform toml typescript typescript_vts +# vue yaml zig +# (This list may be outdated. For the current list, see values of Language enum here: +# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py +# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.) +# Note: +# - For C, use cpp +# - For JavaScript, use typescript +# - For Free Pascal/Lazarus, use pascal +# Special requirements: +# Some languages require additional setup/installations. +# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers +# When using multiple languages, the first language server that supports a given file will be used for that file. +# The first language is the default language and the respective language server will be used as a fallback. +# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored. +languages: +- typescript +- php + +# the encoding used by text files in the project +# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings +encoding: "utf-8" + +# The language backend to use for this project. +# If not set, the global setting from serena_config.yml is used. +# Valid values: LSP, JetBrains +# Note: the backend is fixed at startup. If a project with a different backend +# is activated post-init, an error will be returned. +language_backend: + +# whether to use project's .gitignore files to ignore files +ignore_all_files_in_gitignore: true + +# list of additional paths to ignore in this project. +# Same syntax as gitignore, so you can use * and **. +# Note: global ignored_paths from serena_config.yml are also applied additively. +ignored_paths: [] + +# whether the project is in read-only mode +# If set to true, all editing tools will be disabled and attempts to use them will result in an error +# Added on 2025-04-18 +read_only: false + +# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details. +# Below is the complete list of tools for convenience. +# To make sure you have the latest list of tools, and to view their descriptions, +# execute `uv run scripts/print_tool_overview.py`. +# +# * `activate_project`: Activates a project by name. +# * `check_onboarding_performed`: Checks whether project onboarding was already performed. +# * `create_text_file`: Creates/overwrites a file in the project directory. +# * `delete_lines`: Deletes a range of lines within a file. +# * `delete_memory`: Deletes a memory from Serena's project-specific memory store. +# * `execute_shell_command`: Executes a shell command. +# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced. +# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type). +# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type). +# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes. +# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file. +# * `initial_instructions`: Gets the initial instructions for the current project. +# Should only be used in settings where the system prompt cannot be set, +# e.g. in clients you have no control over, like Claude Desktop. +# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol. +# * `insert_at_line`: Inserts content at a given line in a file. +# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol. +# * `list_dir`: Lists files and directories in the given directory (optionally with recursion). +# * `list_memories`: Lists memories in Serena's project-specific memory store. +# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building). +# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context). +# * `read_file`: Reads a file within the project directory. +# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store. +# * `remove_project`: Removes a project from the Serena configuration. +# * `replace_lines`: Replaces a range of lines within a file with new content. +# * `replace_symbol_body`: Replaces the full definition of a symbol. +# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen. +# * `search_for_pattern`: Performs a search for a pattern in the project. +# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase. +# * `switch_modes`: Activates modes by providing a list of their names +# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information. +# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task. +# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed. +# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store. +excluded_tools: [] + +# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default) +included_optional_tools: [] + +# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools. +# This cannot be combined with non-empty excluded_tools or included_optional_tools. +fixed_tools: [] + +# list of mode names to that are always to be included in the set of active modes +# The full set of modes to be activated is base_modes + default_modes. +# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply. +# Otherwise, this setting overrides the global configuration. +# Set this to [] to disable base modes for this project. +# Set this to a list of mode names to always include the respective modes for this project. +base_modes: + +# list of mode names that are to be activated by default. +# The full set of modes to be activated is base_modes + default_modes. +# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply. +# Otherwise, this overrides the setting from the global configuration (serena_config.yml). +# This setting can, in turn, be overridden by CLI parameters (--mode). +default_modes: + +# initial prompt for the project. It will always be given to the LLM upon activating the project +# (contrary to the memories, which are loaded on demand). +initial_prompt: "" + +# time budget (seconds) per tool call for the retrieval of additional symbol information +# such as docstrings or parameter information. +# This overrides the corresponding setting in the global configuration; see the documentation there. +# If null or missing, use the setting from the global configuration. +symbol_info_budget: diff --git a/.vscode/ftp-kr.json b/.vscode/ftp-kr.json index 2ab157f..5de7c10 100644 --- a/.vscode/ftp-kr.json +++ b/.vscode/ftp-kr.json @@ -12,6 +12,9 @@ "ignoreRemoteModification": true, "ignore": [ ".git", - "/.vscode" + "/.vscode", + "/.serena", + "/.claude", + "CLAUDE.md" ] } \ No newline at end of file diff --git a/.vscode/ftp-kr.sync.cache.json b/.vscode/ftp-kr.sync.cache.json index dde2aed..534d515 100644 --- a/.vscode/ftp-kr.sync.cache.json +++ b/.vscode/ftp-kr.sync.cache.json @@ -89,8 +89,8 @@ }, "UsersController.php": { "type": "-", - "size": 3914, - "lmtime": 1770653696575, + "size": 10771, + "lmtime": 1772109739886, "modified": false } }, @@ -187,6 +187,12 @@ "size": 610, "lmtime": 1770653480229, "modified": false + }, + "VacationRepository.php": { + "type": "-", + "size": 9593, + "lmtime": 1772109599723, + "modified": false } } }, @@ -229,8 +235,8 @@ }, "class.Users.php": { "type": "-", - "size": 2072, - "lmtime": 1770654026945, + "size": 2045, + "lmtime": 1772108632777, "modified": false }, "class.Wiki.php": { @@ -258,21 +264,15 @@ }, "CLAUDE.md": { "type": "-", - "size": 4572, - "lmtime": 1771422482909, - "modified": false - }, - "CODE_INDEX.md": { - "type": "-", - "size": 16884, - "lmtime": 1770652965090, + "size": 4659, + "lmtime": 1772110598538, "modified": false }, "config.php": { "type": "-", - "size": 1186, - "lmtime": 1770587027872, - "modified": true + "size": 1243, + "lmtime": 1771851585764, + "modified": false }, "cron.php": { "type": "-", @@ -282,17 +282,36 @@ }, ".htaccess": { "type": "-", - "size": 1024, - "lmtime": 0, - "modified": false - }, - "index.php": { - "type": "-", - "size": 2464, + "size": 1055, "lmtime": 0, "modified": true }, - "layout": {}, + "index.php": { + "type": "-", + "size": 2782, + "lmtime": 1772108635118, + "modified": false + }, + "layout": { + "style.css": { + "type": "-", + "size": 31663, + "lmtime": 1772109274106, + "modified": false + }, + "style.css.map": { + "type": "-", + "size": 55516, + "lmtime": 1772109274106, + "modified": false + }, + "style.scss": { + "type": "-", + "size": 39770, + "lmtime": 1772111528605, + "modified": false + } + }, "libraries": {}, "logs.txt": { "type": "-", @@ -341,14 +360,14 @@ }, "task_edit.php": { "type": "-", - "size": 29190, + "size": 32082, "lmtime": 1771495910826, - "modified": false + "modified": true }, "task_popup.php": { "type": "-", - "size": 22823, - "lmtime": 1771426296050, + "size": 27993, + "lmtime": 1772111511936, "modified": false }, "task_single.php": { @@ -373,14 +392,20 @@ }, "main-view.php": { "type": "-", - "size": 2012, + "size": 2067, "lmtime": 1770653623175, - "modified": false + "modified": true }, "settings.php": { "type": "-", - "size": 3457, + "size": 1586, "lmtime": 0, + "modified": true + }, + "vacations.php": { + "type": "-", + "size": 15969, + "lmtime": 1772109751414, "modified": false } }, @@ -527,15 +552,15 @@ }, "TODO.md": { "type": "-", - "size": 103, + "size": 0, "lmtime": 1771423099316, - "modified": false + "modified": true }, "upload": {}, "VIDOK_Instrukcja Montażu I Uruchomienia - Wyroby Elektryczne.pdf": { "type": "-", "size": 230708, - "lmtime": 1771496082255, + "lmtime": 1771920013460, "modified": false } } diff --git a/CLAUDE.md b/CLAUDE.md index fbf4fe2..b21d6d6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,5 +1,7 @@ # CLAUDE.md +Obecna wersja PHP na serwerze to 7.4 i należy to uwzględnij podczas pisania kodu. + This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview diff --git a/REFACTORING_PLAN.md b/REFACTORING_PLAN.md deleted file mode 100644 index 364aac7..0000000 --- a/REFACTORING_PLAN.md +++ /dev/null @@ -1,71 +0,0 @@ -# Plan Refaktoryzacji CRM PRO - -## Cel -- Przenieść logikę biznesową i dostęp do danych z warstwy `factory` do `autoload/Domain/*`. -- Zachować kompatybilność wsteczną przez warstwy adapterów/fasad (`controls`, `factory`) podczas migracji. -- Kończyć każdy etap migracji testami regresyjnymi. - -## Aktualny status -- Ostatnia aktualizacja: 2026-02-06 -- Etap: 2 w toku (standaryzacja kontrolerów) -- Obszar Czas pracy: zmigrowany i ustabilizowany - -## Etap 1: Tasks / Czas pracy (ZROBIONE) -- Dodano `autoload/Domain/Tasks/WorkTimeRepository.php`. -- `factory\Tasks::work_time_clients()` deleguje teraz do repozytorium Domain. -- Usunięto limit 3 miesięcy: repozytorium zwraca wszystkie istotne miesiące. -- Uwzględniono statusy zadań: - - `do rozliczenia` (`3`) - - `do sprawdzenia` (`1`) -- Usunięto zależność `\factory\Projects` z `WorkTimeRepository` (czas liczony bezpośrednio w repozytorium Domain). -- Dodano testy: - - `tests/Domain/Tasks/WorkTimeRepositoryTest.php` - - `tests/run.php` - -## Etap 2: Standaryzacja kontrolerów (W TOKU) -- [x] Dodano `autoload/Controllers/TasksController.php`. -- [x] Przeniesiono akcję czasu pracy do nowego kontrolera: `TasksController::workTime()`. -- [x] Zostawiono adapter kompatybilności w `autoload/controls/class.Tasks.php`. -- [x] Oznaczono starą metodę `controls\Tasks::work_time()` jako deprecated. -- [x] Nowy kontroler korzysta bezpośrednio z Domain (`WorkTimeRepository`) zamiast factory. -- [x] Dodano test kontrolera: - - `tests/Controllers/TasksControllerTest.php` -- [ ] Zmigrować kolejne metody z `controls\Tasks`: - - `main_view()` - - `main_view_by_ajax()` - -## Etap 3: Porządki w UI Czasu pracy (ZROBIONE) -- Nowy zbiorczy widok rozliczeń jest aktywny. -- Usunięto zduplikowany/stary blok z `templates/tasks/work-time.php`. -- Akcja „zamknij zadanie” działa przez AJAX bez pełnego przeładowania strony. -- Dodano ładniejsze potwierdzenie (`jquery-confirm`) z fallbackiem. -- Poprawiono hierarchię wizualną (Bootstrap + style pomocnicze). -- Przeniesiono style widoku z inline `