Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Users are no longer recharge when they edit their auctions renlok#446
Browse files Browse the repository at this point in the history
  • Loading branch information
renlok committed Jan 14, 2017
1 parent 19b5d2b commit 0f4061c
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 93 deletions.
22 changes: 1 addition & 21 deletions docs/changes.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
1.2.0 - 10/10/13
-----------------------------
- Fixed DOB string when user does not have one entered when suspending/activating user account
- Fix error in install SQL
- Fixed proxy bidding (Bug #459) (Thanks Bushstar)
- Fixed toocheckout code
- Added Serbia to countries list closedrelisted table
- Added relistall check box to close auctions page (Thanks david62311)
- Fixed reserve not met Items being incorrectly marked as sold in the database (Bug #464) (Thanks pani100)
- Fixed shipping fee not being added to cost of item (Bug #454)
- Fixed link in pay.php to contact seller (Bug #445) (Thanks pani100)
- Fixed admin invoices view
- Fixed browse categories header name
- Added admin warnings for if fees are not set up correctly
- Added confirmation notices when you do an action in user control panel
- Moved the add new news button in admin so its visable
- Fixed buy it now not setting an auction to close if all item have been purchased
- Cleaned up outstanding page
- Added option to enable payment sandboxes to test the IPN

for older changes check out http://www.webidsupport.com/wiki/Change_Log
See: http://bugs.webidsupport.com/changelog_page.php
9 changes: 4 additions & 5 deletions docs/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ INSTALLATION
1. Upload all the files except the docs directory
2. CHMOD the uploaded directory to 0644
3. CHMOD the includes/config.inc.php.new to 0777
5. CHMOD the includes/membertypes.inc.php to 0777
6. CHMOD the language/EN/categories.inc.php to 0777
7. CHMOD the language/EN/categories_select_box.inc.php to 0777
8. CHMOD the cache directory to 0777
9. go to http://yoursite/webid/install/install.php and follow the steps
4. CHMOD the language/EN/categories.inc.php to 0777
5. CHMOD the language/EN/categories_select_box.inc.php to 0777
6. CHMOD the cache directory to 0777
7. go to http://yoursite/webid/install/install.php and follow the steps

For a more detailed set of instructions read install.txt

Expand Down
85 changes: 41 additions & 44 deletions includes/functions_sell.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,43 @@ function addoutstanding()
{
global $DBPrefix, $fee_data, $user, $system, $fee, $_SESSION, $db;

$fee_data['total'] = $fee;

if ($_SESSION['SELL_action'] == 'edit') {
// set defaults
$fee_colomns = array(
'setup',
'featured',
'bold',
'highlighted',
'subtitle',
'relist',
'reserve',
'buynow',
'picture',
'extracat',
'total'
);

$query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE auc_id = :auction_id AND user_id = :user_id";
$params = array();
$params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
$params[] = array(':user_id', $user->user_data['id'], 'int');
$db->query($query, $params);
// build an array full of everything the user has been charged for the auction do far
while ($past_fee_data = $db->fetch()) {
foreach ($fee_colomns as $fee) {
$fee_string = ($fee == 'total') ? '' : '_fee';
$fee_data[$fee . $fee_string] = bcsub($fee_data[$fee . $fee_string],
$past_fee_data[$fee], $system->SETTINGS['moneydecimals']);
if ($fee_data[$fee . $fee_string] < 0) {
$fee_data[$fee . $fee_string] = 0;
}
}
}

}

$query = "INSERT INTO " . $DBPrefix . "useraccounts (auc_id,user_id,setup,featured,bold,highlighted,subtitle,relist,reserve,buynow,picture,extracat,total,paid) VALUES
(:auction_id, :user_id, :setup_fee, :featured_fee, :bold_fee, :highlighted_fee, :subtitle_fee, :relist_fee, :reserve_fee, :buynow_fee, :picture_fee, :extracat_fee, :fee, 0)";

Expand All @@ -322,9 +359,12 @@ function addoutstanding()
$params[] = array(':buynow_fee', $fee_data['buynow_fee'], 'float');
$params[] = array(':picture_fee', $fee_data['picture_fee'], 'float');
$params[] = array(':extracat_fee', $fee_data['extracat_fee'], 'float');
$params[] = array(':fee', $fee, 'float');
$params[] = array(':fee', $fee_data['total'], 'float');
$params[] = array(':user_id', $user->user_data['id'], 'int');
$db->query($query, $params);

// reset fee value
$fee = $fee_data['total'];
}

function remove_bids($auction_id)
Expand Down Expand Up @@ -408,49 +448,6 @@ function get_fee($minimum_bid, $just_fee = true)
}
}

if ($_SESSION['SELL_action'] == 'edit') {
global $user;

$query = "SELECT * FROM " . $DBPrefix . "useraccounts WHERE auc_id = :auction_id AND user_id = :user_id";
$params = array();
$params[] = array(':auction_id', $_SESSION['SELL_auction_id'], 'int');
$params[] = array(':user_id', $user->user_data['id'], 'int');
$db->query($query, $params);
// build an array full of everything the user has been charged for the auction do far
// set defaults
$past_fees = array(
'setup' => 0,
'bold' => 0,
'highlighted' => 0,
'subtitle' => 0,
'relist' => 0,
'reserve' => 0,
'buynow' => 0,
'picture' => 0,
'extracat' => 0
);
while ($row = $db->fetch()) {
foreach ($row as $fee => $value) {
if (isset($past_fees[$fee])) {
$past_fees[$fee] += $value;
}
}
}

$diff = 0;
foreach ($past_fees as $fee => $value) {
if ($value > 0) {
$diff = bcadd($diff, $fee_data[$fee . '_fee'], $system->SETTINGS['moneydecimals']);
$fee_data[$fee . '_fee'] = 0;
}
}

$fee_value = bcsub($fee_value, $diff, $system->SETTINGS['moneydecimals']);
if ($fee_value < 0) {
$fee_value = 0;
}
}

if ($just_fee) {
$return = $fee_value;
} else {
Expand Down
1 change: 0 additions & 1 deletion item.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
***************************************************************************/

include 'common.php';
include INCLUDE_PATH . 'membertypes.inc.php';
include MAIN_PATH . 'language/' . $language . '/categories.inc.php';

// Get parameters from the URL
Expand Down
1 change: 1 addition & 0 deletions select_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
$_SESSION['SELL_start_now'] = '1';
$_SESSION['SELL_ends'] = '';
$_SESSION['SELL_custom_end'] = 0;
$_SESSION['SELL_current_fee'] = 0;
$_SESSION['SELL_caneditstartdate'] = true;
$_SESSION['SELL_hash'] = md5(microtime() . rand(0, 50));
$_SESSION['SELL_submitted'][$_SESSION['SELL_hash']] = false;
Expand Down
28 changes: 24 additions & 4 deletions sell.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
// hash and check the password
include PACKAGE_PATH . 'PasswordHash.php';
$phpass = new PasswordHash(8, false);
if (!($phpass->CheckPassword($_POST['password'], $user->user_data['password']))) {
if (!isset($_POST['password']) || !($phpass->CheckPassword($_POST['password'], $user->user_data['password']))) {
$ERR = $ERR_006;
}
}
Expand Down Expand Up @@ -376,6 +376,12 @@
$shippingtext = $MSG['867'];
}

$current_fee = ((isset($_SESSION['SELL_current_fee'])) ? $_SESSION['SELL_current_fee'] : '0');
$corrected_fee = bcsub(get_fee($minimum_bid), $current_fee, $system->SETTINGS['moneydecimals']);
if ($corrected_fee < 0) {
$corrected_fee = 0;
}

$template->assign_vars(array(
'TITLE' => htmlspecialchars($title),
'SUBTITLE' => htmlspecialchars($subtitle),
Expand Down Expand Up @@ -403,7 +409,7 @@
'PAYMENTS_METHODS' => $payment_methods,
'CAT_LIST1' => $category_string1,
'CAT_LIST2' => $category_string2,
'FEE' => number_format(get_fee($minimum_bid), $system->SETTINGS['moneydecimals']),
'FEE' => number_format($corrected_fee, $system->SETTINGS['moneydecimals']),

'B_USERAUTH' => ($system->SETTINGS['usersauth'] == 'y'),
'B_BN_ONLY' => (!($system->SETTINGS['buy_now'] == 2 && $buy_now_only)),
Expand Down Expand Up @@ -482,6 +488,15 @@
}
}

// can edit start date check
$caneditstartdate = false;
$starting_date = new DateTime($a_starts);
$current_date = new DateTime();
if ($system->SETTINGS['edit_starttime'] && ($_SESSION['SELL_action'] != 'edit' ||
($starting_date > $current_date && $_SESSION['SELL_action'] == 'edit'))) {
$caneditstartdate = true;
}

$CKEditor = new CKEditor();
$CKEditor->basePath = 'js/ckeditor/';
$CKEditor->returnOutput = true;
Expand Down Expand Up @@ -539,13 +554,18 @@
$relist_fee = $row['value'];
}
}
$fee_javascript .= 'var current_fee = ' . ((isset($_SESSION['SELL_current_fee'])) ? $_SESSION['SELL_current_fee'] : '0') . ';';
$current_fee = ((isset($_SESSION['SELL_current_fee'])) ? $_SESSION['SELL_current_fee'] : '0');
$fee_javascript .= 'var current_fee = ' . $current_fee . ';';
$relist_options = '<select name="autorelist" id="autorelist">';
for ($i = 0; $i <= $system->SETTINGS['autorelist_max']; $i++) {
$relist_options .= '<option value="' . $i . '"' . (($relist == $i) ? ' selected="selected"' : '') . '>' . $i . '</option>';
}
$relist_options .= '</select>';
$fee_value = get_fee($minimum_bid);
$corrected_fee = bcsub($fee_value, $current_fee, $system->SETTINGS['moneydecimals']);
if ($corrected_fee < 0) {
$corrected_fee = 0;
}

$template->assign_vars(array(
'TITLE' => $MSG['028'],
Expand Down Expand Up @@ -603,7 +623,7 @@
'MAXPICS' => sprintf($MSG['673'], $system->SETTINGS['maxpictures'], $system->SETTINGS['maxuploadsize']/1024),

'FEE_VALUE' => $fee_value,
'FEE_VALUE_F' => number_format($fee_value, $system->SETTINGS['moneydecimals']),
'FEE_VALUE_F' => number_format($corrected_fee, $system->SETTINGS['moneydecimals']),
'FEE_MIN_BID' => $fee_min_bid,
'FEE_BN' => $fee_bn,
'FEE_RP' => $fee_rp,
Expand Down
1 change: 1 addition & 0 deletions sellsimilar.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
$_SESSION['SELL_is_featured'] = $RELISTEDAUCTION['featured'];
$_SESSION['SELL_is_taxed'] = $RELISTEDAUCTION['tax'];
$_SESSION['SELL_tax_included'] = $RELISTEDAUCTION['taxinc'];
$_SESSION['SELL_current_fee'] = 0;
$_SESSION['SELL_hash'] = md5(microtime() . rand(0, 50));
$_SESSION['SELL_submitted'][$_SESSION['SELL_hash']] = false;

Expand Down
21 changes: 11 additions & 10 deletions themes/classic/sell.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ $(document).ready(function(){
});
<!-- IF B_FEES -->
{FEE_JS}
// something
// set fee values
var min_bid_fee = {FEE_MIN_BID};
var bn = {FEE_BN};
var rp = {FEE_RP};
Expand All @@ -92,18 +92,18 @@ $(document).ready(function(){
}
else
{
for (var i = 0; i < setup.length; i++)
for (var i = 0; i < setup_fee.length; i++)
{
if (setup[i][0] <= min_bid && setup[i][1] >= min_bid)
if (setup_fee[i][0] <= min_bid && setup_fee[i][1] >= min_bid)
{
if (setup[i][3] == 'flat')
if (setup_fee[i][3] == 'flat')
{
min_bid_fee = setup[i][2];
updatefee(setup[i][2]);
min_bid_fee = setup_fee[i][2];
updatefee(setup_fee[i][2]);
}
else
{
min_bid_fee = (setup[i][2] / 100) * min_bid;
min_bid_fee = (setup_fee[i][2] / 100) * min_bid;
updatefee(min_bid_fee);
}
break;
Expand Down Expand Up @@ -197,8 +197,9 @@ $(document).ready(function(){
});
<!-- ENDIF -->
function updatefee(newfee) {
var nowfee = parseFloat($("#fee_exact").val()) + newfee;
$("#fee_exact").val(nowfee);
var nowfee = parseFloat($("#fee_exact").val()) + newfee;
$("#fee_exact").val(nowfee);
nowfee = nowfee - current_fee;
if (nowfee < 0)
{
nowfee = 0;
Expand Down Expand Up @@ -382,7 +383,7 @@ $(document).ready(function(){
<b>{L_2__0016}</b>
</td>
<td class="rightpan">
<!-- IF B_EDITING && !B_CANEDITSTARTDATE -->
<!-- IF B_EDITING && B_CANEDITSTARTDATE eq false -->
{START_TIME}
<input type="hidden" name="a_starts" value="{START_TIME}">
<!-- ELSE -->
Expand Down
17 changes: 9 additions & 8 deletions themes/modern/sell.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ $(document).ready(function(){
}
else
{
for (var i = 0; i < setup.length; i++)
for (var i = 0; i < setup_fee.length; i++)
{
if (setup[i][0] <= min_bid && setup[i][1] >= min_bid)
if (setup_fee[i][0] <= min_bid && setup_fee[i][1] >= min_bid)
{
if (setup[i][3] == 'flat')
if (setup_fee[i][3] == 'flat')
{
min_bid_fee = setup[i][2];
updatefee(setup[i][2]);
min_bid_fee = setup_fee[i][2];
updatefee(setup_fee[i][2]);
}
else
{
min_bid_fee = (setup[i][2] / 100) * min_bid;
min_bid_fee = (setup_fee[i][2] / 100) * min_bid;
updatefee(min_bid_fee);
}
break;
Expand Down Expand Up @@ -197,8 +197,9 @@ $(document).ready(function(){
});
<!-- ENDIF -->
function updatefee(newfee) {
var nowfee = parseFloat($("#fee_exact").val()) + newfee - current_fee;
var nowfee = parseFloat($("#fee_exact").val()) + newfee;
$("#fee_exact").val(nowfee);
nowfee = nowfee - current_fee;
if (nowfee < 0)
{
nowfee = 0;
Expand Down Expand Up @@ -365,7 +366,7 @@ $(document).ready(function(){
<!-- IF B_EDIT_STARTTIME -->
<div class="form-group col-md-12">
<label for="a_starts">{L_2__0016}</label>
<!-- IF B_EDITING && !B_CANEDITSTARTDATE -->
<!-- IF B_EDITING && B_CANEDITSTARTDATE eq false -->
{START_TIME}
<input type="hidden" name="a_starts" value="{START_TIME}">
<!-- ELSE -->
Expand Down

0 comments on commit 0f4061c

Please sign in to comment.