View | Details | Raw Unified | Return to bug 9760
Collapse All | Expand All

(-)a/admin/systempreferences.pl (-393 / +18 lines)
Lines 54-410 use C4::Log; Link Here
54
use C4::Output;
54
use C4::Output;
55
use YAML::Syck qw( Dump LoadFile );
55
use YAML::Syck qw( Dump LoadFile );
56
56
57
57
my %tabsysprefs; #we do no longer need to keep track of a tab per pref (yaml)
58
# use Smart::Comments;
59
60
# FIXME, shouldnt we store this stuff in the systempreferences table?
61
62
# FIXME: This uses hash in a backwards way.  What we really want is:
63
#       $tabsysprefs{key} = $array_ref;
64
#               like
65
#       $tabsysprefs{Cataloguing} = [qw(autoBarcode ISBD marc ...)];
66
#
67
#   Because some things *should* be on more than one tab.
68
#   And the tabname is the unique part (the key).
69
70
my %tabsysprefs;
71
72
# Acquisitions
73
    $tabsysprefs{gist}="Acquisitions";
74
    $tabsysprefs{emailPurchaseSuggestions}="Acquisitions";
75
    $tabsysprefs{RenewSerialAddsSuggestion}="Acquisitions";
76
    $tabsysprefs{AcqCreateItem}="Acquisitions";
77
    $tabsysprefs{OrderPdfFormat}="Acquisitions";
78
    $tabsysprefs{CurrencyFormat}="Acquisitions";
79
    $tabsysprefs{AcqViewBaskets}="Acquisitions";
80
81
# Admin
82
$tabsysprefs{singleBranchMode}      = "Admin";
83
$tabsysprefs{staffClientBaseURL}    = "Admin";
84
$tabsysprefs{Version}               = "Admin";
85
$tabsysprefs{OpacMaintenance}       = "Admin";
86
$tabsysprefs{FrameworksLoaded}      = "Admin";
87
$tabsysprefs{delimiter}             = "Admin";
88
$tabsysprefs{IndependantBranches}   = "Admin";
89
$tabsysprefs{insecure}              = "Admin";
90
$tabsysprefs{KohaAdmin}             = "Admin";
91
$tabsysprefs{KohaAdminEmailAddress} = "Admin";
92
$tabsysprefs{timeout}               = "Admin";
93
$tabsysprefs{Intranet_includes}     = "Admin";
94
$tabsysprefs{AutoLocation}          = "Admin";
95
$tabsysprefs{DebugLevel}            = "Admin";
96
$tabsysprefs{SessionStorage}        = "Admin";
97
98
# This script is deprecated so all of these prefs are lumped here to avoid their being displayed in the local use prefs tab
99
100
$tabsysprefs{noItemTypeImages}      = "Admin";
101
$tabsysprefs{OPACBaseURL}           = "Admin";
102
$tabsysprefs{AnonymousPatron}       = "Admin";
103
$tabsysprefs{casAuthentication}     = "Admin";
104
$tabsysprefs{casLogout}             = "Admin";
105
$tabsysprefs{casServerUrl}          = "Admin";
106
$tabsysprefs{Disable_Dictionary}    = "Admin";
107
$tabsysprefs{EnableOpacSearchHistory}   = "Admin";
108
$tabsysprefs{Intranetbookbag}       = "Admin";
109
$tabsysprefs{maxitemsinSearchResults}   = "Admin";
110
$tabsysprefs{noOPACUserLogin}       = "Admin";
111
$tabsysprefs{'OAI-PMH:ConfFile'}    = "Admin";
112
$tabsysprefs{OpacAddMastheadLibraryPulldown}    = "Admin";
113
$tabsysprefs{opaclargeimage}        = "Admin";
114
$tabsysprefs{OPACXSLTDetailsDisplay}    = "Admin";
115
$tabsysprefs{OPACXSLTResultsDisplay}    = "Admin";
116
$tabsysprefs{PDFFontType}           = "Admin";
117
$tabsysprefs{PrintNoticesMaxLines}  = "Admin";
118
$tabsysprefs{ReservesControlBranch} = "Admin";
119
$tabsysprefs{ResultsDisplay}        = "Admin";
120
$tabsysprefs{NoReturnSetLost}       = "Admin";
121
$tabsysprefs{SearchURL}             = "Admin";
122
$tabsysprefs{ShowPictures}          = "Admin";
123
$tabsysprefs{soundon}               = "Admin";
124
$tabsysprefs{SpineLabelShowPrintOnBibDetails}   = "Admin";
125
$tabsysprefs{WebBasedSelfCheckHeader}           = "Admin";
126
$tabsysprefs{WebBasedSelfCheckTimeout}          = "Admin";
127
128
# Authorities
129
$tabsysprefs{authoritysep}          = "Authorities";
130
$tabsysprefs{AuthDisplayHierarchy}  = "Authorities";
131
$tabsysprefs{dontmerge}             = "Authorities";
132
$tabsysprefs{BiblioAddsAuthorities} = "Authorities";
133
134
# Cataloguing
135
$tabsysprefs{advancedMARCeditor}          = "Cataloging";
136
$tabsysprefs{autoBarcode}                 = "Cataloging";
137
$tabsysprefs{hide_marc}                   = "Cataloging";
138
$tabsysprefs{IntranetBiblioDefaultView}   = "Cataloging";
139
$tabsysprefs{ISBD}                        = "Cataloging";
140
$tabsysprefs{itemcallnumber}              = "Cataloging";
141
$tabsysprefs{LabelMARCView}               = "Cataloging";
142
$tabsysprefs{marcflavour}                 = "Cataloging";
143
$tabsysprefs{MARCOrgCode}                 = "Cataloging";
144
$tabsysprefs{z3950AuthorAuthFields}       = "Cataloging";
145
$tabsysprefs{z3950NormalizeAuthor}        = "Cataloging";
146
$tabsysprefs{Stemming}                    = "Cataloging";
147
$tabsysprefs{WeightFields}                = "Cataloging";
148
$tabsysprefs{NoZebra}                     = "Cataloging";
149
$tabsysprefs{NoZebraIndexes}              = "Cataloging";
150
$tabsysprefs{ReceiveBackIssues}           = "Cataloging";
151
$tabsysprefs{DefaultClassificationSource} = "Cataloging";
152
$tabsysprefs{RoutingSerials}              = "Cataloging";
153
$tabsysprefs{'item-level_itypes'}         = "Cataloging";
154
$tabsysprefs{OpacSuppression}             = "Cataloging";
155
$tabsysprefs{SpineLabelFormat}            = "Cataloging";
156
$tabsysprefs{SpineLabelAutoPrint}         = "Cataloging";
157
158
# Circulation
159
$tabsysprefs{maxoutstanding}                 = "Circulation";
160
$tabsysprefs{maxreserves}                    = "Circulation";
161
$tabsysprefs{noissuescharge}                 = "Circulation";
162
$tabsysprefs{IssuingInProcess}               = "Circulation";
163
$tabsysprefs{patronimages}                   = "Circulation";
164
$tabsysprefs{printcirculationslips}          = "Circulation";
165
$tabsysprefs{ReturnBeforeExpiry}             = "Circulation";
166
$tabsysprefs{SpecifyDueDate}                 = "Circulation";
167
$tabsysprefs{AutomaticItemReturn}            = "Circulation";
168
$tabsysprefs{ReservesMaxPickUpDelay}         = "Circulation";
169
$tabsysprefs{TransfersMaxDaysWarning}        = "Circulation";
170
$tabsysprefs{useDaysMode}                    = "Circulation";
171
$tabsysprefs{ReservesNeedReturns}            = "Circulation";
172
$tabsysprefs{CircAutocompl}                  = "Circulation";
173
$tabsysprefs{AllowRenewalLimitOverride}      = "Circulation";
174
$tabsysprefs{canreservefromotherbranches}    = "Circulation";
175
$tabsysprefs{finesMode}                      = "Circulation";
176
$tabsysprefs{numReturnedItemsToShow}         = "Circulation";
177
$tabsysprefs{emailLibrarianWhenHoldIsPlaced} = "Circulation";
178
$tabsysprefs{itemBarcodeInputFilter}         = "Circulation";
179
$tabsysprefs{WebBasedSelfCheck}              = "Circulation";
180
$tabsysprefs{ShowPatronImageInWebBasedSelfCheck} = "Circulation";
181
$tabsysprefs{CircControl}                    = "Circulation";
182
$tabsysprefs{finesCalendar}                  = "Circulation";
183
$tabsysprefs{previousIssuesDefaultSortOrder} = "Circulation";
184
$tabsysprefs{todaysIssuesDefaultSortOrder}   = "Circulation";
185
$tabsysprefs{HomeOrHoldingBranch}            = "Circulation";
186
$tabsysprefs{HomeOrHoldingBranchReturn}      = "Circulation";
187
$tabsysprefs{RandomizeHoldsQueueWeight}      = "Circulation";
188
$tabsysprefs{StaticHoldsQueueWeight}         = "Circulation";
189
$tabsysprefs{AllowOnShelfHolds}              = "Circulation";
190
$tabsysprefs{AllowHoldsOnDamagedItems}       = "Circulation";
191
$tabsysprefs{UseBranchTransferLimits}        = "Circulation";
192
$tabsysprefs{AllowHoldPolicyOverride}        = "Circulation";
193
$tabsysprefs{BranchTransferLimitsType}       = "Circulation";
194
$tabsysprefs{AllowNotForLoanOverride}        = "Circulation";
195
$tabsysprefs{RenewalPeriodBase}              = "Circulation";
196
$tabsysprefs{FilterBeforeOverdueReport}      = "Circulation";
197
$tabsysprefs{AllowHoldDateInFuture}          = "Circulation";
198
$tabsysprefs{OPACFineNoRenewals}             = "Circulation";
199
$tabsysprefs{InProcessingToShelvingCart}     = "Circulation";
200
$tabsysprefs{NewItemsDefaultLocation}        = "Circulation";
201
$tabsysprefs{ReturnToShelvingCart}           = "Circulation";
202
$tabsysprefs{DisplayClearScreenButton}       = "Circulation";
203
$tabsysprefs{AllowAllMessageDeletion}        = "Circulation";
204
$tabsysprefs{OverdueNoticeBcc}               = "Circulation";
205
$tabsysprefs{OverduesBlockCirc}              = "Circulation";
206
$tabsysprefs{UseTransportCostMatrix}         = "Circulation";
207
$tabsysprefs{AllowReturnToBranch}            = "Circulation";
208
209
# Staff Client
210
$tabsysprefs{template}                = "StaffClient";
211
$tabsysprefs{intranetstylesheet}      = "StaffClient";
212
$tabsysprefs{IntranetNav}             = "StaffClient";
213
$tabsysprefs{intranetcolorstylesheet} = "StaffClient";
214
$tabsysprefs{intranetuserjs}          = "StaffClient";
215
$tabsysprefs{yuipath}                 = "StaffClient";
216
$tabsysprefs{IntranetmainUserblock}   = "StaffClient";
217
$tabsysprefs{viewMARC}                = "StaffClient";
218
$tabsysprefs{viewLabeledMARC}         = "StaffClient";
219
$tabsysprefs{viewISBD}                = "StaffClient";
220
221
# Patrons
222
$tabsysprefs{autoMemberNum}                = "Patrons";
223
$tabsysprefs{checkdigit}                   = "Patrons";
224
$tabsysprefs{intranetreadinghistory}       = "Patrons";
225
$tabsysprefs{NotifyBorrowerDeparture}      = "Patrons";
226
$tabsysprefs{memberofinstitution}          = "Patrons";
227
$tabsysprefs{BorrowerMandatoryField}       = "Patrons";
228
$tabsysprefs{BorrowerUnwantedField}        = "Patrons";
229
$tabsysprefs{borrowerRelationship}         = "Patrons";
230
$tabsysprefs{BorrowersTitles}              = "Patrons";
231
$tabsysprefs{patronimages}                 = "Patrons";
232
$tabsysprefs{minPasswordLength}            = "Patrons";
233
$tabsysprefs{uppercasesurnames}            = "Patrons";
234
$tabsysprefs{MaxFine}                      = "Patrons";
235
$tabsysprefs{NotifyBorrowerDeparture}      = "Patrons";
236
$tabsysprefs{AddPatronLists}               = "Patrons";
237
$tabsysprefs{PatronsPerPage}               = "Patrons";
238
$tabsysprefs{ExtendedPatronAttributes}     = "Patrons";
239
$tabsysprefs{AutoEmailOpacUser}            = "Patrons";
240
$tabsysprefs{AutoEmailPrimaryAddress}      = "Patrons";
241
$tabsysprefs{EnhancedMessagingPreferences} = "Patrons";
242
$tabsysprefs{'SMSSendDriver'}              = 'Patrons';
243
$tabsysprefs{HidePatronName}               = "Patrons";
244
245
246
# I18N/L10N
247
$tabsysprefs{dateformat}    = "I18N/L10N";
248
$tabsysprefs{opaclanguages} = "I18N/L10N";
249
$tabsysprefs{opaclanguagesdisplay} = "I18N/L10N";
250
$tabsysprefs{language}      = "I18N/L10N";
251
252
# Searching
253
$tabsysprefs{defaultSortField}        = "Searching";
254
$tabsysprefs{defaultSortOrder}        = "Searching";
255
$tabsysprefs{numSearchResults}        = "Searching";
256
$tabsysprefs{OPACdefaultSortField}    = "Searching";
257
$tabsysprefs{OPACdefaultSortOrder}    = "Searching";
258
$tabsysprefs{OPACItemsResultsDisplay} = "Searching";
259
$tabsysprefs{OPACnumSearchResults}    = "Searching";
260
$tabsysprefs{QueryFuzzy}              = "Searching";
261
$tabsysprefs{QueryStemming}           = "Searching";
262
$tabsysprefs{QueryWeightFields}       = "Searching";
263
$tabsysprefs{expandedSearchOption}    = "Searching";
264
$tabsysprefs{QueryAutoTruncate}       = "Searching";
265
$tabsysprefs{QueryRemoveStopwords}    = "Searching";
266
$tabsysprefs{AdvancedSearchTypes}     = "Searching";
267
$tabsysprefs{DisplayMultiPlaceHold}   = "Searching";
268
269
# EnhancedContent
270
$tabsysprefs{AmazonCoverImages}      = "EnhancedContent";
271
$tabsysprefs{OPACAmazonCoverImages}  = "EnhancedContent";
272
$tabsysprefs{AmazonLocale}           = "EnhancedContent";
273
$tabsysprefs{AmazonAssocTag}         = "EnhancedContent";
274
275
# Babelthèque
276
$tabsysprefs{Babeltheque}            = "EnhancedContent";
277
278
# Baker & Taylor
279
$tabsysprefs{BakerTaylorBookstoreURL} = 'EnhancedContent';
280
$tabsysprefs{BakerTaylorEnabled}      = 'EnhancedContent';
281
$tabsysprefs{BakerTaylorPassword}     = 'EnhancedContent';
282
$tabsysprefs{BakerTaylorUsername}     = 'EnhancedContent';
283
284
# Library Thing for Libraries
285
$tabsysprefs{LibraryThingForLibrariesID} = "EnhancedContent";
286
$tabsysprefs{LibraryThingForLibrariesEnabled} = "EnhancedContent";
287
$tabsysprefs{LibraryThingForLibrariesTabbedView} = "EnhancedContent";
288
289
# Syndetics
290
$tabsysprefs{SyndeticsClientCode}     = 'EnhancedContent';
291
$tabsysprefs{SyndeticsEnabled}        = 'EnhancedContent';
292
$tabsysprefs{SyndeticsCoverImages}    = 'EnhancedContent';
293
$tabsysprefs{SyndeticsTOC}            = 'EnhancedContent';
294
$tabsysprefs{SyndeticsSummary}        = 'EnhancedContent';
295
$tabsysprefs{SyndeticsEditions}       = 'EnhancedContent';
296
$tabsysprefs{SyndeticsExcerpt}        = 'EnhancedContent';
297
$tabsysprefs{SyndeticsReviews}        = 'EnhancedContent';
298
$tabsysprefs{SyndeticsAuthorNotes}    = 'EnhancedContent';
299
$tabsysprefs{SyndeticsAwards}         = 'EnhancedContent';
300
$tabsysprefs{SyndeticsSeries}         = 'EnhancedContent';
301
$tabsysprefs{SyndeticsCoverImageSize} = 'EnhancedContent';
302
303
304
# FRBR
305
$tabsysprefs{FRBRizeEditions}     = "EnhancedContent";
306
$tabsysprefs{XISBN}               = "EnhancedContent";
307
$tabsysprefs{OCLCAffiliateID}     = "EnhancedContent";
308
$tabsysprefs{XISBNDailyLimit}     = "EnhancedContent";
309
$tabsysprefs{ThingISBN}           = "EnhancedContent";
310
$tabsysprefs{OPACFRBRizeEditions} = "EnhancedContent";
311
312
# Tags
313
$tabsysprefs{TagsEnabled}            = 'EnhancedContent';
314
$tabsysprefs{TagsExternalDictionary} = 'EnhancedContent';
315
$tabsysprefs{TagsInputOnDetail}      = 'EnhancedContent';
316
$tabsysprefs{TagsInputOnList}        = 'EnhancedContent';
317
$tabsysprefs{TagsShowOnDetail}       = 'EnhancedContent';
318
$tabsysprefs{TagsShowOnList}         = 'EnhancedContent';
319
$tabsysprefs{TagsModeration}         = 'EnhancedContent';
320
$tabsysprefs{GoogleJackets}          = 'EnhancedContent';
321
$tabsysprefs{AuthorisedValueImages}  = "EnhancedContent";
322
323
# OPAC
324
$tabsysprefs{BiblioDefaultView}          = "OPAC";
325
$tabsysprefs{LibraryName}                = "OPAC";
326
$tabsysprefs{opaccolorstylesheet}        = "OPAC";
327
$tabsysprefs{opaccredits}                = "OPAC";
328
$tabsysprefs{opaclayoutstylesheet}       = "OPAC";
329
$tabsysprefs{OpacNav}                    = "OPAC";
330
$tabsysprefs{opacsmallimage}             = "OPAC";
331
$tabsysprefs{opacthemes}                 = "OPAC";
332
$tabsysprefs{opacuserjs}                 = "OPAC";
333
$tabsysprefs{opacheader}                 = "OPAC";
334
$tabsysprefs{hideBiblioNumber}           = "OPAC";
335
$tabsysprefs{OpacMainUserBlock}          = "OPAC";
336
$tabsysprefs{OPACURLOpenInNewWindow}     = "OPAC";
337
$tabsysprefs{OPACUserCSS}                = "OPAC";
338
$tabsysprefs{OPACHighlightedWords}       = "OPAC";
339
$tabsysprefs{OPACViewOthersSuggestions}  = "OPAC";
340
$tabsysprefs{URLLinkText}                = "OPAC";
341
$tabsysprefs{OPACSearchForTitleIn}       = "OPAC";
342
$tabsysprefs{OPACShelfBrowser}           = "OPAC";
343
$tabsysprefs{OPACShowHoldQueueDetails}   = "OPAC";
344
$tabsysprefs{OPACAllowHoldDateInFuture}  = "OPAC";
345
$tabsysprefs{OPACPatronDetails}  = "OPAC";
346
$tabsysprefs{OPACFinesTab}  = "OPAC";
347
$tabsysprefs{DisplayOPACiconsXSLT}	 = "OPAC";
348
$tabsysprefs{AutoSelfCheckAllowed}	 = "OPAC";
349
$tabsysprefs{AutoSelfCheckID}		 = "OPAC";
350
$tabsysprefs{AutoSelfCheckPass}		 = "OPAC";
351
352
# OPAC
353
$tabsysprefs{SearchMyLibraryFirst} = "OPAC";
354
$tabsysprefs{hidelostitems}        = "OPAC";
355
$tabsysprefs{opacbookbag}          = "OPAC";
356
$tabsysprefs{OpacPasswordChange}   = "OPAC";
357
$tabsysprefs{opacreadinghistory}   = "OPAC";
358
$tabsysprefs{virtualshelves}       = "OPAC";
359
$tabsysprefs{RequestOnOpac}        = "OPAC";
360
$tabsysprefs{reviewson}            = "OPAC";
361
$tabsysprefs{OpacTopissues}        = "OPAC";
362
$tabsysprefs{OpacAuthorities}      = "OPAC";
363
$tabsysprefs{OpacCloud}            = "OPAC";
364
$tabsysprefs{opacuserlogin}        = "OPAC";
365
$tabsysprefs{AnonSuggestions}      = "OPAC";
366
$tabsysprefs{suggestion}           = "OPAC";
367
$tabsysprefs{OpacTopissue}         = "OPAC";
368
$tabsysprefs{OpacBrowser}          = "OPAC";
369
$tabsysprefs{OpacRenewalAllowed}   = "OPAC";
370
$tabsysprefs{OPACItemHolds}        = "OPAC";
371
$tabsysprefs{OPACGroupResults}     = "OPAC";
372
$tabsysprefs{XSLTDetailsDisplay}   = "OPAC";
373
$tabsysprefs{XSLTResultsDisplay}   = "OPAC";
374
$tabsysprefs{OPACShowCheckoutName}   = "OPAC";
375
$tabsysprefs{AllowPurchaseSuggestionBranchChoice}   = "OPAC";
376
377
# Serials
378
$tabsysprefs{RoutingListAddReserves}  	   = "Serials";
379
$tabsysprefs{OPACSerialIssueDisplayCount}  = "Serials";
380
$tabsysprefs{StaffSerialIssueDisplayCount} = "Serials";
381
$tabsysprefs{RenewSerialAddsSuggestion}    = "Serials";
382
$tabsysprefs{SubscriptionHistory}          = "Serials";
383
384
# LOGFeatures
385
$tabsysprefs{CataloguingLog}  = "Logs";
386
$tabsysprefs{BorrowersLog}    = "Logs";
387
$tabsysprefs{SubscriptionLog} = "Logs";
388
$tabsysprefs{IssueLog}        = "Logs";
389
$tabsysprefs{ReturnLog}       = "Logs";
390
$tabsysprefs{LetterLog}       = "Logs";
391
$tabsysprefs{FinesLog}        = "Logs";
392
393
# OAI-PMH variables
394
$tabsysprefs{'OAI-PMH'}           = "OAI-PMH";
395
$tabsysprefs{'OAI-PMH:archiveID'} = "OAI-PMH";
396
$tabsysprefs{'OAI-PMH:MaxCount'}  = "OAI-PMH";
397
398
# ILS-DI variables
399
$tabsysprefs{'ILS-DI'} = "ILS-DI";
400
$tabsysprefs{'ILS-DI:AuthorizedIPs'}    = "Admin";
401
402
# Creator variables
403
404
$tabsysprefs{'ImageLimit'} = "Creators";
405
58
406
sub StringSearch {
59
sub StringSearch {
407
    my ( $searchstring, $type ) = @_;
60
    my ( $searchstring, $tab ) = @_;
61
    return (0,[]) if $tab ne 'local_use';
62
408
    my $dbh = C4::Context->dbh;
63
    my $dbh = C4::Context->dbh;
409
    $searchstring =~ s/\'/\\\'/g;
64
    $searchstring =~ s/\'/\\\'/g;
410
    my @data = split( ' ', $searchstring );
65
    my @data = split( ' ', $searchstring );
Lines 413-467 sub StringSearch { Link Here
413
    my $cnt = 0;
68
    my $cnt = 0;
414
    my $sth;
69
    my $sth;
415
70
416
    # used for doing a plain-old sys-pref search
71
    my $strsth = "Select variable,value,explanation,type,options from systempreferences where variable in (";
417
    if ( $type && $type ne 'all' ) {
72
    my $first = 1;
418
        foreach my $syspref ( sort { lc $a cmp lc $b } keys %tabsysprefs ) {
73
    for my $name ( get_local_prefs() ) {
419
            if ( $tabsysprefs{$syspref} eq $type ) {
420
                my $sth = $dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
421
                $sth->execute($syspref);
422
                while ( my $data = $sth->fetchrow_hashref ) {
423
                    unless (defined $data->{value}) { $data->{value} = "";}
424
                    $data->{shortvalue} = $data->{value};
425
                    $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60;
426
                    push( @results, $data );
427
                    $cnt++;
428
                }
429
                $sth->finish;
430
            }
431
        }
432
    } else {
433
        my $sth;
434
435
        if ( $type and $type eq 'all' ) {
436
            $sth = $dbh->prepare( "
437
            SELECT *
438
              FROM systempreferences
439
              WHERE variable LIKE ? OR explanation LIKE ?
440
              ORDER BY VARIABLE" );
441
            $sth->execute( "%$searchstring%", "%$searchstring%" );
442
        } else {
443
            my $strsth = "Select variable,value,explanation,type,options from systempreferences where variable in (";
444
            my $first = 1;
445
            for my $name ( get_local_prefs() ) {
446
                $strsth .= ',' unless $first;
74
                $strsth .= ',' unless $first;
447
                $strsth .= "'$name'";
75
                $strsth .= "'$name'";
448
                $first = 0;
76
                $first = 0;
449
            }
77
    }
450
            $strsth .= ") order by variable";
78
    $strsth .= ") order by variable";
451
            $sth = $dbh->prepare($strsth);
79
    $sth = $dbh->prepare($strsth);
452
            $sth->execute();
80
    $sth->execute();
453
        }
454
81
455
        while ( my $data = $sth->fetchrow_hashref ) {
82
    while ( my $data = $sth->fetchrow_hashref ) {
456
            unless (defined $data->{value}) { $data->{value} = "";}
83
            unless (defined $data->{value}) { $data->{value} = "";}
457
            $data->{shortvalue} = $data->{value};
84
            $data->{shortvalue} = $data->{value};
458
            $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60;
85
            $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60;
459
            push( @results, $data );
86
            push( @results, $data );
460
            $cnt++;
87
            $cnt++;
461
        }
462
463
        $sth->finish;
464
    }
88
    }
89
90
    $sth->finish;
465
    return ( $cnt, \@results );
91
    return ( $cnt, \@results );
466
}
92
}
467
93
Lines 769-775 if ( $op eq 'add_form' ) { Link Here
769
################## DEFAULT ##################################
395
################## DEFAULT ##################################
770
} else {    # DEFAULT
396
} else {    # DEFAULT
771
            #Adding tab management for system preferences
397
            #Adding tab management for system preferences
772
    my $tab = $input->param('tab');
398
    my $tab = $input->param('tab')||'local_use';
773
    $template->param( $tab => 1 );
399
    $template->param( $tab => 1 );
774
    my ( $count, $results ) = StringSearch( $searchfield, $tab );
400
    my ( $count, $results ) = StringSearch( $searchfield, $tab );
775
    my @loop_data = ();
401
    my @loop_data = ();
Lines 781-788 if ( $op eq 'add_form' ) { Link Here
781
        $row_data->{delete} = "$script_name?op=delete_confirm&searchfield=" . $results->[$i]{'variable'};
407
        $row_data->{delete} = "$script_name?op=delete_confirm&searchfield=" . $results->[$i]{'variable'};
782
        push( @loop_data, $row_data );
408
        push( @loop_data, $row_data );
783
    }
409
    }
784
    $tab = ( $tab ? $tab : "local_use" );
410
    $template->param( loop => \@loop_data );
785
    $template->param( loop => \@loop_data, $tab => 1 );
786
    if ( $offset > 0 ) {
411
    if ( $offset > 0 ) {
787
        my $prevpage = $offset - $pagesize;
412
        my $prevpage = $offset - $pagesize;
788
        $template->param( "<a href=$script_name?offset=" . $prevpage . '&lt;&lt; Prev</a>' );
413
        $template->param( "<a href=$script_name?offset=" . $prevpage . '&lt;&lt; Prev</a>' );
Lines 861-870 sub get_local_prefs { Link Here
861
    my @prefs_file = get_prefs_from_files();
486
    my @prefs_file = get_prefs_from_files();
862
    my @prefs_db = get_prefs_from_db();
487
    my @prefs_db = get_prefs_from_db();
863
488
864
    my %prefs_file = map { $_ => 1 } @prefs_file;
489
    my %prefs_file = map { lc $_ => 1 } @prefs_file;
865
    my @names = ();
490
    my @names = ();
866
    foreach my $name (@prefs_db) {
491
    foreach my $name (@prefs_db) {
867
        push @names, $name  unless $prefs_file{$name};
492
        push @names, $name  unless $prefs_file{lc $name};
868
    }
493
    }
869
494
870
    return @names;
495
    return @names;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt (-7 / +9 lines)
Lines 264-280 Link Here
264
        <a class="btn btn-small" id="newstopword" href="[% script_name %]?op=add_form"><i class="icon-plus"></i> New preference</a>
264
        <a class="btn btn-small" id="newstopword" href="[% script_name %]?op=add_form"><i class="icon-plus"></i> New preference</a>
265
    </div>
265
    </div>
266
266
267
    <h1>System preferences admin</h1>
267
    [% IF ( tab != 'local_use' ) %]
268
    <h2>[% tab %] preferences</h2>
268
        <p>Please click on one of the tabs at the left side of this form.</p>
269
    [% searchfield %]
269
        <table>
270
    <table width="80%" id="sysprefst">
270
    [% ELSE %]
271
    <thead><tr>
271
        <h1>Local use preferences</h1>
272
        <table width="80%" id="sysprefst">
273
        <thead><tr>
272
        <th>Preference</th>
274
        <th>Preference</th>
273
        <th>Explanation</th>
275
        <th>Explanation</th>
274
        <th>Value</th>
276
        <th>Value</th>
275
        <th>Edit</th>
277
        <th>Edit</th>
276
        <th>Delete</th>
278
        <th>Delete</th>
277
    </tr></thead>
279
        </tr></thead>
280
    [% END %]
278
    <tbody>[% FOREACH loo IN loop %]
281
    <tbody>[% FOREACH loo IN loop %]
279
    [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
282
    [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
280
283
281
- 

Return to bug 9760