+UNIQUE INDEX `coupon_user` (`coupon_id`, `userid`),
+UNIQUE INDEX (`coupon_code`)",
+ 'Coupon->user connection');
+
+ // Configuration entries
+ addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
+ addConfigAddSql('coupon_default_points', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 100.00000');
+ addConfigAddSql('coupon_autopurge_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
+ addConfigAddSql('coupon_userid', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
+
+ // User data table
+ addExtensionAddTableColumnSql('user_data', 'receiving_coupons', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+
+ // Menu systems:
+ // - Admin entries
+ addAdminMenuSql('coupon', NULL, 'Gutscheine', 'Einrichten und Versenden von Code-Gutscheinen, sowie per API (noch in Planung). Bei Code-Gutscheinen wird ein Code pro Mitglied erzeugt, der dann an das Mitglied ausgesandt wird. Löst das Mitglied den Gutschein ein, erhält es die Gutschrift auf sein Konto gutgeschrieben. Ausgangseinstellung ist die Gutschrift auf das Werbeguthaben, was für Paidmailer von Wichtigkeit ist, dass Guthaben aus Gutscheinen nicht auszahlungsfähig ist.', 6);
+ addAdminMenuSql('coupon', 'list_coupon', 'Auflisten', 'Listet alle Gutscheine und Einlösungen durch die Mitglieder auf.', 1);
+ addAdminMenuSql('coupon', 'send_coupon', 'Versenden/Neuen erstellen', 'Versendet neue Gutscheine an die Mitglieder. Wenn Sie auf "Absenden" klicken, warten Sie bitte die Folgeseite ab, da der Versand der Gutscheine derzeit nicht gepoolt ist.', 2);
+ addAdminMenuSql('coupon', 'config_coupon', 'Einstellungen', 'Allgemeine Einstellungen zu Code-Gutscheinen und Gutscheinen von Sponsoren (z.B. per API) können hier vorgenommen werden.', 3);
+ // - Member entries
+ addMemberMenuSql('coupon', NULL, 'Gutscheine', 3);
+ addMemberMenuSql('coupon', 'cash_coupon', 'Gutschein einlösen', 1);
+ addMemberMenuSql('coupon', 'list_coupon', 'Eingelöste auflisten', 2);
+
+ // Add filter (for changing user_points column dynamically
+ registerFilter(__FILE__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', FALSE, TRUE, isExtensionDryRun());