diff --git a/ChangeLog.md b/ChangeLog.md
index 7f3ef8d..0121efd 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
- NEW : Option importée du module déprécié fixedtablehead, permettant, sur les listes, de garder toujours visibles à l'écran les en-têtes de colonnes. - *29/10/2025* - 1.5.0
## Release 1.4
+- FIX : Compat v23 - *12/12/2025* - 1.4.3
- FIX : Ne pas afficher le bouton actions disponibles si ils sont de type input et donc envoi des données via formulaire - *06/02/2024* - 1.4.2
- FIX : Compat 21 - *10/12/2024* - 1.4.1
- NEW : Dolibarr compatibility V20 - *02/07/2024* - 1.4.0
diff --git a/admin/upbuttons_setup.php b/admin/upbuttons_setup.php
index b585b23..2e72c89 100644
--- a/admin/upbuttons_setup.php
+++ b/admin/upbuttons_setup.php
@@ -17,9 +17,10 @@
*/
/**
- * \file admin/upbuttons.php
- * \ingroup upbuttons
- * \brief Module setup page for UpButtons
+ * \file admin/upbuttons.php
+ * \ingroup upbuttons
+ * \brief This file is an example module setup page
+ * Put some comments here
*/
// Dolibarr environment
$res = @include '../../main.inc.php'; // From htdocs directory
diff --git a/backport/v17/core/lib/functions.lib.php b/backport/v17/core/lib/functions.lib.php
deleted file mode 100644
index 20ddd7c..0000000
--- a/backport/v17/core/lib/functions.lib.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
- *
- * 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
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program. If not, see .
- */
-
-
-
diff --git a/class/techatm.class.php b/class/techatm.class.php
index ec050d7..ed44961 100644
--- a/class/techatm.class.php
+++ b/class/techatm.class.php
@@ -6,69 +6,64 @@
*/
namespace upbuttons;
-
+/**
+ * Class TechATM
+ */
class TechATM
{
-
/**
* @var DoliDb Database handler (result of a new DoliDB)
*/
public $db;
-
/**
* @var string Error string
* @see $errors
*/
public $error;
-
/**
* @var string[] Array of error strings
*/
public $errors = array();
-
/**
* @var reponse_code a http_response_header parsed reponse code
*/
public $reponse_code;
-
/**
* @var http_response_header the last call $http_response_header
*/
-
public $http_response_header;
-
/**
* @var TResponseHeader the last call $http_response_header parsed <- for most common usage (see self::parseHeaders() function)
*/
public $TResponseHeader;
-
/**
* url vers le domaine des appels techniques
*/
const ATM_TECH_URL = 'https://tech.atm-consulting.fr';
-
-
/**
* il s'agit de la version de ce cette class
* Si jamais on change la façon de faire
* Au moins on peut gérer des redescentes d'info différentes ex json au lieu de html simple
*/
const CALL_VERSION = 1.0;
-
/**
- * Constructor
+ * Constructor
*
- * @param DoliDB $db
+ * @param \DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
-
/**
- * @param DolibarrModules $moduleDescriptor
+ * Get about page
+ *
+ * @param object $moduleDescriptor Module descriptor
+ * @param bool $useCache Use cache
+ * @return string
*/
- function getAboutPage($moduleDescriptor, $useCache = true){
+ public function getAboutPage($moduleDescriptor, $useCache = true)
+ {
global $langs;
$url = self::ATM_TECH_URL.'/modules/modules-page-about.php';
@@ -82,11 +77,11 @@ function getAboutPage($moduleDescriptor, $useCache = true){
$cacheFileName = dol_sanitizeFileName($moduleDescriptor->name.'_'.$langs->defaultlang).'.html';
$cacheFilePath = $cachePath.'/'.$cacheFileName;
- if($useCache && is_readable($cacheFilePath)){
+ if ($useCache && is_readable($cacheFilePath)) {
$lastChange = filemtime($cacheFilePath);
- if($lastChange > time() - 86400){
+ if ($lastChange > time() - 86400) {
$content = @file_get_contents($cacheFilePath);
- if($content !== false){
+ if ($content !== false) {
return $content;
}
}
@@ -94,7 +89,7 @@ function getAboutPage($moduleDescriptor, $useCache = true){
$content = $this->getContents($url);
- if(!$content){
+ if (!$content) {
$content = '';
// About page goes here
$content.= '

';
@@ -104,14 +99,14 @@ function getAboutPage($moduleDescriptor, $useCache = true){
$content.= '';
}
- if($useCache){
- if(!is_dir($cachePath)){
+ if ($useCache) {
+ if (!is_dir($cachePath)) {
$res = dol_mkdir($cachePath, DOL_DATA_ROOT);
- }else{
+ } else {
$res = true;
}
- if($res){
+ if ($res) {
$comment = ''."\r\n";
file_put_contents(
@@ -125,18 +120,26 @@ function getAboutPage($moduleDescriptor, $useCache = true){
}
/**
- * @param string $moduleTechMane
+ * Get module doc URL
+ *
+ * @param string $moduleTechMane Module name
+ * @return string
*/
- public static function getModuleDocUrl($moduleTechMane){
+ public static function getModuleDocUrl($moduleTechMane)
+ {
$url = self::ATM_TECH_URL.'/modules/doc-redirect.php';
$url.= '?module='.$moduleTechMane;
return $url;
}
/**
- * @param DolibarrModules $moduleDescriptor
+ * Get last module version URL
+ *
+ * @param object $moduleDescriptor Module descriptor
+ * @return string
*/
- public static function getLastModuleVersionUrl($moduleDescriptor){
+ public static function getLastModuleVersionUrl($moduleDescriptor)
+ {
$url = self::ATM_TECH_URL.'/modules/modules-last-version.php';
$url.= '?module='.$moduleDescriptor->name;
$url.= '&number='.$moduleDescriptor->numero;
@@ -148,17 +151,20 @@ public static function getLastModuleVersionUrl($moduleDescriptor){
/**
- * @param $url
+ * Get JSON data
+ *
+ * @param string $url URL to reach
* @return false|object
*/
- public function getJsonData($url){
+ public function getJsonData($url)
+ {
$this->data = false;
$res = @file_get_contents($url);
$this->http_response_header = $http_response_header;
$this->TResponseHeader = self::parseHeaders($http_response_header);
- if($res !== false){
+ if ($res !== false) {
$pos = strpos($res, '{');
- if($pos > 0){
+ if ($pos > 0) {
// cela signifie qu'il y a une erreur ou que la sortie n'est pas propre
$res = substr($res, $pos);
}
@@ -170,168 +176,101 @@ public function getJsonData($url){
}
/**
- * @param $url
+ * Get Contents
+ *
+ * @param string $url URL to reach
* @return false|string
*/
- public function getContents($url){
+ public function getContents($url)
+ {
$this->data = false;
$res = @file_get_contents($url);
$this->http_response_header = $http_response_header;
$this->TResponseHeader = self::parseHeaders($http_response_header);
- if($res !== false){
+ if ($res !== false) {
$this->data = $res;
}
return $this->data;
}
-
- public static function http_response_code_msg($code = NULL)
+ /**
+ * Get HTTP response message
+ *
+ * @param int|null $code HTTP code
+ * @return string
+ */
+ public static function httpResponseCodeMsg($code = null)
{
- if ($code !== NULL) {
-
+ if ($code !== null) {
switch ($code) {
- case 100:
- $text = 'Continue';
- break;
- case 101:
- $text = 'Switching Protocols';
- break;
- case 200:
- $text = 'OK';
- break;
- case 201:
- $text = 'Created';
- break;
- case 202:
- $text = 'Accepted';
- break;
- case 203:
- $text = 'Non-Authoritative Information';
- break;
- case 204:
- $text = 'No Content';
- break;
- case 205:
- $text = 'Reset Content';
- break;
- case 206:
- $text = 'Partial Content';
- break;
- case 300:
- $text = 'Multiple Choices';
- break;
- case 301:
- $text = 'Moved Permanently';
- break;
- case 302:
- $text = 'Moved Temporarily';
- break;
- case 303:
- $text = 'See Other';
- break;
- case 304:
- $text = 'Not Modified';
- break;
- case 305:
- $text = 'Use Proxy';
- break;
- case 400:
- $text = 'Bad Request';
- break;
- case 401:
- $text = 'Unauthorized';
- break;
- case 402:
- $text = 'Payment Required';
- break;
- case 403:
- $text = 'Forbidden';
- break;
- case 404:
- $text = 'Not Found';
- break;
- case 405:
- $text = 'Method Not Allowed';
- break;
- case 406:
- $text = 'Not Acceptable';
- break;
- case 407:
- $text = 'Proxy Authentication Required';
- break;
- case 408:
- $text = 'Request Time-out';
- break;
- case 409:
- $text = 'Conflict';
- break;
- case 410:
- $text = 'Gone';
- break;
- case 411:
- $text = 'Length Required';
- break;
- case 412:
- $text = 'Precondition Failed';
- break;
- case 413:
- $text = 'Request Entity Too Large';
- break;
- case 414:
- $text = 'Request-URI Too Large';
- break;
- case 415:
- $text = 'Unsupported Media Type';
- break;
- case 500:
- $text = 'Internal Server Error';
- break;
- case 501:
- $text = 'Not Implemented';
- break;
- case 502:
- $text = 'Bad Gateway';
- break;
- case 503:
- $text = 'Service Unavailable';
- break;
- case 504:
- $text = 'Gateway Time-out';
- break;
- case 505:
- $text = 'HTTP Version not supported';
- break;
+ case 100: $text = 'Continue'; break;
+ case 101: $text = 'Switching Protocols'; break;
+ case 200: $text = 'OK'; break;
+ case 201: $text = 'Created'; break;
+ case 202: $text = 'Accepted'; break;
+ case 203: $text = 'Non-Authoritative Information'; break;
+ case 204: $text = 'No Content'; break;
+ case 205: $text = 'Reset Content'; break;
+ case 206: $text = 'Partial Content'; break;
+ case 300: $text = 'Multiple Choices'; break;
+ case 301: $text = 'Moved Permanently'; break;
+ case 302: $text = 'Moved Temporarily'; break;
+ case 303: $text = 'See Other'; break;
+ case 304: $text = 'Not Modified'; break;
+ case 305: $text = 'Use Proxy'; break;
+ case 400: $text = 'Bad Request'; break;
+ case 401: $text = 'Unauthorized'; break;
+ case 402: $text = 'Payment Required'; break;
+ case 403: $text = 'Forbidden'; break;
+ case 404: $text = 'Not Found'; break;
+ case 405: $text = 'Method Not Allowed'; break;
+ case 406: $text = 'Not Acceptable'; break;
+ case 407: $text = 'Proxy Authentication Required'; break;
+ case 408: $text = 'Request Time-out'; break;
+ case 409: $text = 'Conflict'; break;
+ case 410: $text = 'Gone'; break;
+ case 411: $text = 'Length Required'; break;
+ case 412: $text = 'Precondition Failed'; break;
+ case 413: $text = 'Request Entity Too Large'; break;
+ case 414: $text = 'Request-URI Too Large'; break;
+ case 415: $text = 'Unsupported Media Type'; break;
+ case 500: $text = 'Internal Server Error'; break;
+ case 501: $text = 'Not Implemented'; break;
+ case 502: $text = 'Bad Gateway'; break;
+ case 503: $text = 'Service Unavailable'; break;
+ case 504: $text = 'Gateway Time-out'; break;
+ case 505: $text = 'HTTP Version not supported'; break;
default:
$text = 'Unknown http status code "' . htmlentities($code) . '"';
break;
}
return $text;
-
} else {
- return $text = 'Unknown http status code NULL';
+ return 'Unknown http status code NULL';
}
}
-
- public static function parseHeaders( $headers )
+ /**
+ * Parse headers
+ *
+ * @param array $headers Headers array
+ * @return array
+ */
+ public static function parseHeaders($headers)
{
$head = array();
- if(!is_array($headers)){
+ if (!is_array($headers)) {
return $head;
}
-
- foreach( $headers as $k=>$v )
- {
- $t = explode( ':', $v, 2 );
- if( isset( $t[1] ) )
- $head[ trim($t[0]) ] = trim( $t[1] );
- else
- {
+ foreach ($headers as $k=>$v) {
+ $t = explode(':', $v, 2);
+ if ( isset($t[1]) )
+ $head[ trim($t[0]) ] = trim($t[1]);
+ else {
$head[] = $v;
- if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
+ if ( preg_match("#HTTP/[0-9\.]+\s+([0-9]+)#", $v, $out) )
$head['reponse_code'] = intval($out[1]);
}
}
return $head;
}
-
}
diff --git a/config.default.php b/config.default.php
index e819aa5..2768a32 100644
--- a/config.default.php
+++ b/config.default.php
@@ -1,17 +1,29 @@
.
+ */
+ if (is_file('../main.inc.php'))$dir = '../';
+elseif (is_file('../../../main.inc.php'))$dir = '../../../';
+else $dir = '../../';
- if(!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) {
- include($dir."master.inc.php");
- }
- elseif(!defined('INC_FROM_DOLIBARR')) {
- include($dir."main.inc.php");
- } else {
- global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
- }
-
\ No newline at end of file
+if (!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) {
+ include $dir."master.inc.php";
+} elseif (!defined('INC_FROM_DOLIBARR')) {
+ include $dir."main.inc.php";
+} else {
+ global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
+}
diff --git a/config.php b/config.php
index a20fa5a..b4e0eb3 100644
--- a/config.php
+++ b/config.php
@@ -1,4 +1,18 @@
.
+ */
- require('config.default.php');
-
+ require 'config.default.php';
diff --git a/core/triggers/interface_99_modUpbuttons_Upbuttonstrigger.class.php b/core/triggers/interface_99_modUpbuttons_Upbuttonstrigger.class.php
index 139299a..e684194 100644
--- a/core/triggers/interface_99_modUpbuttons_Upbuttonstrigger.class.php
+++ b/core/triggers/interface_99_modUpbuttons_Upbuttonstrigger.class.php
@@ -17,17 +17,9 @@
*/
/**
- * \file core/triggers/interface_99_modMyodule_Upbuttonstrigger.class.php
- * \ingroup upbuttons
- * \brief Sample trigger
- * \remarks You can create other triggers by copying this one
- * - File name should be either:
- * interface_99_modMymodule_Mytrigger.class.php
- * interface_99_all_Mytrigger.class.php
- * - The file must stay in core/triggers
- * - The class name must be InterfaceMytrigger
- * - The constructor method must be named InterfaceMytrigger
- * - The name property name must be Mytrigger
+ * \file core/triggers/interface_99_modMyodule_Upbuttonstrigger.class.php
+ * \ingroup upbuttons
+ * \brief Sample trigger
*/
/**
@@ -35,84 +27,110 @@
*/
class InterfaceUpbuttonstrigger
{
+ /**
+ * @var DoliDB Database handler
+ */
+ protected $db;
- private $db;
+ /**
+ * @var string Name
+ */
+ public $name;
- /**
- * Constructor
- *
- * @param DoliDB $db Database handler
- */
- public function __construct($db)
- {
- $this->db = $db;
+ /**
+ * @var string Family
+ */
+ public $family;
- $this->name = preg_replace('/^Interface/i', '', get_class($this));
- $this->family = "demo";
- $this->description = "Triggers of this module are empty functions."
- . "They have no effect."
- . "They are provided for tutorial purpose only.";
- // 'development', 'experimental', 'dolibarr' or version
- $this->version = 'development';
- $this->picto = 'upbuttons@upbuttons';
- }
+ /**
+ * @var string Description
+ */
+ public $description;
- /**
- * Trigger name
- *
- * @return string Name of trigger file
- */
- public function getName()
- {
- return $this->name;
- }
+ /**
+ * @var string Version
+ */
+ public $version;
- /**
- * Trigger description
- *
- * @return string Description of trigger file
- */
- public function getDesc()
- {
- return $this->description;
- }
+ /**
+ * @var string Picto
+ */
+ public $picto;
- /**
- * Trigger version
- *
- * @return string Version of trigger file
- */
- public function getVersion()
- {
- global $langs;
- $langs->load("admin");
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ public function __construct($db)
+ {
+ $this->db = $db;
- if ($this->version == 'development') {
- return $langs->trans("Development");
- } elseif ($this->version == 'experimental')
+ $this->name = preg_replace('/^Interface/i', '', get_class($this));
+ $this->family = "demo";
+ $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only.";
+ // 'development', 'experimental', 'dolibarr' or version
+ $this->version = 'development';
+ $this->picto = 'upbuttons@upbuttons.png';
+ }
- return $langs->trans("Experimental");
- elseif ($this->version == 'dolibarr') return DOL_VERSION;
- elseif ($this->version) return $this->version;
- else {
- return $langs->trans("Unknown");
- }
- }
+ /**
+ * Return name of trigger
+ *
+ * @return string Name of trigger file
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
- /**
- * Function called when a Dolibarrr business event is done.
- * All functions "run_trigger" are triggered if file
- * is inside directory core/triggers
- *
- * @param string $action Event action code
- * @param Object $object Object
- * @param User $user Object user
- * @param Translate $langs Object langs
- * @param conf $conf Object conf
- * @return int <0 if KO, 0 if no triggered ran, >0 if OK
- */
- public function run_trigger($action, $object, $user, $langs, $conf)
- {
- return 0;
- }
+ /**
+ * Return description of trigger
+ *
+ * @return string Description of trigger file
+ */
+ public function getDesc()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Return version of trigger
+ *
+ * @return string Version of trigger file
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+
+ if ($this->version == 'development') {
+ return $langs->trans("Development");
+ } elseif ($this->version == 'experimental') {
+ return $langs->trans("Experimental");
+ } elseif ($this->version == 'dolibarr') {
+ return DOL_VERSION;
+ } elseif ($this->version) {
+ return $this->version;
+ } else {
+ return $langs->trans("Unknown");
+ }
+ }
+
+ /**
+ * Function called when a Dolibarrr business event is done.
+ * All functions "run_trigger" are triggered if file
+ * is inside directory core/triggers
+ *
+ * @param string $action Event action code
+ * @param Object $object Object
+ * @param User $user Object user
+ * @param Translate $langs Object langs
+ * @param conf $conf Object conf
+ * @return int <0 if KO, 0 if no triggered ran, >0 if OK
+ */
+ public function runTrigger($action, $object, $user, $langs, $conf)
+ {
+ return 0;
+ }
}