From 5c110a394de7f2837d6ccc1beb2d82cef9e6f416 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 3 Dec 2015 15:19:13 +0000 Subject: [PATCH] Bug 15294: Koha::Libraries - Rewrite the admin scripts MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch rewrites the admin/branches.pl script to use the new modules instead of C4::Branches. Test plan: 1/ Create libraries using all the fields available 2/ Create groups of libraries 3/ Assign 1+ libraries to some groups 4/ Delete libraries and groups of libraries You should not able to delete a library if items or patrons use it. You should not able to delete a group of libraries if there are still libraries using it. 5/ Update libraries and groups of libraries Followed test plan, works as expected. Signed-off-by: Marc Véron Signed-off-by: Martin Renvoize Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- admin/branches.pl | 537 ++++++---------- .../prog/en/modules/admin/branches.tt | 591 +++++++++--------- 2 files changed, 487 insertions(+), 641 deletions(-) diff --git a/admin/branches.pl b/admin/branches.pl index 4a56f9d459..918b10c4e8 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl # Copyright 2000-2002 Katipo Communications +# Copyright 2015 Koha Development Team # # This file is part of Koha. # @@ -17,402 +18,224 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -=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: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 29b54b90b1..305741ab79 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -1,13 +1,13 @@ [% INCLUDE 'doc-head-open.inc' %] 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 %] [% INCLUDE 'doc-head-close.inc' %] @@ -25,7 +25,7 @@ "sPaginationType": "four_button" })); - [% IF ( heading_branches_add_branch_p ) %] + [% UNLESS library %] $("#Aform").on("submit", function( event ) { if ( $("#branchcode").val().match(/\s/) ) { event.preventDefault(); @@ -62,312 +62,335 @@ tinyMCE.init({ HomeAdministrationLibraries 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 == '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 %]
-
-
- [% IF ( else ) %] +
+
+ +[% FOR m IN messages %] +
+ [% 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 %] +
+[% END %] + +[% IF op == 'list' %] [% END %] -[% IF ( add ) %] - [% IF ( ERROR1 ) %]
Library with that code already exists — Please enter a unique code
[% END %] -

[% IF ( heading_branches_add_branch_p ) %]New library[% ELSE %]Modify library[% END %]

-
-
- - [% IF ( heading_branches_add_branch_p ) %] - - [% ELSE %] - - [% END %] -
  1. - [% IF ( heading_branches_add_branch_p ) %] - - Required - [% ELSE %] - Library code: - - [% branchcode %] +[% IF op == 'add_form' %] +

    [% IF library %]Modify library[% ELSE %]New library[% END %]

    + +
    + + [% IF library %] + [% END %] -
  2. -
  3. - - Required -
  4. -
-
- [% IF ( categoryloop ) %]
Group(s): -
    - [% FOREACH categoryloo IN categoryloop %] -
  1. - [% IF categoryloo.selected %] - - [% ELSE %] - - [% END %] - [% categoryloo.codedescription %] -
  2. +
      +
    1. + [% IF library %] + Library code: + + [% library.branchcode %] + [% ELSE %] + + + Required + [% END %] +
    2. +
    3. + + + Required +
    4. +
    +
+ [% IF categories %] +
Group(s): +
    + [% FOREACH category IN categories %] +
  1. + + [% IF category and selected_categorycodes.grep(category.categorycode).size %] + + [% ELSE %] + + [% END %] + [% category.codedescription %] +
  2. + [% END %] +
+
[% END %] - -[% END %] -
-
    -
  1. -
  2. -
  3. -
  4. -
  5. -
  6. -
  7. -
  8. -
  9. -
  10. -
  11. -
  12. -
  13. -
  14. -
  15. Can be entered as a single IP, or a subnet such as 192.168.1.*
  16. - -
  17. -
+
+
    +
  1. +
  2. +
  3. +
  4. +
  5. +
  6. +
  7. +
  8. +
  9. +
  10. +
  11. +
  12. +
  13. +
  14. +
  15. Can be entered as a single IP, or a subnet such as 192.168.1.*
  16. +
  17. +
+
+
+ + Cancel
-
Cancel
[% END %] -[% IF ( delete_confirm ) %] -
-
Confirm deletion of [% branchname %] ([% branchcode %])? - - -
Cancel
-
+[% IF op == 'delete_confirm' and not ( items_count or patrons_count )%] +
+
+ Confirm deletion of [% library.branchname %] ([% library.branchcode %])? + + + +
+ + Cancel +
+
+
[% END %] -[% IF ( else ) %] +[% IF op == 'list' %]

Libraries

- [% IF ( message ) %]
- [% message %]
[% END %] - [% IF ( MESSAGE1 ) %]
Library not saved — code and/or name missing
[% END %] - [% IF ( MESSAGE2 ) %]
Library saved
[% END %] - [% IF ( MESSAGE3 ) %]
Library deleted
[% END %] - [% IF ( MESSAGE4 ) %]
Library category added
[% END %] - [% IF ( MESSAGE5 ) %]
Library category modified
[% END %] - [% IF ( MESSAGE6 ) %]
Library category deleted
[% END %] - [% IF ( MESSAGE7 ) %]
Library cannot be deleted because there are patrons and items using that library
[% END %] - [% IF ( MESSAGE8 ) %]
Category cannot be deleted because there are libraries using that category
[% END %] - [% IF ( MESSAGE9 ) %]
Category cannot be added, categorycode already exists
[% END %] - [% IF ( MESSAGE10 ) %]
Library cannot be deleted because there are items held by that library
[% END %] - [% IF ( MESSAGE11 ) %]
Library cannot be deleted because there are patrons registered at that library
[% END %] -[% IF ( branches ) %] - - - - - - - - - - - - [% FOREACH branche IN branches %] - - - - - - - - - - - [% END %] -
NameCodeAddressPropertiesIP  
[% branche.branch_name |html %][% branche.branch_code |html %] - [% IF ( branche.address_empty_p ) %] - (nothing entered) - [% ELSE %] - [% IF ( branche.branchaddress1 ) %] - [% branche.branchaddress1 |html %][% END %] - [% IF ( branche.branchaddress2 ) %] -
[% branche.branchaddress2 |html %][% END %] - [% IF ( branche.branchaddress3 ) %] -
[% branche.branchaddress3 |html %][% END %] - [% IF ( branche.branchcity ) %] -
[% branche.branchcity |html %][% END %][% IF ( branche.branchstate ) %], - [% branche.branchstate |html %][% END %] - [% IF ( branche.branchzip ) %] - [% branche.branchzip |html %][% END %] - [% IF ( branche.branchcountry ) %] -
[% branche.branchcountry |html %][% END %] - [% IF ( branche.branchphone ) %] -
Ph: [% branche.branchphone |html %][% END %] - [% IF ( branche.branchfax ) %] -
Fax: [% branche.branchfax |html %][% END %] - [% IF ( branche.branchemail ) %] -
[% branche.branchemail |html %][% END %] - [% IF ( branche.branchurl ) %] -
[% branche.branchurl |html %][% END %] - [% IF ( branche.opac_info ) %] -
OPAC Info:
[% branche.opac_info %]
[% END %] - [% IF ( branche.branchnotes ) %] -
Notes: [% branche.branchnotes |html %][% END %] - [% END %] -
- [% UNLESS ( branche.no_categories_p ) %] - [% FOREACH category_lis IN branche.category_list %] - [% category_lis.categoryname %]
- [% END %] - [% END %] -
- [% branche.branchip %] - - Edit - - Delete -
- [% ELSE %] -
There are no libraries defined. Start defining libraries.
- [% END %] + [% IF libraries %] + + + + + + + + + + + + + + [% FOREACH library IN libraries %] + + + + + + + + + + [% END %] + +
NameCodeAddressPropertiesIP  
[% library.branchname |html %][% library.branchcode |html %] + [% IF library.branchaddress1 %] + [% library.branchaddress1 |html %][% END %] + [% IF library.branchaddress2 %] +
[% library.branchaddress2 |html %][% END %] + [% IF library.branchaddress3 %] +
[% library.branchaddress3 |html %][% END %] + [% IF library.branchcity %] +
[% library.branchcity |html %][% END %][% IF ( library.branchstate ) %], + [% library.branchstate |html %][% END %] + [% IF library.branchzip %] + [% library.branchzip |html %][% END %] + [% IF library.branchcountry %] +
[% library.branchcountry |html %][% END %] + [% IF library.branchphone %] +
Ph: [% library.branchphone |html %][% END %] + [% IF library.branchfax %] +
Fax: [% library.branchfax |html %][% END %] + [% IF library.branchemail %] +
[% library.branchemail |html %][% END %] + [% IF library.branchurl %] +
[% library.branchurl |html %][% END %] + [% IF library.opac_info %] +
OPAC Info:
[% library.opac_info %]
[% END %] + [% IF library.branchnotes %] +
Notes: [% library.branchnotes |html %][% END %] +
+ [% FOREACH category IN library.get_categories %] + [% category.categoryname %]
+ [% END %] +
[% library.branchip %] + Edit + + Delete +
+ [% ELSE %] +
There are no libraries defined. Start defining libraries.
+ [% END %] - [% IF ( branchcategories ) %] - [% FOREACH branchcategorie IN branchcategories %] -

Group(s): [% IF ( branchcategorie.properties ) %]Properties[% ELSE %][% IF ( branchcategorie.searchdomain ) %]Search domain[% END %][% END %]

- [% IF ( branchcategorie.catloop ) %] - - - - - - - - - - - - [% FOREACH catloo IN branchcategorie.catloop %] - - - - - - - - [% END %] - -
NameCodeDescription  
[% catloo.categoryname %][% catloo.categorycode %][% catloo.codedescription %] - Edit - - Delete -
+ [% IF group_types %] + [% FOREACH group_type IN group_types %] +

[% IF group_type.categorytype == 'properties' %]Properties[% ELSIF group_type.categorytype == 'searchdomain' %]Search domain[% END %]

+ [% IF group_type.categories %] + + + + + + + + + + + + [% FOREACH category IN group_type.categories %] + + + + + + + + [% END %] + +
NameCodeDescription  
[% category.categoryname %][% category.categorycode %][% category.codedescription %] + Edit + + Delete +
+ [% ELSE %] + [% IF group_type.categorytype == 'properties' %] + No properties defined. + [% ELSIF group_type.categorytype == 'searchdomain' %] + No search domain defined. + [% END %] + Add a new group. + [% END %] + [% END %] [% ELSE %] - No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined. Add a new group. +

No groups defined.

[% END %] - [% END %] - [% ELSE %] -

No groups defined.

- [% END %] [% END %] -[% IF ( editcategory ) %] -

[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]Add group[% END %]

-
- - [% IF ( categorycode ) %] - - [% ELSE %] - - [% END %] -
+[% IF op == 'add_form_category' %] +

[% IF category.categorycode %]Edit group [% category.categorycode %][% ELSE %]Add group[% END %]

+ + + [% IF category.categorycode %] + + [% END %] +
+
    +
  1. + [% IF category.categorycode %] + Category code: + + [% category.categorycode %] + [% ELSE %] + + + [% END %] +
  2. +
  3. + + +
  4. +
  5. + + +
  6. +
  7. + + - [% categorycode %] - [% ELSE %] - - - [% END %] -
  8. -
  9. - - -
  10. -
  11. - - -
  12. -
  13. - - -
  14. -
  15. - - [% IF ( show_in_pulldown ) %] - - [% ELSE %] - - [% END %] -
  16. -
-
-
+ [% END %] + + +
  • + + [% IF category.show_in_pulldown %] + + [% ELSE %] + + [% END %] +
  • + +
    +
    [% END %] -[% IF ( delete_category ) %] - [% UNLESS ( MESSAGE8 ) %] +[% IF op == 'delete_confirm_category' %]
    - Confirm delete: -
    - - - -
    -
    - + Are you sure you want to delete the group '[% category.codedescription %]' ([% category.categorycode %])? + + + + + Cancel
    - [% END %] [% END %]
    -- 2.39.5