I think Philippe is probably right about userenv not being set in your plugin.  If that is the case you could try calling get_template_and_user() ( which calls checkauth() ), or calling checkauth() directly, to build userenv for you.

On Thu, Sep 24, 2015 at 6:06 AM, Philippe Blouin <philippe.blouin@inlibro.com> wrote:
Like that, I doubt your userenv will contain anything.  You first need to log in.

But you could add the code in cataloguing/addbooks.pl for example.
Somewhere after the
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
...

You could have something like
    warn "AKAFORTES " . C4::Context->userenv->{'surname'};
and look into your koha-error_log to see it.

But this would probably be used somewhere where is done the ModBiblio call in cataloguing, just before, to add something like
    my $z042 = $record->field('042');
    if($z042){
        $z042->add_subfields('a', C4::Context->userenv->{'surname'});
    }

That code is a bit naive, but you get the idea.

Philippe Blouin,
Responsable du développement informatique

Tél.  : (888) 604-2627
philippe.blouin@inLibro.com

inLibro | pour esprit libre | www.inLibro.com
On 09/24/2015 02:09 AM, akafortes wrote:
Thank you very much!!!! That was just what I needed 
Based on the "EXAMPLE.pl", I just did this:

use Modern::Perl;

use C4::Auth;
use C4::Output;

my $builder= sub {
    my $params = shift;
    my $id = $params->{id};
	my $user=C4::Context->userenv->{'surname'};

    return qq|
|;
};

return { builder => $builder};


Philippe Blouin wrote
Are you looking for the information itself, like the content of 
C4::Context->userenv ?  It is a hash with the logged user info, like 
C4::Context->userenv->{'surname'}

(i think :) )

Regards,

Philippe Blouin,
Responsable du développement informatique

Tél.  : (888) 604-2627

      
philippe.blouin@

      
 &lt;mailto:

      
philippe.blouin@

      
&gt;

inLibro | pour esprit libre | www.inLibro.com
&lt;http://www.inLibro.com&gt;
On 09/22/2015 09:16 AM, akafortes wrote:
Hello G.K.MANJUNATH,
thank you for your answer but I'm afraid that's not what I'm looking for.
It's my understanding that this field is used for when the specified
record
is stored in an electronic form and in this field you save information
about
its location and maybe credentials (or something like that) in order to
access it.

G.K.MANJUNATH wrote
Marc tag 856$l  is for  Logon (NR).

I do not know whether the login code gets added to this field.  If can
customise you may be able store it.

check at http://www.loc.gov/marc/bibliographic/bd856.html


tks
g.k.m


On Tue, 22 Sep 2015, akafortes wrote:

Hello,
is it possible to get the username of the logged in user and use it in
a
MARC field?
I would like to add a field where I keep info about who catalogued a
record.



--
View this message in context:
http://koha.1045719.n5.nabble.com/Cataloguer-s-info-in-MARC-field-tp5854171.html
Sent from the Koha-devel mailing list archive at Nabble.com.
_______________________________________________
Koha-devel mailing list

Koha-devel@.koha-community
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

_______________________________________________
Koha-devel mailing list
Koha-devel@.koha-community
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


--
View this message in context:
http://koha.1045719.n5.nabble.com/Cataloguer-s-info-in-MARC-field-tp5854171p5854258.html
Sent from the Koha-devel mailing list archive at Nabble.com.
_______________________________________________
Koha-devel mailing list


      
Koha-devel@.koha-community

      
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
_______________________________________________
Koha-devel mailing list

      
Koha-devel@.koha-community

      
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/



--
View this message in context: http://koha.1045719.n5.nabble.com/Cataloguer-s-info-in-MARC-field-tp5854171p5854481.html
Sent from the Koha-devel mailing list archive at Nabble.com.
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/


_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/



--
Michael Hafen
Washington County School District Technology Department
Systems Analyst