as in subject, i have a field in an external database table with timestamp type.
it is a simple table with this structure:

smsId int(11) No
mittente varchar(70) No
numCell varchar(14) No
smsTxt text No
sms_data timestamp No CURRENT_TIMESTAMP

all others field are well rendered but the sms_data field's rows are empty.
furtermore this warning is displayed on view's page:

Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (linea 2040 di /var/www/html/drupal-7.34/includes/common.inc).

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

purpleleaf’s picture

i found a solution in this page.
adding the filter and the handler and modifying the views_database_connector_views_data function as suggested in the above post solved the problem.

i only edited the workshop_handler_filter_datetime.inc file, and modified all the format_date function passing to it an intval as suggested in this post

jakonore’s picture

Hello Purpleleaf,

I have the same problem with a field from my database which is a timestamp and is being displayed empty by views.

Can you explain how you solved the problem and what changes you did on views_database_connector_views_data ?

I tried to get my head around the post you refer to but I am failing to really understand.

Thanks

purpleleaf’s picture

hi jakonore.
first of all download from Rahul site the handler classes, then include them in your module.info, as suggested in former cited site:

files[] = views/workshop_handler_field_datetime.inc
files[] = views/workshop_handler_filter_datetime.inc

the files in this example are in a new folder called views inside the module folder.

note that the downloaded file must be renamed because they ends in "._inc" not ".inc"

then modify views_database_connector_views_data function inside views_database_connector.views.inc file (row 55) like this:

        if ($col[0] == 'date') {
            $data[$table[0]][$col[1]] = array(
              'title' => $col[1],
              'help' => $col[1],
              'field' => array(
                'handler' => 'workshop_handler_field_datetime',
                'click sortable' => TRUE,
              ),
              'sort' => array(
                'handler' => 'views_handler_sort_date',
              ),
              'filter' => array(
                'handler' => 'workshop_handler_filter_datetime',
              ),
              'argument' => array( 
				'handler' => 'views_handler_argument_date', 
				'empty field name' => t('Undated'), 
			  ), 
            );

It is not necessary to modify workshop_handler_filter_datetime.inc file as i wrote in the former post

clayfreeman’s picture

--

mitjasvab’s picture

Status: Active » Needs review
StatusFileSize
new4.4 KB

Hi,
I assembled a patch with above informations. :-)

clayfreeman’s picture

Status: Needs review » Closed (won't fix)

This project is now abandoned.

bulldozer2003’s picture

Patch in #5 works great.

bulldozer2003’s picture

Assigned: Unassigned » bulldozer2003
Status: Needs review » Fixed

I've committed the patch to the 7.x-1.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

fishfree made their first commit to this issue’s fork.