[#8285] add_source = localsql not working in share mode
Summary add_source = localsql not working in share mode
Queue Turba
Queue Version HEAD
Type Enhancement
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester almarin (at) um (dot) es
Created 2009-05-15 (3599 days ago)
Updated 2009-06-04 (3579 days ago)
Assigned 2009-05-26 (3588 days ago)
Resolved 2009-06-04 (3579 days ago)
Patch No

2009-06-04 19:03:02 Michael Rubinsky Comment #9
State ⇒ Resolved
Version ⇒ HEAD
Reply to this comment
An example hook has been added to imp to automatically set this 
preference, but will only work if using Horde 3.3.5 (our current CVS 
code) or greater due to an issue that was just fixed with pref hooks.
2009-05-26 11:41:18 Jan Schneider Assigned to Michael Rubinsky
2009-05-26 11:41:03 Jan Schneider Comment #7
Type ⇒ Enhancement
State ⇒ Assigned
Priority ⇒ 1. Low
Reply to this comment
It might help to have an example hook that automatically sets the pref 
to the user's share.
2009-05-15 16:28:33 almarin (at) um (dot) es Comment #6 Reply to this comment
Ok, i think you are right. But at least,you should modify this 
recomendation from imp/config/prefs.php.dist:

// address book to use for adding addresses

// put $cfgSources array element name in the value field.

// Setting value to localsql would allow you to add contacts to MySQL database

// See turba/config/sources.php for more info

$_prefs['add_source'] = array(

     'value' => '',

//  'value' => 'localsql',

     'locked' => false,

     'shared' => true,

     'type' => 'implicit'


At least you should mention that it doesn't work in turba's share mode.

2009-05-15 16:09:55 Michael Rubinsky Comment #5 Reply to this comment
I'm with Jan on this. Personally, I'd rather not have the address book 
icon show if no explicit address book is selected in the prefs either 
by the user or by a default value in prefs.php. The value of 
'localsql' is not expected to work when localsql is defined as a 
shared source, so in that case this value should not be used as a 
default value in prefs.php.
2009-05-15 15:40:07 almarin (at) um (dot) es Comment #4 Reply to this comment
One more thing.

The problem is given only in default pref (when you set value => 
'localsql' in prefs.php). If the user enter to options panel and 
selects a diferent addressbook, that addresbook prevails over the 
default addressbook, because of this condition:

if (!in_array($import_source, $addressbooks)) {

I think the patch make more robust the operation, because you can set 
the add_source pref to an addressbook, but that addressbook cound be 
deleted in the future. In that case i think it would be more desirable 
has the operation done over the default addresbook rather than the 

2009-05-15 15:27:52 almarin (at) um (dot) es Comment #3 Reply to this comment
Yes, but the user doesn't choose any addressbook at all, so the user 
should think that the operation is made over the default addressbook.

This error is given when you click in the icon shown near the address 
when you are viewing a mail from IMP. Yes, you are right and it should 
be a second step to choose the target addressbook, but if you don't 
introduce that second step, the only way to give that functionality is 
to work over the default addressbook.

2009-05-15 14:23:31 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
I don't think it's a good idea to silently add the address to a 
different address book than the user intended.
2009-05-15 14:22:33 Jan Schneider Version ⇒ 2.3.1
Queue ⇒ Turba
2009-05-15 10:58:17 almarin (at) um (dot) es Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ add_source = localsql not working in share mode
Queue ⇒ IMP
Milestone ⇒
Patch ⇒ No
New Attachment: api.php.patch Download
Reply to this comment
When add_source pref is set to localsql, when you try to add a contact 
from a message you get this error:

Invalid address book: localsql

I think that the correct behavior is to add that contact to the 
default addressbook.

I attach a patch to modify turba/lib/api.php to achieve that.

Saved Queries