From 2dfed186fd9b36cd7f2ccfee7ca6e0be88f83f92 Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Tue, 11 Jul 2017 16:01:00 +0200
Subject: [PATCH] fix chosen init in some files

---
 apps/maarch_entreprise/actions/process.php       |  2 +-
 .../class/class_lists_Abstract.php               |  3 +--
 core/Controllers/ParametersController.php        |  2 +-
 core/Models/ParametersModel.php                  | 16 +---------------
 core/Models/ParametersModelAbstract.php          |  3 ---
 modules/tags/templates/process/index.php         |  2 +-
 modules/tags/templates/validate_mail/index.php   |  2 +-
 7 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/apps/maarch_entreprise/actions/process.php b/apps/maarch_entreprise/actions/process.php
index 728d828cf8c..3eeede66100 100644
--- a/apps/maarch_entreprise/actions/process.php
+++ b/apps/maarch_entreprise/actions/process.php
@@ -491,7 +491,7 @@ function get_form_txt($values, $path_manage_action,  $id_action, $table, $module
         
         //script
         $frm_str .= '<script>';
-             $frmStr .= '$j("#folder").chosen({width: "100%", disable_search_threshold: 10, search_contains: true});displayFatherFolder(\'folder\'});';
+             $frm_str .= '$j("#folder").chosen({width: "100%", disable_search_threshold: 10, search_contains: true});displayFatherFolder(\'folder\');';
 
         $frm_str .= '</script>';
     }
diff --git a/apps/maarch_entreprise/class/class_lists_Abstract.php b/apps/maarch_entreprise/class/class_lists_Abstract.php
index dd0b98780a6..a3311f14221 100644
--- a/apps/maarch_entreprise/class/class_lists_Abstract.php
+++ b/apps/maarch_entreprise/class/class_lists_Abstract.php
@@ -354,8 +354,7 @@ abstract class lists_Abstract extends Database
                     }
                 }
                 $filters .='</select>&nbsp;';
-                //$filters .= '<script>new c($(\'category_id_list\'),{width:"150px",allow_single_deselect: true});</script>';
-                $filters .= '<script> $j("#category_id").chosen({width:"150px",allow_single_deselect: true});</script>';
+                $filters .= '<script> $j("#category_id_list").chosen({width:"150px",allow_single_deselect: true});</script>';
             break;
 
             case 'priority':
diff --git a/core/Controllers/ParametersController.php b/core/Controllers/ParametersController.php
index ba8168fda00..56a7e49ffd9 100644
--- a/core/Controllers/ParametersController.php
+++ b/core/Controllers/ParametersController.php
@@ -22,7 +22,7 @@ use Core\Models\LangModel;
 use Core\Models\ParametersModel;
 
 require_once 'core/class/class_db_pdo.php';
-require_once 'modules/notes/Models/NotesModel.php';
+require_once 'modules/notes/Models/NoteModel.php';
 
 class ParametersController
 {
diff --git a/core/Models/ParametersModel.php b/core/Models/ParametersModel.php
index eecad051d54..098bd2ea0cd 100644
--- a/core/Models/ParametersModel.php
+++ b/core/Models/ParametersModel.php
@@ -1,22 +1,8 @@
 <?php
 
     namespace Core\Models;
-/*
-    use Psr\Http\Message\RequestInterface;
-    use Psr\Http\Message\ResponseInterface;
-    use Respect\Validation\Validator;
-    use Core\Models\DocserverModel;
-    use Core\Models\DocserverTypeModel;
-    use Core\Models\UserModel;
-    use Core\Models\ParameterModel;
-    use Entities\Models\EntitiesModel;
-    use Core\Controllers\DocserverController;
-    use Core\Controllers\DocserverToolsController;
-*/
-    use Core\Models\ParametersModelAbstract;
 
-    require_once 'core/class/class_db_pdo.php';
-    require_once 'modules/notes/Models/NotesModel.php';
+    use Core\Models\ParametersModelAbstract;
 
     class ParametersModel extends ParametersModelAbstract
     {
diff --git a/core/Models/ParametersModelAbstract.php b/core/Models/ParametersModelAbstract.php
index c8d57a2c535..33171485089 100644
--- a/core/Models/ParametersModelAbstract.php
+++ b/core/Models/ParametersModelAbstract.php
@@ -11,11 +11,8 @@
 
 namespace Core\Models;
 
-require_once 'apps/maarch_entreprise/services/Table.php';
 require_once 'core/class/class_functions.php';
 
-
-
 class ParametersModelAbstract extends \Apps_Table_Service
 {
     public static function getList()
diff --git a/modules/tags/templates/process/index.php b/modules/tags/templates/process/index.php
index f82f056bca3..b7384fe27c7 100644
--- a/modules/tags/templates/process/index.php
+++ b/modules/tags/templates/process/index.php
@@ -58,7 +58,7 @@ $frm_str .='</td></tr><style>#tag_userform_chosen{width:95% !important;}</style>
 $frm_str .= '<input type="hidden" name="res_id" id="res_id"  value="'.$res_id.'" />';
 $frm_str .= '<input type="hidden" id="new_tag_label" name="new_tag_label"/>';
 $frm_str .= '<script type="text/javascript">load_tags('.$route_tag_ui_script.', \''.$res_id.'\', \''.$coll_id.'\');';
-$frmStr .= ' $j("#tag_userform").chosen({width: "95%", disable_search_threshold: 10, search_contains: true});';
+$frm_str .= ' $j("#tag_userform").chosen({width: "95%", disable_search_threshold: 10, search_contains: true});';
 if ($core_tools->test_service('create_tag', 'tags', false) == 1) {
     $frm_str .= '$j( "#tag_userform_chosen input" ).focusout(function() {$j("#new_tag_label").val($j("#tag_userform_chosen input").val());if($j( "#tag_userform_chosen .no-results" ).length){if(confirm("'._ADD_TAG_CONFIRM.'")){add_this_tags('.$route_tag_add_tags_from_res.', '.$route_tag_ui_script.');}}});';
 }
diff --git a/modules/tags/templates/validate_mail/index.php b/modules/tags/templates/validate_mail/index.php
index 823fa476101..e4aed0c5ba7 100644
--- a/modules/tags/templates/validate_mail/index.php
+++ b/modules/tags/templates/validate_mail/index.php
@@ -63,7 +63,7 @@ $frm_str .='<style>#tag_userform_chosen{width:100% !important;}</style>';
 
 $frm_str .= '<input type="hidden" id="new_tag_label" name="new_tag_label"/>';
 $frm_str .= '<script type="text/javascript">load_tags('.$route_tag_ui_script.', \''.$res_id.'\', \''.$coll_id.'\');';
-$frmStr .= ' $j("#tag_userform").chosen({width: "226px", disable_search_threshold: 10,search_contains: true});';
+$frm_str .= ' $j("#tag_userform").chosen({width: "226px", disable_search_threshold: 10,search_contains: true});';
 if ($core_tools->test_service('create_tag', 'tags', false) == 1) {
     $frm_str .= '$j( "#tag_userform_chosen input" ).focusout(function() {$j("#new_tag_label").val($j("#tag_userform_chosen input").val());if($j( "#tag_userform_chosen .no-results" ).length){if(confirm("'._ADD_TAG_CONFIRM.'")){add_this_tags('.$route_tag_add_tags_from_res.', '.$route_tag_ui_script.');}}});';
 }
-- 
GitLab