28require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/knowledgemanagement/class/knowledgerecord.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
45$langs->loadLangs(array(
"knowledgemanagement",
"ticket",
"other"));
50$action =
GETPOST(
'action',
'aZ09');
51$confirm =
GETPOST(
'confirm',
'alpha');
53$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'knowledgerecordcard';
54$backtopage =
GETPOST(
'backtopage',
'alpha');
55$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
61$diroutputmassaction =
$conf->knowledgemanagement->dir_output.
'/temp/massgeneration/'.$user->id;
62$hookmanager->initHooks(array(
'knowledgerecordcard',
'globalcard'));
65$extrafields->fetch_name_optionals_label(
$object->table_element);
67$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
70$search_all =
GETPOST(
"search_all",
'alpha');
72foreach (
$object->fields as $key => $val) {
73 if (
GETPOST(
'search_'.$key,
'alpha')) {
74 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
78if (empty($action) && empty($id) && empty($ref)) {
83include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
86$permissiontoread = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'read');
87$permissiontoadd = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write');
88$permissiontodelete = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'delete') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_DRAFT);
89$permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $permissiontoadd) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'knowledgemanagement',
'knowledgerecord_advance',
'validate')));
90$permissionnote = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write');
91$permissiondellink = $user->hasRight(
'knowledgemanagement',
'knowledgerecord',
'write');
92$upload_dir =
$conf->knowledgemanagement->multidir_output[isset(
$object->entity) ?
$object->entity : 1];
97$isdraft = ((
$object->status == $object::STATUS_DRAFT) ? 1 : 0);
107$parameters = array();
108$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
113if (empty($reshook)) {
116 $backurlforlist = DOL_URL_ROOT.
'/knowledgemanagement/knowledgerecord_list.php';
118 if (empty($backtopage) || ($cancel && empty($id))) {
119 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
120 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
121 $backtopage = $backurlforlist;
123 $backtopage = DOL_URL_ROOT.
'/knowledgemanagement/knowledgerecord_card.php?id='.(
$id > 0 ?
$id :
'__ID__');
128 $triggermodname =
'KNOWLEDGERECORD_MODIFY';
131 if (($action ==
'update' || $action ==
'add') && !empty($permissiontoadd)) {
136 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
139 include DOL_DOCUMENT_ROOT.
'/core/actions_dellink.inc.php';
142 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
148 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
150 if ($action ==
'set_thirdparty' && $permissiontoadd) {
151 $object->setValueFrom(
'fk_soc',
GETPOSTINT(
'fk_soc'),
'',
null,
'date',
'', $user, $triggermodname);
153 if ($action ==
'classin' && $permissiontoadd) {
158 $triggersendname =
'KNOWLEDGEMANAGEMENT_KNOWLEDGERECORD_SENTBYMAIL';
159 $autocopy =
'MAIN_MAIL_AUTOCOPY_KNOWLEDGERECORD_TO';
160 $trackid =
'knowledgerecord'.$object->id;
161 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
163if ($action ==
'confirm_validate') {
172$form =
new Form($db);
177$title = $langs->trans(
"KnowledgeRecord");
179llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-knowledgemanagement page-card');
182if ($action ==
'create') {
183 print
load_fiche_titre($langs->trans(
"NewKnowledgeRecord"),
'',
'object_'.$object->picto);
185 print
'<form method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
186 print
'<input type="hidden" name="token" value="'.newToken().
'">';
187 print
'<input type="hidden" name="action" value="add">';
188 if (!empty($backtopage)) {
189 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
191 if (!empty($backtopageforcancel)) {
192 print
'<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.
'">';
197 print
'<table class="border centpercent tableforfieldcreate">'.
"\n";
200 $object->fields[
'answer'][
'enabled'] = 0;
201 include DOL_DOCUMENT_ROOT.
'/core/tpl/commonfields_add.tpl.php';
202 $object->fields[
'answer'][
'enabled'] = 1;
205 $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT,
'',
'parent', 64, 0, 3);
207 '@phan-var-force array<int,array{rowid:int,id:int,fk_parent:int,label:string,description:string,color:string,position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:string}> $cate_arbo';
209 if (count($cate_arbo)) {
211 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td colspan="3">';
212 print $form->selectCategories(Categorie::TYPE_KNOWLEDGEMANAGEMENT,
'categories', $object);
218 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
223 print $langs->trans(
$object->fields[
'answer'][
'label']);
228 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
230 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formai.class.php';
231 $formai =
new FormAI($db);
233 $formmail->withfckeditor = 1;
235 $formmail->withaiprompt = (
isModEnabled(
'ai') ?
'html' :
'');
237 $showlinktolayout = (
getDolGlobalInt(
'MAIN_EMAIL_USE_LAYOUT') ? $formmail->withlayout :
'');
238 $showlinktolayoutlabel = $langs->trans(
"FillMessageWithALayout");
239 $showlinktoai = ($formmail->withaiprompt ?
'textgenerationemail' :
'');
240 $showlinktoailabel = $langs->trans(
"FillMessageWithAIContent");
241 $htmlname =
'answer';
243 include DOL_DOCUMENT_ROOT.
'/core/tpl/formlayoutai.tpl.php';
247 print
'</table>'.
"\n";
249 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
250 $doleditor =
new DolEditor(
'answer',
$object->answer,
'', 200,
'dolibarr_notes',
'In',
true,
true,
true, ROWS_9,
'100%');
251 $out = $doleditor->Create(1);
256 $aipromptprefix = $langs->transnoentities(
'SuggestAnswerToQuestion');
258 print
'<script nonce="'.getNonce().
'" type="text/javascript">
259 $(document).ready(function() {
260 $("#linkforaiprompttextgenerationemail").on("click", function() {
261 setTimeout(function() {
262 var instructionField = $("#ai_instructionsanswer");
263 if (!instructionField.is(":visible")) {
267 var currentVal = instructionField.val();
269 if (typeof CKEDITOR !==
"undefined" && CKEDITOR.instances && CKEDITOR.instances[
"question"]) {
270 question = $(
"<div>").html(CKEDITOR.instances[
"question"].getData()).text().trim();
272 question = $(
"#question").val() ? $.trim($(
"#question").val()) :
"";
274 if (currentVal ===
"" || currentVal === prefix || currentVal.indexOf(prefix) === 0) {
276 instructionField.val(prefix +
" " + question);
278 instructionField.val(prefix);
280 $(
"#generate_buttonanswer").prop(
"disabled", (instructionField.val() ===
""));
288 print dol_get_fiche_end();
290 print $form->buttonsSaveCancel('Create
');
294 //dol_set_focus('input[
name=
"ref"]
');
297// Part to edit record
298if (($id || $ref) && $action == 'edit
') {
299 print load_fiche_titre($langs->trans("KnowledgeRecord"), '', 'object_
'.$object->picto);
301 print '<form method=
"POST" action=
"'.dolBuildUrl($_SERVER["PHP_SELF
"]).'">
';
302 print '<input
type=
"hidden" name=
"token" value=
"'.newToken().'">
';
303 print '<input
type=
"hidden" name=
"action" value=
"update">
';
304 print '<input
type=
"hidden" name=
"id" value=
"'.$object->id.'">
';
305 if (!empty($backtopage)) {
306 print '<input
type=
"hidden" name=
"backtopage" value=
"'.$backtopage.'">
';
308 if (!empty($backtopageforcancel)) {
309 print '<input
type=
"hidden" name=
"backtopageforcancel" value=
"'.$backtopageforcancel.'">
';
312 print dol_get_fiche_head(array(), '', '', -3);
314 print '<
table class=
"border centpercent tableforfieldedit">
'."\n";
317 $object->fields['answer
']['enabled
'] = 0;
318 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php
';
319 $object->fields['answer
']['enabled
'] = 1;
321 if (isModEnabled('category
')) {
322 $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent
', 64, 0, 3);
323 // $output_mode is 3, so fix return type:
324 '@phan-var-force array<int,array{rowid:int,id:int,fk_parent:int,label:string,
description:string,color:string,
position:string,visible:int,ref_ext:string,picto:string,fullpath:string,fulllabel:
string}> $cate_arbo
';
326 if (count($cate_arbo)) {
328 print '<tr><td>
'.$langs->trans("Categories").'</td><td colspan=
"3">
';
329 print $form->selectCategories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, 'categories
', $object);
335 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php
';
341 print $langs->trans($object->fields['answer
']['label
']).'<br>
';
343 // Add layout and AI tools for answer
345 require_once DOL_DOCUMENT_ROOT.'/core/
class/html.formmail.class.php
';
346 $formmail = new FormMail($db);
347 require_once DOL_DOCUMENT_ROOT.'/core/
class/html.formai.class.php
';
348 $formai = new FormAI($db);
350 $formmail->withfckeditor = 1;
351 $formmail->withlayout = 'email';
352 $formmail->withaiprompt = (isModEnabled('ai
') ? 'html
' : '');
354 $showlinktolayout = (getDolGlobalInt('MAIN_EMAIL_USE_LAYOUT
') ? $formmail->withlayout : '');
355 $showlinktolayoutlabel = $langs->trans("FillMessageWithALayout");
356 $showlinktoai = ($formmail->withaiprompt ? 'textgenerationemail
' : '');
357 $showlinktoailabel = $langs->trans("FillMessageWithAIContent");
358 $htmlname = 'answer
';
360 include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php
';
364 require_once DOL_DOCUMENT_ROOT.'/core/
class/doleditor.class.php
';
365 $doleditor = new DolEditor('answer
', $object->answer, '', 200, 'dolibarr_notes
', 'In
', true, true, true, ROWS_9, '100%
');
366 $out = $doleditor->Create(1);
369 print dol_get_fiche_end();
371 print $form->buttonsSaveCancel();
376// Part to show record
377if ($object->id > 0 && (empty($action) || ($action != 'edit
' && $action != 'create
'))) {
378 $res = $object->fetch_optionals();
380 $head = knowledgerecordPrepareHead($object);
381 print dol_get_fiche_head($head, 'card
', $langs->trans("KnowledgeRecord"), -1, $object->picto, 0, '', '', 0, '', 1);
385 // Confirmation to delete
386 if ($action == 'delete') {
387 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?
id=
'.$object->id, $langs->trans('DeleteKnowledgeRecord
'), $langs->trans('ConfirmDeleteObject
'), 'confirm_delete
', '', 0, 1);
389 // Confirmation to delete line
390 if ($action == 'deleteline
') {
391 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?
id=
'.$object->id.'&lineid=
'.$lineid, $langs->trans('DeleteLine
'), $langs->trans('ConfirmDeleteLine
'), 'confirm_deleteline
', '', 0, 1);
393 // Clone confirmation
394 if ($action == 'clone
') {
395 // Create an array for form
396 $formquestion = array();
397 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?
id=
'.$object->id, $langs->trans('ToClone
'), $langs->trans('ConfirmCloneAsk
', $object->ref), 'confirm_clone
', $formquestion, 'yes
', 1);
400 // Confirmation of action xxxx (You can use it for xxx = 'close
', xxx = 'reopen
', ...)
401 if ($action == 'close
') {
402 $text = $langs->trans('ConfirmCloseKM
', $object->ref);
403 /*if (isModEnabled('notification
'))
405 require_once DOL_DOCUMENT_ROOT . '/core/
class/notify.class.php
';
406 $notify = new Notify($db);
408 $text .= $notify->confirmMessage('MYOBJECT_CLOSE
', $object->socid, $object);
411 $formquestion = array();
414 if ($conf->browser->name == 'ie
') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
415 $formquestion = array(
416 // 'text
' => $langs->trans("ConfirmClone"),
417 // array('type' => 'checkbox
', 'name' => 'clone_content
', 'label
' => $langs->trans("CloneMainAttributes"), 'value
' => 1),
418 // array('type' => 'checkbox
', 'name' => 'update_prices
', 'label
' => $langs->trans("PuttingPricesUpToDate"), 'value
' => 1),
419 // array('type' => 'other
', 'name' => 'idwarehouse
', 'label
' => $langs->trans("SelectWarehouseForStockDecrease"), 'value
' => $formproduct->selectWarehouses(GETPOST('idwarehouse
')?GETPOST('idwarehouse
'):'ifone
', 'idwarehouse
', '', 1, 0, 0, '', 0, $forcecombo))
422 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?
id=
'.$object->id, $langs->trans('SetObsolete
'), $text, 'confirm_close
', $formquestion, 0, 1, 220);
425 // Confirmation of action xxxx (You can use it for xxx = 'close
', xxx = 'reopen
', ...)
426 if ($action == 'reopen
') {
427 $text = $langs->trans('ConfirmReopenKM
', $object->ref);
428 /*if (isModEnabled('notification
'))
430 require_once DOL_DOCUMENT_ROOT . '/core/
class/notify.class.php
';
431 $notify = new Notify($db);
433 $text .= $notify->confirmMessage('MYOBJECT_CLOSE
', $object->socid, $object);
436 $formquestion = array();
439 if ($conf->browser->name == 'ie
') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
440 $formquestion = array(
441 // 'text
' => $langs->trans("ConfirmClone"),
442 // array('type' => 'checkbox
', 'name' => 'clone_content
', 'label
' => $langs->trans("CloneMainAttributes"), 'value
' => 1),
443 // array('type' => 'checkbox
', 'name' => 'update_prices
', 'label
' => $langs->trans("PuttingPricesUpToDate"), 'value
' => 1),
444 // array('type' => 'other
', 'name' => 'idwarehouse
', 'label
' => $langs->trans("SelectWarehouseForStockDecrease"), 'value
' => $formproduct->selectWarehouses(GETPOST('idwarehouse
')?GETPOST('idwarehouse
'):'ifone
', 'idwarehouse
', '', 1, 0, 0, '', 0, $forcecombo))
447 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?
id=
'.$object->id, $langs->trans('Re-Open
'), $text, 'confirm_reopen
', $formquestion, 0, 1, 220);
450 // Call Hook formConfirm
451 $parameters = array('formConfirm
' => $formconfirm, 'lineid
' => $lineid);
452 $reshook = $hookmanager->executeHooks('formConfirm
', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
453 if (empty($reshook)) {
454 $formconfirm .= $hookmanager->resPrint;
455 } elseif ($reshook > 0) {
456 $formconfirm = $hookmanager->resPrint;
459 // Print form confirm
464 // ------------------------------------------------------------
465 $linkback = '<a href=
"'.DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">
'.$langs->trans("BackToList").'</a>
';
467 $morehtmlref = '<div
class=
"refidno">
';
470 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client
', $object->ref_client, $object, 0, 'string', '', 0, 1);
471 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client
', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
473 $morehtmlref.='<br>
'.$langs->trans('ThirdParty
') . ' :
' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
475 if (isModEnabled('project
')) {
476 $langs->load("projects");
477 $morehtmlref .= '<br>
'.$langs->trans('Project') . ' ';
478 if ($permissiontoadd) {
479 //if ($action != 'classify
') $morehtmlref.='<a
class=
"editfielda" href=
"' . dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true) . '">
' . img_edit($langs->transnoentitiesnoconv('SetProject
')) . '</a>
';
480 $morehtmlref .= ' :
';
481 if ($action == 'classify
') {
482 //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF
'] . '?
id=
' . $object->id, $object->socid, $object->fk_project, 'projectid
', 0, 0, 0, 1, '', 'maxwidth300
');
483 $morehtmlref .= '<form method=
"post" action=
"'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">
';
484 $morehtmlref .= '<input
type=
"hidden" name=
"action" value=
"classin">
';
485 $morehtmlref .= '<input
type=
"hidden" name=
"token" value=
"'.newToken().'">
';
486 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid
', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
487 $morehtmlref .= '<input
type=
"submit" class=
"button valignmiddle" value=
"'.$langs->trans("Modify
").'">
';
488 $morehtmlref .= '</form>
';
490 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF
'] . '?
id=
' . $object->id, $object->socid, $object->fk_project, 'none
', 0, 0, 0, 1, '', 'maxwidth300
');
493 if (!empty($object->fk_project)) {
494 $proj = new Project($db);
495 $proj->fetch($object->fk_project);
496 $morehtmlref .= ':
'.$proj->getNomUrl();
502 $morehtmlref .= '</div>
';
505 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
508 print '<div
class=
"fichecenter">
';
509 print '<div
class=
"fichehalfleft">
';
510 print '<div
class=
"underbanner clearboth"></div>
';
511 print '<
table class=
"border centpercent tableforfield">
'."\n";
514 $keyforbreak = 'fk_c_ticket_category
'; // We change column just before this field
515 //unset($object->fields['fk_project
']); // Hide field already shown in banner
516 //unset($object->fields['fk_soc
']); // Hide field already shown in banner
517 $object->fields['answer
']['enabled
'] = 0;
518 include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php
';
519 $object->fields['answer
']['enabled
'] = 1;
522 if (isModEnabled('category
')) {
523 print '<tr><td
class=
"valignmiddle">
'.$langs->trans("Categories").'</td><td>
';
524 print $form->showCategories($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1);
528 // Other attributes. Fields from hook formObjectOptions and Extrafields.
529 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php
';
536 print '<div
class=
"clearboth"></div>
';
540 print load_fiche_titre($langs->trans($object->fields['answer
']['label
']), '', '');
541 if ($action == 'edit
') {
542 // Add layout and AI tools for answer
544 require_once DOL_DOCUMENT_ROOT.'/core/
class/html.formmail.class.php
';
545 $formmail = new FormMail($db);
546 require_once DOL_DOCUMENT_ROOT.'/core/
class/html.formai.class.php
';
547 $formai = new FormAI($db);
549 $formmail->withfckeditor = 1;
550 $formmail->withlayout = 'email';
551 $formmail->withaiprompt = (isModEnabled('ai
') ? 'html
' : '');
553 $showlinktolayout = (getDolGlobalInt('MAIN_EMAIL_USE_LAYOUT
') ? $formmail->withlayout : '');
554 $showlinktolayoutlabel = $langs->trans("FillMessageWithALayout");
555 $showlinktoai = ($formmail->withaiprompt ? 'textgenerationemail
' : '');
556 $showlinktoailabel = $langs->trans("FillMessageWithAIContent");
557 $htmlname = 'answer
';
559 include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php
';
563 require_once DOL_DOCUMENT_ROOT.'/core/
class/doleditor.class.php
';
564 $doleditor = new DolEditor('answer
', $object->answer, '', 200, 'dolibarr_notes
', 'In
', true, true, true, ROWS_9, '100%
', 1);
565 $out = $doleditor->Create(1);
567 $out = '<div
class=
"content kmcontent">
';
568 $out .= $object->answer;
572 print dol_get_fiche_end();
575 // Buttons for actions
577 if ($action != 'presend
' && $action != 'editline
') {
578 print '<div
class=
"tabsAction">
'."\n";
579 $parameters = array();
580 $reshook = $hookmanager->executeHooks('addMoreActionsButtons
', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
582 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors
');
585 if (empty($reshook)) {
587 //if (empty($user->socid)) {
588 //print dolGetButtonAction('', $langs->trans('SendMail
'), 'email', $_SERVER["PHP_SELF"].'?
id=
'.$object->id.'&action=presend&mode=init#formmailbeforetitle
');
592 if ($object->status == $object::STATUS_VALIDATED) {
593 print dolGetButtonAction('', $langs->trans('SetToDraft
'), 'default', $_SERVER["PHP_SELF"].'?
id=
'.$object->id.'&action=confirm_setdraft&confirm=yes&token=
'.newToken(), '', $permissiontoadd);
595 if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) {
596 print dolGetButtonAction('', $langs->trans('Modify
'), 'default', $_SERVER["PHP_SELF"].'?
id=
'.$object->id.'&action=edit&token=
'.newToken(), '', $permissiontoadd);
599 if ($object->status == $object::STATUS_DRAFT) {
600 if ((empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) && $permissiontovalidate) {
601 print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF
'].'?
id=
'.$object->id.'&action=confirm_validate&token=
'.newToken().'&confirm=yes
', '', $permissiontoadd);
603 $langs->load("errors");
604 //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF
'].'?
id=
'.$object->id.'&action=confirm_validate&confirm=yes
', '', 0);
605 print '<a
class=
"butActionRefused" href=
"" title=
"'.$langs->trans("ErrorAddAtLeastOneLineFirst
").'">
'.$langs->trans("Validate").'</a>
';
610 print dolGetButtonAction($langs->trans('ToClone
'), $langs->trans('ToClone
'), 'clone
', $_SERVER['PHP_SELF
'].'?
id=
'.$object->id.'&action=clone&token=
'.newToken().'&
object=scrumsprint
', '', $permissiontoadd, array('attr
' => array('class' => 'reposition
')));
613 if ($permissiontoadd) {
614 if ($object->status == $object::STATUS_ENABLED) {
615 print '<a
class=
"butActionDelete" href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=disable&token='.newToken().'">
'.$langs->trans("Disable").'</a>
'."\n";
617 print '<a
class=
"butAction" href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=enable&token='.newToken().'">
'.$langs->trans("Enable").'</a>
'."\n";
621 if ($permissiontoadd) {
622 if ($object->status == $object::STATUS_VALIDATED) {
623 print '<a
class=
"butActionDelete" href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=close&token='.newToken().'">
'.$langs->trans("SetObsolete").'</a>
'."\n";
624 } elseif ($object->status == $object::STATUS_CANCELED) {
625 print '<a
class=
"butAction" href=
"'.$_SERVER["PHP_SELF
"].'?id='.$object->id.'&action=reopen&token='.newToken().'">
'.$langs->trans("ReOpen").'</a>
'."\n";
629 // Delete (need delete permission, or if draft, just need create/modify permission)
630 print dolGetButtonAction($langs->trans('Delete
'), $langs->trans('Delete
'), 'delete', $_SERVER['PHP_SELF
'].'?
id=
'.$object->id.'&action=
delete&token=
'.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd), array('attr
' => array('class' => 'reposition
')))."\n";
636 // Select mail models is same action as presend
637 if (GETPOST('modelselected
')) {
641 if ($action != 'presend
') {
642 print '<div
class=
"fichecenter"><div
class=
"fichehalfleft">
';
643 print '<a
name=
"builddoc"></a>
'; // ancre
645 $includedocgeneration = 0;
648 if ($includedocgeneration) {
649 $objref = dol_sanitizeFileName($object->ref);
650 $relativepath = $objref.'/
'.$objref.'.pdf
';
651 $filedir = $conf->knowledgemanagement->dir_output.'/
'.$object->element.'/
'.$objref;
652 $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
653 $genallowed = $user->hasRight('knowledgemanagement
', 'knowledgerecord
', 'read
'); // If you can read, you can build the PDF to read content
654 $delallowed = $user->hasRight('knowledgemanagement
', 'knowledgerecord
', 'write'); // If you can create/edit, you can remove a file on card
655 print $formfile->showdocuments('knowledgemanagement:
KnowledgeRecord', $object->element.'/
'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
658 // Show links to link elements
659 $tmparray = $form->showLinkToObjectBlock($object, array(), array('knowledgerecord
'), 1);
660 $linktoelem = $tmparray['linktoelem
'];
661 $htmltoenteralink = $tmparray['htmltoenteralink
'];
662 print $htmltoenteralink;
664 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
667 print '</div><div
class=
"fichehalfright">
';
671 $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll
'), '', 'fa fa-bars imgforviewmode
', DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_agenda.php?
id=
'.$object->id);
673 // List of actions on element
674 include_once DOL_DOCUMENT_ROOT.'/core/
class/html.formactions.class.php
';
675 $formactions = new FormActions($db);
676 $somethingshown = $formactions->showactions($object, $object->element.'@
'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
678 print '</div></div>
';
681 //Select mail models is same action as presend
682 if (GETPOST('modelselected
')) {
687 $modelmail = 'knowledgerecord
';
688 $defaulttopic = 'InformationMessage
';
689 $diroutput = $conf->knowledgemanagement->dir_output;
690 $trackid = 'knowledgerecord
'.$object->id;
692 include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php
';
write(string $newInnerBlock)
Replace the whole permissions block, markers included, in a single write.
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class for KnowledgeRecord.
Class to manage projects.
Class toolbox to validate values.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
treeview li table
No Email.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.