[BETA] Bank

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
RMS
Registered User
Posts: 517
Joined: Sun Apr 21, 2002 1:53 am
Location: I'm not sure

Post by RMS » Fri Jan 03, 2003 9:15 pm

lol, thanks :P
This is my signature.

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sat Jan 04, 2003 6:12 pm

ADDON TO Bank & Transaction MODS (Both Required)!

I have whipped up a little add-on mod to compliment the "Bank mod" here and the "Transaction mod" from this thread (Click)

Its pretty simple and as long as you have the "Transaction mod" already installed, all you need is the following additions in the bank.php!

In bank.php

FIND:

Code: Select all

	$deposit = round($deposit);
	if ((!is_numeric($deposit)) || ($deposit < 1)) { message_die(GENERAL_MESSAGE, 'Invalid Deposit Amount!'); }
	if ($deposit > $urow[user_points]) { message_die(GENERAL_MESSAGE, 'You don\'t have that many '.$bankinfo[7].' to deposit!'); }
	$newbalance = $row[holding] + $deposit;
	$newpoints = $urow[user_points] - $deposit;
	$sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='$userdata[user_id]'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!'); }
AFTER ADD:

Code: Select all

	if( $deposit != 0 )
	{

	$sql = "INSERT INTO " . TRANSACTION_TABLE . " (trans_date, trans_from, trans_to, trans_amount)
			VALUES ( " . time() . ", '" . $userdata['username'] . "', 'Deposit in Bank', '$deposit')";
	}

	if( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Could not insert data into transaction table", '', __LINE__, __FILE__, $sql);
	}
FIND:

Code: Select all

	$withdrawtotal = round($withdraw / 100 * $bankinfo[1]);
	$withdrawtotal = $withdrawtotal + $withdraw;
	if ($row[holding] < $withdrawtotal) { message_die(GENERAL_MESSAGE, 'You don\'t have enough '.$bankinfo[7].' deposited to make that withdrawal!'); }
	$newbalance = $row[holding] - $withdrawtotal;
	$newpoints = $urow[user_points] + $withdraw;
	$sql = "update " . USERS_TABLE . " set user_points='$newpoints' where user_id='$userdata[user_id]'";
	if ( !($db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Updating User Points!'); }
AFTER ADD:

Code: Select all

	if( $withdrawtotal != 0 )
	{

	$sql = "INSERT INTO " . TRANSACTION_TABLE . " (trans_date, trans_from, trans_to, trans_amount)
			VALUES ( " . time() . ", '" . $userdata['username'] . "', 'Bank Withdrawal', '$withdraw')";
	}

	if( !$db->sql_query($sql) )
	{
		message_die(GENERAL_ERROR, "Could not insert data into transaction table", '', __LINE__, __FILE__, $sql);
	}
And if you have already converted points to gold/allowance... then simply replace the user_points to user_money in the FIND

User avatar
thewizard
Registered User
Posts: 356
Joined: Sun Sep 29, 2002 7:46 am

Post by thewizard » Sat Jan 04, 2003 6:24 pm

what is it exactly that this does??

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sat Jan 04, 2003 6:33 pm

thewizard wrote: what is it exactly that this does??


The add-on I created additionally adds all bank transactions if your running the mentioned "Transaction mod" for recording user's donations :wink:

Here's a screenshot example. Note the first entry is the normal operation of the transaction mod showing a donation. The #2 and #3 are examples of what gets added with my modifications. 8)
Image

User avatar
thewizard
Registered User
Posts: 356
Joined: Sun Sep 29, 2002 7:46 am

Post by thewizard » Sat Jan 04, 2003 6:48 pm

thats kool ill have to add that to my site

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Sat Jan 04, 2003 7:33 pm

Nice work LaZeR :)

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sat Jan 04, 2003 7:39 pm

Zarath wrote: Nice work LaZeR :)


Thanks, feel free to incorporate it if you wish within the bank, thats why I added it to this thread rather than putting in a mod template, ect... But I understand if you don't wish to work further on this mod, we'll just keep adding our tweaks here 8)

User avatar
RMS
Registered User
Posts: 517
Joined: Sun Apr 21, 2002 1:53 am
Location: I'm not sure

Post by RMS » Sat Jan 04, 2003 7:40 pm

that's cool. seems to work as well as a newly oiled up cheese processing unit :)
This is my signature.

User avatar
thewizard
Registered User
Posts: 356
Joined: Sun Sep 29, 2002 7:46 am

Post by thewizard » Sat Jan 04, 2003 8:59 pm

hey lazer think you guys can come up with something similar to for the store mod? :)

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sat Jan 04, 2003 9:24 pm

thewizard wrote: hey lazer think you guys can come up with something similar to for the store mod? :)


Very possible although I'll probably wait a bit till I see whats next in Zarath's update - release :wink: You do mean like a list of all shop transactions with the user's name, correct?

User avatar
thewizard
Registered User
Posts: 356
Joined: Sun Sep 29, 2002 7:46 am

Post by thewizard » Sat Jan 04, 2003 9:42 pm

yeah something that shows that users purchases and such. This seems to be requested the most by my members cause they say they would like to keep track of what was purchased and spent and etc easier.

User avatar
scoobie
Registered User
Posts: 237
Joined: Sun May 12, 2002 6:07 pm

Post by scoobie » Sun Jan 05, 2003 1:39 am

THat is a fantastic idea

would be great to see what people are buying on one simple page.
You can have it all if you like... but you can pay for it the rest of your life.

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sun Jan 05, 2003 2:36 am

thewizard wrote: yeah something that shows that users purchases and such.


Ok I may take a stab at this. I will likely take a copy of the current transaction.php and its template and create a new file with a different name to be seperate from the bank & donate records and also a seperate table in the database just for shop transactions. Of course the real work will be the conversion of the records to display the user and what they bought or sold. If all goes well my plan will be to then tie it into shop.php and code an option - link from there to view the shop's transactions. If anyone else wants to embark on this project feel free :wink: and just PM me here or contact me via my board in my sig for anything you come up with if you wish. I may start work in a day or two on this.

PS: :oops: And I just realized we're discussing this in the wrong thread so any further discussions on any transaction add-on for the Item shop will be in the item shop thread HERE. :wink:

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Sun Jan 05, 2003 10:43 am

LaZeR wrote:
Zarath wrote:Nice work LaZeR :)


Thanks, feel free to incorporate it if you wish within the bank, thats why I added it to this thread rather than putting in a mod template, ect... But I understand if you don't wish to work further on this mod, we'll just keep adding our tweaks here 8)



Can't, that would cause it to require the transaction mod and then it wouldn't be standalone minus the requirement of the points mod :P

I don't have the transaction mod installed on my boards either.

User avatar
LaZeR
Registered User
Posts: 671
Joined: Sat Jun 29, 2002 8:38 pm
Contact:

Post by LaZeR » Sun Jan 05, 2003 12:47 pm

Zarath wrote: Can't, that would cause it to require the transaction mod and then it wouldn't be standalone minus the requirement of the points mod :P

I don't have the transaction mod installed on my boards either.


Understood and true :) I just didn't want it to seem like I was trying to force myself in on anything and steal any of the glory you deserve for these fine creations you've contributed lately making all this possible!

I am just curious if you now plan on going any further with this (Bank Mod) possibly since it is becoming so popular and compliments your great (Item Shop) so well :!: :?:

PS: To scoobie and the wizard on that little project you both had interest in seeing developed. See this thread :wink:

Locked

Return to “[2.0.x] MODs in Development”