Forums

Using the IP Address as Receipt Number

simong 18 Sep, 2009
Hi Guys
Thanks for a great (still!!!) piece of software.
I have a question I am sure you can solve for me - We are using the IP address on the 'response' email as an invoice number (the form is the Order itself, the response email is the Invoice).
What we are trying now to do is; just in case there are numerous order out of the same office, is to add a small script that writes the hours and minutes (ie 15:35) after the IP address.
My question... where and how do I put the script - if in the "chronocontact.php" file, what is the context (being completely unaware of syntax in this sitaution)

TIA. Simon


... if the script is:

<!--

// var d = new Date();

// var curr_hour = d.getHours();
// var curr_min = d.getMinutes();

// document.write(curr_hour + " : " + curr_min);

//-->
GreyHead 18 Sep, 2009
Hi Simon,

The code where this is written by ChronoForms is in components/com_chronocontact/libraries/mails.php around line 123 in the current release.

But frankly, rather than hack the core code I'd add your own code in the OnSubmit Before box.
<?php
JRequest::setVar('invoice_no', $_SERVER['REMOTE_ADDR'].date('-h:i'), 'post');
?>
Then add {invoice_no} to the Email Template.

You may need to change the order in which the Email runs to get the value to show up correctly - I forget just at the moment. Please run a little test to check.

Bob
simong 20 Sep, 2009
Hi Bob,
Thanks. I get the impression you never sleep !!! 😀

The form is being run through Joomla 1.012; so am getting a 'fatal error' due to the "JRequest"... or at least that is what I believe is happening!!
I added the code as you suggested and placed the additional call in the form... though it falls over completely with the Fatal Error message.
>>>>
Fatal error: Undefined class name 'jrequest' in e:\inetpub\esvc000008\components\com_chronocontact\chronocontact.php(401) : eval()'d code on line 2
PHP Fatal error: Undefined class name 'jrequest' in e:\inetpub\esvc000008\components\com_chronocontact\chronocontact.php(401) : eval()'d code on line 2
>>>>

Thanks...
Can't thank you enough, Simon
simong 21 Sep, 2009
hi Bob,

Am I on a 'wild goose chase' here... expecting to be able to do this through J1.12 ? I have told my client (new) that he must upgrade... though he has agreed to do so only once 1.6 is released. Is there a simple solution to this JRequest issue through 1.12 or is it moribund, and best to settle with solely the IP address. (Sorry for not informing you of the version earlier)
Simon
GreyHead 21 Sep, 2009
Hi Simon,

The JRequest code is Joomla 1.5. The equivalent for Joomla 1.0 would be
<?php
$_POST['invoice_no'] = $_SERVER['REMOTE_ADDR'].date('-h:i');
?>
I no longer remember the ChronoForms workflow (or functionality come to that) from the old version though. I think you should be able to use {invoice_no} in the email though.

Bob

PS Yes you should definitely get the site upgraded if possible. Joomla 1.0 is no longer supported at all by Joomla and so any security problems will nto be fixed. Better for the client to bite the bullet now than after the site has been hacked. (I don't know of any current threats but something will turn up sooner or later.)
simong 21 Sep, 2009
Thanks Bob,
Will check it later tonight - local time (when the server is a little quieter)
Your help is much appreciated... as always

Simon
This topic is locked and no more replies can be posted.