diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index bcbdf18c213..74ad69e4e1d 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -53,13 +53,11 @@ if ($action == 'add' && !empty($permissiontoadd)) {
foreach ($object->fields as $key => $val) {
if ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') {
- continue; // The field was not submited to be edited
+ continue; // The field was not submited to be saved
}
} else {
if (!GETPOSTISSET($key)) {
- if ($key != 'lang' || !GETPOSTISSET($key.'object')) {
- continue; // The field was not submited to be edited
- }
+ continue; // The field was not submited to be saved
}
}
// Ignore special fields
@@ -90,7 +88,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
$value = $tmparraykey[GETPOST($key)].','.GETPOST($key.'2');
} else {
if ($key == 'lang') {
- $value = GETPOST($key.'object', 'aZ09');
+ $value = GETPOST($key, 'aZ09');
} else {
$value = GETPOST($key, 'alphanohtml');
}
@@ -158,7 +156,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
// Check if field was submited to be edited
if ($object->fields[$key]['type'] == 'duration') {
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) {
- continue; // The field was not submited to be edited
+ continue; // The field was not submited to be saved
}
} elseif ($object->fields[$key]['type'] == 'boolean') {
if (!GETPOSTISSET($key)) {
@@ -167,9 +165,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
} else {
if (!GETPOSTISSET($key)) {
- if ($key != 'lang' || !GETPOSTISSET($key.'object')) {
- continue; // The field was not submited to be edited
- }
+ continue; // The field was not submited to be saved
}
}
// Ignore special fields
@@ -178,7 +174,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
if (in_array($key, array('date_creation', 'tms', 'fk_user_creat', 'fk_user_modif'))) {
if (!in_array(abs($val['visible']), array(1, 3, 4))) {
- continue; // Only 1 and 3 and 4 that are case to update
+ continue; // Only 1 and 3 and 4, that are cases to update
}
}
@@ -208,7 +204,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
$value = array_keys($object->param_list)[GETPOST($key)].','.GETPOST($key.'2');
} else {
if ($key == 'lang') {
- $value = GETPOST($key.'object', 'aZ09');
+ $value = GETPOST($key, 'aZ09');
} else {
$value = GETPOST($key, 'alphanohtml');
}
@@ -303,6 +299,8 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
setEventMessages($object->error, null, 'errors');
}
}
+
+ $action = '';
}
// Remove a line
@@ -334,11 +332,13 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto
}
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
+
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
+ $action = '';
}
// Action validate object
@@ -374,6 +374,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
+ $action = '';
}
// Action close object
@@ -404,6 +405,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
+ $action = '';
}
// Action setdraft object
@@ -414,6 +416,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
+ $action = '';
}
// Action reopen object
@@ -444,6 +447,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
+ $action = '';
}
// Action clone object
@@ -462,6 +466,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
} else {
$newid = $result;
}
+
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
exit;
} else {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index a6d0717f411..4d3c39027ac 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -8170,7 +8170,7 @@ abstract class CommonObject
} else {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
$return .= '';
- $return .= '
';
+ $return .= '
';
} else {
$return .= '';
$return .= '
';
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 259e5a3a19a..50f4bf9fb39 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -272,7 +272,7 @@ class FormTicket
print '';
}
- //Categories
+ // Categories
if ($conf->categorie->enabled) {
// Categories
print '
| '.$langs->trans("Categories").' | ';
@@ -441,6 +441,7 @@ class FormTicket
print ' |
| ';
print $langs->trans("AssignedTo");
print ' | ';
+ print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers(GETPOST('fk_user_assign', 'int'), 'fk_user_assign', 1);
print ' | ';
print '
';
diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php
index a0e83c6eb5e..be91d7b28a5 100644
--- a/htdocs/core/tpl/commonfields_add.tpl.php
+++ b/htdocs/core/tpl/commonfields_add.tpl.php
@@ -80,7 +80,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($val['type'] == 'price') {
$value = price2num(GETPOST($key));
} elseif ($key == 'lang') {
- $value = GETPOST($key.'object', 'aZ09');
+ $value = GETPOST($key, 'aZ09');
} else {
$value = GETPOST($key, 'alphanohtml');
}
@@ -89,7 +89,7 @@ foreach ($object->fields as $key => $val) {
} else {
if ($key == 'lang') {
print img_picto('', 'language', 'class="pictofixedwidth"');
- print $formadmin->select_language($value, $key.'object', 0, null, 1, 0, 0, 'minwidth300', 2);
+ print $formadmin->select_language($value, $key, 0, null, 1, 0, 0, 'minwidth300', 2);
} else {
print $object->showInputField($val, $key, $value, '', '', '', 0);
}
diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php
index a3d70117fea..a56ca8d865a 100644
--- a/htdocs/core/tpl/commonfields_edit.tpl.php
+++ b/htdocs/core/tpl/commonfields_edit.tpl.php
@@ -19,6 +19,7 @@
* $action
* $conf
* $langs
+ * $form
*/
// Protection to avoid direct call of template
@@ -80,7 +81,7 @@ foreach ($object->fields as $key => $val) {
} elseif ($val['type'] == 'price') {
$value = GETPOSTISSET($key) ? price2num(GETPOST($key)) : price2num($object->$key);
} elseif ($key == 'lang') {
- $value = GETPOSTISSET($key.'object', 'aZ09')?GETPOST($key.'object', 'aZ09'):$object->lang;
+ $value = GETPOSTISSET($key, 'aZ09') ? GETPOST($key, 'aZ09') : $object->lang;
} else {
$value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key;
}
@@ -90,7 +91,7 @@ foreach ($object->fields as $key => $val) {
} else {
if ($key == 'lang') {
print img_picto('', 'language', 'class="pictofixedwidth"');
- print $formadmin->select_language($value, $key.'object', 0, null, 1, 0, 0, 'minwidth300', 2);
+ print $formadmin->select_language($value, $key, 0, null, 1, 0, 0, 'minwidth300', 2);
} else {
print $object->showInputField($val, $key, $value, '', '', '', 0);
}
diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
index f3d6d81aaec..d6ee36eab37 100644
--- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php
+++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
@@ -101,7 +101,8 @@ class KnowledgeRecord extends CommonObject
*/
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
- 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"),
+ 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"),
+ 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>1),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,),
@@ -114,8 +115,7 @@ class KnowledgeRecord extends CommonObject
'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300'),
//'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'),
- 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),),
- 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>51, 'notnull'=>0, 'visible'=>1),
+ 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated'),),
);
public $rowid;
public $ref;
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 99e8e97ecc6..1500de628e7 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -373,13 +373,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($object->status == $object::STATUS_VALIDATED) {
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
}
- if ($object->status == $object::STATUS_VALIDATED && $permissiontovalidate) {
+ if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd);
}
// Validate
if ($object->status == $object::STATUS_DRAFT) {
if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) {
- print dolGetButtonAction($langs->trans('ValidateReply'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd);
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd);
} else {
$langs->load("errors");
//print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0);
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index 923213fe479..828137556ce 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -462,7 +462,7 @@ foreach ($object->fields as $key => $val) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
if ($key == 'lang') {
- print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth300', 2);
+ print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
} else {
print '';
}
diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php
index 8f4024342d7..d8c5f84d3de 100644
--- a/htdocs/modulebuilder/template/myobject_list.php
+++ b/htdocs/modulebuilder/template/myobject_list.php
@@ -533,7 +533,13 @@ foreach ($object->fields as $key => $val) {
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
- print '';
+ if ($key == 'lang') {
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
+ $formadmin = new FormAdmin($db);
+ print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
+ } else {
+ print '';
+ }
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));