Debug v22

This commit is contained in:
Laurent Destailleur 2025-05-16 22:39:08 +02:00
parent d540dd0ab7
commit fed208b57d
6 changed files with 36 additions and 8 deletions

View file

@ -581,7 +581,7 @@ if (isModEnabled('category') && ($user->hasRight('produit', 'lire') || $user->ha
}
// alert on late date
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('Alert').' <input type="checkbox" name="search_option" value="late"'.($search_option == 'late' ? ' checked' : '').'>';
$moreforfilter .= '<label for="search_option">'.$langs->trans('Alert').'</label> <input type="checkbox" name="search_option" id="search_option" value="late"'.($search_option == 'late' ? ' checked' : '').'>';
$moreforfilter .= '</div>';
$parameters = array();

View file

@ -49,6 +49,7 @@ if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
include '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
/**
* @var Conf $conf
@ -80,10 +81,16 @@ if (!defined("NOLOGIN")) { // No need of restrictedArea if not logged: Later the
* View
*/
$form = new Form($db);
top_httphead('application/json');
if ($action == "getCategories") {
$response = '';
$response = array();
$cate_arbo = $form->select_all_categories($type, '', '', 64, 0, 2);
/*
$sql = "SELECT c.rowid, c.label, c.color";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c ";
$sql .= " WHERE c.type = '".$db->escape($type)."'";
@ -95,12 +102,16 @@ if ($action == "getCategories") {
$response = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
$response[] = array('id' => $obj->rowid, 'label' => $obj->label, 'data-html' => 'TODO', 'color' => $obj->color);
$response[] = array('id' => $obj->rowid, 'label' => $obj->label, 'html' => img_picto('', 'tag', 'class="pictofixedwidth"'.($obj->color ? ' style="color: #'.$obj->color.'"' : '')).$obj->label, 'color' => $obj->color);
$i++;
}
} else {
dol_print_error($db);
}
*/
foreach ($cate_arbo as $categ) {
$response[] = array('id' => $categ['id'], 'label' => $categ['label'], 'fulllabel' => $categ['fulllabel'], 'htmlforoption' => dolPrintHTML($categ['fulllabel']), 'htmlforattribute' => dolPrintHTMLForAttribute($categ['data-html']), 'color' => $categ['color']);
}
$response =json_encode($response);
echo $response;

View file

@ -102,7 +102,7 @@ if ($action == "getKnowledgeRecord") {
$response = array();
while ($i < $num) {
$obj = $db->fetch_object($resql);
$response[] = array('title'=>$obj->question,'ref'=>$obj->ref,'answer'=>dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)),'url'=>$obj->url);
$response[] = array('title' => dol_escape_htmltag($obj->question), 'ref' => dol_escape_htmltag($obj->ref), 'answer' => dol_escape_htmltag(preg_replace('/\\r|\\r\\n|\\n/', "", $obj->answer)), 'url' => $obj->url);
$i++;
}
} else {

View file

@ -5690,7 +5690,7 @@ class Form
$add = '';
}
$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth"'.(empty($cate_arbo[$key]['color']) ? '' : ' style="color: #' . $cate_arbo[$key]['color'] . '"'));
$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];

View file

@ -2790,11 +2790,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
dataType: \'json\',
success: function (data) {
var $select = $(\'#'.dol_escape_js($htmlname).'\');
var selectedValues = $select.val(); // This is an array of selected values
console.log(selectedValues);
$select.empty();
$.each(data, function (index, item) {
$select.append(\'<option value="\' + item.id + \'" data-html="aaa">\' + item.label + \'</option>\');
$select.append(\'<option value="\' + item.id + \'" data-html="\' + item.htmlforattribute + \'">\' + item.htmlforoption + \'</option>\');
});
$select.val(selectedValues);
},
error: function (xhr, status, error) {
alert("Error when loading ajax page : " + error);
@ -2966,7 +2968,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
)
);
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250);
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 300);
}
// Clone confirmation

View file

@ -5811,6 +5811,21 @@ div#card-errors {
padding-top: 5px;
padding-bottom: 5px;
}
.ui-widget-header {
padding: 8px !important;
background: unset;
border: unset;
border-bottom: 1px solid #AAA;
margin-bottom: 12px;
}
button.ui-button-icon-only.ui-dialog-titlebar-close {
padding: 12px;
margin-top: -15px;
}
.ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-dialog-buttons.ui-draggable {
box-shadow: 5px 5px 20px #AAA;
}
/* ============================================================================== */
/* For content of image preview */