./inc/libs/task_functions.php:247: // @TODO These can be rewritten to filter
./inc/libs/task_functions.php:51:// @TODO Move all extension-dependent queries into filters
./inc/libs/theme_functions.php:93: // @TODO Can't this be rewritten to an API function?
-./inc/libs/user_functions.php:221:// @TODO Double-check configuration entry here
-./inc/libs/user_functions.php:312: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
-./inc/libs/user_functions.php:341: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
+./inc/libs/user_functions.php:227:// @TODO Double-check configuration entry here
+./inc/libs/user_functions.php:318: // @TODO Make this filter working: $ADDON = runFilterChain('post_login_update', $content);
+./inc/libs/user_functions.php:347: // @TODO Make this filter working: $url = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
./inc/libs/yoomedia_functions.php:114: $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
./inc/load_config.php:75: // @TODO Rewrite them to avoid this else block
./inc/loader/load-extension.php:13: * @TODO Rewrite this whole file *
./inc/modules/admin/what-mem_add.php:63: // @TODO Cant this be rewritten?
./inc/modules/admin/what-mem_add.php:79: // @TODO This can be somehow rewritten to a function
./inc/modules/admin/what-unlock_emails.php:84: // @TODO Rewrite these if-blocks to a filter
-./inc/modules/admin/what-usage.php:87: // @TODO This code is double, see loadTemplate() and loadEmailTemplate() in functions.php
+./inc/modules/admin/what-usage.php:89: // @TODO This code is double, see loadTemplate() and loadEmailTemplate() in functions.php
./inc/modules/admin/what-usr_online.php:49: // @TODO Add a filter for sponsor
./inc/modules/guest/what-beg.php:51:// @TODO No more needed? define('__BEG_USERID_TIMEOUT', createFancyTime(getBegUseridTimeout()));
./inc/modules/guest/what-login.php:125: // @TODO Move this HTML code into a template
} // END - if
// Version number
-setThisExtensionVersion('0.0.2');
+setThisExtensionVersion('0.0.3');
// Version history array (add more with , '0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2'));
+setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3'));
switch (getExtensionMode()) {
case 'register': // Do stuff when installtion is running
// Remove all filters
unregisterFilter(__FUNCTION__, __LINE__, 'determine_points_column_name', 'COUPON_CHANGE_POINTS_COLUMN_NAME', true, isExtensionDryRun());
+ unregisterFilter(__FUNCTION__, __LINE__, 'post_cash_coupon', 'POST_CASH_COUPON', true, isExtensionDryRun());
break;
case 'activate': // Do stuff when admin activates this extension
addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_points_data` SET `subject`='coupon_cashed' WHERE `subject`='coupon' LIMIT 1");
// Update notes (these will be set as task text!)
- setExtensionUpdateNotes('');
+ setExtensionUpdateNotes('Eintrag in <strong>{CONFIG_OPEN}_MYSQL_PREFIX{CONFIG_CLOSE}_points_data</strong> umbenannt.');
+ break;
+
+ case '0.0.3': // SQL queries for v0.0.3
+ registerFilter('post_cash_coupon', 'POST_CASH_COUPON', false, true, isExtensionDryRun());
+
+ // Update notes (these will be set as task text!)
+ setExtensionUpdateNotes('Filter zum Post- und Pre-Filter hinzugefügt.');
break;
} // END - switch
break;
return $filterData;
}
+// Filter to do generic post-coupon-cash things
+function FILTER_POST_CASH_COUPON ($filterData) {
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
+ // Now we just need to book that points on the user's account
+ initReferalSystem();
+ addPointsThroughReferalSystem('coupon_cashed', $filterData['userid'], $filterData['points']);
+
+ // Subtract points from member account if the admin has selected one
+ if (isValidUserId(getCouponUserid())) {
+ // Subtract from this account and ignore return status
+ subtractPoints('cashed_coupon', getCouponUserid(), $filterData['points']);
+ } // END - if
+
+ // Translate some data
+ $filterData['coupon_expired'] = generateDateTime($filterData['coupon_expired'], '0');
+ $filterData['coupon_created'] = generateDateTime($filterData['coupon_created'], '0');
+
+ // Send admin notification
+ sendAdminNotification('{--ADMIN_COUPON_CASHED_SUBJECT--}', 'admin_coupon_cashed', $filterData, $filterData['userid']);
+
+ // Return data
+ //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
+ return $filterData;
+}
+
// [EOF]
?>
'ADMIN_CONFIG_COUPON_TITLE' => "Allgemeine Einstellungen zu den Gutscheinen",
'ADMIN_CONFIG_COUPON_DEFAULT_TIME' => "Zeit, bis Gutscheine ablaufen sollen. Sie können diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachträglich anpassen.",
'ADMIN_CONFIG_COUPON_DEFAULT_POINTS' => "Ausgangsvergütung in {?POINTS?}. Sie können diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachträglich anpassen.",
- 'ADMIN_CONFIG_COUPON_AUTOPURGE_TIME' => "Dauer bis abgelaufene Gutscheine aus der Datenbank entfernt werden",
+ 'ADMIN_CONFIG_COUPON_AUTOPURGE_TIME' => "Dauer bis abgelaufene Gutscheine aus der Datenbank entfernt werden:",
'ADMIN_CONFIG_COUPON_USERID' => "Mitgliederaccount, von dem die eingelösten {?POINTS?} abgebucht werden sollen:",
// Admin - Send coupon to members
return $GLOBALS[__FUNCTION__];
}
+// Wrapper function for 'coupon_userid'
+function getCouponUserid () {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Get config entry
+ $GLOBALS[__FUNCTION__] = getConfig('coupon_userid');
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
+}
+
// [EOF]
?>
adminSaveSettingsFromPostData();
} else {
// Add userid selection
- $content['coupon_userid'] = addMemberSelectionBox(getConfig('coupon_userid'), false, true, true, 'coupon_userid');
+ $content['coupon_userid'] = addMemberSelectionBox(getCouponUserid(), false, true, true, 'coupon_userid');
// Prepare some template data
$content['coupon_default_time_selection'] = createConfigurationTimeSelections('coupon_default_time' , 'WDh');
// Search for the coupon
$result = SQL_QUERY_ESC("SELECT
c.`coupon_id`,
+ c.`userid`,
+ c.`coupon_code`,
UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`,
UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`,
d.`coupon_type`,
// Load data
$content = SQL_FETCHARRAY($result);
+ // Run pre-filter
+ $content = runFilterChain('pre_cash_coupon', $content);
+
// Mark it as "cashed"
SQL_QUERY_ESC("UPDATE
`{?_MYSQL_PREFIX?}_user_coupons`
debug_report_bug(__FILE__, __LINE__, 'Coupon data cannot be updated! coupon_id=' . $content['coupon_id']);
} // END - if
- // Now we just need to book that points on the user's account
- initReferalSystem();
- addPointsThroughReferalSystem('coupon_cashed', getMemberId(), $content['points']);
-
- // Subtract points from member account if the admin has selected one
- if (isValidUserId(getConfig('coupon_userid'))) {
- // Subtract from this account and ignore return status
- subtractPoints('cashed_coupon', getConfig('coupon_userid'), $content['points']);
- } // END - if
-
- // Translate some data
- $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '0');
- $content['coupon_created'] = generateDateTime($content['coupon_created'], '0');
-
- // Send admin notification
- sendAdminNotification('{--ADMIN_COUPON_CASHED_SUBJECT--}', 'admin_coupon_cashed', $content, getMemberId());
+ // Run post filter chain
+ $content = runFilterChain('post_cash_coupon', $content);
// Display message
displayMessage('{%message,MEMBER_COUPON_CODE_CASHED=' . $content['points'] . '%}');
<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
<tr>
<td class="table_header bottom" colspan="2" align="center">
- <strong>{--ADMIN_CONFIG_COUPON_TITLE--}:</strong>
+ <strong>{--ADMIN_CONFIG_COUPON_TITLE--}</strong>
</td>
</tr>
<tr>
- <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_DEFAULT_TIME--}:</td>
+ <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_DEFAULT_TIME--}</td>
<td class="bottom" align="center">
$content[coupon_default_time_selection]
</td>
</tr>
<tr>
- <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_AUTOPURGE_TIME--}:</td>
+ <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_AUTOPURGE_TIME--}</td>
<td class="bottom" align="center">
$content[coupon_autopurge_time_selection]
</td>
</tr>
<tr>
- <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_DEFAULT_POINTS--}:</td>
+ <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_DEFAULT_POINTS--}</td>
<td class="bottom" align="center">
<input type="input" name="coupon_default_points" class="form_field" value="{%config,translateComma=coupon_default_points%}" size="5" maxlength="20" />
<span class="tiny">({?POINTS?})</span>
</td>
</tr>
<tr>
- <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_USERID--}:</td>
+ <td class="bottom" align="right">{--ADMIN_CONFIG_COUPON_USERID--}</td>
<td class="bottom" align="center">
$content[coupon_userid]
</td>