Bug 15869: Change framework on overlay
[koha-ffzg.git] / admin / itemtypes.pl
index a1c8001..44e9ad5 100755 (executable)
 use Modern::Perl;
 use CGI qw ( -utf8 );
 
-use File::Spec;
 
-use C4::Koha;
+use C4::Koha qw( getImageSets GetAuthorisedValues );
 use C4::Context;
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 use Koha::ItemTypes;
 use Koha::ItemType;
 use Koha::Localizations;
@@ -46,7 +45,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         flagsrequired   => { parameters => 'manage_itemtypes' },
-        debug           => 1,
     }
 );
 
@@ -62,7 +60,7 @@ if ( $op eq 'add_form' ) {
     my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}});
     my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
     my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
-    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
+    my $translated_languages = C4::Languages::getTranslatedLanguages( "both", C4::Context->preference('template') );
     $template->param(
         itemtype  => $itemtype,
         parent_type => $parent_type,
@@ -99,6 +97,7 @@ if ( $op eq 'add_form' ) {
     my $searchcategory = $input->param('searchcategory');
     my $rentalcharge_daily_calendar  = $input->param('rentalcharge_daily_calendar') // 0;
     my $rentalcharge_hourly_calendar = $input->param('rentalcharge_hourly_calendar') // 0;
+    my $automatic_checkin = $input->param('automatic_checkin') // 0;
 
     if ( $itemtype and $is_a_modif ) {    # it's a modification
         $itemtype->description($description);
@@ -118,6 +117,7 @@ if ( $op eq 'add_form' ) {
         $itemtype->searchcategory($searchcategory);
         $itemtype->rentalcharge_daily_calendar($rentalcharge_daily_calendar);
         $itemtype->rentalcharge_hourly_calendar($rentalcharge_hourly_calendar);
+        $itemtype->automatic_checkin($automatic_checkin);
 
         eval {
           $itemtype->store;
@@ -150,6 +150,7 @@ if ( $op eq 'add_form' ) {
                 searchcategory      => $searchcategory,
                 rentalcharge_daily_calendar  => $rentalcharge_daily_calendar,
                 rentalcharge_hourly_calendar => $rentalcharge_hourly_calendar,
+                automatic_checkin   => $automatic_checkin,
             }
         );
         eval {
@@ -197,7 +198,7 @@ if ( $op eq 'add_form' ) {
 
 if ( $op eq 'list' ) {
     $template->param(
-        itemtypes => scalar Koha::ItemTypes->search,
+        itemtypes => Koha::ItemTypes->search,
         messages  => \@messages,
     );
 }