#!/usr/bin/perl
# Copyright 2000-2002 Katipo Communications
+# Copyright 2015 Koha Development Team
#
# This file is part of Koha.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-=head1 branches.pl
-
- FIXME: individual fields in branch address need to be exported to templates,
- in order to fix bug 180; need to notify translators
- FIXME: looped html (e.g., list of checkboxes) need to be properly
- TMPL_LOOP'ized; doing this properly will fix bug 130; need to
- notify translators
- FIXME: need to implement the branch categories stuff
- FIXME: there are too many TMPL_IF's; the proper way to do it is to have
- separate templates for each individual action; need to notify
- translators
- FIXME: there are lots of error messages exported to the template; a lot
- of these should be converted into exported booleans / counters etc
- so that the error messages can be localized; need to notify translators
-
- Finlay working on this file from 26-03-2002
- Reorganising this branches admin page.....
-
-=cut
-
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Koha;
-use C4::Branch;
-
-# Fixed variables
-my $script_name = "/cgi-bin/koha/admin/branches.pl";
+use Koha::Borrowers;
+use Koha::Items;
+use Koha::Libraries;
+use Koha::LibraryCategories;
-################################################################################
-# Main loop....
my $input = new CGI;
my $branchcode = $input->param('branchcode');
-my $branchname = $input->param('branchname');
my $categorycode = $input->param('categorycode');
-my $op = $input->param('op') || '';
+my $op = $input->param('op') || 'list';
+my @messages;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
- {
- template_name => "admin/branches.tt",
+ { template_name => "admin/branches.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { parameters => 'parameters_remaining_permissions'},
+ flagsrequired => { parameters => 'parameters_remaining_permissions' },
debug => 1,
}
);
-$template->param(
- script_name => $script_name,
- action => $script_name,
-);
-$template->param( ($op || 'else') => 1 );
-
-if ( $op eq 'add' ) {
- # If the user has pressed the "add new branch" button.
- $template->param( 'heading_branches_add_branch_p' => 1 );
- editbranchform($branchcode,$template);
-
-}
-elsif ( $op eq 'edit' ) {
+if ( $op eq 'add_form' ) {
+ my $library;
+ if ($branchcode) {
+ $library = Koha::Libraries->find($branchcode);
+ }
- # if the user has pressed the "edit branch settings" button.
- $template->param( 'heading_branches_add_branch_p' => 0,
- 'add' => 1, );
- editbranchform($branchcode,$template);
-}
-elsif ( $op eq 'add_validate' ) {
+ $template->param(
+ library => $library,
+ categories => [ Koha::LibraryCategories->search( {}, { order_by => [ 'categorytype', 'categoryname' ] } ) ],
+ $library ? ( selected_categorycodes => [ map { $_->categorycode } $library->get_categories ] ) : (),
+ );
+} elsif ( $op eq 'add_validate' ) {
+ my @fields = qw(
+ branchname
+ branchaddress1
+ branchaddress2
+ branchaddress3
+ branchzip
+ branchcity
+ branchstate
+ branchcountry
+ branchphone
+ branchfax
+ branchemail
+ branchreplyto
+ branchreturnpath
+ branchurl
+ issuing
+ branchip
+ branchnotes
+ opac_info
+ );
+ my $is_a_modif = $input->param('is_a_modif');
- # confirm settings change...
- my $params = $input->Vars;
- unless ( $params->{'branchcode'} && $params->{'branchname'} ) {
- $template->param( else => 1 );
- default("MESSAGE1",$template);
+ my @categories;
+ for my $category ( Koha::LibraryCategories->search ) {
+ push @categories, $category
+ if $input->param( "selected_categorycode_" . $category->categorycode );
}
- else {
- my $mod_branch = 1;
- if ($params->{add}) {
- my ($existing) =
- C4::Context->dbh->selectrow_array("SELECT count(*) FROM branches WHERE branchcode = ?", {}, $branchcode);
- if ($existing > 0) {
- $mod_branch = 0;
- _branch_to_template($params, $template); # preserve most (FIXME) of user's input
- $template->param( 'heading_branches_add_branch_p' => 1, 'add' => 1, 'ERROR1' => 1 );
- }
+ if ($is_a_modif) {
+ my $library = Koha::Libraries->find($branchcode);
+ for my $field (@fields) {
+ $library->$field( $input->param($field) );
+ }
+ $library->update_categories( \@categories );
+
+ eval { $library->store; };
+ if ($@) {
+ push @messages, { type => 'error', code => 'error_on_update' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_update' };
}
- if ($mod_branch) {
- my $error = ModBranch($params); # FIXME: causes warnings to log on duplicate branchcode
- # if error saving, stay on edit and rise error
- if ($error) {
- # copy input parameters back to form
- # FIXME - doing this doesn't preserve any branch group selections, but good enough for now
- editbranchform($branchcode,$template);
- $template->param( 'heading_branches_add_branch_p' => 1, 'add' => 1, "ERROR$error" => 1 );
- } else {
- $template->param( else => 1);
- default("MESSAGE2",$template);
+ } else {
+ $branchcode =~ s|\s||g;
+ my $library = Koha::Library->new(
+ { branchcode => $branchcode,
+ ( map { $_ => $input->param($_) || undef } @fields )
}
+ );
+ eval { $library->store; };
+ $library->add_to_categories( \@categories );
+ if ($@) {
+ push @messages, { type => 'error', code => 'error_on_insert' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_insert' };
}
}
-}
-elsif ( $op eq 'delete' ) {
- # if the user has pressed the "delete branch" button.
-
- # check to see if the branchcode is being used in the database somewhere....
- my $dbh = C4::Context->dbh;
- my $sthitems = $dbh->prepare("select count(*) from items where holdingbranch=? or homebranch=?");
- my $sthborrowers = $dbh->prepare("select count(*) from borrowers where branchcode=?");
- $sthitems->execute( $branchcode, $branchcode );
- $sthborrowers->execute( $branchcode );
- my ($totalitems) = $sthitems->fetchrow_array;
- my ($totalborrowers) = $sthborrowers->fetchrow_array;
- if ($totalitems && !$totalborrowers) {
- $template->param( else => 1 );
- default("MESSAGE10", $template);
- }
- elsif (!$totalitems && $totalborrowers){
- $template->param( else => 1 );
- default("MESSAGE11", $template);
- }
- elsif ($totalitems && $totalborrowers){
- $template->param( else => 1 );
- default("MESSAGE7", $template);
- }
- else {
- $template->param( delete_confirm => 1 );
- $template->param( branchname => $branchname );
- $template->param( branchcode => $branchcode );
- }
-}
-elsif ( $op eq 'delete_confirmed' ) {
-
- # actually delete branch and return to the main screen....
- DelBranch($branchcode);
- $template->param( else => 1 );
- default("MESSAGE3",$template);
-}
-elsif ( $op eq 'editcategory' ) {
-
- # If the user has pressed the "add new category" or "modify" buttons.
- $template->param( 'heading_branches_edit_category_p' => 1 );
- editcatform($categorycode,$template);
-}
-elsif ( $op eq 'addcategory_validate' ) {
-
- $template->param( else => 1 );
- # confirm settings change...
- my $params = $input->Vars;
- $params->{'show_in_pulldown'} = ( $params->{'show_in_pulldown'} eq 'on' ) ? 1 : 0;
-
- unless ( $params->{'categorycode'} && $params->{'categoryname'} ) {
- default("MESSAGE4",$template);
- }
- elsif ($input->param('add')){
- # doing an add must check the code is unique
- if (CheckCategoryUnique($input->param('categorycode'))){
- ModBranchCategoryInfo($params);
- default("MESSAGE5",$template);
- }
- else {
- default("MESSAGE9",$template);
- }
- }
- else {
- ModBranchCategoryInfo($params);
- default("MESSAGE5",$template);
- }
-}
-elsif ( $op eq 'delete_category' ) {
-
- # if the user has pressed the "delete branch" button.
- if ( CheckBranchCategorycode($categorycode) ) {
- $template->param( else => 1 );
- default( 'MESSAGE8', $template );
+ $op = 'list';
+} elsif ( $op eq 'delete_confirm' ) {
+ my $library = Koha::Libraries->find($branchcode);
+ my $items_count = Koha::Items->search(
+ { -or => {
+ holdingbranch => $branchcode,
+ homebranch => $branchcode
+ },
+ }
+ )->count;
+ my $patrons_count = Koha::Borrowers->search( { branchcode => $branchcode, } )->count;
+
+ if ( $items_count or $patrons_count ) {
+ push @messages,
+ { type => 'error',
+ code => 'cannot_delete_library',
+ data => {
+ items_count => $items_count,
+ patrons_count => $patrons_count,
+ },
+ };
+ $op = 'list';
} else {
- $template->param( delete_category => 1 );
- $template->param( categorycode => $categorycode );
+ $template->param(
+ library => $library,
+ items_count => $items_count,
+ patrons_count => $patrons_count,
+ );
}
-}
-elsif ( $op eq 'categorydelete_confirmed' ) {
-
- # actually delete branch and return to the main screen....
- DelBranchCategory($categorycode);
- $template->param( else => 1 );
- default("MESSAGE6",$template);
+} elsif ( $op eq 'delete_confirmed' ) {
+ my $library = Koha::Libraries->find($branchcode);
-}
-else {
- # if no operation has been set...
- default("",$template);
-}
+ my $deleted = eval { $library->delete; };
-################################################################################
-#
-# html output functions....
-
-sub default {
- my $message = shift || '';
- my $innertemplate = shift or return;
- $innertemplate->param($message => 1) if $message;
- $innertemplate->param(
- 'heading_branches_p' => 1,
+ if ( $@ or not $deleted ) {
+ push @messages, { type => 'error', code => 'error_on_delete' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_delete' };
+ }
+ $op = 'list';
+} elsif ( $op eq 'add_form_category' ) {
+ my $category;
+ if ($categorycode) {
+ $category = Koha::LibraryCategories->find($categorycode);
+ }
+ $template->param( category => $category, );
+} elsif ( $op eq 'add_validate_category' ) {
+ my $is_a_modif = $input->param('is_a_modif');
+ my @fields = qw(
+ categoryname
+ codedescription
+ categorytype
);
- branchinfotable("",$innertemplate);
-}
-
-sub editbranchform {
- my ($branchcode,$innertemplate) = @_;
- # initiate the scrolling-list to select the printers
- my $printers = GetPrinters();
- my @printerloop;
- my $data;
- my $oldprinter = "";
-
-
- # make the checkboxes.....
- my $catinfo = GetBranchCategories();
-
- if ($branchcode) {
- $data = GetBranchInfo($branchcode);
- $data = $data->[0];
- if ( exists $data->{categories} ) {
- # Set the selected flag for the categories of this branch
- $catinfo = [
- map {
- my $catcode = $_->{categorycode};
- if ( grep {/$catcode/} @{$data->{categories}} ){
- $_->{selected} = 1;
- }
- $_;
- } @{$catinfo}
- ];
+ if ($is_a_modif) {
+ my $category = Koha::LibraryCategories->find($categorycode);
+ for my $field (@fields) {
+ $category->$field( $input->param($field) );
+ }
+ $category->show_in_pulldown( $input->param('show_in_pulldown') eq 'on' );
+ eval { $category->store; };
+ if ($@) {
+ push @messages, { type => 'error', code => 'error_on_update_category' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_update_category' };
+ }
+ } else {
+ my $category = Koha::LibraryCategory->new(
+ { categorycode => $categorycode,
+ ( map { $_ => $input->param($_) || undef } @fields )
+ }
+ );
+ $category->show_in_pulldown( $input->param('show_in_pulldown') eq 'on' );
+ eval { $category->store; };
+ if ($@) {
+ push @messages, { type => 'error', code => 'error_on_insert_category' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_insert_category' };
}
-
- # get the old printer of the branch
- $oldprinter = $data->{'branchprinter'} || '';
- _branch_to_template($data, $innertemplate);
- }
- $innertemplate->param( categoryloop => $catinfo );
-
- foreach my $thisprinter ( keys %$printers ) {
- push @printerloop, {
- value => $thisprinter,
- selected => ( $oldprinter eq $printers->{$thisprinter} ),
- branchprinter => $printers->{$thisprinter}->{'printqueue'},
- };
}
-
- $innertemplate->param( printerloop => \@printerloop );
-
- for my $obsolete ( 'categoryname', 'categorycode', 'codedescription' ) {
- $innertemplate->param(
- $obsolete => 'Your template is out of date (bug 130)' );
+ $op = 'list';
+} elsif ( $op eq 'delete_confirm_category' ) {
+ my $category = Koha::LibraryCategories->find($categorycode);
+ if ( my $libraries_count = scalar( $category->branchcodes ) ) {
+ push @messages,
+ { type => 'error',
+ code => 'cannot_delete_category',
+ data => { libraries_count => $libraries_count, },
+ };
+ $op = 'list';
+ } else {
+ $template->param( category => $category );
}
-}
-
-sub editcatform {
+} elsif ( $op eq 'delete_confirmed_category' ) {
+ my $category = Koha::LibraryCategories->find($categorycode);
+ my $deleted = eval { $category->delete; };
- # prepares the edit form...
- my ($categorycode,$innertemplate) = @_;
- # warn "cat : $categorycode";
- my @cats;
- my $data;
- if ($categorycode) {
- $data = GetBranchCategory($categorycode);
- $innertemplate->param(
- categorycode => $data->{'categorycode'},
- categoryname => $data->{'categoryname'},
- codedescription => $data->{'codedescription'},
- show_in_pulldown => $data->{'show_in_pulldown'},
- );
+ if ( $@ or not $deleted ) {
+ push @messages, { type => 'error', code => 'error_on_delete_category' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_delete_category' };
}
- for my $ctype (GetCategoryTypes()) {
- push @cats , { type => $ctype , selected => ($data->{'categorytype'} and $data->{'categorytype'} eq $ctype) };
- }
- $innertemplate->param(categorytype => \@cats);
+ $op = 'list';
+} else {
+ $op = 'list';
}
-sub branchinfotable {
-
-# makes the html for a table of branch info from reference to an array of hashs.
-
- my ($branchcode,$innertemplate) = @_;
- my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
- my @loop_data = ();
- foreach my $branch (@$branchinfo) {
- #
- # We export the following fields to the template. These are not
- # pre-composed as a single "address" field because the template
- # might (and should) escape what is exported here. (See bug 180)
- #
- # - branch_name (Note: not "branchname")
- # - branch_code (Note: not "branchcode")
- # - address (containing a static error message)
- # - branchaddress1 \
- # - branchaddress2 |
- # - branchaddress3 | comprising the old "address" field
- # - branchzip |
- # - branchcity |
- # - branchcountry |
- # - branchphone |
- # - branchfax |
- # - branchemail /
- # - branchurl /
- # - opac_info (can contain HTML)
- # - address-empty-p (1 if no address information, 0 otherwise)
- # - categories (containing a static error message)
- # - category_list (loop containing "categoryname")
- # - no-categories-p (1 if no categories set, 0 otherwise)
- # - value
- #
- my %row = ();
-
- # Handle address fields separately
- my $address_empty_p = 1;
- for my $field (
- 'branchaddress1', 'branchaddress2',
- 'branchaddress3', 'branchzip',
- 'branchcity', 'branchstate', 'branchcountry',
- 'branchphone', 'branchfax',
- 'branchemail', 'branchurl', 'opac_info',
- 'branchip', 'branchprinter', 'branchnotes'
- )
- {
- $row{$field} = $branch->{$field};
- $address_empty_p = 0 if ( $branch->{$field} );
- }
- $row{'address-empty-p'} = $address_empty_p;
-
- # Handle categories
- my $no_categories_p = 1;
- my @categories;
- foreach my $cat ( @{ $branch->{'categories'} } ) {
- my $catinfo = GetBranchCategory($cat);
- push @categories, { 'categoryname' => $catinfo->{'categoryname'} };
- $no_categories_p = 0;
- }
-
- $row{'category_list'} = \@categories;
- $row{'no-categories-p'} = $no_categories_p;
- $row{'branch_name'} = $branch->{'branchname'};
- $row{'branch_code'} = $branch->{'branchcode'};
- $row{'value'} = $branch->{'branchcode'};
-
- push @loop_data, \%row;
- }
- my @branchcategories = ();
- for my $ctype ( GetCategoryTypes() ) {
- my $catinfo = GetBranchCategories($ctype);
- my @categories;
- foreach my $cat (@$catinfo) {
- push @categories, {
- categoryname => $cat->{'categoryname'},
- categorycode => $cat->{'categorycode'},
- codedescription => $cat->{'codedescription'},
- categorytype => $cat->{'categorytype'},
- };
- }
- push @branchcategories, { categorytype => $ctype , $ctype => 1 , catloop => ( @categories ? \@categories : undef) };
- }
- $innertemplate->param(
- branches => \@loop_data,
- branchcategories => \@branchcategories
+if ( $op eq 'list' ) {
+ my $libraries = Koha::Libraries->search( {}, { order_by => ['branchcode'] }, );
+ $template->param(
+ libraries => $libraries,
+ group_types => [
+ { categorytype => 'searchdomain',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'searchdomain' } ) ],
+ },
+ { categorytype => 'properties',
+ categories => [ Koha::LibraryCategories->search( { categorytype => 'properties' } ) ],
+ },
+ ]
);
-
}
-sub _branch_to_template {
- my ($data, $template) = @_;
- $template->param(
- branchcode => $data->{'branchcode'},
- branch_name => $data->{'branchname'},
- branchaddress1 => $data->{'branchaddress1'},
- branchaddress2 => $data->{'branchaddress2'},
- branchaddress3 => $data->{'branchaddress3'},
- branchzip => $data->{'branchzip'},
- branchcity => $data->{'branchcity'},
- branchstate => $data->{'branchstate'},
- branchcountry => $data->{'branchcountry'},
- branchphone => $data->{'branchphone'},
- branchfax => $data->{'branchfax'},
- branchemail => $data->{'branchemail'},
- branchreplyto => $data->{'branchreplyto'},
- branchreturnpath => $data->{'branchreturnpath'},
- branchurl => $data->{'branchurl'},
- opac_info => $data->{'opac_info'},
- branchip => $data->{'branchip'},
- branchnotes => $data->{'branchnotes'},
- );
-}
+$template->param(
+ messages => \@messages,
+ op => $op,
+);
output_html_with_http_headers $input, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 8
-# End:
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Libraries and groups
-[% IF ( editcategory ) %]
- ›[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]New group[% END %]
-[% ELSIF ( delete_category ) %]
- › Confirm deletion of group [% categorycode %]
-[% ELSIF ( add ) %]
- ›[% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library [% branchcode %][% END %]
-[% ELSIF ( delete_confirm ) %]
- › Confirm deletion of library '[% branchcode %]'
+[% IF op == 'editcategory' %]
+ ›[% IF category.categorycode %]Edit group [% category.categorycode%][% ELSE %]New group[% END %]
+[% ELSIF op == 'delete_confirm_category' %]
+ › Confirm deletion of group [% category.categorycode %]
+[% ELSIF op == 'add_form' %]
+ ›[% IF library %]Modify library[% ELSE %]New library [% library.branchcode %][% END %]
+[% ELSIF op == 'delete_confirm' %]
+ › Confirm deletion of library '[% library.branchcode %]'
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
"sPaginationType": "four_button"
}));
- [% IF ( heading_branches_add_branch_p ) %]
+ [% UNLESS library %]
$("#Aform").on("submit", function( event ) {
if ( $("#branchcode").val().match(/\s/) ) {
event.preventDefault();
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
› <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
› <a href="/cgi-bin/koha/admin/branches.pl">Libraries and groups</a>
-[% IF ( editcategory ) %]
-› [% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]New group[% END %]
-[% ELSIF ( delete_category ) %]
-› Confirm deletion of group [% categorycode %]
-[% ELSIF ( add ) %]
-› [% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library [% branchcode %][% END %]
-[% ELSIF ( delete_confirm ) %]
-› Confirm deletion of library '[% branchcode %]'
+[% IF op == 'add_form_category' %]
+› [% IF category.categorycode %]Edit group [% category.categorycode %][% ELSE %]New group[% END %]
+[% ELSIF op == 'delete_confirm_category' %]
+› Confirm deletion of group [% category.categorycode %]
+[% ELSIF op == 'add_form' %]
+› [% IF library %]Modify library[% ELSE %]New library [% library.branchcode %][% END %]
+[% ELSIF op == 'delete_confirm' %]
+› Confirm deletion of library '[% library.branchcode %]'
[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
- <div id="yui-main">
- <div class="yui-b">
- [% IF ( else ) %]
+ <div id="yui-main">
+ <div class="yui-b">
+
+[% FOR m IN messages %]
+ <div class="dialog [% m.type %]">
+ [% SWITCH m.code %]
+ [% CASE 'error_on_update' %]
+ An error occurred when updating this library. Perhaps it already exists.
+ [% CASE 'error_on_insert' %]
+ An error occurred when adding this library. The branchcode might already exist.
+ [% CASE 'error_on_delete' %]
+ An error occurred when deleting this library. Check the logs.
+ [% CASE 'success_on_update' %]
+ Library updated successfully.
+ [% CASE 'success_on_insert' %]
+ Library added successfully.
+ [% CASE 'success_on_delete' %]
+ Library deleted successfully.
+ [% CASE 'cannot_delete_library' %]
+ This library cannot be deleted. Patrons or items are still using it
+ [% IF m.data.patrons_count and m.data.items_count %]
+ ([% m.data.patrons_count %] patrons and [% m.data.items_count %] items).
+ [% ELSIF m.data.patrons_count %]
+ ([% m.data.patrons_count %] patrons).
+ [% ELSIF m.data.items_count %]
+ ([% m.data.items_count %] items).
+ [% END %]
+ [% CASE 'error_on_update_category' %]
+ An error occurred when updating this library category. Perhaps it already exists.
+ [% CASE 'error_on_insert_category' %]
+ An error occurred when adding this library category. The categorycode might already exist.
+ [% CASE 'error_on_delete_category' %]
+ An error occurred when deleting this library category. Check the logs.
+ [% CASE 'success_on_update_category' %]
+ Library category updated successfully.
+ [% CASE 'success_on_insert_category' %]
+ Library category added successfully.
+ [% CASE 'success_on_delete_category' %]
+ Library category deleted successfully.
+ [% CASE 'cannot_delete_category' %]
+ This library category cannot be deleted. [% m.data.libraries_count %] libraries are still using it.
+ [% CASE %]
+ [% m.code %]
+ [% END %]
+ </div>
+[% END %]
+
+[% IF op == 'list' %]
<div id="toolbar" class="btn-toolbar">
- <a class="btn btn-small" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add"><i class="fa fa-plus"></i> New library</a>
- <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/branches.pl?op=editcategory"><i class="fa fa-plus"></i> New group</a>
+ <a class="btn btn-small" id="newbranch" href="/cgi-bin/koha/admin/branches.pl?op=add_form"><i class="fa fa-plus"></i> New library</a>
+ <a class="btn btn-small" id="newcategory" href="/cgi-bin/koha/admin/branches.pl?op=add_form_category"><i class="fa fa-plus"></i> New group</a>
</div>
[% END %]
-[% IF ( add ) %]
- [% IF ( ERROR1 ) %]<div class="dialog message">Library with that code already exists — Please enter a unique code</div>[% END %]
- <h3>[% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library[% END %]</h3>
- <form action="[% action %]" id="Aform" name="Aform" class="validated" method="post">
- <fieldset class="rows">
- <input type="hidden" name="op" value="add_validate" />
- [% IF ( heading_branches_add_branch_p ) %]
- <input type="hidden" name="add" value="1" />
- [% ELSE %]
- <input type="hidden" name="add" value="0" />
- [% END %]
- <ol><li>
- [% IF ( heading_branches_add_branch_p ) %]
- <label for="branchcode" class="required">Library code: </label>
- <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% branchcode |html %]" class="required" required="required" /> <span class="required">Required</span>
- [% ELSE %]
- <span class="label">Library code: </span>
- <input type="hidden" name="branchcode" value="[% branchcode |html %]" />
- [% branchcode %]
+[% IF op == 'add_form' %]
+ <h3>[% IF library %]Modify library[% ELSE %]New library[% END %]</h3>
+ <form action="/cgi-bin/koha/admin/branches.pl" id="Aform" name="Aform" class="validated" method="post">
+ <fieldset class="rows">
+ <input type="hidden" name="op" value="add_validate" />
+ [% IF library %]
+ <input type="hidden" name="is_a_modif" value="1" />
[% END %]
- </li>
- <li>
- <label for="branchname" class="required">Name: </label>
- <input type="text" name="branchname" id="branchname" size="80" value="[% branch_name |html %]" class="required" required="required" /> <span class="required">Required</span>
- </li>
- </ol>
- </fieldset>
- [% IF ( categoryloop ) %]<fieldset class="rows"><legend>Group(s):</legend>
- <ol>
- [% FOREACH categoryloo IN categoryloop %]
- <li><label for="[% categoryloo.categorycode %]">[% categoryloo.categoryname %]: </label>
- [% IF categoryloo.selected %]
- <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" checked="checked" />
- [% ELSE %]
- <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" />
- [% END %]
- <span class="hint">[% categoryloo.codedescription %]</span>
- </li>
+ <ol>
+ <li>
+ [% IF library %]
+ <span class="label">Library code: </span>
+ <input type="hidden" name="branchcode" value="[% library.branchcode |html %]" />
+ [% library.branchcode %]
+ [% ELSE %]
+ <label for="branchcode" class="required">Library code: </label>
+ <input type="text" name="branchcode" id="branchcode" size="10" maxlength="10" value="[% library.branchcode |html %]" class="required" required="required" />
+ <span class="required">Required</span>
+ [% END %]
+ </li>
+ <li>
+ <label for="branchname" class="required">Name: </label>
+ <input type="text" name="branchname" id="branchname" size="80" value="[% library.branchname |html %]" class="required" required="required" />
+ <span class="required">Required</span>
+ </li>
+ </ol>
+ </fieldset>
+ [% IF categories %]
+ <fieldset class="rows"><legend>Group(s):</legend>
+ <ol>
+ [% FOREACH category IN categories %]
+ <li>
+ <label for="[% category.categorycode %]">[% category.categoryname %]: </label>
+ [% IF category and selected_categorycodes.grep(category.categorycode).size %]
+ <input type="checkbox" id="[% category.categorycode %]" name="selected_categorycode_[% category.categorycode %]" checked="checked" />
+ [% ELSE %]
+ <input type="checkbox" id="[% category.categorycode %]" name="selected_categorycode_[% category.categorycode %]" />
+ [% END %]
+ <span class="hint">[% category.codedescription %]</span>
+ </li>
+ [% END %]
+ </ol>
+ </fieldset>
[% END %]
- </ol>
-</fieldset>[% END %]
- <fieldset class="rows">
- <ol>
- <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% branchaddress1 |html %]" /></li>
- <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% branchaddress2 |html %]" /></li>
- <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% branchaddress3 |html %]" /></li>
- <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% branchcity |html %]" /></li>
- <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% branchstate |html %]" /></li>
- <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip" size="25" maxlength="25" value="[% branchzip |html %]" /></li>
- <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% branchcountry |html %]" /></li>
- <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% branchphone |html %]" /></li>
- <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% branchfax |html %]" /></li>
- <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% branchemail |html %]" /></li>
- <li><label for="branchreplyto">Reply-To (if different to Email): </label> <input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% branchreplyto |html %]" /></li>
- <li><label for="branchreturnpath">Return-Path (if different to Email): </label> <input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% branchreturnpath |html %]" /></li>
- <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" size="80" value="[% branchurl |html %]" class="url" /></li>
- <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
- <li><label for="branchip">IP: </label><input type="text" name="branchip" id="branchip" size="15" maxlength="15" value="[% branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
- <!--
- <li><label for="branchprinter">Library Printer: </label>
- <select id="branchprinter" name="branchprinter">
- <option value="">None</option>
- [% FOREACH printerloo IN printerloop %]
- [% IF ( printerloo.selected ) %]
- <option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
- [% ELSE %]
- <option value="[% printerloo.value %]">[% printerloo.branchprinter %]</option>
- [% END %]
- [% END %]
- </select></li>
- -->
- <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% branchnotes |html %]" /></li>
- </ol>
+ <fieldset class="rows">
+ <ol>
+ <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% library.branchaddress1 |html %]" /></li>
+ <li><label for="branchaddress2">Address line 2: </label><input type="text" name="branchaddress2" id="branchaddress2" size="60" value="[% library.branchaddress2 |html %]" /></li>
+ <li><label for="branchaddress3">Address line 3: </label><input type="text" name="branchaddress3" id="branchaddress3" size="60" value="[% library.branchaddress3 |html %]" /></li>
+ <li><label for="branchcity">City: </label><input type="text" name="branchcity" id="branchcity" size="60" value="[% library.branchcity |html %]" /></li>
+ <li><label for="branchstate">State: </label><input type="text" name="branchstate" id="branchstate" size="60" value="[% library.branchstate |html %]" /></li>
+ <li><label for="branchzip">ZIP/Postal code: </label><input type="text" name="branchzip" id="branchzip" size="25" maxlength="25" value="[% library.branchzip |html %]" /></li>
+ <li><label for="branchcountry">Country: </label><input type="text" name="branchcountry" id="branchcountry" size="60" value="[% library.branchcountry |html %]" /></li>
+ <li><label for="branchphone">Phone: </label><input type="text" name="branchphone" id="branchphone" size="60" value="[% library.branchphone |html %]" /></li>
+ <li><label for="branchfax">Fax: </label><input type="text" name="branchfax" id="branchfax" size="60" value="[% library.branchfax |html %]" /></li>
+ <li><label for="branchemail">Email: </label><input type="text" name="branchemail" id="branchemail" class="email" size="80" value="[% library.branchemail |html %]" /></li>
+ <li><label for="branchreplyto">Reply-To (if different to Email): </label> <input type="text" name="branchreplyto" id="branchreplyto" class="email" size="80" value="[% library.branchreplyto |html %]" /></li>
+ <li><label for="branchreturnpath">Return-Path (if different to Email): </label> <input type="text" name="branchreturnpath" id="branchreturnpath" class="email" size="80" value="[% library.branchreturnpath |html %]" /></li>
+ <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" size="80" value="[% library.branchurl |html %]" class="url" /></li>
+ <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% library.opac_info |html %]</textarea></li>
+ <li><label for="branchip">IP: </label><input type="text" name="branchip" id="branchip" size="15" maxlength="15" value="[% library.branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
+ <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" size="80" value="[% library.branchnotes |html %]" /></li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="submit" value="Submit" />
+ <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
</fieldset>
- <fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a></fieldset>
</form>
[% END %]
-[% IF ( delete_confirm ) %]
- <form action="[% action %]" method="post">
-<fieldset><legend>Confirm deletion of [% branchname %] ([% branchcode %])?</legend><input type="hidden" name="op" value="delete_confirmed" />
- <input type="hidden" name="branchcode" value="[% branchcode |html %]" />
- <input type="hidden" name="branchname" value="[% branchname |html %]">
- <fieldset class="action"><input type="submit" value="Delete Library" /> <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a></fieldset>
-</fieldset></form>
+[% IF op == 'delete_confirm' and not ( items_count or patrons_count )%]
+ <form action="/cgi-bin/koha/admin/branches.pl" method="post">
+ <fieldset>
+ <legend>Confirm deletion of [% library.branchname %] ([% library.branchcode %])?</legend>
+ <input type="hidden" name="op" value="delete_confirmed" />
+ <input type="hidden" name="branchcode" value="[% library.branchcode |html %]" />
+ <input type="hidden" name="branchname" value="[% library.branchname |html %]">
+ <fieldset class="action">
+ <input type="submit" value="Delete Library" />
+ <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
+ </fieldset>
+ </fieldset>
+ </form>
[% END %]
-[% IF ( else ) %]
+[% IF op == 'list' %]
<h3>Libraries</h3>
- [% IF ( message ) %]<div class="dialog message">
- [% message %]</div>[% END %]
- [% IF ( MESSAGE1 ) %]<div class="dialog message">Library not saved — code and/or name missing</div>[% END %]
- [% IF ( MESSAGE2 ) %]<div class="dialog message">Library saved</div>[% END %]
- [% IF ( MESSAGE3 ) %]<div class="dialog message">Library deleted</div>[% END %]
- [% IF ( MESSAGE4 ) %]<div class="dialog message">Library category added</div>[% END %]
- [% IF ( MESSAGE5 ) %]<div class="dialog message">Library category modified</div>[% END %]
- [% IF ( MESSAGE6 ) %]<div class="dialog message">Library category deleted</div>[% END %]
- [% IF ( MESSAGE7 ) %]<div class="dialog message">Library cannot be deleted because there are patrons and items using that library</div>[% END %]
- [% IF ( MESSAGE8 ) %]<div class="dialog message">Category cannot be deleted because there are libraries using that category</div>[% END %]
- [% IF ( MESSAGE9 ) %]<div class="dialog message">Category cannot be added, categorycode already exists</div>[% END %]
- [% IF ( MESSAGE10 ) %]<div class="dialog message">Library cannot be deleted because there are items held by that library</div>[% END %]
- [% IF ( MESSAGE11 ) %]<div class="dialog message">Library cannot be deleted because there are patrons registered at that library</div>[% END %]
-[% IF ( branches ) %]
- <table id="branchest">
-<thead><tr>
- <th>Name</th>
- <th>Code</th>
- <th>Address</th>
- <th>Properties</th>
- <th>IP</th>
- <!-- <th>Printer</th> -->
- <th> </th>
- <th> </th>
- </tr></thead><tbody>
- [% FOREACH branche IN branches %]
- <tr>
- <td>[% branche.branch_name |html %]</td>
- <td>[% branche.branch_code |html %]</td>
- <td>
- [% IF ( branche.address_empty_p ) %]
- (nothing entered)
- [% ELSE %]
- [% IF ( branche.branchaddress1 ) %]
- [% branche.branchaddress1 |html %][% END %]
- [% IF ( branche.branchaddress2 ) %]
- <br />[% branche.branchaddress2 |html %][% END %]
- [% IF ( branche.branchaddress3 ) %]
- <br />[% branche.branchaddress3 |html %][% END %]
- [% IF ( branche.branchcity ) %]
- <br />[% branche.branchcity |html %][% END %][% IF ( branche.branchstate ) %],
- [% branche.branchstate |html %][% END %]
- [% IF ( branche.branchzip ) %]
- [% branche.branchzip |html %][% END %]
- [% IF ( branche.branchcountry ) %]
- <br />[% branche.branchcountry |html %][% END %]
- [% IF ( branche.branchphone ) %]
- <br />Ph: [% branche.branchphone |html %][% END %]
- [% IF ( branche.branchfax ) %]
- <br />Fax: [% branche.branchfax |html %][% END %]
- [% IF ( branche.branchemail ) %]
- <br /><a href="mailto:[% branche.branchemail %]">[% branche.branchemail |html %]</a>[% END %]
- [% IF ( branche.branchurl ) %]
- <br /><a href="[% branche.branchurl %]">[% branche.branchurl |html %]</a>[% END %]
- [% IF ( branche.opac_info ) %]
- <br />OPAC Info: <div>[% branche.opac_info %]</div>[% END %]
- [% IF ( branche.branchnotes ) %]
- <br />Notes: [% branche.branchnotes |html %][% END %]
- [% END %]
- </td>
- <td>
- [% UNLESS ( branche.no_categories_p ) %]
- [% FOREACH category_lis IN branche.category_list %]
- [% category_lis.categoryname %]<br />
- [% END %]
- [% END %]
- </td>
- <td>
- [% branche.branchip %]
- </td>
- <!-- <td>
- [% branche.branchprinter %]
- </td> -->
- <td>
- <a href="[% branche.action %]?op=edit&branchcode=[% branche.value |url %]">Edit</a>
- </td>
- <td>
- <a href="[% branche.action %]?branchcode=[% branche.value |url %]&branchname=[% branche.branch_name |url %]&op=delete">Delete</a>
- </td>
- </tr>
- [% END %]</tbody>
- </table>
- [% ELSE %]
- <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add">Start defining libraries</a>.</div>
- [% END %]
+ [% IF libraries %]
+ <table id="branchest">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Code</th>
+ <th>Address</th>
+ <th>Properties</th>
+ <th>IP</th>
+ <th> </th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH library IN libraries %]
+ <tr>
+ <td>[% library.branchname |html %]</td>
+ <td>[% library.branchcode |html %]</td>
+ <td>
+ [% IF library.branchaddress1 %]
+ [% library.branchaddress1 |html %][% END %]
+ [% IF library.branchaddress2 %]
+ <br />[% library.branchaddress2 |html %][% END %]
+ [% IF library.branchaddress3 %]
+ <br />[% library.branchaddress3 |html %][% END %]
+ [% IF library.branchcity %]
+ <br />[% library.branchcity |html %][% END %][% IF ( library.branchstate ) %],
+ [% library.branchstate |html %][% END %]
+ [% IF library.branchzip %]
+ [% library.branchzip |html %][% END %]
+ [% IF library.branchcountry %]
+ <br />[% library.branchcountry |html %][% END %]
+ [% IF library.branchphone %]
+ <br />Ph: [% library.branchphone |html %][% END %]
+ [% IF library.branchfax %]
+ <br />Fax: [% library.branchfax |html %][% END %]
+ [% IF library.branchemail %]
+ <br /><a href="mailto:[% library.branchemail %]">[% library.branchemail |html %]</a>[% END %]
+ [% IF library.branchurl %]
+ <br /><a href="[% library.branchurl %]">[% library.branchurl |html %]</a>[% END %]
+ [% IF library.opac_info %]
+ <br />OPAC Info: <div>[% library.opac_info %]</div>[% END %]
+ [% IF library.branchnotes %]
+ <br />Notes: [% library.branchnotes |html %][% END %]
+ </td>
+ <td>
+ [% FOREACH category IN library.get_categories %]
+ [% category.categoryname %]<br />
+ [% END %]
+ </td>
+ <td>[% library.branchip %]</td>
+ <td>
+ <a href="/cgi-bin/koha/admin/branches.pl?op=add_form&branchcode=[% library.branchcode %]">Edit</a>
+ </td>
+ <td>
+ <a href="/cgi-bin/koha/admin/branches.pl?op=delete_confirm&branchcode=[% library.branchcode %]">Delete</a>
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ [% ELSE %]
+ <div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add_form">Start defining libraries</a>.</div>
+ [% END %]
- [% IF ( branchcategories ) %]
- [% FOREACH branchcategorie IN branchcategories %]
- <h3>Group(s): [% IF ( branchcategorie.properties ) %]Properties[% ELSE %][% IF ( branchcategorie.searchdomain ) %]Search domain[% END %][% END %]</h3>
- [% IF ( branchcategorie.catloop ) %]
- <table>
- <thead>
- <tr>
- <th>Name</th>
- <th>Code</th>
- <th>Description</th>
- <th> </th>
- <th> </th>
- </tr>
- </thead>
- <tbody>
- [% FOREACH catloo IN branchcategorie.catloop %]
- <tr>
- <td>[% catloo.categoryname %]</td>
- <td>[% catloo.categorycode %]</td>
- <td>[% catloo.codedescription %]</td>
- <td>
- <a href="[% catloo.action %]?op=editcategory&categorycode=[% catloo.categorycode |url %]">Edit</a>
- </td>
- <td>
- <a href="[% catloo.action %]?op=delete_category&categorycode=[% catloo.categorycode |url %]">Delete</a>
- </td>
- </tr>
- [% END %]
- </tbody>
- </table>
+ [% IF group_types %]
+ [% FOREACH group_type IN group_types %]
+ <h3>[% IF group_type.categorytype == 'properties' %]Properties[% ELSIF group_type.categorytype == 'searchdomain' %]Search domain[% END %]</h3>
+ [% IF group_type.categories %]
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Code</th>
+ <th>Description</th>
+ <th> </th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH category IN group_type.categories %]
+ <tr>
+ <td>[% category.categoryname %]</td>
+ <td>[% category.categorycode %]</td>
+ <td>[% category.codedescription %]</td>
+ <td>
+ <a href="/cgi-bin/koha/admin/branches.pl?categorycode=[% category.categorycode %]&op=add_form_category">Edit</a>
+ </td>
+ <td>
+ <a href="/cgi-bin/koha/admin/branches.pl?categorycode=[% category.categorycode %]&op=delete_confirm_category">Delete</a>
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ [% ELSE %]
+ [% IF group_type.categorytype == 'properties' %]
+ No properties defined.
+ [% ELSIF group_type.categorytype == 'searchdomain' %]
+ No search domain defined.
+ [% END %]
+ <a href="/cgi-bin/koha/admin/branches.pl?op=add_form_category">Add a new group</a>.
+ [% END %]
+ [% END %]
[% ELSE %]
- No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined. <a href="/cgi-bin/koha/admin/branches.pl?op=editcategory">Add a new group</a>.
+ <p>No groups defined.</p>
[% END %]
- [% END %]
- [% ELSE %]
- <p>No groups defined.</p>
- [% END %] <!-- NAME="branchcategories" -->
[% END %]
-[% IF ( editcategory ) %]
- <h3>[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]Add group[% END %]</h3>
- <form action="[% action %]" name="Aform" method="post">
- <input type="hidden" name="op" value="addcategory_validate" />
- [% IF ( categorycode ) %]
- <input type="hidden" name="add" value="0">
- [% ELSE %]
- <input type="hidden" name="add" value="1">
- [% END %]
- <fieldset class="rows">
+[% IF op == 'add_form_category' %]
+ <h3>[% IF category.categorycode %]Edit group [% category.categorycode %][% ELSE %]Add group[% END %]</h3>
+ <form action="/cgi-bin/koha/admin/branches.pl" name="Aform" method="post">
+ <input type="hidden" name="op" value="add_validate_category" />
+ [% IF category.categorycode %]
+ <input type="hidden" name="is_a_modif" value="1" />
+ [% END %]
+ <fieldset class="rows">
+ <ol>
+ <li>
+ [% IF category.categorycode %]
+ <span class="label">Category code: </span>
+ <input type="hidden" name="categorycode" id="categorycode" value="[% category.categorycode |html %]" />
+ [% category.categorycode %]
+ [% ELSE %]
+ <label for="categorycode">Category code:</label>
+ <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" />
+ [% END %]
+ </li>
+ <li>
+ <label for="categoryname">Name: </label>
+ <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% category.categoryname |html %]" />
+ </li>
+ <li>
+ <label for="codedescription">Description: </label>
+ <input type="text" name="codedescription" id="codedescription" size="70" value="[% category.codedescription |html %]" />
+ </li>
+ <li>
+ <label for="categorytype">Category type: </label>
+ <select id="categorytype" name="categorytype">
+ [% IF category.categorytype == 'properties' %]
+ <option value="searchdomain">Search domain</option>
+ <option value="properties" selected="selected">Properties</option>
+ [% ELSE %]
+ <option value="searchdomain">Search domain</option>
+ <option value="properties">Properties</option>
- <ol><li>
- [% IF ( categorycode ) %]
- <span class="label">Category code: </span>
- <input type="hidden" name="categorycode" id="categorycode" value="[% categorycode |html %]" />
- [% categorycode %]
- [% ELSE %]
- <label for="categorycode">Category code:</label>
- <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" value="[% categorycode |html %]" />
- [% END %]
- </li>
- <li>
- <label for="categoryname">Name: </label>
- <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% categoryname |html %]" />
- </li>
- <li>
- <label for="codedescription">Description: </label>
- <input type="text" name="codedescription" id="codedescription" size="70" value="[% codedescription |html %]" />
- </li>
- <li>
- <label for="categorytype">Category type: </label>
- <select id="categorytype" name="categorytype">
- [% FOREACH categorytyp IN categorytype %]
- [% IF ( categorytyp.selected ) %]
- <option value="[% categorytyp.type %]" selected="selected">
- [% ELSE %]
- <option value="[% categorytyp.type %]">
- [% END %] [% categorytyp.type %]</option>
- [% END %]
- </select>
- </li>
- <li>
- <label for="show_in_pulldown">Show in search pulldown: </label>
- [% IF ( show_in_pulldown ) %]
- <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" checked="checked"/>
- [% ELSE %]
- <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" />
- [% END %]
- </li>
- </ol>
- </fieldset>
- <fieldset class="action"><input type="submit" value="Update" /></fieldset>
+ [% END %]
+ </select>
+ </li>
+ <li>
+ <label for="show_in_pulldown">Show in search pulldown: </label>
+ [% IF category.show_in_pulldown %]
+ <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" checked="checked"/>
+ [% ELSE %]
+ <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" />
+ [% END %]
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action"><input type="submit" value="Update" /></fieldset>
</form>
[% END %]
-[% IF ( delete_category ) %]
- [% UNLESS ( MESSAGE8 ) %]
+[% IF op == 'delete_confirm_category' %]
<div class="dialog message">
- Confirm delete:
- <form action="[% action %]" method="post">
- <input type="hidden" name="op" value="categorydelete_confirmed" />
- <input type="hidden" name="categorycode" value="[% categorycode |html %]" />
- <input type="submit" value="YES" />
- </form>
- <form action="[% action %]" method="post"><input type="hidden" name="op" value="">
- <input type="submit" value="NO" />
+ Are you sure you want to delete the group '[% category.codedescription %]' ([% category.categorycode %])?
+ <form action="/cgi-bin/koha/admin/branches.pl" method="post">
+ <input type="hidden" name="op" value="delete_confirmed_category" />
+ <input type="hidden" name="categorycode" value="[% category.categorycode |html %]" />
+ <input type="submit" value="Delete" />
+ <a class="cancel" href="/cgi-bin/koha/admin/branches.pl">Cancel</a>
</form>
</div>
- [% END %]
[% END %]
</div>