+ my $insecure = C4::Context->preference('insecure');
+ if ($user or $insecure) {
+ $template->param( loggedinusername => $user );
+ $template->param( sessionID => $sessionID );
+
+ $borrowernumber = getborrowernumber($user);
+ my ( $borr, $alternativeflags ) =
+ GetMemberDetails( $borrowernumber );
+ my @bordat;
+ $bordat[0] = $borr;
+ $template->param( "USER_INFO" => \@bordat );
+
+ # We are going to use the $flags returned by checkauth
+ # to create the template's parameters that will indicate
+ # which menus the user can access.
+ if (( $flags && $flags->{superlibrarian}==1) or $insecure==1) {
+ $template->param( CAN_user_circulate => 1 );
+ $template->param( CAN_user_catalogue => 1 );
+ $template->param( CAN_user_parameters => 1 );
+ $template->param( CAN_user_borrowers => 1 );
+ $template->param( CAN_user_permission => 1 );
+ $template->param( CAN_user_reserveforothers => 1 );
+ $template->param( CAN_user_borrow => 1 );
+ $template->param( CAN_user_editcatalogue => 1 );
+ $template->param( CAN_user_updatecharge => 1 );
+ $template->param( CAN_user_acquisition => 1 );
+ $template->param( CAN_user_management => 1 );
+ $template->param( CAN_user_tools => 1 );
+ $template->param( CAN_user_editauthorities => 1 );
+ $template->param( CAN_user_serials => 1 );
+ $template->param( CAN_user_reports => 1 );
+ }
+
+ if ( $flags && $flags->{circulate} == 1 ) {
+ $template->param( CAN_user_circulate => 1 );
+ }
+
+ if ( $flags && $flags->{catalogue} == 1 ) {
+ $template->param( CAN_user_catalogue => 1 );
+ }
+
+ if ( $flags && $flags->{parameters} == 1 ) {
+ $template->param( CAN_user_parameters => 1 );
+ $template->param( CAN_user_management => 1 );
+ }
+
+ if ( $flags && $flags->{borrowers} == 1 ) {
+ $template->param( CAN_user_borrowers => 1 );
+ }
+
+ if ( $flags && $flags->{permissions} == 1 ) {
+ $template->param( CAN_user_permission => 1 );
+ }
+
+ if ( $flags && $flags->{reserveforothers} == 1 ) {
+ $template->param( CAN_user_reserveforothers => 1 );
+ }
+
+ if ( $flags && $flags->{borrow} == 1 ) {
+ $template->param( CAN_user_borrow => 1 );
+ }
+
+ if ( $flags && $flags->{editcatalogue} == 1 ) {
+ $template->param( CAN_user_editcatalogue => 1 );
+ }
+
+ if ( $flags && $flags->{updatecharges} == 1 ) {
+ $template->param( CAN_user_updatecharge => 1 );
+ }
+
+ if ( $flags && $flags->{acquisition} == 1 ) {
+ $template->param( CAN_user_acquisition => 1 );
+ }
+
+ if ( $flags && $flags->{tools} == 1 ) {
+ $template->param( CAN_user_tools => 1 );
+ }
+
+ if ( $flags && $flags->{editauthorities} == 1 ) {
+ $template->param( CAN_user_editauthorities => 1 );
+ }
+
+ if ( $flags && $flags->{serials} == 1 ) {
+ $template->param( CAN_user_serials => 1 );
+ }
+
+ if ( $flags && $flags->{reports} == 1 ) {
+ $template->param( CAN_user_reports => 1 );
+ }
+ }
+ if ( $in->{'type'} eq "intranet" ) {
+ $template->param(
+ intranetcolorstylesheet =>
+ C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ intranetuserjs => C4::Context->preference("intranetuserjs"),
+ TemplateEncoding => C4::Context->preference("TemplateEncoding"),
+ AmazonContent => C4::Context->preference("AmazonContent"),
+ LibraryName => C4::Context->preference("LibraryName"),
+ LoginBranchname => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
+ AutoLocation => C4::Context->preference("AutoLocation"),
+ hide_marc => C4::Context->preference("hide_marc"),
+ patronimages => C4::Context->preference("patronimages"),
+ "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
+ );
+ }
+ else {
+ warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]"
+ unless ( $in->{'type'} eq 'opac' );
+ my $LibraryNameTitle = C4::Context->preference("LibraryName");
+ $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi;
+ $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg;
+ $template->param(
+ suggestion => "" . C4::Context->preference("suggestion"),
+ virtualshelves => "" . C4::Context->preference("virtualshelves"),
+ OpacNav => "" . C4::Context->preference("OpacNav"),
+ opacheader => "" . C4::Context->preference("opacheader"),
+ opaccredits => "" . C4::Context->preference("opaccredits"),
+ opacsmallimage => "" . C4::Context->preference("opacsmallimage"),
+ opaclargeimage => "" . C4::Context->preference("opaclargeimage"),
+ opaclayoutstylesheet => "". C4::Context->preference("opaclayoutstylesheet"),
+ opaccolorstylesheet => "". C4::Context->preference("opaccolorstylesheet"),
+ opaclanguagesdisplay => "". C4::Context->preference("opaclanguagesdisplay"),
+ opacuserlogin => "" . C4::Context->preference("opacuserlogin"),
+ opacbookbag => "" . C4::Context->preference("opacbookbag"),
+ TemplateEncoding => "". C4::Context->preference("TemplateEncoding"),
+ AmazonContent => "" . C4::Context->preference("AmazonContent"),
+ LibraryName => "" . C4::Context->preference("LibraryName"),
+ LibraryNameTitle => "" . $LibraryNameTitle,
+ LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
+ OpacPasswordChange => C4::Context->preference("OpacPasswordChange"),
+ opacreadinghistory => C4::Context->preference("opacreadinghistory"),
+ opacuserjs => C4::Context->preference("opacuserjs"),
+ OpacCloud => C4::Context->preference("OpacCloud"),
+ OpacTopissue => C4::Context->preference("OpacTopissue"),
+ OpacAuthorities => C4::Context->preference("OpacAuthorities"),
+ OpacBrowser => C4::Context->preference("OpacBrowser"),
+ RequestOnOpac => C4::Context->preference("RequestOnOpac"),
+ reviewson => C4::Context->preference("reviewson"),
+ hide_marc => C4::Context->preference("hide_marc"),
+ patronimages => C4::Context->preference("patronimages"),
+ "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
+ );