This topic is locked

placing the clientsname before the documentname

5/9/2008 2:22:17 PM
PHPRunner General questions
S
shoppy author

Hi all,
I would like to automaticly place the clientsname before the name copied from the document.

confused? I would be reading this line !! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=8431&image=1&table=forumtopics' class='bbcemoticon' alt='<<' />
When I ad a document, it automaticly takes over the name of the documents and places it in the dir 'files'.

But all the files are linked to clients.

So I would like to have the name of the client added to the filename.
example: the file name is 'documen.pdf'

I now add, myself, the name ... Clien_document.pdf

So I can find the docs in the big list.
Can this be done automaticly?
Thanks for your help.
(I honestly never encountered a helpdesk that helped me the way you guy's do.)
John

kujox 5/9/2008

What I have done is have a field which is client id in the document table, you can then use this field to list all the documents for that client

S
shoppy author 5/10/2008

Hi Kujox,
Could you explane how you did that?

With an example maybe.
John

S
shoppy author 5/15/2008

Jane,
You also don't know how to fix this?
Counting on you! (as always)
John

J
Jane 5/15/2008

John,
you can change file name manually in the Filename box on the ADD/EDIT page.
If you want to fill this field automatically, open include/commonfunctions.php file, find

$file_move = array($file['tmp_name'],GetUploadFolder($field).$value);



and place your code before this line.

You can put the correct file name in $value variable.
Here is just a sample:

$value=$SESSION["UserID"]."".$value;

S
shoppy author 5/15/2008

Sorry Jane,
Doesn't work.
regards,
John

J
Jane 5/15/2008

John,
I can't tell what happens without any clarifications.

Doesn't work means nothing.

Please post code you're changed here or publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

S
shoppy author 5/15/2008

John,

I can't tell what happens without any clarifications.

Doesn't work means nothing.

Please post code you're changed here or publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.


Ok, you said I had to post the code you gave me before the
$file_move = array($file['tmp_name'],GetUploadFolder($field).$value);
So I did,
I changed $value=$SESSION["UserID"]."".$value; in $value=$SESSION["KlantID"]."".$value;

because KlantID = the unique clientID.
But when I want to upload a document into the folder nothing happens to the documentname.
regards,
John

J
Jane 5/15/2008

John,
don't change $_SESSION variable.

Here is the correct code:

$value=$SESSION["UserID"]."".$value;

$file_move = array($file['tmp_name'],GetUploadFolder($field).$value);


Here is the list of $_SESSION variables used in the PHPRunner:

http://www.xlinesoft.com/phprunner/docs/ph...n_variables.htm

S
shoppy author 5/15/2008

Sorry Jane,
This is where I block.
I scrolled trough al the options but I don't know witch to choose.
In the table '_klant' is a field called 'Naam' (name). This field contains the name of the client.

This is what I like to place in front of the document name.
The code you gave me places my login name in front of the document name.
Can you help me?
regards,
John

J
Jane 5/16/2008

John,
I see what you're saying.

Save client name in the new $_SESSION variable the AfterSuccessfulLogin event and then use this variable in your code.

Here is a sample code for event:

global $conn;

$str = "select Naam from _klant where LoginName='".$_SESSION["UserID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);
$_SESSION["Naam"] = $data["Naam"];



where LoginName is your actual field name.

S
shoppy author 5/16/2008

John,

I see what you're saying.

Save client name in the new $_SESSION variable the AfterSuccessfulLogin event and then use this variable in your code.

Here is a sample code for event:
where LoginName is your actual field name.


Thanks Jane, but this is still not what I mean.
I've send you an email.
John