I'm converting my timetracking records to now use the billed flag instead of my own field.

I have my own created views but can't build a filter for billed or not billed.

Is this a bug or am I not doing something?

Thanks.

CommentFileSizeAuthor
#14 storm-660150-13.patch992 bytesjuliangb
#8 billed_filter.patch840 bytesflickerfly
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

flickerfly’s picture

I was also looking for this capability. It would help speed up billing to know what I've already billed at that level instead of having to click in, forget which I clicked on and have to go back and look again. Then on bad days or when someone walks into my office I sometimes have to click on it a third time. It gets a bit aggravating at that point. :-)

flickerfly’s picture

Category: support » feature
Mark_Watson27’s picture

I think the code for filtering is missing from stormtimetracking.views.inc
you need to add the filter for the two fields so the code will look like:

  $data['stormtimetracking']['billable'] = array(
    'title' => t('Timetracking Billable'),
    'help' => 'Storm Timetracking Billable',
    'field' => array(
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  
  $data['stormtimetracking']['billed'] = array(
    'title' => t('Timetracking Billed'),
    'help' => 'Storm Timetracking Billed',
    'field' => array(
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  
  return $data;
}
Magnity’s picture

Status: Active » Needs review

Is this tested?

That seems right, but the data type in the schema is int (can't remember why - bool would be better), so I'd like to make sure that doesn't affect which filter is needed.

Magnity’s picture

Status: Needs review » Needs work

Doesn't seem to work for exposed filter. I think it might be a case of changing the database entry to bool.

tchurch’s picture

Not sure if this helps but I tried this code:

$data['stormtimetracking']['billed'] = array(
'title' => t('Timetracking Billed'),
'help' => 'Storm Timetracking Billed',
'field' => array(
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);

It works for me (and also for the exposed filter) but it's not a dropdown list to select billed (i.e. 1) or not billed (i.e. 0)

I'm not that familiar with this to be able to hard-code a dropdown list here (if it can be done).

juliangb’s picture

Any chance of a patch? (http://drupal.org/patch/create)

I'm happy to put it in if it improves the situation, even if it doesn't 100% address the situation.

flickerfly’s picture

Status: Needs work » Needs review
FileSize
840 bytes

Please Test This!

Here's a patch using tchurch's filter and both fields identified by Mark_Watson27 (billed & billable). It was created against today's 6.x-1.x-dev. It's super simple, but should probably have some review.

Status: Needs review » Needs work

The last submitted patch, billed_filter.patch, failed testing.

juliangb’s picture

Version: 6.x-1.27 » 6.x-1.x-dev
Status: Needs work » Needs review

I wonder if the bot was testing against the right version of Storm.

juliangb’s picture

#8: billed_filter.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, billed_filter.patch, failed testing.

juliangb’s picture

The reason that the patch is failing is because it is patched relative to the root of the drupal install rather than of storm.

juliangb’s picture

Status: Needs work » Needs review
FileSize
992 bytes

Reroll from correct directory.

Have also removed the additional line breaks that were added.

juliangb’s picture

Status: Needs review » Fixed

Committed.

Haven't directly tested this functionality myself, but the code looks logical and seems that it works from #6 and #8.

tchurch’s picture

What would be nice if it could show a dropdown box (billed or unbilled) instead of an input box (which you put 1 or 0 in it).
From a website user/customer point of view, this would look better and be less confusing.

Not sure how to code this though.

juliangb’s picture

Title: Allow filter by 'billed' column in views. » Improve filter by 'billed' column in views.
Category: feature » task
Status: Fixed » Active

Agreed.

flickerfly’s picture

thank juliangb for picking this up when I dropped out on it. :-) Awesome to see it committed!

I agree, if it could be a dropdown instead, it would be much cooler. I actually looked into some other modules looking for example code, but didn't come out with anything with the time I had.