diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1590485 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + # Keep GitHub Actions up-to-date + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: #all in one PR + github-actions-all: + patterns: + - "*" diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index e198da9..6fd1780 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -5,9 +5,6 @@ on: branches: - master - develop - - 'feature/*' - - 'hotfix/*' - - 'release/*' tags: - '*' pull_request: @@ -19,26 +16,48 @@ concurrency: cancel-in-progress: true jobs: + setup-phpunit-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.gen.outputs.matrix }} + steps: + - uses: actions/checkout@v6 + - id: gen + uses: galette/.github/actions/matrix-generator@main + with: + all-jobs: ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-objectslend' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }} + + setup-lint-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.gen.outputs.matrix }} + steps: + - uses: actions/checkout@v6 + - id: gen + uses: galette/.github/actions/matrix-generator@main + with: + target: lint + all-jobs: ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-objectslend' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }} + lint: runs-on: ubuntu-latest - name: "Lint on PHP ${{ matrix.php-versions }}" + needs: setup-lint-matrix + name: "Lint on PHP ${{ matrix.php-version }}" strategy: - matrix: - php-versions: [ '8.2', '8.5' ] - coverage: [none] + matrix: ${{ fromJSON(needs.setup-lint-matrix.outputs.matrix) }} fail-fast: false steps: - name: PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php-version }} tools: composer coverage: ${{ matrix.coverage }} - name: Checkout Galette core - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: repository: galette/galette path: galette-core @@ -46,7 +65,7 @@ jobs: ref: develop - name: Checkout plugin - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: galette-core/galette/plugins/plugin-objectslend @@ -56,7 +75,7 @@ jobs: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} @@ -73,7 +92,7 @@ jobs: ../../vendor/bin/phpcs lib/ ./*.php - name: CS Fixer - if: matrix.php-versions == '8.1' + if: matrix.php-is-min run: | cd galette-core/galette/plugins/plugin-objectslend ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff @@ -90,35 +109,21 @@ jobs: - name: Headers checks run: | - cd galette-core/galette/plugins/plugin-objectslend - ../../vendor/bin/docheader --docheader=../../../.docheader check lib ./*.php + cd galette-core + ./bin/console galette:headers:check \ + --project-name="Galette Objects Lend plugin" \ + --start-year="2013" \ + --directory="galette/plugins/plugin-objectslend" unit-tests: runs-on: ubuntu-latest + needs: setup-phpunit-matrix strategy: - matrix: - include: - #always tests higher stable php version with lower db version - #enable coverage on higher stable php version with higher postrgesql version - #lower php version - - { php-version: "8.2", db-image: "mysql:5.7", coverage: none, always: false } - - { php-version: "8.2", db-image: "mysql:8.1", coverage: none, always: false } - - { php-version: "8.2", db-image: "mariadb:10.4", coverage: none, always: false } - - { php-version: "8.2", db-image: "mariadb:11", coverage: none, always: false } - - { php-version: "8.2", db-image: "postgres:11", coverage: none, always: false } - - { php-version: "8.2", db-image: "postgres:16", coverage: none, always: false } - #higher stable php version - - { php-version: "8.5", db-image: "mysql:5.7", coverage: none, always: true } - - { php-version: "8.5", db-image: "mysql:8.1", coverage: none, always: false } - - { php-version: "8.5", db-image: "mariadb:10.4", coverage: none, always: true } - - { php-version: "8.5", db-image: "mariadb:11", coverage: none, always: false } - - { php-version: "8.5", db-image: "postgres:11", coverage: none, always: true } - - { php-version: "8.5", db-image: "postgres:16", coverage: none, always: true } + matrix: ${{ fromJSON(needs.setup-phpunit-matrix.outputs.matrix) }} fail-fast: false env: - skip: ${{ matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/plugin-objectslend' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags'))) }} DB: ${{ matrix.db-image }} services: @@ -150,17 +155,15 @@ jobs: steps: - name: PHP - if: env.skip != 'true' uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-versions }} + php-version: ${{ matrix.php-version }} tools: composer, pecl coverage: ${{ matrix.coverage }} extensions: apcu ini-values: apc.enable_cli=1 - name: "Show versions" - if: env.skip != 'true' run: | php --version composer --version @@ -168,37 +171,16 @@ jobs: echo "npm $(npm --version)" docker exec ${{ job.services.db.id }} bash -c "if [[ -n \$(command -v psql) ]]; then psql --version; else if [[ -n \$(command -v mysql) ]]; then mysql --version; else mariadb --version; fi fi" - - name: Checkout Galette core - if: env.skip != 'true' - uses: actions/checkout@v4 + - name: Build Galette + uses: galette/.github/actions/build-galette@main with: - repository: galette/galette - path: galette-core - fetch-depth: 1 - ref: develop + php-version: ${{ matrix.php-version }} - name: Checkout plugin - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: path: galette-core/galette/plugins/plugin-objectslend - - name: "Restore dependencies cache" - if: env.skip != 'true' - uses: actions/cache@v4 - with: - path: | - ~/.composer/cache/ - ~/.npm/_cacache/ - key: "${{ runner.os }}-galette-${{ matrix.php-version }}-${{ hashFiles('galette/composer.lock', 'package-lock.json') }}" - restore-keys: | - ${{ runner.os }}-galette-${{ matrix.php-version }}- - - - name: Install dependencies - if: env.skip != 'true' - run: | - cd galette-core - bin/install_deps - - name: Init for PostgreSQL env: POSTGRES_HOST: localhost @@ -207,7 +189,7 @@ jobs: cd galette-core bin/console galette:install -v --dbtype=pgsql --dbhost=localhost --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w bin/console galette:plugins:install-db --all - if: env.skip != 'true' && startsWith(matrix.db-image, 'postgres') + if: startsWith(matrix.db-image, 'postgres') - name: Init for MariaDB run: | @@ -215,10 +197,9 @@ jobs: mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306 bin/console galette:install -v --dbtype=mysql --dbhost=127.0.0.1 --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w bin/console galette:plugins:install-db --all - if: env.skip != 'true' && (startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb')) + if: startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') - name: Unit tests - if: env.skip != 'true' run: | cd galette-core/galette/plugins/plugin-objectslend ../../vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GaletteObjectsLend/ diff --git a/_config.inc.php b/_config.inc.php index a73196e..b072382 100644 --- a/_config.inc.php +++ b/_config.inc.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/_define.php b/_define.php index 3f96a71..1a9fb06 100644 --- a/_define.php +++ b/_define.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/_routes.php b/_routes.php index dac0923..df0b43a 100644 --- a/_routes.php +++ b/_routes.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/bin/release b/bin/release index fbe7c42..8c87d26 100755 --- a/bin/release +++ b/bin/release @@ -1,5 +1,11 @@ #!/usr/bin/python +/** + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later + */ + import os, sys, argparse, re, git, http.client, subprocess import urlgrabber.progress, tarfile, shutil, gitdb, time, fnmatch from datetime import datetime diff --git a/bin/twig-cache b/bin/twig-cache index 73c9a6e..6ed9879 100755 --- a/bin/twig-cache +++ b/bin/twig-cache @@ -1,6 +1,12 @@ #!/bin/php . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Controllers/Crud/ObjectsController.php b/lib/GaletteObjectsLend/Controllers/Crud/ObjectsController.php index 01ade29..8b777a1 100644 --- a/lib/GaletteObjectsLend/Controllers/Crud/ObjectsController.php +++ b/lib/GaletteObjectsLend/Controllers/Crud/ObjectsController.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Controllers/Crud/StatusController.php b/lib/GaletteObjectsLend/Controllers/Crud/StatusController.php index 602bb2f..f0156f9 100644 --- a/lib/GaletteObjectsLend/Controllers/Crud/StatusController.php +++ b/lib/GaletteObjectsLend/Controllers/Crud/StatusController.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Controllers/ImagesController.php b/lib/GaletteObjectsLend/Controllers/ImagesController.php index b52c4ee..e7349b0 100644 --- a/lib/GaletteObjectsLend/Controllers/ImagesController.php +++ b/lib/GaletteObjectsLend/Controllers/ImagesController.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Controllers/MainController.php b/lib/GaletteObjectsLend/Controllers/MainController.php index d75db7d..2c90303 100644 --- a/lib/GaletteObjectsLend/Controllers/MainController.php +++ b/lib/GaletteObjectsLend/Controllers/MainController.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Controllers/PdfController.php b/lib/GaletteObjectsLend/Controllers/PdfController.php index 1dc56db..87d983a 100644 --- a/lib/GaletteObjectsLend/Controllers/PdfController.php +++ b/lib/GaletteObjectsLend/Controllers/PdfController.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Entity/CategoryPicture.php b/lib/GaletteObjectsLend/Entity/CategoryPicture.php index 465b382..3f6e933 100644 --- a/lib/GaletteObjectsLend/Entity/CategoryPicture.php +++ b/lib/GaletteObjectsLend/Entity/CategoryPicture.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -31,8 +18,8 @@ */ class CategoryPicture extends Picture { - public const PK = 'category_id'; - public const TABLE = 'categories_pictures'; + public const string PK = 'category_id'; + public const string TABLE = 'categories_pictures'; /** * Default constructor. diff --git a/lib/GaletteObjectsLend/Entity/LendCategory.php b/lib/GaletteObjectsLend/Entity/LendCategory.php index 668fc2d..9399f5a 100644 --- a/lib/GaletteObjectsLend/Entity/LendCategory.php +++ b/lib/GaletteObjectsLend/Entity/LendCategory.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -41,8 +28,8 @@ */ class LendCategory { - public const TABLE = 'category'; - public const PK = 'category_id'; + public const string TABLE = 'category'; + public const string PK = 'category_id'; /** @var array */ private array $fields = [ diff --git a/lib/GaletteObjectsLend/Entity/LendObject.php b/lib/GaletteObjectsLend/Entity/LendObject.php index 008d517..3c37479 100644 --- a/lib/GaletteObjectsLend/Entity/LendObject.php +++ b/lib/GaletteObjectsLend/Entity/LendObject.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -62,8 +49,8 @@ */ class LendObject { - public const TABLE = 'objects'; - public const PK = 'object_id'; + public const string TABLE = 'objects'; + public const string PK = 'object_id'; /** @var array */ private array $fields = [ diff --git a/lib/GaletteObjectsLend/Entity/LendPDF.php b/lib/GaletteObjectsLend/Entity/LendPDF.php index d67f2fa..ebe7454 100644 --- a/lib/GaletteObjectsLend/Entity/LendPDF.php +++ b/lib/GaletteObjectsLend/Entity/LendPDF.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Entity/LendRent.php b/lib/GaletteObjectsLend/Entity/LendRent.php index 06d4da6..14cae37 100644 --- a/lib/GaletteObjectsLend/Entity/LendRent.php +++ b/lib/GaletteObjectsLend/Entity/LendRent.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -51,8 +38,8 @@ */ class LendRent { - public const TABLE = 'rents'; - public const PK = 'rent_id'; + public const string TABLE = 'rents'; + public const string PK = 'rent_id'; /** @var array */ private array $fields = [ diff --git a/lib/GaletteObjectsLend/Entity/LendStatus.php b/lib/GaletteObjectsLend/Entity/LendStatus.php index c411388..960d51a 100644 --- a/lib/GaletteObjectsLend/Entity/LendStatus.php +++ b/lib/GaletteObjectsLend/Entity/LendStatus.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -41,8 +28,8 @@ */ class LendStatus { - public const TABLE = 'status'; - public const PK = 'status_id'; + public const string TABLE = 'status'; + public const string PK = 'status_id'; private Db $zdb; diff --git a/lib/GaletteObjectsLend/Entity/ObjectPicture.php b/lib/GaletteObjectsLend/Entity/ObjectPicture.php index f9d2819..b4316e8 100644 --- a/lib/GaletteObjectsLend/Entity/ObjectPicture.php +++ b/lib/GaletteObjectsLend/Entity/ObjectPicture.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -31,8 +18,8 @@ */ class ObjectPicture extends Picture { - public const PK = 'object_id'; - public const TABLE = 'pictures'; + public const string PK = 'object_id'; + public const string TABLE = 'pictures'; /** * Default constructor. diff --git a/lib/GaletteObjectsLend/Entity/Picture.php b/lib/GaletteObjectsLend/Entity/Picture.php index 46977fe..534cf72 100644 --- a/lib/GaletteObjectsLend/Entity/Picture.php +++ b/lib/GaletteObjectsLend/Entity/Picture.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Entity/Preferences.php b/lib/GaletteObjectsLend/Entity/Preferences.php index 843d880..24ddb2b 100644 --- a/lib/GaletteObjectsLend/Entity/Preferences.php +++ b/lib/GaletteObjectsLend/Entity/Preferences.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -51,8 +38,8 @@ */ class Preferences { - public const TABLE = 'parameters'; - public const PK = 'code'; + public const string TABLE = 'parameters'; + public const string PK = 'code'; private Db $zdb; /** @var array */ @@ -62,97 +49,97 @@ class Preferences * Show categories at the top of the objects list * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_CATEGORY = 'VIEW_CATEGORY'; + public const string PARAM_VIEW_CATEGORY = 'VIEW_CATEGORY'; /** * Show serial number column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_SERIAL = 'VIEW_SERIAL'; + public const string PARAM_VIEW_SERIAL = 'VIEW_SERIAL'; /** * Show thumbnail column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_THUMBNAIL = 'VIEW_THUMBNAIL'; + public const string PARAM_VIEW_THUMBNAIL = 'VIEW_THUMBNAIL'; /** * Show description column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_DESCRIPTION = 'VIEW_DESCRIPTION'; + public const string PARAM_VIEW_DESCRIPTION = 'VIEW_DESCRIPTION'; /** * Show price column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_PRICE = 'VIEW_PRICE'; + public const string PARAM_VIEW_PRICE = 'VIEW_PRICE'; /** * Show dimensions column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_DIMENSION = 'VIEW_DIMENSION'; + public const string PARAM_VIEW_DIMENSION = 'VIEW_DIMENSION'; /** * Show weight column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_WEIGHT = 'VIEW_WEIGHT'; + public const string PARAM_VIEW_WEIGHT = 'VIEW_WEIGHT'; /** * Show rent price column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_LEND_PRICE = 'VIEW_LEND_PRICE'; + public const string PARAM_VIEW_LEND_PRICE = 'VIEW_LEND_PRICE'; /** * Show previsional return date column * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_DATE_FORECAST = 'VIEW_DATE_FORECAST'; + public const string PARAM_VIEW_DATE_FORECAST = 'VIEW_DATE_FORECAST'; /** * Show the sum of prices on the list of objects * Valeur : 0 = false / 1 = true */ - public const PARAM_VIEW_LIST_PRICE_SUM = 'VIEW_LIST_PRICE_SUM'; + public const string PARAM_VIEW_LIST_PRICE_SUM = 'VIEW_LIST_PRICE_SUM'; /** * Maximum width of a thumbnail (applied to objects/categories) * Valeur : largeur en pixels */ - public const PARAM_THUMB_MAX_WIDTH = 'THUMB_MAX_WIDTH'; + public const string PARAM_THUMB_MAX_WIDTH = 'THUMB_MAX_WIDTH'; /** * Maximum height of a thumbnail (applied to objects/categories) * Valeur : largeur en pixels */ - public const PARAM_THUMB_MAX_HEIGHT = 'THUMB_MAX_HEIGHT'; + public const string PARAM_THUMB_MAX_HEIGHT = 'THUMB_MAX_HEIGHT'; /** * Generate automatically a contribution when an object is rented * Valeur : 0 = false / 1 = true */ - public const PARAM_AUTO_GENERATE_CONTRIBUTION = 'AUTO_GENERATE_CONTRIBUTION'; + public const string PARAM_AUTO_GENERATE_CONTRIBUTION = 'AUTO_GENERATE_CONTRIBUTION'; /** * Contribution ID to generate when an object is rented * Valeur : ID du type de contribution */ - public const PARAM_GENERATED_CONTRIBUTION_TYPE_ID = 'GENERATED_CONTRIBUTION_TYPE_ID'; + public const string PARAM_GENERATED_CONTRIBUTION_TYPE_ID = 'GENERATED_CONTRIBUTION_TYPE_ID'; /** * Text for the contribution * Valeur : texte d'info à mettre avec des placeholders à remplacer */ - public const PARAM_GENERATED_CONTRIB_INFO_TEXT = 'GENERATED_CONTRIB_INFO_TEXT'; + public const string PARAM_GENERATED_CONTRIB_INFO_TEXT = 'GENERATED_CONTRIB_INFO_TEXT'; /** * Allow non staff members to rent objects * Valeur : 0 = false / 1 = true */ - public const PARAM_ENABLE_MEMBER_RENT_OBJECT = 'ENABLE_MEMBER_RENT_OBJECT'; + public const string PARAM_ENABLE_MEMBER_RENT_OBJECT = 'ENABLE_MEMBER_RENT_OBJECT'; /** * Default constructor diff --git a/lib/GaletteObjectsLend/Filters/CategoriesList.php b/lib/GaletteObjectsLend/Filters/CategoriesList.php index 90ac02d..41af683 100644 --- a/lib/GaletteObjectsLend/Filters/CategoriesList.php +++ b/lib/GaletteObjectsLend/Filters/CategoriesList.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Filters/ObjectsList.php b/lib/GaletteObjectsLend/Filters/ObjectsList.php index 4addb2d..580eb21 100644 --- a/lib/GaletteObjectsLend/Filters/ObjectsList.php +++ b/lib/GaletteObjectsLend/Filters/ObjectsList.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/Filters/StatusList.php b/lib/GaletteObjectsLend/Filters/StatusList.php index e4f6f80..b369cf6 100644 --- a/lib/GaletteObjectsLend/Filters/StatusList.php +++ b/lib/GaletteObjectsLend/Filters/StatusList.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/IO/PdfObject.php b/lib/GaletteObjectsLend/IO/PdfObject.php index f54095f..706fce1 100644 --- a/lib/GaletteObjectsLend/IO/PdfObject.php +++ b/lib/GaletteObjectsLend/IO/PdfObject.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); diff --git a/lib/GaletteObjectsLend/IO/PdfObjects.php b/lib/GaletteObjectsLend/IO/PdfObjects.php index cb42535..fd29175 100644 --- a/lib/GaletteObjectsLend/IO/PdfObjects.php +++ b/lib/GaletteObjectsLend/IO/PdfObjects.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -39,7 +26,7 @@ */ class PdfObjects extends Pdf { - public const LIST_FONT = self::FONT_SIZE - 2; + public const int LIST_FONT = self::FONT_SIZE - 2; private Db $zdb; private LendPreferences $lendsprefs; diff --git a/lib/GaletteObjectsLend/PluginGaletteObjectslend.php b/lib/GaletteObjectsLend/PluginGaletteObjectslend.php index 79bab27..bd5d973 100644 --- a/lib/GaletteObjectsLend/PluginGaletteObjectslend.php +++ b/lib/GaletteObjectsLend/PluginGaletteObjectslend.php @@ -1,31 +1,28 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); namespace GaletteObjectsLend; +use DI\Attribute\Inject; +use Galette\Core\Db; use Galette\Core\Login; -use Galette\Entity\Adherent; +use Galette\Core\Plugins\InstallableInterface; +use Galette\Core\Plugins\MenuProviderInterface; use Galette\Core\GalettePlugin; +use GaletteObjectsLend\Entity\CategoryPicture; +use GaletteObjectsLend\Entity\LendObject; +use GaletteObjectsLend\Entity\LendCategory; +use GaletteObjectsLend\Entity\LendRent; +use GaletteObjectsLend\Entity\ObjectPicture; +use GaletteObjectsLend\Entity\LendStatus; +use GaletteObjectsLend\Entity\Preferences; /** * Plugin Galette Objects Lend @@ -33,14 +30,17 @@ * @author Johan Cwiklinski */ -class PluginGaletteObjectslend extends GalettePlugin +class PluginGaletteObjectslend extends GalettePlugin implements InstallableInterface, MenuProviderInterface { + #[Inject] + private readonly Db $zdb; //@phpstan-ignore property.uninitializedReadonly (injected from DI) + /** * Extra menus entries * * @return array> */ - public static function getMenusContents(): array + public function getMenus(): array { /** @var Login $login */ global $login; @@ -101,62 +101,24 @@ public static function getMenusContents(): array * * @return array> */ - public static function getPublicMenusItemsList(): array + public function getPublicMenus(): array { return []; } /** - * Get dashboards contents - * - * @return array> + * Is the plugin fully installed (including database, extra configuration, etc.)? */ - public static function getDashboardsContents(): array + public function isInstalled(): bool { - return []; - } - - /** - * Get actions contents - * - * @param Adherent $member Member instance - * - * @return array> - */ - public static function getListActionsContents(Adherent $member): array - { - return []; - } - - /** - * Get detailed actions contents - * - * @param Adherent $member Member instance - * - * @return array> - */ - public static function getDetailedActionsContents(Adherent $member): array - { - return static::getListActionsContents($member); - } - - /** - * Get batch actions contents - * - * @return array> - */ - public static function getBatchActionsContents(): array - { - return []; - } - - /** - * Get current logged-in user dashboards contents - * - * @return array> - */ - public static function getMyDashboardsContents(): array - { - return []; + return + $this->zdb->tableExists(LEND_PREFIX . CategoryPicture::class) + && $this->zdb->tableExists(LEND_PREFIX . LendCategory::class) + && $this->zdb->tableExists(LEND_PREFIX . LendObject::class) + && $this->zdb->tableExists(LEND_PREFIX . LendRent::class) + && $this->zdb->tableExists(LEND_PREFIX . LendStatus::class) + && $this->zdb->tableExists(LEND_PREFIX . ObjectPicture::class) + && $this->zdb->tableExists(LEND_PREFIX . Preferences::class) + ; } } diff --git a/lib/GaletteObjectsLend/Repository/Categories.php b/lib/GaletteObjectsLend/Repository/Categories.php index ab2fadf..0dacc47 100644 --- a/lib/GaletteObjectsLend/Repository/Categories.php +++ b/lib/GaletteObjectsLend/Repository/Categories.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -42,17 +29,17 @@ */ class Categories { - public const TABLE = LendCategory::TABLE; - public const PK = LendCategory::PK; + public const string TABLE = LendCategory::TABLE; + public const string PK = LendCategory::PK; - public const ALL_CATEGORIES = 0; - public const ACTIVE_CATEGORIES = 1; - public const INACTIVE_CATEGORIES = 2; + public const int ALL_CATEGORIES = 0; + public const int ACTIVE_CATEGORIES = 1; + public const int INACTIVE_CATEGORIES = 2; - public const FILTER_NAME = 0; + public const int FILTER_NAME = 0; - public const ORDERBY_NAME = 0; - public const ORDERBY_ACTIVITY = 1; + public const int ORDERBY_NAME = 0; + public const int ORDERBY_ACTIVITY = 1; private CategoriesList $filters; private ?int $count = null; diff --git a/lib/GaletteObjectsLend/Repository/Objects.php b/lib/GaletteObjectsLend/Repository/Objects.php index 65b87da..007527d 100644 --- a/lib/GaletteObjectsLend/Repository/Objects.php +++ b/lib/GaletteObjectsLend/Repository/Objects.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -43,28 +30,28 @@ */ class Objects { - public const TABLE = LendObject::TABLE; - public const PK = LendObject::PK; - - public const ALL_OBJECTS = 0; - public const ACTIVE_OBJECTS = 1; - public const INACTIVE_OBJECTS = 2; - - public const FILTER_NAME = 0; - public const FILTER_SERIAL = 1; - public const FILTER_DIM = 2; - public const FILTER_ID = 3; - - public const ORDERBY_NAME = 0; - public const ORDERBY_SERIAL = 1; - public const ORDERBY_PRICE = 2; - public const ORDERBY_RENTPRICE = 3; - public const ORDERBY_WEIGHT = 4; - public const ORDERBY_STATUS = 5; - public const ORDERBY_BDATE = 6; - public const ORDERBY_FDATE = 7; - public const ORDERBY_MEMBER = 8; - public const ORDERBY_CATEGORY = 9; + public const string TABLE = LendObject::TABLE; + public const string PK = LendObject::PK; + + public const int ALL_OBJECTS = 0; + public const int ACTIVE_OBJECTS = 1; + public const int INACTIVE_OBJECTS = 2; + + public const int FILTER_NAME = 0; + public const int FILTER_SERIAL = 1; + public const int FILTER_DIM = 2; + public const int FILTER_ID = 3; + + public const int ORDERBY_NAME = 0; + public const int ORDERBY_SERIAL = 1; + public const int ORDERBY_PRICE = 2; + public const int ORDERBY_RENTPRICE = 3; + public const int ORDERBY_WEIGHT = 4; + public const int ORDERBY_STATUS = 5; + public const int ORDERBY_BDATE = 6; + public const int ORDERBY_FDATE = 7; + public const int ORDERBY_MEMBER = 8; + public const int ORDERBY_CATEGORY = 9; private Db $zdb; diff --git a/lib/GaletteObjectsLend/Repository/Status.php b/lib/GaletteObjectsLend/Repository/Status.php index b552dbb..d914019 100644 --- a/lib/GaletteObjectsLend/Repository/Status.php +++ b/lib/GaletteObjectsLend/Repository/Status.php @@ -1,22 +1,9 @@ . + * This file is part of Galette Objects Lend plugin (https://galette.eu). + * SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + * SPDX-License-Identifier: GPL-3.0-or-later */ declare(strict_types=1); @@ -39,24 +26,24 @@ */ class Status { - public const TABLE = LendStatus::TABLE; - public const PK = LendStatus::PK; + public const string TABLE = LendStatus::TABLE; + public const string PK = LendStatus::PK; - public const ALL = 0; - public const ACTIVE = 1; - public const INACTIVE = 2; + public const int ALL = 0; + public const int ACTIVE = 1; + public const int INACTIVE = 2; - public const DC_STOCK = 0; - public const IN_STOCK = 1; - public const OUT_STOCK = 2; + public const int DC_STOCK = 0; + public const int IN_STOCK = 1; + public const int OUT_STOCK = 2; - public const FILTER_NAME = 0; + public const int FILTER_NAME = 0; - public const ORDERBY_ID = 0; - public const ORDERBY_NAME = 1; - public const ORDERBY_ACTIVE = 2; - public const ORDERBY_STOCK = 3; - public const ORDERBY_RENTDAYS = 4; + public const int ORDERBY_ID = 0; + public const int ORDERBY_NAME = 1; + public const int ORDERBY_ACTIVE = 2; + public const int ORDERBY_STOCK = 3; + public const int ORDERBY_RENTDAYS = 4; private Db $zdb; private Login $login; diff --git a/scripts/mysql.sql b/scripts/mysql.sql index 3a863aa..12f3a63 100644 --- a/scripts/mysql.sql +++ b/scripts/mysql.sql @@ -1,3 +1,9 @@ +-- +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + SET FOREIGN_KEY_CHECKS=0; DROP TABLE IF EXISTS galette_lend_category; diff --git a/scripts/pgsql.sql b/scripts/pgsql.sql index 5ff3285..0ba06d0 100644 --- a/scripts/pgsql.sql +++ b/scripts/pgsql.sql @@ -1,4 +1,9 @@ --- sequence for objects +-- +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + DROP SEQUENCE IF EXISTS galette_lend_objects_id_seq; CREATE SEQUENCE galette_lend_objects_id_seq START 1 diff --git a/scripts/upgrade-to-0.3.0-mysql.sql b/scripts/upgrade-to-0.3.0-mysql.sql index 7c960d1..9f17d66 100644 --- a/scripts/upgrade-to-0.3.0-mysql.sql +++ b/scripts/upgrade-to-0.3.0-mysql.sql @@ -1,5 +1,7 @@ -- --- Structure de la table `vm_lend_parameters` +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later -- CREATE TABLE IF NOT EXISTS `galette_lend_parameters` ( diff --git a/scripts/upgrade-to-0.4.0-mysql.sql b/scripts/upgrade-to-0.4.0-mysql.sql index 86779c9..e490e5d 100644 --- a/scripts/upgrade-to-0.4.0-mysql.sql +++ b/scripts/upgrade-to-0.4.0-mysql.sql @@ -1,3 +1,9 @@ +-- +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + ALTER TABLE `galette_lend_status` CHANGE `is_galette_location` `is_home_location` TINYINT(1) NOT NULL; ALTER TABLE `galette_lend_status` ADD `rent_day_number` INT NULL DEFAULT NULL ; ALTER TABLE `galette_lend_rents` ADD `date_forecast` DATETIME NULL DEFAULT NULL AFTER `date_begin`; diff --git a/scripts/upgrade-to-0.4.2-mysql.sql b/scripts/upgrade-to-0.4.2-mysql.sql index c47c3cb..d556ea3 100644 --- a/scripts/upgrade-to-0.4.2-mysql.sql +++ b/scripts/upgrade-to-0.4.2-mysql.sql @@ -1,3 +1,9 @@ +-- +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later +-- + insert into galette_lend_parameters (code, is_date, is_text, is_numeric, value_text, date_creation, date_modification) values diff --git a/scripts/upgrade-to-0.5-mysql.sql b/scripts/upgrade-to-0.5-mysql.sql index 4560080..2136687 100644 --- a/scripts/upgrade-to-0.5-mysql.sql +++ b/scripts/upgrade-to-0.5-mysql.sql @@ -1,5 +1,7 @@ -- --- Structure de la table 'galette_lend_categories_pictures' +-- This file is part of Galette Objects Lend plugin (https://galette.eu). +-- SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team +-- SPDX-License-Identifier: GPL-3.0-or-later -- CREATE TABLE IF NOT EXISTS galette_lend_categories_pictures ( diff --git a/templates/default/categories_list.html.twig b/templates/default/categories_list.html.twig index 1124972..a525cbf 100644 --- a/templates/default/categories_list.html.twig +++ b/templates/default/categories_list.html.twig @@ -1,23 +1,9 @@ {# -/** - * Copyright © 2003-2024 The Galette Team - * - * This file is part of Galette (https://galette.eu). - * - * Galette is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Galette is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Galette. If not, see . - */ -#} + # This file is part of Galette Objects Lend plugin (https://galette.eu). + # SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + # SPDX-License-Identifier: GPL-3.0-or-later + #} + {% extends 'elements/list.html.twig' %} {% import "macros.twig" as macros %} diff --git a/templates/default/category_edit.html.twig b/templates/default/category_edit.html.twig index 4ec1928..a20e41f 100644 --- a/templates/default/category_edit.html.twig +++ b/templates/default/category_edit.html.twig @@ -1,23 +1,9 @@ {# -/** - * Copyright © 2003-2024 The Galette Team - * - * This file is part of Galette (https://galette.eu). - * - * Galette is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Galette is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Galette. If not, see . - */ -#} + # This file is part of Galette Objects Lend plugin (https://galette.eu). + # SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + # SPDX-License-Identifier: GPL-3.0-or-later + #} + {% extends "page.html.twig" %} {% block content %} diff --git a/templates/default/headers.html.twig b/templates/default/headers.html.twig index 0c99f4f..da7874b 100644 --- a/templates/default/headers.html.twig +++ b/templates/default/headers.html.twig @@ -1,23 +1,9 @@ {# -/** - * Copyright © 2003-2024 The Galette Team - * - * This file is part of Galette (https://galette.eu). - * - * Galette is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Galette is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Galette. If not, see . - */ -#} + # This file is part of Galette Objects Lend plugin (https://galette.eu). + # SPDX-FileCopyrightText: Copyright © 2013-2026 The Galette Team + # SPDX-License-Identifier: GPL-3.0-or-later + #} + {% if olendsprefs is defined and olendsprefs.showFullsize() %}