Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
16fe32f908
4 changed files with 95 additions and 59 deletions
|
|
@ -1003,28 +1003,28 @@ class KnowledgeRecord extends CommonObject
|
|||
return $this->initAsSpecimenCommon();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an array of lines
|
||||
*
|
||||
* @return KnowledgeRecordLine[]|int array of lines if OK, <0 if KO
|
||||
*/
|
||||
public function getLinesArray()
|
||||
{
|
||||
$this->lines = array();
|
||||
// /**
|
||||
// * Create an array of lines
|
||||
// *
|
||||
// * @return KnowledgeRecordLine[]|int array of lines if OK, <0 if KO
|
||||
// */
|
||||
// public function getLinesArray()
|
||||
// {
|
||||
// $this->lines = array();
|
||||
|
||||
$objectline = new KnowledgeRecordLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_knowledgerecord:=:'.((int) $this->id).')');
|
||||
// $objectline = new KnowledgeRecordLine($this->db);
|
||||
// $result = $objectline->fetchAll('ASC', 'position', 0, 0, '(fk_knowledgerecord:=:'.((int) $this->id).')');
|
||||
|
||||
if (is_numeric($result)) {
|
||||
$this->error = $objectline->error;
|
||||
$this->errors = $objectline->errors;
|
||||
return $result;
|
||||
} else {
|
||||
$this->lines = $result;
|
||||
// @phpstan-ignore-next-line
|
||||
return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
|
||||
}
|
||||
}
|
||||
// if (is_numeric($result)) {
|
||||
// $this->error = $objectline->error;
|
||||
// $this->errors = $objectline->errors;
|
||||
// return $result;
|
||||
// } else {
|
||||
// $this->lines = $result;
|
||||
// // @phpstan-ignore-next-line
|
||||
// return $result; // @phan-suppress-current-line PhanTypeMismatchReturn
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the reference to the following non used object depending on the active numbering module.
|
||||
|
|
@ -1236,25 +1236,25 @@ class KnowledgeRecord extends CommonObject
|
|||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
// require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
|
||||
/**
|
||||
* Class KnowledgeRecordLine. You can also remove this and generate a CRUD class for lines objects.
|
||||
*/
|
||||
class KnowledgeRecordLine extends CommonObjectLine
|
||||
{
|
||||
// To complete with content of an object KnowledgeRecordLine
|
||||
// We should have a field rowid, fk_knowledgerecord and position
|
||||
// /**
|
||||
// * Class KnowledgeRecordLine. You can also remove this and generate a CRUD class for lines objects.
|
||||
// */
|
||||
// class KnowledgeRecordLine extends CommonObjectLine
|
||||
// {
|
||||
// // To complete with content of an object KnowledgeRecordLine
|
||||
// // We should have a field rowid, fk_knowledgerecord and position
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
// /**
|
||||
// * Constructor
|
||||
// *
|
||||
// * @param DoliDB $db Database handler
|
||||
// */
|
||||
// public function __construct(DoliDB $db)
|
||||
// {
|
||||
// $this->db = $db;
|
||||
|
||||
$this->isextrafieldmanaged = 0;
|
||||
}
|
||||
}
|
||||
// $this->isextrafieldmanaged = 0;
|
||||
// }
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -459,12 +459,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
// Add field answer
|
||||
print '<br>';
|
||||
print $langs->trans($object->fields['answer']['label']).'<br>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, true, true, ROWS_9, '100%', 1);
|
||||
$out = $doleditor->Create(1);
|
||||
print load_fiche_titre($langs->trans($object->fields['answer']['label']), '', '');
|
||||
if ($action == 'edit') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('answer', $object->answer, '', 200, 'dolibarr_notes', 'In', true, true, true, ROWS_9, '100%', 1);
|
||||
$out = $doleditor->Create(1);
|
||||
} else {
|
||||
$out = '<div class="content">';
|
||||
$out .= $object->answer;
|
||||
$out .= '</div>';
|
||||
}
|
||||
print $out;
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,18 @@ if (GETPOSTISSET('formfilteraction')) {
|
|||
$searchCategoryMoList = GETPOST('search_category_mo_list', 'array:int');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
if ($key == 'status' && GETPOSTISSET('search_status')) {
|
||||
$search_status = GETPOST('search_status', 'array:int');
|
||||
if (empty($search_status) && GETPOST('search_status', 'alpha') !== '') {
|
||||
$search_status = GETPOST('search_status', 'int');
|
||||
if ($search_status !== -1) {
|
||||
$search_status = array($search_status);
|
||||
} else {
|
||||
$search_status = '';
|
||||
}
|
||||
}
|
||||
$search[$key] = $search_status;
|
||||
} elseif (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
|
|
@ -358,24 +369,42 @@ if ($object->ismultientitymanaged == 1) {
|
|||
|
||||
foreach ($search as $key => $val) {
|
||||
if (array_key_exists($key, $object->fields)) {
|
||||
if ($key == 'status' && $search[$key] == -1) {
|
||||
continue;
|
||||
}
|
||||
if ($key == 'status' && $search[$key] == -2) {
|
||||
$sql .= " AND (t.status IN (".$db->sanitize($object::STATUS_VALIDATED.",".$object::STATUS_INPROGRESS)."))";
|
||||
if ($search_option == 'late') {
|
||||
if ($key == 'status') {
|
||||
if ($search[$key] === -1 || (is_array($search[$key]) && (count($search[$key]) == 0 || (count($search[$key]) == 1 && reset($search[$key]) == -1)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$status_to_search = array();
|
||||
if (is_array($search[$key])) {
|
||||
foreach ($search[$key] as $status_val) {
|
||||
if ($status_val == -2) {
|
||||
$status_to_search[] = $object::STATUS_VALIDATED;
|
||||
$status_to_search[] = $object::STATUS_INPROGRESS;
|
||||
} elseif ($status_val !== '' && $status_val >= 0) {
|
||||
$status_to_search[] = $status_val;
|
||||
}
|
||||
}
|
||||
} elseif ($search[$key] == -2) {
|
||||
$status_to_search[] = $object::STATUS_VALIDATED;
|
||||
$status_to_search[] = $object::STATUS_INPROGRESS;
|
||||
} elseif ($search[$key] !== '' && $search[$key] >= 0) {
|
||||
$status_to_search[] = $search[$key];
|
||||
}
|
||||
|
||||
if (!empty($status_to_search)) {
|
||||
$sql .= " AND t.status IN (".$db->sanitize(implode(',', array_unique($status_to_search))).")";
|
||||
}
|
||||
|
||||
if ($search_option == 'late' && (in_array(-2, (array) $search[$key]) || in_array($object::STATUS_VALIDATED, (array) $search[$key]) || in_array($object::STATUS_INPROGRESS, (array) $search[$key]))) {
|
||||
$sql .= " AND (t.date_end_planned < '".$db->idate(dol_now() - getWarningDelay('mrp', 'progress'))."')";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($key == 'fk_parent_line' && $search[$key] != '') {
|
||||
$sql .= natural_search('moparent.ref', $search[$key], 0);
|
||||
continue;
|
||||
}
|
||||
if ($key == 'status') {
|
||||
$sql .= natural_search('t.status', (string) $search[$key], 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
|
||||
|
|
@ -729,8 +758,10 @@ foreach ($object->fields as $key => $val) {
|
|||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
if ($key == 'status') {
|
||||
$val['arrayofkeyval'][-2] = $langs->trans("StatusMrpValidated").'+'.$langs->trans("StatusMrpProgress");
|
||||
print $form->multiselectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) && $search[$key] !== '' && $search[$key] != -1 ? (array) $search[$key] : array()), 0, 0, 'maxwidth100', 0, 0, '', '', '');
|
||||
} else {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
}
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -167,7 +167,7 @@ $formproduct = new FormProduct($db);
|
|||
$product_fourn = new ProductFournisseur($db);
|
||||
$productstatic = new Product($db);
|
||||
$resql = false;
|
||||
// action recherche des produits par mot-cle et/ou par categorie
|
||||
// action searching products by keywords and/or by category
|
||||
if ($action == 'search') {
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
|
|
@ -480,7 +480,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
if ($prod_arbo->type == 2 || $prod_arbo->type == 3) {
|
||||
$is_pere = 0;
|
||||
$prod_arbo->get_sousproduits_arbo();
|
||||
// associations sousproduits
|
||||
// associations subproducts
|
||||
$prods_arbo = $prod_arbo->get_arbo_each_prod();
|
||||
if (count($prods_arbo) > 0) {
|
||||
foreach ($prods_arbo as $key => $value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue