Bug 15801: Koha::BiblioFrameworks - Remove C4::Koha::getframeworkinfo
This was the "Get" subroutine for the framework, it can be easily replaced with a call to the Koha::BiblioFrameworks->find method. This patch also replaces some confusing wordings (framework vs frameworkcode). Test plan: On the circulation home page, you should see a "Fast cataloguing" link if the FA framework exists. Note that the admin/marctagstructure.pl has already been tested in the previous patch. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Link pops Ok No errors Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
8f436a5075
commit
c8f6794bb1
5 changed files with 29 additions and 52 deletions
29
C4/Koha.pm
29
C4/Koha.pm
|
@ -40,13 +40,12 @@ BEGIN {
|
|||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(
|
||||
&GetPrinters &GetPrinter
|
||||
&GetItemTypes &getitemtypeinfo
|
||||
&GetPrinters &GetPrinter
|
||||
&GetItemTypes &getitemtypeinfo
|
||||
&GetItemTypesCategorized &GetItemTypesByCategory
|
||||
&getframeworkinfo
|
||||
&getallthemes
|
||||
&getFacets
|
||||
&getnbpages
|
||||
&getallthemes
|
||||
&getFacets
|
||||
&getnbpages
|
||||
&get_infos_of
|
||||
&get_notforloan_label_of
|
||||
&getitemtypeimagedir
|
||||
|
@ -227,24 +226,6 @@ sub GetItemTypesByCategory {
|
|||
return @$tmp;
|
||||
}
|
||||
|
||||
=head2 getframeworkinfo
|
||||
|
||||
$frameworkinfo = &getframeworkinfo($frameworkcode);
|
||||
|
||||
Returns information about an frameworkcode.
|
||||
|
||||
=cut
|
||||
|
||||
sub getframeworkinfo {
|
||||
my ($frameworkcode) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth =
|
||||
$dbh->prepare("select * from biblio_framework where frameworkcode=?");
|
||||
$sth->execute($frameworkcode);
|
||||
my $res = $sth->fetchrow_hashref;
|
||||
return $res;
|
||||
}
|
||||
|
||||
=head2 getitemtypeinfo
|
||||
|
||||
$itemtype = &getitemtypeinfo($itemtype, [$interface]);
|
||||
|
|
|
@ -35,8 +35,6 @@ my $input = new CGI;
|
|||
my $frameworkcode = $input->param('frameworkcode') || ''; # set to select framework
|
||||
my $existingframeworkcode = $input->param('existingframeworkcode') || '';
|
||||
my $searchfield = $input->param('searchfield') || 0;
|
||||
# set when we have to create a new framework (in frameworkcode) by copying an old one (in existingframeworkcode)
|
||||
my $frameworkinfo = getframeworkinfo($frameworkcode);
|
||||
$searchfield=~ s/\,//g;
|
||||
|
||||
my $offset = $input->param('offset') || 0;
|
||||
|
@ -76,10 +74,10 @@ unless ($frameworkexist) {
|
|||
}
|
||||
}
|
||||
|
||||
my $framework = $frameworks->search({ frameworkcode => $frameworkcode })->next;
|
||||
$template->param(
|
||||
frameworks => $frameworks,
|
||||
frameworkcode => $frameworkcode,
|
||||
frameworktext => $frameworkinfo->{frameworktext},
|
||||
framework => $framework,
|
||||
script_name => $script_name,
|
||||
( $op || 'else' ) => 1,
|
||||
);
|
||||
|
@ -209,7 +207,6 @@ if ($op eq 'add_form') {
|
|||
}
|
||||
$template->param(existingframeworkloop => \@existingframeworkloop,
|
||||
frameworkcode => $frameworkcode,
|
||||
# FRtext => $frameworkinfo->{frameworktext},
|
||||
);
|
||||
################## DEFAULT ##################################
|
||||
} else { # DEFAULT
|
||||
|
|
|
@ -16,13 +16,12 @@
|
|||
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
||||
#
|
||||
|
||||
use strict;
|
||||
#use warnings; FIXME - Bug 2505
|
||||
use Modern::Perl;
|
||||
use CGI qw ( -utf8 );
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
use C4::Context;
|
||||
use C4::Koha;
|
||||
use Koha::BiblioFrameworks;
|
||||
|
||||
my $query = new CGI;
|
||||
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user(
|
||||
|
@ -36,8 +35,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user(
|
|||
);
|
||||
|
||||
# Checking if there is a Fast Cataloging Framework
|
||||
my $fa = getframeworkinfo('FA');
|
||||
$template->param( fast_cataloging => 1 ) if (defined $fa);
|
||||
$template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );
|
||||
|
||||
# Checking if the transfer page needs to be displayed
|
||||
$template->param( display_transfer => 1 ) if ( ($flags->{'superlibrarian'} == 1) || (C4::Context->preference("IndependentBranches") == 0) );
|
||||
|
|
|
@ -47,6 +47,7 @@ use Koha::Patron;
|
|||
use Koha::Patron::Debarments qw(GetDebarments);
|
||||
use Koha::DateUtils;
|
||||
use Koha::Database;
|
||||
use Koha::BiblioFrameworks;
|
||||
use Koha::Patron::Messages;
|
||||
use Koha::Patron::Images;
|
||||
use Koha::SearchEngine;
|
||||
|
@ -580,7 +581,7 @@ my $patron_messages = Koha::Patron::Messages->search(
|
|||
);
|
||||
|
||||
my $fast_cataloging = 0;
|
||||
if (defined getframeworkinfo('FA')) {
|
||||
if ( Koha::BiblioFrameworks->find('FA') ) {
|
||||
$fast_cataloging = 1
|
||||
}
|
||||
|
||||
|
|
|
@ -38,15 +38,15 @@ $(document).ready(function() {
|
|||
› <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
||||
› <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
|
||||
[% IF ( add_form ) %]
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framework.frameworktext %] ([% framework.frameworkcode %])</a>
|
||||
› [% action %] [% searchfield %]
|
||||
[% ELSIF ( else ) %]
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
|
||||
[% ELSIF ( delete_confirm ) %]
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framwork.frameworktext %] ([% framework.frameworkcode %])</a>
|
||||
› Confirm deletion of tag '[% searchfield %]'
|
||||
[% ELSIF ( delete_confirmed ) %]
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
|
||||
› <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% framework.frameworktext %] ([% framework.frameworkcode %])</a>
|
||||
› Data deleted
|
||||
[% END %]
|
||||
</div>
|
||||
|
@ -58,17 +58,17 @@ $(document).ready(function() {
|
|||
|
||||
[% IF ( else ) %]
|
||||
<div id="toolbar" class="btn-toolbar">
|
||||
<a class="btn btn-small" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&frameworkcode=[% frameworkcode %]"><i class="fa fa-plus"></i> New tag</a>
|
||||
<a class="btn btn-small" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&frameworkcode=[% framework.frameworkcode %]"><i class="fa fa-plus"></i> New tag</a>
|
||||
</div>[% END %]
|
||||
|
||||
<h1>MARC Framework for [% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1>
|
||||
<h1>MARC Framework for [% IF framework %][% framework.frameworktext %] ([% framework.frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1>
|
||||
|
||||
[% IF ( add_form ) %]
|
||||
|
||||
<form action="[% script_name %]" name="Aform" method="post" class="validated">
|
||||
|
||||
<fieldset class="rows"><legend>[% IF ( use_heading_flags_p ) %][% IF ( heading_modify_tag_p ) %]Modify tag <input type="hidden" name="modif" value="1" />[% searchfield %][% END %][% IF ( heading_add_tag_p ) %]Add tag[% END %][% ELSE %][% action %][% END %]</legend> <input type="hidden" name="op" value="add_validate" />
|
||||
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
|
||||
<input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
|
@ -112,7 +112,7 @@ $(document).ready(function() {
|
|||
</ol></fieldset>
|
||||
<fieldset class="action">
|
||||
<input type="submit" value="Save changes" />
|
||||
<a class="cancel" href="[% script_name %]?frameworkcode=[% frameworkcode %]">Cancel</a>
|
||||
<a class="cancel" href="[% script_name %]?frameworkcode=[% framework.frameworkcode %]">Cancel</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
[% END %]
|
||||
|
@ -126,10 +126,10 @@ $(document).ready(function() {
|
|||
<form action="[% script_name %]" method="post">
|
||||
<input type="hidden" name="op" value="delete_confirmed" />
|
||||
<input type="hidden" name="searchfield" value="[% searchfield %]" />
|
||||
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
|
||||
<input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
|
||||
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this tag</button>
|
||||
</form>
|
||||
<form action="[% script_name %]" method="get"><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
|
||||
<form action="[% script_name %]" method="get"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
|
||||
<button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -138,7 +138,7 @@ $(document).ready(function() {
|
|||
[% IF ( delete_confirmed ) %]
|
||||
|
||||
<div class="dialog message"><h3>Tag deleted</h3>
|
||||
<form action="[% script_name %]" method="post"><input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
|
||||
<form action="[% script_name %]" method="post"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
|
||||
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
|
||||
</form></div>
|
||||
[% END %]
|
||||
|
@ -146,8 +146,8 @@ $(document).ready(function() {
|
|||
|
||||
<form action="[% script_name %]" method="post">
|
||||
<input type="hidden" name="op" value="framework_create_confirm" />
|
||||
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
|
||||
Create framework for [% frameworkcode %] ([% frameworktext %]) using
|
||||
<input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
|
||||
Create framework for [% frameworkcode %] ([% framework.frameworktext %]) using
|
||||
<select name="existingframeworkcode">
|
||||
<option value="">Default</option>
|
||||
[% FOREACH existingframeworkloo IN existingframeworkloop %]
|
||||
|
@ -168,11 +168,11 @@ $(document).ready(function() {
|
|||
<label for="frameworkcode"><strong>In framework:</strong> </label>
|
||||
<select id="frameworkcode" name="frameworkcode">
|
||||
<option value="">Default</option>
|
||||
[% FOREACH framework IN frameworks %]
|
||||
[% IF framework.frameworkcode == frameworkcode %]
|
||||
<option value="[% framework.frameworkcode %]" selected="selected">[% framework.frameworktext %]</option>
|
||||
[% FOREACH f IN frameworks %]
|
||||
[% IF f.frameworkcode == framework.frameworkcode %]
|
||||
<option value="[% f.frameworkcode %]" selected="selected">[% f.frameworktext %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% framework.frameworkcode %]">[% framework.frameworktext %]</option>
|
||||
<option value="[% f.frameworkcode %]">[% f.frameworktext %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
|
|
Loading…
Reference in a new issue