mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 22:41:30 +01:00
New : language support for knowledgemanagement module
This commit is contained in:
@@ -596,3 +596,4 @@ create table llx_onlinesignature
|
|||||||
pathoffile varchar(255)
|
pathoffile varchar(255)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD default_lang varchar(6)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord(
|
|||||||
date_creation datetime NOT NULL,
|
date_creation datetime NOT NULL,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
last_main_doc varchar(255),
|
last_main_doc varchar(255),
|
||||||
|
default_lang varchar(6),
|
||||||
fk_user_creat integer NOT NULL,
|
fk_user_creat integer NOT NULL,
|
||||||
fk_user_modif integer,
|
fk_user_modif integer,
|
||||||
fk_user_valid integer,
|
fk_user_valid integer,
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class KnowledgeRecord extends CommonObject
|
|||||||
//'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', 'label'=>'GroupOfTicket', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory'),
|
'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php', 'label'=>'GroupOfTicket', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory'),
|
||||||
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),),
|
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),),
|
||||||
|
'default_lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>0,),
|
||||||
);
|
);
|
||||||
public $rowid;
|
public $rowid;
|
||||||
public $ref;
|
public $ref;
|
||||||
@@ -130,6 +131,7 @@ class KnowledgeRecord extends CommonObject
|
|||||||
public $answer;
|
public $answer;
|
||||||
public $url;
|
public $url;
|
||||||
public $status;
|
public $status;
|
||||||
|
public $default_lang;
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php';
|
||||||
|
|
||||||
@@ -156,6 +157,7 @@ if ($action == 'confirm_validate') {
|
|||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
$formproject = new FormProjets($db);
|
$formproject = new FormProjets($db);
|
||||||
|
$formadmin = new FormAdmin($db);
|
||||||
|
|
||||||
$title = $langs->trans("KnowledgeRecord");
|
$title = $langs->trans("KnowledgeRecord");
|
||||||
$help_url = '';
|
$help_url = '';
|
||||||
@@ -185,6 +187,13 @@ 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';
|
||||||
|
|
||||||
|
//Language of question/response
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||||
|
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||||
|
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||||
|
|
||||||
@@ -225,6 +234,13 @@ 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';
|
||||||
|
|
||||||
|
//Language of question/response
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||||
|
print img_picto('', 'language', 'class="pictofixedwidth"');
|
||||||
|
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'default_lang', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
@@ -332,6 +348,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
//unset($object->fields['fk_soc']); // Hide field already shown in banner
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
|
//Language of question/response
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td><td>';
|
||||||
|
$langs->load("languages");
|
||||||
|
$labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
|
||||||
|
print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||||
|
print $labellang;
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
// Other attributes. Fields from hook formObjectOptions and Extrafields.
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
|
||||||
@@ -117,6 +118,15 @@ foreach ($object->fields as $key => $val) {
|
|||||||
'position'=>$val['position'],
|
'position'=>$val['position'],
|
||||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||||
);
|
);
|
||||||
|
}else if ($key = 'default_lang'){
|
||||||
|
$visible = (int) dol_eval($val['visible'], 1);
|
||||||
|
$arrayfields['t.'.$key] = array(
|
||||||
|
'label'=>$val['label'],
|
||||||
|
'checked'=>(($visible < 0) ? 0 : 1),
|
||||||
|
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||||
|
'position'=>$val['position'],
|
||||||
|
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
@@ -197,6 +207,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$user_temp = new User($db);
|
$user_temp = new User($db);
|
||||||
|
$formadmin = new FormAdmin($db);
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@@ -455,7 +466,11 @@ foreach ($object->fields as $key => $val) {
|
|||||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||||
|
if($key == 'default_lang'){
|
||||||
|
print $formadmin->select_language($search[$key], 'search_default_lang', 0, null, 1, 0, 0, 'minwidth300', 2);
|
||||||
|
}else{
|
||||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||||
|
}
|
||||||
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
@@ -592,6 +607,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|||||||
}
|
}
|
||||||
print $user_temp->getNomUrl(-1);
|
print $user_temp->getNomUrl(-1);
|
||||||
}
|
}
|
||||||
|
}else if($key == 'lang'){
|
||||||
|
$labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
|
||||||
|
print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
|
||||||
|
print $labellang;
|
||||||
} else {
|
} else {
|
||||||
print $object->showOutputField($val, $key, $object->$key, '');
|
print $object->showOutputField($val, $key, $object->$key, '');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user