View Issue Details

IDProjectCategoryView StatusLast Update
0010828phplist applicationTemplate Managementpublic18-02-08 14:08
Reportersniffi 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.10.4 
Target Version2.10.7Fixed in Version2.10.5 
Summary0010828: Possible faulty insert; Database error 1062 while doing query Duplicate entry 'Untitled Template' for key 2
DescriptionWhen inserting a template with the name "Untitled Template" or when inserting a template fails for some reason you must manually delete the "untitled template" from the template list.
This is caused in admin/template.php:

    if (!$id) {
      Sql_Query("insert into {$tables["template"]} (title) values(\"Untitled Template\")");
      $id = Sql_Insert_id();
    }
    Sql_Query(sprintf('update %s set title = "%s",template = "%s" where id = %d',
       $tables["template"],$title,addslashes($content),$id));

Why not insert with the right title in the first place? i guess it's related to editing or something. maybe its easier to just not mark the title field as unique, and check uniqueness manually
TagsNo tags attached.

Relationships

related to 0003721 closed phplist 2.10.x 

Activities

user1822

21-08-07 19:26

  ~0030815

When adding a template with an existing name this generates an 1062 error and the 'Untitled Template' tupel appears.

Changed temporary name to the $title field, which solves this issue.