Jonathan Druart
19a977dc7b
This is the fourth and last patch set to remove C4::Branch. The real purpose of this patch is to standardise and refactor some code which is related to the libraries selection/display. Its unconfessed purpose is to remove the C4::Branch package. Before this patch set, only 6 subroutines still existed in the C4::Branch package: - GetBranchName - GetBranchesLoop - mybranch - onlymine - GetBranches - GetBranch GetBranchName basically returns the branchname for a given branchcode. The branchname is only used for a display purpose and we don't need to retrieve it in package or pl scripts (unless for a few exceptions). We have a `Branches` template plugin with a `GetName` method which does exactly this job. To achieve this removal, we will use this template plugin and delete the GetBranchName from pl and pm files. The `Branches.all()` will now select the library of the logged in user if no `selected` parameter has been passed. This new behavior could cause regressions, for instance there are some places where we do not want an option preselected (batch item modification for instance), keep that in mind when testing. GetBranchesLoop took 3 parameters: $branch and $onlymine. The first one was used to set a "selected" flag, for a display purpose: select an option in the libraries dropdown lists. The second one was useless: If not passed or set to 0, the `C4::Branch::onlymine` subroutine was called. This onlymine flag was use to know if the logged in user was able to see other libraries infos. A patron can see the infos from other libraries if IndependentBranches is not set OR if he has the superlibrarian permission. Prior to this patch set, the "onlymine test" was done on different places (neworderempty.pl, additem.pl, holidays.pl, etc.), including the Branches TT plugin. In this patch set, this test is only done on one place (C4::Context::only_my_library, code moved from C4::Branch::onlymine). To accomplish the same job as this subroutine, we just need to call the `Branches.all()` method from the `Branches` TT plugin. It already accepts a `selected` parameter to set a flag on the option to select. To avoid the repetitive [% IF selected %]<option selected="selected">[% ELSE %]<option>[% END %] pattern, a new `html_helpers` TT include file has been created, it defines an `options_for_libraries` block, which takes a `selected` parameter. We could imagine to use this include file for other selects. The 'mybranch` and `onlymine` subroutines of the C4::Branch package have been moved to C4::Context. onlymine has been renamed with only_my_library. There are only 4 occurrences of it, against 11 before this patch set. There 2 subroutines are Context-centric and it makes sense to put them in `C4::Context` (at least it's the least worst place!) GetBranches is the tricky part of this patch set: It retrieves all the libraries, independently of the value of IndependentBranches. To keep the same way as the existing calls of `Branches.all()`, I have added a `unfiltered` parameter. If set, the `Branches.all()` will call a usual Koha::Libraries->search method, otherwise Koha::Libraries->search_filtered will be called. This new method will check if the logged in user is allowed to see other libraries or only its library. Note that this `GetBranches` subroutine also created a `category` key: it allowed to get the list of groups (of libraries) where this library existed. Thanks to a previous patch set (bug 15295), this value was not used anymore (I may have missed something!). Note that the only use of `GetBranch` was buggy (see bug 15746). Test plan (for the whole patch set): The best way to test this whole patch set is to test with 2 instances: 1 with the patch set applied, 1 using master, to be sure there is no regression. It would be good to test the same with `IndependentBranches` and the without `IndependentBranches`. No difference should be found. The tester must focus on the library dropdowns on as many forms as possible. You will notice changes in the order of the options: the libraries will now be ordered by branchname (instead of branchcode in some places). A special attention will be given to the following page: - acqui/neworderempty.pl - catalogue/search.pl - members/members-home.pl (header?) - opac/opac-topissues.pl - tools/holidays.pl - admin/branch_transfer_limits.pl - admin/item_circulation_alerts.pl - rotating_collections/transferCollection.pl - suggestion/suggestion.pl - tools/export.pl Notes for QA: - There are 2 FIXMEs in the patch set, I have kept the existing behavior, but I am not sure it's the good one. Feel free to open a bug report and I will fill a patch if you think it's not correct. Otherwise, remove the FIXME lines in a follow-up patch. - The whole patch set is huge and makes a lot of changes. But it finally will tremendously reduce the number of lines: 716 insertions for 1910 deletions Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
279 lines
14 KiB
Text
279 lines
14 KiB
Text
[% USE Koha %]
|
|
[% USE AuthorisedValues %]
|
|
[% USE Branches %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>
|
|
Koha › Tools ›
|
|
[% IF ( do_it ) %]
|
|
Logs › Results
|
|
[% ELSE %]
|
|
Logs
|
|
[% END %]
|
|
</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'calendar.inc' %]
|
|
</head>
|
|
<body id="tools_viewlog" class="tools">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
[% BLOCK translate_log_module %]
|
|
[% SWITCH module %]
|
|
[% CASE 'CATALOGUING' %]Catalog
|
|
[% CASE 'AUTHORITIES' %]Authorities
|
|
[% CASE 'MEMBERS' %]Patrons
|
|
[% CASE 'ACQUISITIONS' %]Acquisitions
|
|
[% CASE 'SERIAL' %]Serials
|
|
[% CASE 'HOLDS' %]Holds
|
|
[% CASE 'CIRCULATION' %]Circulation
|
|
[% CASE 'LETTER' %]Letter
|
|
[% CASE 'FINES' %]Fines
|
|
[% CASE 'SYSTEMPREFERENCE' %]System prefs
|
|
[% CASE 'CRONJOBS' %]Cron jobs
|
|
[% CASE 'REPORTS' %]Reports
|
|
[% CASE %][% module %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% BLOCK translate_log_action %]
|
|
[% SWITCH action %]
|
|
[% CASE 'ADD' %]Add
|
|
[% CASE 'DELETE' %]Delete
|
|
[% CASE 'MODIFY' %]Modify
|
|
[% CASE 'ISSUE' %]Checkout
|
|
[% CASE 'RETURN' %]Return
|
|
[% CASE 'CREATE' %]Create
|
|
[% CASE 'CANCEL' %]Cancel
|
|
[% CASE 'RESUME' %]Resume
|
|
[% CASE 'SUSPEND' %]Suspend
|
|
[% CASE 'RENEW' %]Renew
|
|
[% CASE 'CHANGE PASS' %]Change password
|
|
[% CASE 'ADDCIRCMESSAGE' %]Add circulation message
|
|
[% CASE 'DELCIRCMESSAGE' %]Delete circulation message
|
|
[% CASE 'Run' %]Run
|
|
[% CASE %][% action %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% BLOCK translate_log_interface %]
|
|
[% SWITCH interface %]
|
|
[% CASE 'INTRANET' %]Intranet
|
|
[% CASE 'OPAC' %]OPAC
|
|
[% CASE 'SIP' %]SIP
|
|
[% CASE 'COMMANDLINE' %]Command-line
|
|
[% CASE %][% interface %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
[% IF ( do_it ) %]
|
|
<a href="/cgi-bin/koha/tools/viewlog.pl">Logs</a> › Results
|
|
[% ELSE %]
|
|
Logs
|
|
[% END %]
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% IF ( CAN_user_reports ) %]
|
|
<h1>Browse system logs</h1>
|
|
<form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
|
|
[% IF ( do_it ) %]
|
|
<input type="hidden" name="do_it" value="[% do_it %]" />
|
|
[% END %]
|
|
<input type="hidden" name="src" value="[% src | html %]" />
|
|
<fieldset class="rows">
|
|
<ol>
|
|
<li>
|
|
<label for="user">Librarian:</label>
|
|
<input type="text" name="user" id="user" value="[% user | html %]" />
|
|
</li>
|
|
<li>
|
|
<label for="modules">Modules:</label>
|
|
<select name="modules" id="modules" multiple="multiple">
|
|
[% UNLESS modules %]
|
|
<option value="" selected="selected">All</option>
|
|
[% ELSE %]
|
|
<option value="">All</option>
|
|
[% END %]
|
|
[% FOREACH modx IN [ 'CATALOGUING' 'AUTHORITIES' 'MEMBERS' 'ACQUISITIONS' 'SERIAL' 'HOLDS' 'CIRCULATION' 'LETTER' 'FINES' 'SYSTEMPREFERENCE' 'CRONJOBS', 'REPORTS' ] %]
|
|
[% IF modules.grep(modx).size %]
|
|
<option value="[% modx %]" selected="selected">[% PROCESS translate_log_module module=modx %]</option>
|
|
[% ELSE %]
|
|
<option value="[% modx %]">[% PROCESS translate_log_module module=modx %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="actions">Actions:</label>
|
|
<select name="actions" id="actions" multiple="multiple">
|
|
[% UNLESS actions %]
|
|
<option value="" selected="selected">All</option>
|
|
[% ELSE %]
|
|
<option value="">All</option>
|
|
[% END %]
|
|
|
|
[% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'CHANGE PASS' 'Run' ] %]
|
|
[% IF actions.grep(actx).size %]
|
|
<option value="[% actx %]" selected="selected">[% PROCESS translate_log_action action=actx %]</option>
|
|
[% ELSE %]
|
|
<option value="[% actx %]">[% PROCESS translate_log_action action=actx %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="object">Object: </label>
|
|
<input type="text" id="object" name="object" value="[% object | html %]" />
|
|
</li>
|
|
<li>
|
|
<label for="info">Info:</label>
|
|
<input type="text" id="info" name="info" value="[% info | html %]" />
|
|
</li>
|
|
<li>
|
|
<label for="interfaces">Interface:</label>
|
|
<select name="interfaces" id="interfaces" multiple="multiple">
|
|
[% UNLESS interfaces %]
|
|
<option value="" selected="selected">All</option>
|
|
[% ELSE %]
|
|
<option value="">All</option>
|
|
[% END %]
|
|
|
|
[% FOREACH interf IN [ 'INTRANET' 'OPAC' 'SIP' 'COMMANDLINE' ] %]
|
|
[% IF interfaces.grep(interf).size %]
|
|
<option value="[% interf %]" selected="selected">[% PROCESS translate_log_interface interface=interf %]</option>
|
|
[% ELSE %]
|
|
<option value="[% interf %]">[% PROCESS translate_log_interface interface=interf %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="from"> Display from: </label> <input type="text" size="10" id="from" name="from" value="[% datefrom | html %]" class="datepickerfrom" />
|
|
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
|
</li>
|
|
<li>
|
|
<label for="to">Display to: </label> <input size="10" id="to" name="to" type="text" value="[% dateto | html %]" class="datepickerto" />
|
|
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="rows">
|
|
<legend>Output</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="screen" >To screen in the browser:</label> <input id="screen" type="radio" checked="checked" name="output" value="screen" />
|
|
</li>
|
|
<li>
|
|
<label for="file">To a file:</label>
|
|
<input id="file" type="radio" name="output" value="file" />
|
|
<label class="inline" for="basename">Named:</label>
|
|
<input type="text" name="basename" id="basename" value="Export" />
|
|
<!--
|
|
<label for="MIME" class="inline">Into an application:</label>
|
|
[% CGIextChoice %]
|
|
[% CGIsepChoice %]
|
|
-->
|
|
<input type="hidden" name="report_name" value="[% report_name %]" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" value="Submit" />
|
|
<input type="hidden" name="do_it" value="1" />
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
[% IF ( do_it ) %]
|
|
[% IF ( total ) %]
|
|
<h4>[% total %] lines found.</h4>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Date</th>
|
|
<th>Librarian</th>
|
|
<th>Module</th>
|
|
<th>Action</th>
|
|
<th>Object</th>
|
|
<th>Info</th>
|
|
<th>Interface</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH loopro IN looprow %]
|
|
<tr>
|
|
<td>[% loopro.timestamp %]</td>
|
|
<td>
|
|
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.user %]" title="display detail for this librarian."> [% IF ( loopro.userfirstname ) || ( loopro.usersurname ) %][% loopro.userfirstname %] [% loopro.usersurname %] ([% loopro.user %]) [% ELSE %][% loopro.user %][% END %]</a>
|
|
</td>
|
|
<td>[% PROCESS translate_log_module module=loopro.module %]</td>
|
|
<td>[% PROCESS translate_log_action action=loopro.action %]</td>
|
|
<td>
|
|
[% IF ( loopro.module == 'MEMBERS' ) || ( loopro.module == 'CIRCULATION' ) || ( loopro.module == 'FINES' ) %]
|
|
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loopro.object %]" title="Display member details."> [% IF ( loopro.object ) %][% IF ( loopro.borrowerfirstname ) || ( loopro.borrowersurname ) %][% loopro.borrowerfirstname %] [% loopro.borrowersurname %] ([% loopro.object %]) [% ELSE %]Member [% loopro.object %][% END %][% END %] </a>
|
|
[% ELSE %]
|
|
[% IF ( loopro.module == 'CATALOGUING' ) %]
|
|
[% IF ( loopro.info.substr(0, 4) == 'item' ) %]
|
|
<a href="/cgi-bin/koha/catalogue/moredetail.pl?item=[% loopro.object %]&biblionumber=[% loopro.biblionumber %]&bi=[% loopro.biblioitemnumber %]#item[% loopro.object %]">Item [% loopro.object %]</a>
|
|
[% ELSIF ( loopro.info.substr(0, 6) == 'biblio' ) %]
|
|
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loopro.object %]" title="Display detail for this biblio">Biblio [% loopro.object %]</a>
|
|
[% ELSE %]
|
|
[% loopro.object %]
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% IF ( loopro.module == 'SERIAL' ) %]
|
|
<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% loopro.object %]">Subscription [% loopro.object %] </a>
|
|
[% ELSE %]
|
|
[% IF ( loopro.module == 'AUTHORITIES' ) %]
|
|
<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% loopro.object %]" title="Display detail for this authority">Authority [% loopro.object %]</a>
|
|
[% ELSE %]
|
|
[% loopro.object %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF ( loopro.module == 'CIRCULATION' ) %]
|
|
<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% loopro.info %]&biblionumber=[% loopro.biblionumber %]&bi=[% loopro.biblioitemnumber %]#item[% loopro.info %]" title="Display detail for this item">Item [% loopro.barcode |html %]</a>
|
|
[% ELSE %]
|
|
[% loopro.info |html %]
|
|
[% END %]
|
|
</td>
|
|
<td>[% PROCESS translate_log_interface interface=loopro.interface %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% ELSE %]
|
|
<div class="dialog alert">
|
|
No log found
|
|
[% IF ( CATALOGUING ) %]
|
|
for <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% object | url %]">Bibliographic record [% object | html %]</a>
|
|
[% END %]
|
|
[% IF ( MEMBERS ) %]
|
|
for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% object | url %]">[% INCLUDE 'patron-title.inc' %]</a>
|
|
[% END %]
|
|
.
|
|
</div>
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="yui-b noprint">
|
|
[% IF ( menu ) %]
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
[% ELSE %]
|
|
[% IF ( CATALOGUING ) %]
|
|
[% INCLUDE 'biblio-view-menu.inc' %]
|
|
[% ELSE %]
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|