diff --git a/htdocs/core/ajax/ajaxstatusprospect.php b/htdocs/core/ajax/ajaxstatusprospect.php
index 83a01e07f49..cef9077144b 100644
--- a/htdocs/core/ajax/ajaxstatusprospect.php
+++ b/htdocs/core/ajax/ajaxstatusprospect.php
@@ -21,8 +21,9 @@
*/
/**
- * \file htdocs/core/ajax/ajaxstatusprospect.php
- * \brief File to return Ajax response on third parties request
+ * \file htdocs/core/ajax/ajaxstatusprospect.php
+ * \brief File of service to update prospect status of a third party
+ * TODO Rename into updatestatusprospect.php
*/
if (!defined('NOTOKENRENEWAL')) {
@@ -87,7 +88,7 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) {
$response = '';
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
- $sql .= "fk_stcomm=".((int) $idstatus);
+ $sql .= "fk_stcomm = ".((int) $idstatus);
$sql .= " WHERE rowid = ".((int) $idprospect);
$resql = $db->query($sql);
diff --git a/htdocs/core/ajax/fetchCategories.php b/htdocs/core/ajax/fetchCategories.php
new file mode 100644
index 00000000000..1d95a34b603
--- /dev/null
+++ b/htdocs/core/ajax/fetchCategories.php
@@ -0,0 +1,107 @@
+
+ *
+ * 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/ajax/fetchCategories.php
+ * \brief File to fetch categories
+ */
+
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', '1'); // Disables token renewal
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', '1');
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
+if (!defined('NOREQUIRESOC')) {
+ define('NOREQUIRESOC', '1');
+}
+// Do not check anti CSRF attack test
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', '1');
+}
+// If we need access without being logged.
+if (!empty($_GET['public'])) { // Keep $_GET here. GETPOST() is not yet defined so we use $_GET
+ if (!defined("NOLOGIN")) {
+ define("NOLOGIN", '1');
+ }
+}
+if (!defined('NOIPCHECK')) {
+ define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
+}
+if (!defined('NOBROWSERNOTIF')) {
+ define('NOBROWSERNOTIF', '1');
+}
+include '../../main.inc.php';
+
+/**
+ * @var Conf $conf
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Translate $langs
+ * @var User $user
+ */
+
+$action = GETPOST('action', 'aZ09');
+$lang = GETPOST('lang', 'aZ09');
+
+$type = GETPOST('type');
+
+// Security check
+if (!defined("NOLOGIN")) { // No need of restrictedArea if not logged: Later the select will filter on public articles only if not logged.
+ restrictedArea($user, 'knowledgemanagement', 0, 'knowledgemanagement_knowledgerecord', 'knowledgerecord');
+}
+
+
+/*
+ * Actions
+ */
+
+// None
+
+
+/*
+ * View
+ */
+
+top_httphead('application/json');
+
+if ($action == "getCategories") {
+ $response = '';
+ $sql = "SELECT c.rowid, c.label, c.color";
+ $sql .= " FROM ".MAIN_DB_PREFIX."categorie as c ";
+ $sql .= " WHERE c.type = '".$db->escape($type)."'";
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $i = 0;
+ $response = array();
+ while ($i < $num) {
+ $obj = $db->fetch_object($resql);
+ $response[] = array('id' => $obj->rowid, 'label' => $obj->label, 'data-html' => 'TODO', 'color' => $obj->color);
+ $i++;
+ }
+ } else {
+ dol_print_error($db);
+ }
+
+ $response =json_encode($response);
+ echo $response;
+}
diff --git a/htdocs/core/ajax/fetchKnowledgeRecord.php b/htdocs/core/ajax/fetchKnowledgeRecord.php
index 707fd880ae7..1bb9dd925c2 100644
--- a/htdocs/core/ajax/fetchKnowledgeRecord.php
+++ b/htdocs/core/ajax/fetchKnowledgeRecord.php
@@ -1,7 +1,6 @@
- */
-/*
+ *
* 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
@@ -17,8 +16,8 @@
*/
/**
- * \file /htdocs/core/ajax/fetchKnowledgeRecord.php
- * \brief File to make Ajax action on Knowledge Management
+ * \file htdocs/core/ajax/fetchKnowledgeRecord.php
+ * \brief File to fetch km record
*/
if (!defined('NOTOKENRENEWAL')) {
@@ -85,7 +84,7 @@ top_httphead('application/json');
if ($action == "getKnowledgeRecord") {
$response = '';
- $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code";
+ $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer, kr.url, ctc.code";
$sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ";
$sql .= " JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category";
$sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'";
@@ -109,6 +108,7 @@ if ($action == "getKnowledgeRecord") {
} else {
dol_print_error($db);
}
+
$response =json_encode($response);
echo $response;
}
diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php
index 610dbde94a7..81b5a3d18a3 100644
--- a/htdocs/core/ajax/objectonoff.php
+++ b/htdocs/core/ajax/objectonoff.php
@@ -18,9 +18,10 @@
*/
/**
- * \file htdocs/core/ajax/objectonoff.php
- * \brief File to set status for an object. Called when ajax_object_onoff() is used.
- * This Ajax service is often called when option MAIN_DIRECT_STATUS_UPDATE is set.
+ * \file htdocs/core/ajax/objectonoff.php
+ * \brief File to set status for an object. Called when ajax_object_onoff() is used.
+ * This Ajax service is often called when option MAIN_DIRECT_STATUS_UPDATE is set.
+ * TODO Rename into updatestatus.php
*/
if (!defined('NOTOKENRENEWAL')) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 68f81f8abcd..606add1e69e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2827,7 +2827,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
console.log("open popup name='.$name.'");
},
close: function (event, ui) {
- console.log("Popup is closed, run jsonclose='.$jsonclose.');
+ console.log("Popup is closed, run jsonclose = '.$jsonclose.'");
'.(empty($jsonclose) ? '' : $jsonclose.';').'
}
});
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 634ab817109..2beafb27db8 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -2182,7 +2182,7 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
*/
function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
{
- global $user, $conf, $langs;
+ global $user, $langs;
if ($mainmenu == 'products') {
// Products
@@ -2358,7 +2358,7 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
*/
function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
{
- global $user, $conf, $langs;
+ global $user, $langs;
if ($mainmenu == 'project') {
if (isModEnabled('project')) {
@@ -2433,7 +2433,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
*/
function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
{
- global $user, $conf, $langs;
+ global $user, $langs;
if ($mainmenu == 'hrm') {
// HRM module
@@ -2544,7 +2544,8 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu
global $user, $langs;
if ($mainmenu == 'tools') {
- if (isModEnabled('category') && !getDolGlobalString('CATEGORY_EDIT_IN_POPUP_NOT_IN_MENU')) {
+ if (isModEnabled('category')) {
+ //if (isModEnabled('category') && getDolGlobalString('CATEGORY_EDIT_IN_POPUP_NOT_IN_MENU')) {
$titleindex = $langs->trans("Categories");
$newmenu->add("/categories/index.php?leftmenu=category", $titleindex, 0, $user->hasRight('category', 'read'), '', $mainmenu, 'category', 5, '', '', '', img_picto('', 'category', 'class="paddingright pictofixedwidth"'));
}
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 1a143cdb5f0..bed3591c922 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2759,15 +2759,19 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
$arrayselected[] = $cat->id;
}
print img_picto('', 'category', 'class="pictofixedwidth"');
+ $categtype = Categorie::TYPE_CUSTOMER;
$htmlname = 'custcats';
print $form->multiselectarray($htmlname, $cate_arbo, $arrayselected, 0, 0, 'minwidth100 widthcentpercentminusxx', 0, 0);
if (getDolGlobalString('CATEGORY_EDIT_IN_POPUP_NOT_IN_MENU')) {
// Add html code to add the edit button and go back
$jsonclose = 'doJsCodeAfterPopupClose'.$htmlname.'()';
- $s = dolButtonToOpenUrlInDialogPopup($htmlname, $langs->transnoentitiesnoconv("Categories"), img_picto('', 'add', 'class="editfielda"'), '/categories/categorie_list.php?type='.Categorie::TYPE_CUSTOMER, '', '', '', $jsonclose);
+ $urltoopen = '/categories/categorie_list.php?type='.$categtype;
+
+ $s = dolButtonToOpenUrlInDialogPopup($htmlname, $langs->transnoentitiesnoconv("Categories"), img_picto('', 'add', 'class="editfielda"'), $urltoopen, '', '', '', $jsonclose);
print $s;
// Add js code to add the edit button and go back
+ print ''."\n";
print '