big commit, still breaking things...
[koha.git] / admin / systempreferences.pl
index acc7b61..a18d7b7 100755 (executable)
@@ -48,18 +48,19 @@ use C4::Search;
 use HTML::Template;
 use C4::Context;
 
-
 my %tabsysprefs;
 $tabsysprefs{acquisitions}="Acquisitions";
 $tabsysprefs{gist}="Acquisitions";
 $tabsysprefs{authoritysep}="Authorities";
 $tabsysprefs{ISBD}="Catalogue";
 $tabsysprefs{marc}="Catalogue";
+$tabsysprefs{autoBarcode}="Catalogue";
 $tabsysprefs{marcflavour}="Catalogue";
-$tabsysprefs{SubscriptionHistory}="Catalogue";
+$tabsysprefs{SubscriptionHistory}="OPAC";
 $tabsysprefs{maxoutstanding}="Circulation";
 $tabsysprefs{printcirculationslips}="Circulation";
-$tabsysprefs{suggestion}="Acquisitions";
+$tabsysprefs{ReturnBeforeExpiry}="Circulation";
+$tabsysprefs{suggestion}="OPAC";
 $tabsysprefs{automembernum}="Members";
 $tabsysprefs{noissuescharge}="Circulation";
 $tabsysprefs{opacthemes}="OPAC";
@@ -67,9 +68,11 @@ $tabsysprefs{opaclanguages}="OPAC";
 $tabsysprefs{LibraryName}="OPAC";
 $tabsysprefs{opacstylesheet}="OPAC";
 $tabsysprefs{BiblioDefaultView}="OPAC";
-$tabsysprefs{hidelostitem}="OPAC";
+$tabsysprefs{opaclargeimage}="OPAC";
+$tabsysprefs{opacsmallimage}="OPAC";
+$tabsysprefs{hidelostitems}="OPAC";
 $tabsysprefs{KohaAdmin}="Admin";
-$tabsysprefs{checkdigit}="Admin";
+$tabsysprefs{checkdigit}="Members";
 $tabsysprefs{dateformat}="Admin";
 $tabsysprefs{insecure}="Admin";
 $tabsysprefs{ldapinfos}="Admin";
@@ -77,6 +80,7 @@ $tabsysprefs{ldapserver}="Admin";
 $tabsysprefs{itemcallnumber}="Catalogue";
 $tabsysprefs{maxreserves}="Circulation";
 $tabsysprefs{virtualshelves}="OPAC";
+$tabsysprefs{hide_marc}="Catalogue";
 
 sub StringSearch  {
        my ($env,$searchstring,$type)=@_;
@@ -93,12 +97,12 @@ sub StringSearch  {
                                $sth->execute($syspref);
                                while (my $data=$sth->fetchrow_hashref){
                                        push(@results,$data);
-                                       $cnt ++;
+                                       $cnt++;
                                }
                                $sth->finish;
                        }
                }
-       }else {
+       } else {
                my $strsth ="Select variable,value,explanation,type,options from systempreferences where variable not in (";  
                foreach my $syspref (keys %tabsysprefs){
                        $strsth .= $dbh->quote($syspref).",";
@@ -110,7 +114,7 @@ sub StringSearch  {
                $sth->execute();
                while (my $data=$sth->fetchrow_hashref){
                        push(@results,$data);
-                       $cnt ++;
+                       $cnt++;
                }
                $sth->finish;
        }
@@ -304,7 +308,7 @@ if ($op eq 'add_form') {
                }
        }
        $sth->finish;
-       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=systempreferences.pl\"></html>";
+       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=systempreferences.pl?tab=".$tabsysprefs{$input->param('variable')}."\"></html>";
        exit;
 ################## DELETE_CONFIRM ##################################
 # called by default form, used to confirm deletion of data in DB
@@ -332,19 +336,16 @@ if ($op eq 'add_form') {
        #Adding tab management for system preferences
        my $tab=$input->param('tab');
        
-       if  ($searchfield ne '') {
-                $template->param(searchfield => "<p>You Searched for <strong>$searchfield</strong></p>");
-       }
        my $env;
        my ($count,$results)=StringSearch($env,$searchfield,$tab);
        my $toggle=0;
        my @loop_data = ();
        for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-               if ($toggle eq 0){
+               if ($toggle eq 0){
                        $toggle=1;
-               } else {
+               } else {
                        $toggle=0;
-               }
+               }
                my %row_data;  # get a fresh hash for the row data
                $row_data{variable} = $results->[$i]{'variable'};
                $row_data{value} = $results->[$i]{'value'};
@@ -354,6 +355,7 @@ if ($op eq 'add_form') {
                $row_data{delete} = "$script_name?op=delete_confirm&amp;searchfield=".$results->[$i]{'variable'};
                push(@loop_data, \%row_data);
        }
+       $tab=($tab?$tab:"Others");
        $template->param(loop => \@loop_data, $tab => 1);
        if ($offset>0) {
                my $prevpage = $offset-$pagesize;