Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ci #63

Merged
merged 5 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Continuous integration"

on:
push:
branches:
- "master"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
strategy:
fail-fast: false
matrix:
include:
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"}
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"}
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"}
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"}
- {glpi-version: "10.0.x", php-version: "8.3-rc", db-image: "mysql:8.0"}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "useditemsexport"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
17 changes: 17 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset>
<file>.</file>
<exclude-pattern>/.git/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>

<arg name="colors" />
<arg name="extensions" value="php" />
<arg value="p" />
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.4"
"glpi-project/tools": "^0.7.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"optimize-autoloader": true,
Expand Down
199 changes: 189 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,28 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');

Session::haveRight("config", UPDATE);

Html::header(PluginUseditemsexportConfig::getTypeName(1),
$_SERVER['PHP_SELF'], "plugins", "useditemsexport", "config");
Html::header(
PluginUseditemsexportConfig::getTypeName(1),
$_SERVER['PHP_SELF'],
"plugins",
"useditemsexport",
"config"
);

if (!isset($_GET["id"])) {
$_GET["id"] = 1;
$_GET["id"] = 1;
}

$PluginUseditemsexportConfig = new PluginUseditemsexportConfig();

if (isset($_POST["update"])) {
$PluginUseditemsexportConfig->check($_POST["id"], UPDATE);
$PluginUseditemsexportConfig->update($_POST);
Html::back();
$PluginUseditemsexportConfig->check($_POST["id"], UPDATE);
$PluginUseditemsexportConfig->update($_POST);
Html::back();
}

$PluginUseditemsexportConfig->showForm($_GET["id"]);
Expand Down
26 changes: 12 additions & 14 deletions front/export.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,23 @@
* -------------------------------------------------------------------------
*/

include ('../../../inc/includes.php');
include('../../../inc/includes.php');

$PluginUseditemsexportExport = new PluginUseditemsexportExport();

if (isset($_REQUEST['generate'])) {

if ($PluginUseditemsexportExport::generatePDF($_POST['users_id'])) {
Session::addMessageAfterRedirect(__('PDF successfully generated.', 'useditemsexport'), true);
Html::back();
}
if ($PluginUseditemsexportExport::generatePDF($_POST['users_id'])) {
Session::addMessageAfterRedirect(__('PDF successfully generated.', 'useditemsexport'), true);
Html::back();
}
}

if (isset($_REQUEST["purgeitem"])) {

foreach ($_POST["useditemsexport"] as $key => $val) {
$input = ['id' => $key];
if ($val == 1) {
$PluginUseditemsexportExport->delete($input, true);
}
}
Html::back();
foreach ($_POST["useditemsexport"] as $key => $val) {
$input = ['id' => $key];
if ($val == 1) {
$PluginUseditemsexportExport->delete($input, true);
}
}
Html::back();
}
Loading