Fix for Bug 1955: Remove noOPACUserLogin system preference
[koha.git] / admin / systempreferences.pl
index b60d58b..3c22d31 100755 (executable)
@@ -47,19 +47,28 @@ use C4::Context;
 use C4::Koha;
 use C4::Languages qw(getTranslatedLanguages);
 use C4::ClassSource;
+use C4::Log;
 use C4::Output;
-use C4::Context;
 
 # use Smart::Comments;
 
 
 # FIXME, shouldnt we store this stuff in the systempreferences table? 
 
+# FIXME: This uses hash in a backwards way.  What we really want is:
+#              $tabsysprefs{key} = $array_ref;
+#                              like
+#              $tabsysprefs{Cataloguing} = [qw(autoBarcode ISBD marc ...)];
+#
+#      Because some things *should* be on more than one tab.
+#      And the tabname is the unique part (the key).
+
 my %tabsysprefs;
 # Acquisitions
     $tabsysprefs{acquisitions}="Acquisitions";
     $tabsysprefs{gist}="Acquisitions";
     $tabsysprefs{emailPurchaseSuggestions}="Acquisitions";
+       $tabsysprefs{RenewSerialAddsSuggestion}="Acquisitions";
 
 # Admin
     $tabsysprefs{singleBranchMode}="Admin";
@@ -81,6 +90,7 @@ my %tabsysprefs;
     $tabsysprefs{SessionStorage}="Admin";
     $tabsysprefs{noItemTypeImages}="Admin";
     $tabsysprefs{OPACBaseURL}="Admin";
+    $tabsysprefs{GranularPermissions}="Admin";
 
 # Authorities
     $tabsysprefs{authoritysep}="Authorities";
@@ -97,7 +107,6 @@ my %tabsysprefs;
     $tabsysprefs{LabelMARCView}="Cataloguing";
     $tabsysprefs{marc}="Cataloguing";
     $tabsysprefs{marcflavour}="Cataloguing";
-    $tabsysprefs{serialsadditems}="Cataloguing";
     $tabsysprefs{MARCOrgCode}="Cataloguing";
     $tabsysprefs{z3950AuthorAuthFields}="Cataloguing";
     $tabsysprefs{z3950NormalizeAuthor}="Cataloguing";
@@ -150,7 +159,7 @@ my %tabsysprefs;
     $tabsysprefs{IntranetmainUserblock}="StaffClient";
     
 # Patrons
-    $tabsysprefs{automembernum}="Patrons";
+    $tabsysprefs{autoMemberNum}="Patrons";
     $tabsysprefs{checkdigit}="Patrons";
     $tabsysprefs{intranetreadinghistory}="Patrons";
     $tabsysprefs{NotifyBorrowerDeparture}="Patrons";
@@ -165,16 +174,9 @@ my %tabsysprefs;
     $tabsysprefs{NoReturnSetLost}="Patrons";
     $tabsysprefs{MaxFine}="Patrons";
     $tabsysprefs{NotifyBorrowerDeparture}="Patrons";
+    $tabsysprefs{AddPatronLists}="Patrons";
     $tabsysprefs{PatronsPerPage}="Patrons";
-
-# FRBR
-    $tabsysprefs{FRBRizeEditions}="FRBR";
-    $tabsysprefs{XISBN}="FRBR";
-    $tabsysprefs{OCLCAffiliateID}="FRBR";
-    $tabsysprefs{XISBNDailyLimit}="FRBR";
-    $tabsysprefs{PINESISBN}="FRBR";
-    $tabsysprefs{ThingISBN}="FRBR";
-    $tabsysprefs{OPACFRBRizeEditions}="FRBR";
+    $tabsysprefs{ExtendedPatronAttributes}="Patrons";
 
 # I18N/L10N
     $tabsysprefs{dateformat}="I18N/L10N";
@@ -199,14 +201,36 @@ my %tabsysprefs;
     $tabsysprefs{QueryAutoTruncate}="Searching";
     $tabsysprefs{QueryRemoveStopwords}="Searching";
 
-# Amazon.com
-    $tabsysprefs{AmazonContent}="Amazon";
-    $tabsysprefs{AWSAccessKeyID}="Amazon";
-    $tabsysprefs{AmazonLocale}="Amazon";
-    $tabsysprefs{AmazonAssocTag}="Amazon";
-    $tabsysprefs{AmazonSimilarItems}="Amazon";
-    $tabsysprefs{OPACAmazonContent}="Amazon";
-    $tabsysprefs{OPACAmazonSimilarItems}="Amazon";
+# EnhancedContent
+   $tabsysprefs{AmazonContent}="EnhancedContent";
+   $tabsysprefs{AWSAccessKeyID}="EnhancedContent";
+   $tabsysprefs{AmazonLocale}="EnhancedContent";
+   $tabsysprefs{AmazonAssocTag}="EnhancedContent";
+   $tabsysprefs{AmazonSimilarItems}="EnhancedContent";
+   $tabsysprefs{OPACAmazonContent}="EnhancedContent";
+   $tabsysprefs{OPACAmazonSimilarItems}="EnhancedContent";
+# Baker & Taylor 
+   $tabsysprefs{BakerTaylorBookstoreURL} = 'EnhancedContent';
+   $tabsysprefs{BakerTaylorEnabled}      = 'EnhancedContent';
+   $tabsysprefs{BakerTaylorPassword}     = 'EnhancedContent';
+   $tabsysprefs{BakerTaylorUsername}     = 'EnhancedContent';
+# FRBR    
+   $tabsysprefs{FRBRizeEditions}="EnhancedContent";
+   $tabsysprefs{XISBN}="EnhancedContent";
+   $tabsysprefs{OCLCAffiliateID}="EnhancedContent";
+   $tabsysprefs{XISBNDailyLimit}="EnhancedContent";
+   $tabsysprefs{PINESISBN}="EnhancedContent";
+   $tabsysprefs{ThingISBN}="EnhancedContent";
+   $tabsysprefs{OPACFRBRizeEditions}="EnhancedContent";
+# Tags
+   $tabsysprefs{TagsEnabled}            = 'EnhancedContent';
+   $tabsysprefs{TagsExternalDictionary} = 'EnhancedContent';
+   $tabsysprefs{TagsInputOnDetail}      = 'EnhancedContent';
+   $tabsysprefs{TagsInputOnList}        = 'EnhancedContent';
+   $tabsysprefs{TagsShowOnDetail}       = 'EnhancedContent';
+   $tabsysprefs{TagsShowOnList}         = 'EnhancedContent';
+   $tabsysprefs{TagsModeration}         = 'EnhancedContent';
+   $tabsysprefs{GoogleJackets}                         = 'EnhancedContent';
 
 # OPAC
     $tabsysprefs{BiblioDefaultView}="OPAC";
@@ -224,7 +248,6 @@ my %tabsysprefs;
     $tabsysprefs{opacheader}="OPAC";
 
     $tabsysprefs{hideBiblioNumber}="OPAC";
-    $tabsysprefs{noOPACUserLogin}="OPAC";
     $tabsysprefs{OPACDisplayExtendedSubInfo}="OPAC";
     $tabsysprefs{OpacMainUserBlock}="OPAC";
     $tabsysprefs{OPACSubscriptionDisplay}="OPAC";
@@ -258,13 +281,13 @@ my %tabsysprefs;
     $tabsysprefs{OpacRenewalAllowed} = "OPAC";
 
 # LOGFeatures
-    $tabsysprefs{CataloguingLog}  = "LOGFeatures";
-    $tabsysprefs{BorrowersLog}    = "LOGFeatures";
-    $tabsysprefs{SubscriptionLog} = "LOGFeatures";
-    $tabsysprefs{IssueLog}        = "LOGFeatures";
-    $tabsysprefs{ReturnLog}       = "LOGFeatures";
-    $tabsysprefs{LetterLog}       = "LOGFeatures";
-    $tabsysprefs{FinesLog}        = "LOGFeatures";
+    $tabsysprefs{CataloguingLog}  = "Logs";
+    $tabsysprefs{BorrowersLog}    = "Logs";
+    $tabsysprefs{SubscriptionLog} = "Logs";
+    $tabsysprefs{IssueLog}        = "Logs";
+    $tabsysprefs{ReturnLog}       = "Logs";
+    $tabsysprefs{LetterLog}       = "Logs";
+    $tabsysprefs{FinesLog}        = "Logs";
     
 # OAI-PMH variables
    $tabsysprefs{'OAI-PMH'}           = "OAI-PMH";
@@ -273,7 +296,6 @@ my %tabsysprefs;
    $tabsysprefs{'OAI-PMH:Set'}       = "OAI-PMH";
    $tabsysprefs{'OAI-PMH:Subset'}    = "OAI-PMH";
 
-
 sub StringSearch  {
     my ($searchstring,$type)=@_;
     my $dbh = C4::Context->dbh;
@@ -333,8 +355,9 @@ sub StringSearch  {
 }
 
 my $input = new CGI;
-my $searchfield=$input->param('searchfield');
-my $offset=$input->param('offset');
+my $searchfield = $input->param('searchfield');
+my $Tvalue = $input->param('Tvalue');
+my $offset = $input->param('offset');
 my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
 
 my ($template, $borrowernumber, $cookie)
@@ -400,12 +423,16 @@ if ($op eq 'update_and_reedit') {
             my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
             $sth->execute($value, $input->param('explanation'), $input->param('variable'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+                       warn "logaction !! mod ";
+                       logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value );
         }
     } else {
         unless (C4::Context->config('demo') eq 1) {
             my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?,?,?)");
             $sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+                       warn "logaction !! add ";
+                       logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $input->param('value') );
         }
     }
     $sth->finish;
@@ -538,12 +565,14 @@ if ($op eq 'add_form') {
             my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
             $sth->execute($value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'), $input->param('variable'));
             $sth->finish;
+                       logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value );
         }
     } else {
         unless (C4::Context->config('demo') eq 1) {
             my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation,type,options) values (?,?,?,?,?)");
             $sth->execute($input->param('variable'), $value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+                       logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $value );
         }
     }
     $sth->finish;
@@ -568,6 +597,8 @@ if ($op eq 'add_form') {
     my $dbh = C4::Context->dbh;
     my $sth=$dbh->prepare("delete from systempreferences where variable=?");
     $sth->execute($searchfield);
+       my $logstring =  $searchfield . " | " . $Tvalue ;
+       logaction('SYSTEMPREFERENCE','DELETE',undef,$logstring);
     $sth->finish;
 
                                                     # END $OP eq DELETE_CONFIRMED