Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: "Generate CI matrix"
uses: "glpi-project/plugin-ci-workflows/.github/workflows/generate-ci-matrix.yml@v1"
with:
glpi-version: "11.0.x"
glpi-version: "12.0.x"
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
needs: "generate-ci-matrix"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor/
.gh_token
*.min.*
var/
.phpunit.result.cache
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [UNRELEASED]
## [unreleased]

### Added

- GLPI 12 compatibility

### Fixed

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../PluginsMakefile.mk
2 changes: 1 addition & 1 deletion ajax/billactions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* -------------------------------------------------------------------------
*/

Session::checkRight("plugin_order_bill", READ);
Session::checkRight(PluginOrderBill::$rightname, READ);

header("Content-Type: text/html; charset=UTF-8");

Expand Down
4 changes: 1 addition & 3 deletions ajax/dropdownReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
/** @var DBmysql $DB */
global $DB;

include_once(__DIR__ . "/../../../inc/includes.php");

Session::checkRight("plugin_order_reference", READ);
Session::checkRight(PluginOrderReference::$rightname, READ);

// Make a select box for references
if (isset($_POST["itemtype"])) {
Expand Down
2 changes: 1 addition & 1 deletion ajax/dropdownSupplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
Html::header_nocache();
}

Session::checkRight("contact_enterprise", READ);
Session::checkRight(Contact::$rightname, READ);

// Make a select box
if (isset($_POST["suppliers_id"])) {
Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"php": ">=8.2",
"sboden/odtphp": "^3.2"
},
"require-dev": {
"glpi-project/tools": "^0.8"
},
"config": {
"optimize-autoloader": true,
"platform": {
Expand All @@ -20,6 +17,11 @@
"url": "https://github.com/teclib/odtphp/"
}
],
"autoload": {
"psr-4": {
"GlpiPlugin\\Order\\Tests\\": "tests"
}
},
"autoload-dev": {
"psr-4": {
"Glpi\\Tools\\": "../../tools/src/"
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

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

2 changes: 1 addition & 1 deletion front/bill.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
Html::back();
}

Session::checkRight("plugin_order_bill", READ);
Session::checkRight(PluginOrderBill::$rightname, READ);

Html::header(PluginOrderBill::getTypeName(), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill");
if (isset($_REQUEST['id'])) {
Expand Down
2 changes: 1 addition & 1 deletion front/bill.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* -------------------------------------------------------------------------
*/

Session::checkRight("plugin_order_bill", READ);
Session::checkRight(PluginOrderBill::$rightname, READ);

Html::header(PluginOrderBill::getTypeName(), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "bill");

Expand Down
2 changes: 1 addition & 1 deletion front/config.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
} else {
Html::header(__s("Orders", "order"), $_SERVER['PHP_SELF'], "management", "PluginOrderMenu", "order");

Session::checkRight("config", UPDATE);
Session::checkRight(Config::$rightname, UPDATE);
$config->showForm(1);

Html::footer();
Expand Down
2 changes: 1 addition & 1 deletion front/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"order",
);

if (PluginOrderOrder::canView() || Session::haveRight("config", UPDATE)) {
if (PluginOrderOrder::canView() || Session::haveRight(Config::$rightname, UPDATE)) {
Search::show("PluginOrderOrder");
} else {
echo "<div class='center'><br><br><img src=\""
Expand Down
2 changes: 1 addition & 1 deletion front/profile.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* -------------------------------------------------------------------------
*/

Session::checkRight("profile", UPDATE);
Session::checkRight(Profile::$rightname, UPDATE);

$prof = new PluginOrderProfile();

Expand Down
9 changes: 7 additions & 2 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function plugin_order_getDatabaseRelations()
"glpi_plugin_order_orders" => "plugin_order_orderstates_id",
],
"glpi_plugin_order_accountsections" => [
"glpi_plugin_order_accountsections" => "plugin_order_accountsections_id",
"glpi_plugin_order_orders" => "plugin_order_accountsections_id",
],
"glpi_plugin_order_analyticnatures" => [
"glpi_plugin_order_orders_items" => "plugin_order_analyticnatures_id",
Expand Down Expand Up @@ -237,7 +237,12 @@ function plugin_order_getAddSearchOptions($itemtype)
$plugin = new Plugin();

$sopt = [];
if ($plugin->isInstalled('order') && $plugin->isActivated('order') && Session::haveRight("plugin_order_order", READ) && in_array($itemtype, PluginOrderOrder_Item::getClasses(true))) {
if (
$plugin->isInstalled('order')
&& $plugin->isActivated('order')
&& Session::haveRight(PluginOrderOrder::$rightname, READ)
&& in_array($itemtype, PluginOrderOrder_Item::getClasses(true))
) {
$sopt[3160]['table'] = 'glpi_plugin_order_orders';
$sopt[3160]['field'] = 'name';
$sopt[3160]['linkfield'] = '';
Expand Down
2 changes: 1 addition & 1 deletion inc/accountsection.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginOrderAccountsection extends CommonDropdown
{
public static $rightname = 'plugin_order_order';
public static string $rightname = 'plugin_order_order';

public static function getTypeName($nb = 0)
{
Expand Down
2 changes: 1 addition & 1 deletion inc/analyticnature.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginOrderAnalyticnature extends CommonDropdown
{
public static $rightname = 'plugin_order_order';
public static string $rightname = 'plugin_order_order';

public static function getTypeName($nb = 0)
{
Expand Down
6 changes: 3 additions & 3 deletions inc/bill.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

class PluginOrderBill extends CommonDropdown
{
public static $rightname = 'plugin_order_bill';
public static string $rightname = 'plugin_order_bill';

public $dohistory = true;
public bool $dohistory = true;

public $first_level_menu = "plugins";

Expand Down Expand Up @@ -641,7 +641,7 @@ public static function uninstall()
public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (!$withtemplate) {
switch ($item->getType()) {
switch ($item::class) {
case 'PluginOrderOrder':
return self::createTabEntry(
self::getTypeName(),
Expand Down
2 changes: 1 addition & 1 deletion inc/billstate.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PluginOrderBillState extends CommonDropdown

public const PAID = 1;

public static $rightname = 'plugin_order_bill';
public static string $rightname = 'plugin_order_bill';


public static function getTypeName($nb = 0)
Expand Down
2 changes: 1 addition & 1 deletion inc/billtype.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginOrderBillType extends CommonDropdown
{
public static $rightname = 'plugin_order_bill';
public static string $rightname = 'plugin_order_bill';


public static function getTypeName($nb = 0)
Expand Down
6 changes: 3 additions & 3 deletions inc/config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class PluginOrderConfig extends CommonDBTM
{
public static $rightname = 'config';
public static string $rightname = 'config';

public const CONFIG_NEVER = 0;

Expand All @@ -53,13 +53,13 @@ public function __construct()

public static function canView(): bool
{
return Session::haveRight('config', READ);
return Session::haveRight(Config::$rightname, READ);
}


public static function canCreate(): bool
{
return Session::haveRight('config', UPDATE);
return Session::haveRight(Config::$rightname, UPDATE);
}


Expand Down
6 changes: 3 additions & 3 deletions inc/documentcategory.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
$config = PluginOrderConfig::getConfig();

if ($item->getType() == "DocumentCategory" && $config->canRenameDocuments()) {
if ($item::class == "DocumentCategory" && $config->canRenameDocuments()) {
return __s("Orders", "order");
}

Expand All @@ -54,7 +54,7 @@ public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $
{
$config = PluginOrderConfig::getConfig();

if ($item->getType() == "DocumentCategory" && $config->canRenameDocuments()) {
if ($item::class == "DocumentCategory" && $config->canRenameDocuments()) {
self::showForDocumentCategory($item);
}

Expand All @@ -79,7 +79,7 @@ public static function showForDocumentCategory($item)
}

echo "<form name='form' method='post' action='"
. Toolbox::getItemTypeFormURL($documentCategory->getType()) . "'>";
. Toolbox::getItemTypeFormURL($documentCategory::class) . "'>";

echo "<div align='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __s('Document category prefix', 'order') . "</th></tr>";
Expand Down
Loading
Loading