diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index b0ca0986ffb..6e77fd3fa95 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -2288,6 +2288,7 @@ class Adherent extends CommonObject
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$langs->load("users");
return ['optimize' => $langs->trans("ShowUser")];
@@ -2318,6 +2319,12 @@ class Adherent extends CommonObject
$datas['email'] = '
'.$langs->trans("EMail").': '.$this->email;
}
$datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs);
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1);
+ }
$datas['divclose'] = '';
return $datas;
@@ -2353,6 +2360,7 @@ class Adherent extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$classfortooltip = 'classforajaxtooltip';
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index d4f252bfd43..8dae305a989 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -461,7 +461,7 @@ class Documents extends DolibarrApi
} elseif ($modulepart == 'knowledgemanagement') {
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read') && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
throw new RestException(401);
}
diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php
index e59ff070aec..2de1f43d071 100644
--- a/htdocs/categories/class/api_categories.class.php
+++ b/htdocs/categories/class/api_categories.class.php
@@ -323,7 +323,7 @@ class Categories extends DolibarrApi
throw new RestException(401);
} elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) {
throw new RestException(401);
- } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
+ } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
throw new RestException(401);
}
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index fd5b55e70fe..11cb4f98dbd 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1580,6 +1580,7 @@ class ActionComm extends CommonObject
$langs->load('agenda');
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
// Set label of type
$labeltype = '';
if ($this->type_code) {
@@ -1631,6 +1632,12 @@ class ActionComm extends CommonObject
$datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow));
$datas['note'] .= '';
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1);
+ }
return $datas;
}
@@ -1734,6 +1741,7 @@ class ActionComm extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 7032f9c40e2..4ccdf93cb58 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1417,6 +1417,7 @@ class Account extends CommonObject
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
$pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").'';
if (isset($this->status)) {
$pictos .= ' '.$this->getLibStatut(5);
@@ -1434,6 +1435,12 @@ class Account extends CommonObject
$datas['accountaccounting'] = '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number);
$datas['accountancyjournal'] = '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal;
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACCOUNT, 1);
+ }
return $datas;
}
@@ -1454,38 +1461,20 @@ class Account extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("BankAccount").'';
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
- }
- $label .= '
'.$langs->trans('Label').': '.$this->label;
- $label .= '
'.$langs->trans('AccountNumber').': '.$this->number;
- $label .= '
'.$langs->trans('IBAN').': '.getIbanHumanReadable($this);
- $label .= '
'.$langs->trans('BIC').': '.$this->bic;
- $label .= '
'.$langs->trans("AccountCurrency").': '.$this->currency_code;
-
- if (empty($user->rights->banque->lire) || !empty($user->socid)) {
- $option = 'nolink';
- }
-
- if (isModEnabled('accounting')) {
- include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
- $langs->load("accountancy");
- $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number);
- $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal;
- }
$classfortooltip = 'classfortooltip';
$dataparams = '';
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ 'nofetch' => 1,
+ ];
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
- $params = [
- 'id' => $this->id,
- 'objecttype' => $this->element,
- 'option' => $option,
- ];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
- $label = $langs->trans('Loading');
}
+ $label = implode($this->getTooltipContentArray($params));
+
$linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">';
$url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
@@ -1871,7 +1860,7 @@ class Account extends CommonObject
/**
* Class to manage bank transaction lines
*/
-class AccountLine extends CommonObject
+class AccountLine extends CommonObjectLine
{
/**
* @var string Error code (or message)
diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php
index 60220a221ff..3933f03533b 100644
--- a/htdocs/core/ajax/ajaxtooltip.php
+++ b/htdocs/core/ajax/ajaxtooltip.php
@@ -163,6 +163,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') {
$classpath = 'opensurvey/class';
$module = 'opensurvey';
$myobject = 'opensurveysondage';
+} elseif ($objecttype == 'knowledgerecord') {
+ $classpath = 'knowledgemanagement/class';
+ $module = 'knowledgemanagement';
+ $myobject = 'knowledgerecord';
}
// Generic case for $classfile and $classname
diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php
new file mode 100644
index 00000000000..2cb4818d6ac
--- /dev/null
+++ b/htdocs/core/boxes/box_last_knowledgerecord.php
@@ -0,0 +1,217 @@
+
+ * Copyright (C) 2016 Christophe Battarel
+ * Copyright (C) 2018-2023 Frédéric France
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/boxes/box_last_knowledgerecord.php
+ * \ingroup knowledgerecord
+ * \brief This box shows latest created knowledgerecords
+ */
+require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
+
+/**
+ * Class to manage the box
+ */
+class box_last_knowledgerecord extends ModeleBoxes
+{
+ /**
+ * @var string boxcode
+ */
+ public $boxcode = "box_last_knowledgerecord";
+
+ /**
+ * @var string box img
+ */
+ public $boximg = "knowledgemanagement";
+
+ /**
+ * @var string boc label
+ */
+ public $boxlabel;
+
+ /**
+ * @var array box dependancies
+ */
+ public $depends = array("knowledgemanagement");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ /**
+ * @var string param
+ */
+ public $param;
+
+ /**
+ * @var array box info heads
+ */
+ public $info_box_head = array();
+
+ /**
+ * @var array box info content
+ */
+ public $info_box_contents = array();
+
+ /**
+ * Constructor
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param = '')
+ {
+ global $langs;
+ $langs->load("boxes", "languages");
+ $this->db = $db;
+
+ $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastKnowledgerecord");
+ }
+
+ /**
+ * Load data into info_box_contents array to show array later.
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $user, $langs;
+
+ $this->max = $max;
+
+ require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php";
+
+ $text = $langs->trans("BoxLastKnowledgerecordDescription", $max);
+ $this->info_box_head = array(
+ 'text' => $text,
+ 'limit' => dol_strlen($text),
+ );
+
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="left"',
+ 'text' => $langs->trans("BoxLastKnowledgerecordContent"),
+ );
+
+ if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
+ $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status';
+ $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k";
+ $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")";
+
+ if ($user->socid) {
+ $sql .= " AND k.fk_soc= ".((int) $user->socid);
+ }
+
+ $sql.= " AND k.status > 0";
+
+ $sql .= " ORDER BY k.date_creation DESC, k.rowid DESC ";
+ $sql .= $this->db->plimit($max, 0);
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+
+ $i = 0;
+
+ while ($i < $num) {
+ $objp = $this->db->fetch_object($resql);
+
+ $datec = $this->db->jdate($objp->date_creation);
+
+ $knowledgerecord = new KnowledgeRecord($this->db);
+ $knowledgerecord->id = $objp->id;
+ $knowledgerecord->date_creation = $objp->date_creation;
+ $knowledgerecord->ref = $objp->ref;
+ $knowledgerecord->status = $objp->status;
+ $knowledgerecord->question = $objp->question;
+
+ $r = 0;
+
+ // Ticket
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="nowraponall"',
+ 'text' => $knowledgerecord->getNomUrl(1),
+ 'asis' => 1
+ );
+ $r++;
+
+ // Question
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="tdoverflowmax200"',
+ 'text' => ''.dol_escape_htmltag($objp->question).'',
+ 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id),
+ );
+ $r++;
+
+ // Language
+ $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : '');
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="tdoverflowmax100"',
+ 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang,
+ 'asis' => 1,
+ );
+ $r++;
+
+ // Date creation
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"',
+ 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'),
+ );
+ $r++;
+
+ // Statut
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="right nowraponall"',
+ 'text' => $knowledgerecord->getLibStatut(3),
+ );
+ $r++;
+
+ $i++;
+ }
+
+ if ($num == 0) {
+ $this->info_box_contents[$i][0] = array(
+ 'td' => '',
+ 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'',
+ );
+ }
+ } else {
+ dol_print_error($this->db);
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'',
+ );
+ }
+ }
+
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
+ * @return string
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
+}
diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php
new file mode 100644
index 00000000000..2c5319151fa
--- /dev/null
+++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php
@@ -0,0 +1,217 @@
+
+ * Copyright (C) 2016 Christophe Battarel
+ * Copyright (C) 2018-2023 Frédéric France
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/boxes/box_last_modified_knowledgerecord.php
+ * \ingroup knowledgerecord
+ * \brief This box shows latest created knowledgerecords
+ */
+require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
+
+/**
+ * Class to manage the box
+ */
+class box_last_modified_knowledgerecord extends ModeleBoxes
+{
+ /**
+ * @var string boxcode
+ */
+ public $boxcode = "box_last_modified_knowledgerecord";
+
+ /**
+ * @var string box img
+ */
+ public $boximg = "knowledgemanagement";
+
+ /**
+ * @var string boc label
+ */
+ public $boxlabel;
+
+ /**
+ * @var array box dependancies
+ */
+ public $depends = array("knowledgemanagement");
+
+ /**
+ * @var DoliDB Database handler.
+ */
+ public $db;
+
+ /**
+ * @var string param
+ */
+ public $param;
+
+ /**
+ * @var array box info heads
+ */
+ public $info_box_head = array();
+
+ /**
+ * @var array box info content
+ */
+ public $info_box_contents = array();
+
+ /**
+ * Constructor
+ * @param DoliDB $db Database handler
+ * @param string $param More parameters
+ */
+ public function __construct($db, $param = '')
+ {
+ global $langs;
+ $langs->load("boxes", "knowledgemanagement", "languages");
+ $this->db = $db;
+
+ $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedKnowledgerecord");
+ }
+
+ /**
+ * Load data into info_box_contents array to show array later.
+ *
+ * @param int $max Maximum number of records to load
+ * @return void
+ */
+ public function loadBox($max = 5)
+ {
+ global $user, $langs;
+
+ $this->max = $max;
+
+ require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php";
+
+ $text = $langs->trans("BoxLastModifiedKnowledgerecordDescription", $max);
+ $this->info_box_head = array(
+ 'text' => $text,
+ 'limit' => dol_strlen($text),
+ );
+
+ $this->info_box_contents[0][0] = array(
+ 'td' => 'class="left"',
+ 'text' => $langs->trans("BoxLastKnowledgerecordContent"),
+ );
+
+ if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
+ $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status';
+ $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k";
+ $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")";
+
+ if ($user->socid) {
+ $sql .= " AND k.fk_soc= ".((int) $user->socid);
+ }
+
+ $sql.= " AND k.status > 0";
+
+ $sql .= " ORDER BY k.tms DESC, k.rowid DESC ";
+ $sql .= $this->db->plimit($max, 0);
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+
+ $i = 0;
+
+ while ($i < $num) {
+ $objp = $this->db->fetch_object($resql);
+
+ $datec = $this->db->jdate($objp->date_creation);
+
+ $knowledgerecord = new KnowledgeRecord($this->db);
+ $knowledgerecord->id = $objp->id;
+ $knowledgerecord->date_creation = $objp->date_creation;
+ $knowledgerecord->ref = $objp->ref;
+ $knowledgerecord->status = $objp->status;
+ $knowledgerecord->question = $objp->question;
+
+ $r = 0;
+
+ // Ticket
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="nowraponall"',
+ 'text' => $knowledgerecord->getNomUrl(1),
+ 'asis' => 1
+ );
+ $r++;
+
+ // Question
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="tdoverflowmax200"',
+ 'text' => ''.dol_escape_htmltag($objp->question).'',
+ 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id),
+ );
+ $r++;
+
+ // Language
+ $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : '');
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="tdoverflowmax100"',
+ 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang,
+ 'asis' => 1,
+ );
+ $r++;
+
+ // Date creation
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"',
+ 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'),
+ );
+ $r++;
+
+ // Statut
+ $this->info_box_contents[$i][$r] = array(
+ 'td' => 'class="right nowraponall"',
+ 'text' => $knowledgerecord->getLibStatut(3),
+ );
+ $r++;
+
+ $i++;
+ }
+
+ if ($num == 0) {
+ $this->info_box_contents[$i][0] = array(
+ 'td' => '',
+ 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'',
+ );
+ }
+ } else {
+ dol_print_error($this->db);
+ }
+ } else {
+ $this->info_box_contents[0][0] = array(
+ 'td' => '',
+ 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'',
+ );
+ }
+ }
+
+ /**
+ * Method to show box
+ *
+ * @param array $head Array with properties of box title
+ * @param array $contents Array with properties of box lines
+ * @param int $nooutput No print, only return string
+ * @return string
+ */
+ public function showBox($head = null, $contents = null, $nooutput = 0)
+ {
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ }
+}
diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php
index 716b8ed0482..228ba016ceb 100644
--- a/htdocs/core/boxes/box_members_subscriptions_by_year.php
+++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php
@@ -191,7 +191,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
if ($num == 0) {
$this->info_box_contents[$line][0] = array(
- 'td' => 'class="center"',
+ 'td' => 'class="left" colspan="4"',
'text' => $langs->trans("NoRecordedMembers"),
);
} else {
diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php
index b331c56a917..c372f611c60 100644
--- a/htdocs/core/modules/modKnowledgeManagement.class.php
+++ b/htdocs/core/modules/modKnowledgeManagement.class.php
@@ -201,12 +201,14 @@ class modKnowledgeManagement extends DolibarrModules
// Boxes/Widgets
// Add here list of php file(s) stored in knowledgemanagement/core/boxes that contains a class to show a widget.
$this->boxes = array(
- // 0 => array(
- // 'file' => 'knowledgemanagementwidget1.php@knowledgemanagement',
- // 'note' => 'Widget provided by KnowledgeManagement',
- // 'enabledbydefaulton' => 'Home',
- // ),
- // ...
+ 0 => array(
+ 'file' => 'box_last_knowledgerecord.php',
+ 'enabledbydefaulton' => 'ticketindex',
+ ),
+ 1 => array(
+ 'file' => 'box_last_modified_knowledgerecord.php',
+ 'enabledbydefaulton' => 'ticketindex',
+ ),
);
// Cronjobs (List of cron jobs entries to add when module is enabled)
@@ -271,7 +273,7 @@ class modKnowledgeManagement extends DolibarrModules
'langs'=>'knowledgemanagement', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000 + $r,
'enabled'=>'$conf->knowledgemanagement->enabled', // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled.
- 'perms'=>'1', // Use 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read' if you want your menu with a permission rules
+ 'perms'=>'1', // Use 'perms'=>'$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
@@ -334,7 +336,7 @@ class modKnowledgeManagement extends DolibarrModules
// Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->knowledgemanagement->enabled',
// Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules
- 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->write',
+ 'perms'=>'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2
diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
index 8232287b23b..0806514b968 100644
--- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
+++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php
@@ -70,7 +70,7 @@ class KnowledgeManagement extends DolibarrApi
*/
public function get($id)
{
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
throw new RestException(401);
}
@@ -144,7 +144,7 @@ class KnowledgeManagement extends DolibarrApi
$obj_ret = array();
$tmpobject = new KnowledgeRecord($this->db);
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
throw new RestException(401);
}
@@ -249,7 +249,7 @@ class KnowledgeManagement extends DolibarrApi
*/
public function post($request_data = null)
{
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
throw new RestException(401);
}
@@ -282,7 +282,7 @@ class KnowledgeManagement extends DolibarrApi
*/
public function put($id, $request_data = null)
{
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
throw new RestException(401);
}
@@ -324,7 +324,7 @@ class KnowledgeManagement extends DolibarrApi
*/
public function delete($id)
{
- if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->delete) {
+ if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete')) {
throw new RestException(401);
}
$result = $this->knowledgerecord->fetch($id);
diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
index 3f9f1b40223..f85b2f8e9cf 100644
--- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php
+++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php
@@ -129,7 +129,15 @@ class KnowledgeRecord extends CommonObject
public $fk_user_valid;
public $import_key;
public $model_pdf;
+
+ /**
+ * @var string question asked
+ */
public $question;
+
+ /**
+ * @var string answer to question
+ */
public $answer;
public $url;
public $status;
@@ -192,7 +200,7 @@ class KnowledgeRecord extends CommonObject
}
// Example to show how to set values of fields definition dynamically
- /*if ($user->rights->knowledgemanagement->knowledgerecord->read) {
+ /*if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
$this->fields['myfield']['visible'] = 1;
$this->fields['myfield']['noteditable'] = 0;
}*/
@@ -265,8 +273,8 @@ class KnowledgeRecord extends CommonObject
if (property_exists($object, 'ref')) {
$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
}
- if (property_exists($object, 'label')) {
- $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
+ if (property_exists($object, 'question')) {
+ $object->question = empty($this->fields['question']['default']) ? $langs->trans("CopyOf")." ".$object->question : $this->fields['question']['default'];
}
if (property_exists($object, 'status')) {
$object->status = self::STATUS_DRAFT;
@@ -530,7 +538,7 @@ class KnowledgeRecord extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->write))
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->knowledgerecord_advance->validate))))
{
$this->error='NotEnoughPermissions';
@@ -706,6 +714,39 @@ class KnowledgeRecord extends CommonObject
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'KNOWLEDGERECORD_REOPEN');
}
+ /**
+ * getTooltipContentArray
+ *
+ * @param array $params ex option, infologin
+ * @since v18
+ * @return array
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs;
+
+ $langs->loadLangs(['knowledgemanagement', 'languages']);
+
+ $datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
+ $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").'';
+ if (isset($this->statut)) {
+ $datas['picto'] .= ' '.$this->getLibStatut(5);
+ }
+ $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ $datas['question'] = '
'.$langs->trans('Question').': '.$this->question;
+ $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : '');
+ $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang;
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1);
+ }
+
+ return $datas;
+ }
+
/**
* Return a link to the object card (with optionaly the picto)
*
@@ -726,12 +767,19 @@ class KnowledgeRecord extends CommonObject
$result = '';
- $label = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").'';
- if (isset($this->status)) {
- $label .= ' '.$this->getLibStatut(5);
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ 'nofetch' => 1,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params='.json_encode($params);
}
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
+ $label = implode($this->getTooltipContentArray($params));
$url = dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$this->id;
@@ -752,8 +800,8 @@ class KnowledgeRecord extends CommonObject
$label = $langs->trans("ShowKnowledgeRecord");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
@@ -774,7 +822,7 @@ class KnowledgeRecord extends CommonObject
if (empty($this->showphoto_on_popup)) {
if ($withpicto) {
- $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
} else {
if ($withpicto) {
diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php
index e24e23b14e7..6cf8428d06b 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php
@@ -90,7 +90,7 @@ if ($id > 0 || !empty($ref)) {
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
-$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php
/*
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 52143048f72..495b095fb4d 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -74,12 +74,12 @@ if (empty($action) && empty($id) && empty($ref)) {
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
-$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read;
-$permissiontovalidate = $user->rights->knowledgemanagement->knowledgerecord->write;
-$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
-$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
-$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php
-$permissiondellink = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_dellink.inc.php
+$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read');
+$permissiontovalidate = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
+$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
+$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php
+$permissiondellink = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check - Protection if external user
@@ -538,8 +538,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->knowledgemanagement->dir_output.'/'.$object->element.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
- $genallowed = $user->rights->knowledgemanagement->knowledgerecord->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->knowledgemanagement->knowledgerecord->write; // If you can create/edit, you can remove a file on card
+ $genallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); // If you can read, you can build the PDF to read content
+ $delallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('knowledgemanagement:KnowledgeRecord', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
}
diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php
index 4e557a3e1ae..751cdff5c9e 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_contact.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php
@@ -56,7 +56,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
-$permission = $user->rights->knowledgemanagement->knowledgerecord->write;
+$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
/*
diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php
index 7430de8a495..8d8fe6ac769 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_document.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_document.php
@@ -81,7 +81,7 @@ if ($id > 0 || !empty($ref)) {
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft);
-$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
+$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
@@ -183,9 +183,9 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'knowledgemanagement';
- //$permission = $user->rights->knowledgemanagement->knowledgerecord->write;
+ //$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
$permission = 1;
- //$permtoedit = $user->rights->knowledgemanagement->knowledgerecord->write;
+ //$permtoedit = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
$permtoedit = 1;
$param = '&id='.$object->id;
diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php
index 7cd5a24c764..3a916cb96ef 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_list.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_list.php
@@ -140,9 +140,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
-$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read;
-$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write;
-$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete;
+$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read');
+$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
+$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete');
// Security check
if (empty($conf->knowledgemanagement->enabled)) {
@@ -428,7 +428,7 @@ if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
-if (isModEnabled('category') && $user->rights->knowledgemanagement->knowledgerecord->write) {
+if (isModEnabled('category') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php
index 28a2bcaa9d0..ea1052ccc98 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_note.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_note.php
@@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id;
}
-$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php
-$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php
+$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang
index 38c1624afad..050ecbcc03a 100644
--- a/htdocs/langs/en_US/knowledgemanagement.lang
+++ b/htdocs/langs/en_US/knowledgemanagement.lang
@@ -51,4 +51,10 @@ SuggestedForTicketsInGroup=Suggested on ticket creation
SetObsolete=Set as obsolete
ConfirmCloseKM=Do you confirm the closing of this article as obsolete ?
-ConfirmReopenKM=Do you want to restore this article to status "Validated" ?
\ No newline at end of file
+ConfirmReopenKM=Do you want to restore this article to status "Validated" ?
+BoxLastKnowledgerecordDescription=Last %s articles
+BoxLastKnowledgerecord=Last articles
+BoxLastKnowledgerecordContent=Last articles
+BoxLastKnowledgerecordModifiedContent=Last modified articles
+BoxLastModifiedKnowledgerecordDescription=Last %s modified articles
+BoxLastModifiedKnowledgerecord=Last modified articles
diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index 5876a019d25..b0237c5578b 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -233,3 +233,4 @@ CreateDolibarrThirdPartyDesc=A thirdparty is the legal entity that will be used
MemberFirstname=Member firstname
MemberLastname=Member lastname
MemberCodeDesc=Member Code, unique for all members
+NoRecordedMembers=No registered member
diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php
index ddfd8a7f57b..afdac2d16a8 100644
--- a/htdocs/mrp/class/mo.class.php
+++ b/htdocs/mrp/class/mo.class.php
@@ -93,7 +93,6 @@ class Mo extends CommonObject
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
*/
- // BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
@@ -126,6 +125,10 @@ class Mo extends CommonObject
public $rowid;
public $entity;
public $ref;
+
+ /**
+ * @var int mrptype
+ */
public $mrptype;
public $label;
public $qty;
@@ -154,8 +157,17 @@ class Mo extends CommonObject
public $fk_user_modif;
public $import_key;
public $status;
+
+ /**
+ * @var int ID of product
+ */
public $fk_product;
+ /**
+ * @var Product product object
+ */
+ public $product;
+
/**
* @var integer|string date_start_planned
*/
@@ -167,10 +179,20 @@ class Mo extends CommonObject
public $date_end_planned;
+ /**
+ * @var int ID bom
+ */
public $fk_bom;
- public $fk_project;
- // END MODULEBUILDER PROPERTIES
+ /**
+ * @var Bom bom
+ */
+ public $bom;
+
+ /**
+ * @var int ID project
+ */
+ public $fk_project;
// If this object has a subtable with lines
@@ -204,12 +226,24 @@ class Mo extends CommonObject
*/
public $lines = array();
+ /**
+ * @var MoLine MO line
+ */
+ public $line = array();
+
/**
* @var integer Mo parent line
* */
+ /**
+ * @var int ID of parent line
+ */
public $fk_parent_line;
+ /**
+ * @var array tpl
+ */
+ public $tpl = array();
/**
* Constructor
@@ -1100,6 +1134,9 @@ class Mo extends CommonObject
if (isset($this->label)) {
$datas['label'] = '
'.$langs->trans('Label').': '.$this->label;
}
+ if (isset($this->mrptype)) {
+ $datas['type'] = '
'.$langs->trans('Type').': '.$this->fields['mrptype']['arrayofkeyval'][$this->mrptype];
+ }
return $datas;
}
@@ -1458,7 +1495,7 @@ class Mo extends CommonObject
* If lines are into a template, title must also be into a template
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
- * @param CommonObjectLine $line Line
+ * @param MoLine $line Line
* @param string $var Var
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
* @param string $defaulttpldir Directory where to find the template
@@ -1519,7 +1556,7 @@ class Mo extends CommonObject
/**
* Function used to return childs of Mo
*
- * @return array|int array if OK, -1 if KO
+ * @return Mo[]|int array if OK, -1 if KO
*/
public function getMoChilds()
{
@@ -1557,7 +1594,7 @@ class Mo extends CommonObject
/**
* Function used to return childs of Mo
*
- * @return Object|int MO object if OK, -1 if KO, 0 if not exist
+ * @return Mo|int MO object if OK, -1 if KO, 0 if not exist
*/
public function getMoParent()
{
@@ -1680,6 +1717,7 @@ class MoLine extends CommonObjectLine
public $qty;
public $qty_frozen;
public $disable_stock_change;
+ public $efficiency;
public $batch;
public $role;
public $fk_mrp_production;
@@ -1689,6 +1727,7 @@ class MoLine extends CommonObjectLine
public $fk_user_creat;
public $fk_user_modif;
public $import_key;
+ public $fk_parent_line;
/**
* Constructor
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index e928c2f3cd6..b141da8d392 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -115,6 +115,11 @@ class Opensurveysondage extends CommonObject
*/
public $allow_spy;
+ /**
+ * @var array fields
+ */
+ public $fields = array();
+
/**
* Draft status (not used)
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index e9755559a50..74025356811 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5012,6 +5012,7 @@ class Product extends CommonObject
$langs->load('products');
$datas = [];
+ $nofetch = empty($params['nofetch']) ? false : true;
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
return ['optimize' => $langs->trans("ShowProduct")];
@@ -5104,6 +5105,12 @@ class Product extends CommonObject
$datas['accountancybuy'] = $buylabel;
}
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
+ }
return $datas;
}
@@ -5136,6 +5143,7 @@ class Product extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 41b829aa5ef..e180d9ab13e 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2612,6 +2612,7 @@ class Societe extends CommonObject
$datas = [];
$option = $params['option'] ?? '';
+ $nofetch = empty($params['nofetch']) ? false : true;
$name = $this->name;
if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -2724,6 +2725,17 @@ class Societe extends CommonObject
if (isModEnabled('accounting') && $this->fournisseur) {
$datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur;
}
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ if ($this->client) {
+ $datas['categories_customer'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1);
+ }
+ if ($this->fournisseur) {
+ $datas['categories_supplier'] = '
' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1);
+ }
+ }
$datas['divclose'] = '';
@@ -2789,6 +2801,7 @@ class Societe extends CommonObject
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 932ed171cea..bc50c0e31f8 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1433,6 +1433,7 @@ class Ticket extends CommonObject
$langs->load('ticket');
+ $nofetch = empty($params['nofetch']) ? false : true;
$datas = [];
$datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").'';
$datas['picto'] .= ' '.$this->getLibStatut(4);
@@ -1440,10 +1441,16 @@ class Ticket extends CommonObject
$datas['track_id'] = '
'.$langs->trans('TicketTrackId').': '.$this->track_id;
$datas['subject'] = '
'.$langs->trans('Subject').': '.$this->subject;
if ($this->date_creation) {
- $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.$this->date_creation;
+ $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.dol_print_date($this->date_creation, 'dayhour');
}
if ($this->date_modification) {
- $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.$this->date_modification;
+ $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour');
+ }
+ // show categories for this record only in ajax to not overload lists
+ if (isModEnabled('categorie') && !$nofetch) {
+ require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
+ $form = new Form($this->db);
+ $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1);
}
return $datas;
@@ -1474,6 +1481,8 @@ class Ticket extends CommonObject
$params = [
'id' => $this->id,
'objecttype' => $this->element,
+ 'option' => $option,
+ 'nofetch' => 1,
];
$classfortooltip = 'classfortooltip';
$dataparams = '';
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index b5453ed638b..d858a4d7334 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -252,7 +252,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
$linkback = ''.$langs->trans("BackToList").' ';
- dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, '');
+ dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, '');
print dol_get_fiche_end();
diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php
index 243084ec89f..f75a93f7082 100644
--- a/htdocs/ticket/index.php
+++ b/htdocs/ticket/index.php
@@ -65,7 +65,7 @@ $object = new Ticket($db);
// Security check
//$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', '');
-if (empty($user->rights->ticket->read) && empty($user->rights->knowledgemanagement->knowledgerecord->read)) {
+if (empty($user->rights->ticket->read) && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
accessforbidden('Not enought permissions');
}