Results 1 to 10 of 10

Thread: Date search doesn't work in cases

  1. #1
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Date search doesn't work in cases

    When doing a date search in cases (doesn't matter what range or type of search) it doesn't do anything. I did some debugging myself and with both entered and modified searches active it runs the query

    SELECT cases.id ,cases_cstm.contact_id1_c,cases_cstm.case_number_c , cases.case_number , cases.name , accounts.name account_name , accounts.assigned_user_id account_name_owner , 'Accounts' account_name_mod, cases.account_id , cases.status , TRIM(CONCAT(IFNULL(jt1.first_name,''),' ',IFNULL(jt1.last_name,''))) contact_c , cases.priority , cases.date_entered , cases.assigned_user_id FROM cases LEFT JOIN cases_cstm ON cases.id = cases_cstm.id_c LEFT JOIN accounts accounts ON
    accounts.id= cases.account_id AND accounts.deleted=0
    AND accounts.deleted=0 LEFT JOIN contacts jt1 ON cases_cstm.contact_id1_c = jt1.id AND jt1.deleted=0 where cases.deleted=0 ORDER BY cases.case_number ASC LIMIT 0,51

    which has no date information in it. Below that in the log there is

    1-3c8e-03d5-b598-4dc9437c7fcb][INFO] Query:
    SELECT meetings.id, name,reminder_time, description,location, date_start, assigned_user_id
    FROM meetings LEFT JOIN meetings_users ON meetings.id = meetings_users.meeting_id
    WHERE meetings_users.user_id ='196b1d71-3c8e-03d5-b598-4dc9437c7fcb'
    AND meetings_users.accept_status != 'decline'
    AND meetings.reminder_time != -1
    AND meetings_users.deleted != 1
    AND meetings.status != 'Held'
    AND date_start >= '2011-07-28 21:28:53'
    AND date_start <= '2011-07-28 22:28:53'

    which has the date start info but not for the cases. How can i fix this?

  2. #2
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Re: Date search doesn't work in cases

    I still can't figure this out....

  3. #3
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Date search doesn't work in cases

    If the field was included correctly on searchdefs (what looks that was) the query should works.
    Once you was able to get the generated query, if you is able to find what is its problem, maybe you can extend the list.view.php to fix the where statment before process it.

    But in your case, at least for this sql exemple, looks a little bit strange the field start_data have appeared twice:
    AND date_start >= '2011-07-28 21:28:53'
    AND date_start <= '2011-07-28 22:28:53'

    Is possible a data is bigger and smaller than a value in the same time? Looks like this case will get the record just when the start date is equals the searched value, including the minutes and seconds.

    May you have to fix the sql part to use a "between" sql statment instead of AND.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  4. #4
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Re: Date search doesn't work in cases

    I'm having problems parsing your english but if I understand correctly you are having issues with the and clause. Even if that is incorrect (which doesn't matter as it is attached to the table of an unused module) I still can't get the date search to do anything. I know that the date fields were added correctly because they are default fields and the relevant section of the searchdefs is:

    PHP Code:
    'date_entered' => 
          array (
            
    'width' => '10%',
            
    'label' => 'LBL_DATE_ENTERED',
            
    'default' => true,
            
    'name' => 'date_entered',
          ),
          
    'date_modified' => 
          array (
            
    'type' => 'datetime',
            
    'label' => 'LBL_DATE_MODIFIED',
            
    'width' => '10%',
            
    'default' => true,
            
    'name' => 'date_modified',
          ), 
    Which was added using the studio they show up in the advanced search as expected they just don't do anything. Also the " 'type' => 'datetime', " Doesn't seem to matter as both created and modified show up as the same selectbox/search options and neither do anything

  5. #5
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Re: Date search doesn't work in cases

    I still can't figure this out.....

  6. #6
    jgrimaldos is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    26

    Default Re: Date search doesn't work in cases

    Any insight on this? I'm having exactly the same Problem.

  7. #7
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Re: Date search doesn't work in cases

    sadly no........ I still can't figure it out......

  8. #8
    waterfoul is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    25

    Default Re: Date search doesn't work in cases

    FOUND IT!
    It is a problem with the date info missing from modules\Cases\metadata\SearchFields.php which is fixed in teh most recent beta All I did is replace that file with the one from the beta archive and it worked. I attached it so everyone else doesn't have to go looking for it.
    Attached Files Attached Files

  9. #9
    jgrimaldos is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    26

    Default Re: Date search doesn't work in cases

    Thanks, tested and it worked like a charm.

  10. #10
    calebeskurdal is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    12

    Default Re: Date search doesn't work in cases

    Thanks for the bug fix! Just found this and used your fix.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Date Search doesn't work
    By tboard0166 in forum Help
    Replies: 3
    Last Post: 2008-05-22, 03:01 PM
  2. Replies: 6
    Last Post: 2008-04-21, 02:34 PM
  3. Replies: 0
    Last Post: 2008-01-30, 03:29 PM
  4. Due date for cases
    By sygroup in forum Feature Requests
    Replies: 2
    Last Post: 2005-12-14, 06:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •