FIX not active value are not hidden (missing filter of field) (#20032)

* FIX not active value are not hidden (missing filter of field)

* FIX wrong category table and wrong object id
This commit is contained in:
Regis Houssin 2022-02-10 09:19:14 +01:00 committed by GitHub
parent eda401dea0
commit cc8af7b1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View File

@ -7379,7 +7379,11 @@ class Form
$objecttmp = null; $objecttmp = null;
$InfoFieldList = explode(":", $objectdesc); $InfoFieldList = explode(":", $objectdesc, 4);
$vartmp = $InfoFieldList[3];
$InfoFieldList[4] = preg_replace('/^.*:(\w*)$/', '\1', $vartmp); // take the sort field
$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
$classname = $InfoFieldList[0]; $classname = $InfoFieldList[0];
$classpath = $InfoFieldList[1]; $classpath = $InfoFieldList[1];
$addcreatebuttonornot = empty($InfoFieldList[2]) ? 0 : $InfoFieldList[2]; $addcreatebuttonornot = empty($InfoFieldList[2]) ? 0 : $InfoFieldList[2];

View File

@ -115,7 +115,7 @@ class KnowledgeRecord extends CommonObject
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
//'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'),
'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0::pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0:(t.active:=:1):pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),),
); );
public $rowid; public $rowid;
@ -459,7 +459,7 @@ class KnowledgeRecord extends CommonObject
public function delete(User $user, $notrigger = false) public function delete(User $user, $notrigger = false)
{ {
$error = 0; $error = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".((int) $this->rowid); $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_knowledgemanagement = ".((int) $this->id);
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (!$resql) {

View File

@ -175,10 +175,10 @@ if ($action == 'create') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
if ($backtopage) { if (!empty($backtopage)) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
} }
if ($backtopageforcancel) { if (!empty($backtopageforcancel)) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
} }
@ -192,7 +192,7 @@ if ($action == 'create') {
// Common attributes // Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
if ($conf->categorie->enabled) { if (!empty($conf->categorie->enabled)) {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1);
if (count($cate_arbo)) { if (count($cate_arbo)) {
@ -225,10 +225,10 @@ if (($id || $ref) && $action == 'edit') {
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
if ($backtopage) { if (!empty($backtopage)) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
} }
if ($backtopageforcancel) { if (!empty($backtopageforcancel)) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
} }
@ -239,7 +239,7 @@ if (($id || $ref) && $action == 'edit') {
// Common attributes // Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
if ($conf->categorie->enabled) { if (!empty($conf->categorie->enabled)) {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1);
if (count($cate_arbo)) { if (count($cate_arbo)) {