Email Options

AndyB

Member
You are using DaDaBIK version 7.3.3 pro, installed on 29-07-2016, the last version of DaDaBIK is 7.3.3 released on 26-07-2016
You are runnning the last release of DaDaBIK
PHP Version: 5.6.24
mysql version: 5.6.26-log
Web server: Apache
Client: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.59.10 (KHTML, like Gecko) Version/5.1.9 Safari/534.59.10


I have turned on the option for receiving emails when new records are added or amended but was wondering if there are any options.

When I receive an email about a changed record i cannot tell which field has been amended. All the fields are displayed in the email again. Also fields which contain file attachments or picture attachments do not actually contain the data stored in the field

For example:-
<img target="_blank" src="index.php?r=1477148436&function=show_file&file_type=image_file&tablename=ClockDataExpanded&file_field_name=PhotoClock&where_field=UniqueNumberID&where_value=649">

Thanks.

Andy
 

eugenio

Administrator
Staff member
Hello Andy,
yes you only see the current record values, DaDaBIK doesn't keep track of the records history to tell you what has been changed; I agree it would be an interesting feature, though.

About the pictures: the tricky part here is that with the new file access mode, files are not publicly accessible anymore; you could fix this issue by changing in config $file_access_mode to 'public_url' and making the uploads folder public, but you will make your uploaded files available to anyone who know the correspondent URL.

I am testing an alternative solution about this issue and I'll let you know if I have news.

Cheers,
 

AndyB

Member
Eugenio,

Interestingly when I sent you this email I was in the middle of creating a view of my table in MySQL and when I changed a record via this view the email gave me the correct names of the attached pictures and files instead of the example I sent in my first post.

It seems like there might be a difference between updating a record via the table or updating the record via a view.

Regards

Andy
 

eugenio

Administrator
Staff member
Hello,
I don't think this is possible; email-wise, there is no difference between views and tables.
Can you post the working example?
 

AndyB

Member
Eugenio,

You are correct, I tested it both ways and tables or views made no difference.

I have now had about 30 emails and only 2 had the correct content:-

PhotoClock: IMG_1654_86.JPG

All the other emails had for this field:-

Photo of Clock: <img target="_blank" src="index.php?r=1477415186&function=show_file&file_type=image_file&tablename=ClockDataExpanded&file_field_name=PhotoClock&where_field=UniqueNumberID&where_value=647">


I thought had about what could be different and the only thing I changed between the two emails was the layout of the form in form configurator. When I first created the form all the fields were in one column and I chaged them to display in 2 columns.

I hope this helps.

Regards

Andy
 

eugenio

Administrator
Staff member
Hello,
actually the correct content (even if it doesn't work as expected for the reason I explained in the first message) is the second one; I don't think it's possible that you get as content just "IMG_1654_86.JPG" unless the field was NOT set as image_file in the form configurator.
I have a doubt now: what do you want to see in the email, the actual picture or the name of the file (IMG_1654_86.JPG)?

Best,
 

AndyB

Member
Eugenio,

I was expecting to see the name of the file.

Maybe you have just hit on the answer, I had just set up the view so the form configurator would not have had image_file as the field type.
It's clear to me once you said that.

It would still be nice to see the name of the file but maybe this can be looked at in future developments.

Thanks

Andy
 

eugenio

Administrator
Staff member
Oh you want to see the file name, not the picture, ok now I understand.

You could add this little hack to show image_file fields as text in email, I haven't tested it but it should work: open /include/business_logic.php with a plain text editor and search for this string:

[pre]
$field_to_display = get_field_correct_displaying($field_values_ar[$x][$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table", $fields_labels_ar[$i], 0, $where_field, $where_value); // get the correct display mode for the field
[/pre]

Replace the whole thing with this piece of code

[pre]
if ($fields_labels_ar[$i]['type_field'] === 'select_single' && $output === 'email'){
$field_to_display = get_field_correct_displaying($field_values_ar[$x][$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "plain_text", $fields_labels_ar[$i], 0, $where_field, $where_value); // get the correct display mode for the field
}
else{
$field_to_display = get_field_correct_displaying($field_values_ar[$x][$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], $fields_labels_ar[$i]["separator_field"], "details_table", $fields_labels_ar[$i], 0, $where_field, $where_value); // get the correct display mode for the field
}
[/pre]

let me know if it works.
 

AndyB

Member
Eugenio,

I made this change but it did not chage what was emailed to me. I still got the same content in the email.

Andy
 

eugenio

Administrator
Staff member
Sorry, I made a mistake with copy and paste :) it's not:

if ($fields_labels_ar[$i]['type_field'] === 'select_single' && $output === 'email'){

it's:

if ($fields_labels_ar[$i]['type_field'] === 'image_file' && $output === 'email'){
 

AndyB

Member
Eugenio,

That worked perfectly, thank you.
Is it possble ot make the same code change for other attached files - ie generic file?

Thanks

Andy
 

eugenio

Administrator
Staff member
Yes, change it with:

if ( ( $fields_labels_ar[$i]['type_field'] === 'image_file' || $fields_labels_ar[$i]['type_field'] === 'generic_file' ) && $output === 'email'){

Cheers,
 

AndyB

Member
Eugenio,

That worked perfectly, thank you so much.

Now I just need to see the changes highlighted in the email so I will be hoping you can do this at some time in the future.

Regards

Andy
 
Top