Skip to content

Commit

Permalink
Evarisk#1045 [QRCode] fix: PSR12 & useless fields
Browse files Browse the repository at this point in the history
  • Loading branch information
theodaviddd committed Sep 10, 2024
1 parent 29599e6 commit 6e3aefb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 20 deletions.
17 changes: 8 additions & 9 deletions admin/qrcode.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2021-2023 EVARISK
/* Copyright (C) 2024 EVARISK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -16,9 +16,9 @@
*/

/**
* \file admin/redirections.php
* \file admin/qrcode.php
* \ingroup saturne
* \brief Saturne redirections page
* \brief Saturne qrcode page
*/

// Load Saturne environment
Expand All @@ -39,7 +39,7 @@
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/includes/tecnickcom/tcpdf/tcpdf_barcodes_2d.php';

// Load Module libraries
// Load Saturne libraries
require_once __DIR__ . '/../lib/saturne.lib.php';
require_once __DIR__ . '/../class/saturneqrcode.class.php';

Expand All @@ -54,7 +54,7 @@

// Get parameters
$action = GETPOST('action', 'alpha');
$url = GETPOST('url', 'alpha');
$url = GETPOST('url', 'alpha');

// Initialize Redirection Manager
$saturneQRCode = new SaturneQRCode($db);
Expand All @@ -74,10 +74,9 @@
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}
$saturneQRCode->url = $url;
$saturneQRCode->url = $url;
$saturneQRCode->encoded_qr_code = $saturneQRCode->getQRCodeBase64($url);
$saturneQRCode->module_name = 'saturne';
$saturneQRCode->status = 1;
$saturneQRCode->module_name = 'saturne';
$saturneQRCode->create($user);

setEventMessage('QRCodeCreated');
Expand All @@ -87,7 +86,7 @@

if ($action == 'update') {
$saturneQRCode->fetch(GETPOST('id'));
$saturneQRCode->url = GETPOST('url');
$saturneQRCode->url = GETPOST('url');
$saturneQRCode->encoded_qr_code = $saturneQRCode->getQRCodeBase64($saturneQRCode->url);
$saturneQRCode->update($user);

Expand Down
6 changes: 0 additions & 6 deletions class/saturneqrcode.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class SaturneQRCode extends SaturneObject
'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 0],
'tms' => ['type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 50, 'notnull' => 1, 'visible' => 0],
'import_key' => ['type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 60, 'notnull' => 0, 'visible' => 0, 'index' => 0],
'status' => ['type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 70, 'notnull' => 1, 'visible' => 2, 'default' => 0, 'index' => 1, 'validate' => 1, 'arrayofkeyval' => [0 => 'StatusDraft', 1 => 'ValidatePendingSignature', 2 => 'Expired', 3 => 'Archived']],
'module_name' => ['type' => 'varchar(128)', 'label' => 'ModuleName', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 0],
'url' => ['type' => 'text', 'label' => 'Url', 'enabled' => 1, 'position' => 80, 'notnull' => 0, 'visible' => 0, 'index' => 0],
'encoded_qr_code' => ['type' => 'text', 'label' => 'EncodedData', 'enabled' => 1, 'position' => 90, 'notnull' => 0, 'visible' => 0, 'index' => 0],
Expand Down Expand Up @@ -111,11 +110,6 @@ class SaturneQRCode extends SaturneObject
*/
public $import_key;

/**
* @var int Status
*/
public $status;

/**
* @var string Module name
*/
Expand Down
1 change: 0 additions & 1 deletion lib/saturne_functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ function saturne_load_langs(array $domains = [])
global $langs, $moduleNameLowerCase;

$langs->loadLangs(['saturne@saturne', 'object@saturne', 'signature@saturne', 'medias@saturne', $moduleNameLowerCase . '@' . $moduleNameLowerCase]);

if (!empty($domains)) {
foreach ($domains as $domain) {
$langs->load($domain);
Expand Down
2 changes: 0 additions & 2 deletions sql/qrcode/llx_saturne_qrcode.key.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_saturne_qrcode ADD INDEX idx_saturne_object_qrcode_rowid (rowid);
ALTER TABLE llx_saturne_qrcode ADD INDEX idx_saturne_object_qrcode_ref (ref);
ALTER TABLE llx_saturne_qrcode ADD INDEX idx_saturne_object_qrcode_status (status);
ALTER TABLE llx_saturne_qrcode ADD CONSTRAINT llx_saturne_qrcode_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
3 changes: 1 addition & 2 deletions sql/qrcode/llx_saturne_qrcode.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Copyright (C) 2021-2023 EVARISK <[email protected]>
-- Copyright (C) 2024 EVARISK <[email protected]>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
Expand All @@ -19,7 +19,6 @@ CREATE TABLE llx_saturne_qrcode(
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
import_key varchar(14),
status integer DEFAULT 1 NOT NULL,
module_name varchar(255),
url text,
encoded_qr_code longtext,
Expand Down

0 comments on commit 6e3aefb

Please sign in to comment.