diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index a5908ae8f51..d97a4860a19 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -2419,6 +2419,7 @@ class ExtraFields
$value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1);
} elseif ($type == 'stars') {
$objectid = (int) $object->id;
+ $nbstars = (int) $value;
if ($showValueInsteadOfInputField == 1) {
$value = ''.dol_escape_htmltag($value).'';
} else {
@@ -2428,7 +2429,7 @@ class ExtraFields
$value .= '
';
$i = 1;
while ($i <= $size) {
- $value .= ''.img_picto('', 'fontawesome_star_fas').'';
+ $value .= ''.img_picto('', 'fontawesome_star_fas').'';
$i++;
}
$value .= '
';
@@ -2436,23 +2437,24 @@ class ExtraFields
$(document).ready(function() {
let container = $("#'.$key.$objectid.'_selection");
let selectedStars = parseInt($("#'.$key.$objectid.'").val() || $("#'.$key.$objectid.'").text()) || 0;
- container.find(".star").each(function() {
- $(this).toggleClass("active", $(this).data("value") <= selectedStars);
- });';
+ ';
if ($showValueInsteadOfInputField == 0) {
$value .= '
container.find(".star").on("mouseover", function() {
+ console.log("Mouse over a star");
let selectedStar = $(this).data("value");
container.find(".star").each(function() {
$(this).toggleClass("active", $(this).data("value") <= selectedStar);
});
});
container.on("mouseout", function() {
+ console.log("Mouse out of star");
container.find(".star").each(function() {
$(this).toggleClass("active", $(this).data("value") <= selectedStars);
});
});
container.find(".star").off("click").on("click", function() {
+ console.log("We click on star, we call the ajax core/ajax/updateextrafield.php");
selectedStars = $(this).data("value");
if (selectedStars == 1 && $("#'.$key.$objectid.'").val() == 1) {
selectedStars = 0;
@@ -2469,7 +2471,7 @@ class ExtraFields
objectId: '.((int) $objectid).',
field: \''.dol_escape_js($key).'\',
value: selectedStars,
- token: "'.newToken().'"
+ token: \''.newToken().'\'
},
success: function(response) {
var res = JSON.parse(response);
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index ffa376e82bf..73df5603cd2 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -5387,7 +5387,7 @@ img.boxhandle, img.boxclose {
.star-selection {
font-size: 1rem;
cursor: pointer;
- display: flex;
+ display: inline-block;
}
.star {
color: #ccc;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 36837e81227..a9155c780dc 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -5372,7 +5372,7 @@ img.boxhandle, img.boxclose {
.star-selection {
font-size: 1rem;
cursor: pointer;
- display: flex;
+ display: inline-block;
}
.star {
color: #ccc;