> > Bug (approved)

searching for Item-IDs does not work


Jul 17, 2006
30 min ... 60 min
Aug 10, 2006
Jul 17, 2006 / pixtur
Aug 10, 2006 / pixtur
pixtur, tino

Attached files

No files uploaded
This working until v0.06

Issue report

Not available
WinXP / Firefox 1.5


tino:It works but...

11 years ago (2. update 11 years ago)

Hey Tom,

I implemented the search for Item-IDs.

But it doesn't work for numbers as a string in an Item so far.

pixtur:Just looked at the code...

11 years ago

Some hints:

please use this convention for else:

if(true) {

else {


Getting the item could have been implemented much shorter as:

        ### query string is a number? ###
        if(preg_match("/^\s*(\d+)!?\s*$/", $search_query, $matches)) {
          if($item= DbProjectItem::getVisibleById(intval($matches[1]))) {
            if($item->item == ITEM_TASK) {
              $PH->messages[]=__("Jumped to the only result found.");
              $PH->show( 'taskView',array('tsk'=>$tasks[0]->id));
            else if {
                #... and so on

This would be valid since the fulltext search engine for mySQL wouldn't allow searching for numbers anyway. So we could guess the entering a valid id is meant as a direct jump.


tino:Reply to Just looked at the code...

11 years ago (2. update 11 years ago)

Hey Tom,

is there something similar to DbProjectItem::getById for non-project items (Companies, Persons)?

tino:Can you give me a hint?

11 years ago (3. update 11 years ago)

Hey Tom,

from pages/search.inc.php

### query string is a number? ###
if(preg_match("/^[0-9]*$/", $search_query, $matches)) {
    # project items like projects, tasks, comments, efforts and files #
    if($item= DbProjectItem::getVisibleById(intval($matches[0]))) {
        new FeedbackMessage(__('Jumped to the only result found.'));
        switch ($item->type) {
            case ITEM_PROJECT:
            case ITEM_TASK:
            case ITEM_COMMENT:
            # effort-view not implemented so far
            /*case ITEM_EFFORT:
            	exit;  */  
            case ITEM_FILE:

For the person- and company-search I need something similar to DbProjectItem::getVisibleById.
Is there something similar, Tom?

So I can upload the cleaner and more accessible version of the search by Item-Id's.


11 years ago

good morning Tom.

You're right! I'll change it as soon as possible.

Is it right to search for projects, companies and persons too?


11 years ago

we should search for all items that have an TypeView function:
  • Company
  • Person
  • Task
  • Comment
  • Effort
  • Project
  • File

tino:Reply to Reply

11 years ago (4. update 11 years ago)

  • Company
  • Person
  • Task - done
  • Comment - done
  • Effort (not implemented cause we have no EffortView yet)
  • Project - done
  • File - done

Tom, do you have an idea with the EffortView.

We can add the search for efforts when we added an EffortView - or have you another idea how we can do it?


11 years ago

Yes this has to be implemented. We need this anyway.

We already have an reference implementation, otherwise I would use the commentView and clone this function. This should not be much work. It's sad but I would need to finish the data-stuff before releason a new version and currently I have not much time for this.