Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.90.1] Cannot find last element in entity tree if collapsed (closed) #347

Closed
rickyweb opened this issue Jan 4, 2016 · 7 comments
Closed
Assignees
Labels

Comments

@rickyweb
Copy link

rickyweb commented Jan 4, 2016

In the modal entity selection window, the initial state is closed for every child. If you are searching for the very last child in the last node, then it doesn't get found.

Workaround: if the node has been opened (expanded) manually, then the item gets found.

In order to avoid the users to have to manually expand the tree, I decided to open it completely when loaded. Here's the diff I use as a temporary workaround.

--- entitytreesons.php  2016-01-04 11:50:56.891131872 +0100
+++ entitytreesons.php.new      2016-01-04 11:50:42.269131175 +0100
@@ -84,7 +84,7 @@
                if (isset($ancestors[$ID])) {
                   $path['state'] = 'open';
                } else {
-                  $path['state'] = 'closed';
+                  $path['state'] = 'open';
                }
             }
          }
@@ -120,7 +120,7 @@
                   if (isset($ancestors[$row['id']])) {
                      $path['state'] = 'open';
                   } else {
-                     $path['state'] = 'closed';
+                     $path['state'] = 'open';
                   }
                }
                $nodes[] = $path;
@@ -131,4 +131,4 @@
    }
    echo json_encode($nodes);
 }
-?>
\ No newline at end of file
+?>
@tomolimo
Copy link
Contributor

tomolimo commented Jan 4, 2016

Hello,
I made a test and cannot reproduce this behavior.
Our entity tree has more than 900 entries.
Could you be more specific about steps to reproduce this?
thank you,
regards,
Tomolimo

@rickyweb
Copy link
Author

rickyweb commented Jan 4, 2016

Hello Tomolimo,

Thanks for your feedback. I've attached a dump of my glpi_entities table which is way smaller than yours by the way. If you search for "N" then you get a match for

  • Root entity
  • Poland 1
  • NB
  • Poland 2
  • VN

It doesn't match however NA which is a child of VN.
If you search for "NA" directly, you get a blank result screen. (see screenshot-animation at the end of this post.

If you first open the VN node and actually see the NA element, then you can also search for it and it gets found.

glpi_entities.dump.sql.txt

screenshot-animation

@orthagh
Copy link
Contributor

orthagh commented Jan 6, 2016

Also, I just tested on curent 0.90/bugfixes without reproducing.

What's your glpi version ?

@rickyweb
Copy link
Author

rickyweb commented Jan 6, 2016

I'm using GLPI 0.90.1 with Firefox 43.0.3 (same issue with Google Chrome 35.0.1916.114 m and IE 11.0.9600.18124CO)

Here's the detail:

Operating system: Linux localhost 4.2.7-200.fc22.x86_64 #1 SMP Thu Dec 10 03:28:47 UTC 2015 x86_64
PHP 5.6.16 apache2handler (Core, PDO, Phar, Reflection, SPL, SimpleXML, apache2handler, bcmath, bz2, calendar, ctype, curl,
date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mcrypt, mhash,
mongo, mysql, mysqli, mysqlnd, openssl, pcre, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, posix, session, shmop, soap, sockets,
sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, xmlreader, xmlwriter, xsl, zlib)
Setup: max_execution_time="30" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files"
upload_max_filesize="2M"
Software: Apache/2.4.17 (Fedora) OpenSSL/1.0.1k-fips mod_nss/2.4.16 NSS/3.19.3 Basic ECC PHP/5.6.16 mod_perl/2.0.9 Perl/v5.20.3
()
Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0
Server Software: MariaDB Server
Server Version: 10.0.21-MariaDB
Server SQL Mode:
Parameters: root@localhost/glpi
Host info: Localhost via UNIX socket

OK/var/www/html/glpi-0.90.1/config : OK
OK/var/www/html/glpi-0.90.1/files : OK
OK/var/www/html/glpi-0.90.1/files/_dumps : OK
OK/var/www/html/glpi-0.90.1/files/_sessions : OK
OK/var/www/html/glpi-0.90.1/files/_cron : OK
OK/var/www/html/glpi-0.90.1/files/_graphs : OK
OK/var/www/html/glpi-0.90.1/files/_lock : OK
OK/var/www/html/glpi-0.90.1/files/_plugins : OK
OK/var/www/html/glpi-0.90.1/files/_tmp : OK
OK/var/www/html/glpi-0.90.1/files/_rss : OK
OK/var/www/html/glpi-0.90.1/files/_uploads : OK
OK/var/www/html/glpi-0.90.1/files/_pictures : OK
OK/var/www/html/glpi-0.90.1/files/_log : OK
Web access to files directory is protectedWeb access to files directory is protected : OK
OKSELinux mode is Disabled

@orthagh
Copy link
Contributor

orthagh commented Jan 6, 2016

i just tested with your data, and reproduce the issue.

I'll keep you informed of my corrections

@orthagh
Copy link
Contributor

orthagh commented Jan 6, 2016

found the problem in your data.
It seems the field ancestors_cache of your glpi_entities table is corrupted

I suggest you to send the next query in your mysql console (or phpmyadmin, etc)

UPDATE glpi_entities SET ancestors_cache = '';

@orthagh orthagh closed this as completed Jan 6, 2016
@orthagh orthagh added the invalid label Jan 6, 2016
@orthagh orthagh self-assigned this Jan 6, 2016
@rickyweb
Copy link
Author

rickyweb commented Jan 7, 2016

Perfect, that worked. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants