Opened 9 years ago
Closed 9 years ago
#1176 closed Bug/Fehler (fixed)
Fehler in create_account.php bzgl. Neukunden Gutschein?
| Reported by: | Torsten Riemer | Owned by: | somebody |
|---|---|---|---|
| Priority: | normal | Milestone: | modified-shop-2.0.3.0 |
| Component: | Shop | Version: | 2.0.2.2 |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: |
Description (last modified by )
Bitte mal prüfen: BUG in v2.0.2.2 -> create_account.php ?
Es gibt wohl einen SQL-Fehler:
1062 - Duplicate entry '0' FOR KEY 'idx_coupon_id'
INSERT INTO coupon_email_track (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) VALUES ('', '0', 'Admin', 'mail@example.com', now())
Attachments (0)
Change History (8)
comment:1 by , 9 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 9 years ago
comment:4 by , 9 years ago
Sind das nicht 2 Fehler an gleicher Stelle?
- $insert_id = xtc_db_insert_id(); statt $insert_id = xtc_db_insert_id($insert_query);
- Ich sehe nicht, warum auf coupon_id in Tabelle coupon_email_track ein unique-index ist. Es gibt doch extra eine Spalte um unique_id um jeden Datensatz eindeutig zu identifizieren.
comment:5 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Ich öffne das Ticket nochmal wegen der Frage von webald.
comment:6 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Mit dem Fix wurde das Problem gelöst
Spalte coupon_id ist ein unique-index weil eine Coupon-Id nur einmal vorkommen darf.
Ohne diesen unique-index wäre der Fehler gar nicht aufgefallen.
comment:7 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Dann ist die Spalte unique-id überflüssig. Zwei unabhängige und eindeutige Indizes sind unnötig.
Allerdings bin ich der Meinung, dass der unique-Index auf coupon_id vom Datenbank-Design her keinen Sinn macht. coupon_id wird in der Tabelle coupons festgelegt und ist dort eindeutig; coupon_email_track ist nur eine davon abhängige Tabelle.
In dieser Tabelle könnte auch das mehrfache Versenden eines Coupons dokumentiert werden (etwa weil der Coupon vom Admin erneut zugesandt werden mußte). Das geht derzeit aufgrund des Index nicht. Hierfür ware u. U. eine zusätzliche Spalte mit einem Flag notwendig, ob dieser Datensatz bei der Berechnung des Kundenguthabens berücksichtigt werden muss.
comment:8 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Die coupon_id ist ein Autoincrement. Damit wird auch der Verweis auf die Sprache gemacht. Die coupon_code muss eindeutig sein und deshalb gibt es hier einen UNIQUE Index dazu.

Fehler besteht seit 2.0.0.0