Gossamer Forum
Home : Products : DBMan : Installation :

Passing userid to field

Quote Reply
Passing userid to field
First let me say, I am not a programmer!! I can read code and decipher what is being done but when I need to do something new it is not so easy.

I am using DBMAN as a software library. I have a listing of software titles for our lab that associates can check out. I want to grab their userid when they go to the "Modify" screen and edit the record if they checkout the software, and when they come back to check it in I want to replace their userid with blank characters again.

I do not know exactly where to begin. Can someone help me with the code to do this??

Don
Quote Reply
Re: Passing userid to field In reply to
You could have an admin-only field for the "checker-outer" -- hidden to the user, but available for you. Also, you would have set the field not to be required.

In html_modify_form_record, after the line that starts with

if (!%rec) { &html_modify_failure

add

unless ($per_admin) {
$rec{'User'} = $db_userid;
}

If you want to automatically clear the field when you modify the record, add these lines:

else {
$rec{'User'} = "";
}



------------------
JPD





Quote Reply
Re: Passing userid to field In reply to
Thank you, JPDeni!

I made all the changes you offered but one. I did not make it a hidden admin only field. I need everyone to see who has it checked out. It is grabbing the userid and updating the record like I want.

There is still two things that I want to do. First, I have three radio buttons to show the status of the software product, Checkin, Checkout, Retired. On the "Modify" screen I would like to have the user field in the database go to blanks when checkin is selected, show the userid when checkout or retired are selected.

Second, only display the 8 digit userid, meaning remove the period and the 14 digits.

I would greatly appreciate any help anyone could offer me.

JPDeni, thanks for taking time to help. I know you are very busy. I hope you finished the big project you were working on.

------------------
Quote Reply
Re: Passing userid to field In reply to
Things have settled down a bit for me, so I am able to come back. I missed the forum! Smile

Quote:
only display the 8 digit userid, meaning remove the period and the 14 digits.

Using $db_userid should just give you the login of the user.

Quote:
I have three radio buttons to show the status of the software product, Checkin, Checkout, Retired. On the "Modify" screen I would like to have the user field in the database go to blanks when checkin is selected, show the userid when checkout or retired are selected.

I'm not sure I understand. At what point are the radio buttons selected? If the choice is made on the modify form, you'll have to wait until the modification is submitted before you know what's been selected.

I think I need a little more clarification.


------------------
JPD





Quote Reply
Re: Passing userid to field In reply to
JPD,

I am using $db_userid and I am getting example.12345678901234. I want to drop the numbers from displaying.

You appear to have it. The radio buttons get selected on the modify screen. Once the submit button is hit I want the database to be modified as requested above. If checkin was selected blank field, if checkout or retired was selected grab userid (minus the long number) and update user field in database.

Thanks for the quick response. Let me know if this is too much to ask.

------------------
Quote Reply
Re: Passing userid to field In reply to
 
Code:
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;

Code:
if ($in{'Status'} eq "Checkin") {
$in{'User'} = "";
}
else {
$in{'User'} = $db_userid;
}

If you're still gettting the extra numbers in the User field, add the line I gave you at the beginning of this message just after

else {



------------------
JPD





Quote Reply
Re: Passing userid to field In reply to
JPD,

Thank you very much. It works just how I want it to.

The userid issue was my fault and your suggestion was not necessary. I removed some bad code I put in earlier and it resolved my problem.

Your second solution was just what I needed!

Thanks again!!


------------------