phplist

NOTE:: Before reporting an issue, make sure you are running the latest version, currently 3.3.1


View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012206phplist applicationSubscriber Importpublic05-11-07 18:2729-04-11 14:59
Reporterpremax 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version2.10.5 
Target Version2.10.13Fixed in Version2.10.14 
Summary0012206: incorrect import of checkboxgroup attributes
DescriptionThis is issue from all versions of phplist, the bug is in import1.php, checked also the newest one from cvs.

The thing is that email import with the same values for attributes does not work for attributes of type checkboxgroup. This type of attribute is an array if fact and phplist tries to deal with it like a linear variable. So du to import phplist inserts such values to the phplist_user_user_attribute table:

select * from phplist_user_user_attribute;

attributeid | userid | value
 1 | 1 | Array
 1 | 2 | Array
 1 | 3 | Array
 1 | 4 | Array

Attribute of id 1 is checkgroupbox. In the result, no values for checkgroupboxes are set during import. Also, the error "Database error 1054 while doing query Unknown column 'Array' in 'where clause'" shows up in several places.

The fix:
 find the following lines in the file admin/import1.php (lines 222-224 in rev 1.14 8/2/2007 from cvs):

while (list($attr,$value) = each($attributes))
 Sql_query(sprintf('replace into %s (attributeid,userid,value)
 values("%s","%s","%s")',
 $tables["user_attribute"],$attr,$userid,addslashes($value))
 );

and replace them with:

while (list($attr,$value) = each($attributes))
{
 if(is_array($value))
    $value=implode(',',$value);
 Sql_query(sprintf('replace into %s (attributeid,userid,value)
 values("%s","%s","%s")',
 $tables["user_attribute"],$attr,$userid,addslashes($value)));
}

So the fix is to check if attribute is an array or not, and deal with this.
Works for me :]

TagsNo tags attached.
Attached Files? file icon import1.php [^] (15,000 bytes) 05-11-07 18:27

- Relationships
related to 0003721closed phplist application phplist 2.10.x 
related to 0004722assignedmichiel phpList plugins Selection criteria problem with checkbox attribute. 
related to 0005921closeduser1822 phplist application selecting values in checkbox attribute during import doesn't work 
related to 0015421resolvedmichiel phplist application Importing CSV with multiple values for Checkboxgroup crashes with SQL Error 

-  Notes
(0035744)
user1308
05-11-07 19:49

Thanks will check fix in next release and maybe add it to the code
(0051206)
michiel (manager)
29-04-11 14:59

http://phplist.svn.sourceforge.net/phplist/?rev=2672&view=rev [^]


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker