From 1940d4871c0bc90c8b1b7a75c76779b3d29a21f6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 21 Mar 2013 06:15:28 -0700 Subject: [PATCH] Bug 8215 - Add Course Reserves - QA Followup Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- course_reserves/add_items.pl | 5 ++-- course_reserves/course-details.pl | 5 ++-- course_reserves/course-reserves.pl | 2 +- course_reserves/course.pl | 2 +- .../intranet-tmpl/prog/en/js/staff-global.js | 4 ++++ .../modules/course_reserves/course-details.tt | 10 +++----- .../course_reserves/course-reserves.tt | 9 +------ .../prog/en/modules/course_reserves/course.tt | 1 - .../modules/course_reserves/invalid-course.tt | 24 +++++++++++++++++++ 9 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/invalid-course.tt diff --git a/course_reserves/add_items.pl b/course_reserves/add_items.pl index bbf67d5159..bb770a33d2 100755 --- a/course_reserves/add_items.pl +++ b/course_reserves/add_items.pl @@ -36,15 +36,14 @@ my $action = $cgi->param('action') || ''; my $course_id = $cgi->param('course_id') || ''; my $barcode = $cgi->param('barcode') || ''; -die('No course_id provided') unless ($course_id); - my $item = GetBiblioFromItemNumber( undef, $barcode ); my $step = ( $action eq 'lookup' && $item ) ? '2' : '1'; +my $tmpl = ( $course_id ) ? "add_items-step$step.tt" : "invalid-course.tt"; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "course_reserves/add_items-step$step.tmpl", + template_name => "course_reserves/$tmpl", query => $cgi, type => "intranet", authnotrequired => 0, diff --git a/course_reserves/course-details.pl b/course_reserves/course-details.pl index a0b03e92fa..e1440f1bf1 100755 --- a/course_reserves/course-details.pl +++ b/course_reserves/course-details.pl @@ -36,9 +36,10 @@ my $course_id = $cgi->param('course_id'); my $flagsrequired; $flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' ); +my $tmpl = ( $course_id ) ? "course-details.tt" : "invalid-course.tt"; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "course_reserves/course-details.tmpl", + template_name => "course_reserves/$tmpl", query => $cgi, type => "intranet", authnotrequired => 0, @@ -46,8 +47,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( } ); -die("No course_id given") unless ($course_id); - if ( $action eq 'del_reserve' ) { DelCourseReserve( cr_id => $cgi->param('cr_id') ); } diff --git a/course_reserves/course-reserves.pl b/course_reserves/course-reserves.pl index ebffed4ba0..8b4e50e0f3 100755 --- a/course_reserves/course-reserves.pl +++ b/course_reserves/course-reserves.pl @@ -35,7 +35,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $cgi, type => "intranet", authnotrequired => 0, - flagsrequired => {}, + flagsrequired => { coursereserves => '*' }, } ); diff --git a/course_reserves/course.pl b/course_reserves/course.pl index e2af77f71d..1a3d4a4116 100755 --- a/course_reserves/course.pl +++ b/course_reserves/course.pl @@ -32,7 +32,7 @@ my $cgi = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "course_reserves/course.tmpl", + template_name => "course_reserves/course.tt", query => $cgi, type => "intranet", authnotrequired => 0, diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js index f4062c2dad..1d23253ea1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js @@ -14,6 +14,10 @@ function _(s) { return s; } // dummy function for gettext $(".focus").focus(); $(".validated").validate(); + + $('.noEnterSubmit').keypress(function(e){ + if ( e.which == 13 ) return false; + }); }); // http://jennifermadden.com/javascript/stringEnterKeyDetector.html diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt index 72f41fe32e..6b2f787733 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt @@ -31,10 +31,6 @@
    - [% IF CAN_user_coursereserves_add_reserves %]
  • Add reserves
  • [% END %] - [% IF ( CAN_user_coursereserves_manage_courses ) %]
  • Edit course
  • [% END %] - [% IF ( CAN_user_coursereserves_manage_courses ) %]
  • Delete course
  • [% END %] + [% IF CAN_user_coursereserves_add_reserves %]
  • Add reserves
  • [% END %] + [% IF ( CAN_user_coursereserves_manage_courses ) %]
  • Edit course
  • [% END %] + [% IF ( CAN_user_coursereserves_manage_courses ) %]
  • Delete course
  • [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt index 23d18ededf..c757518819 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt @@ -33,16 +33,9 @@
-
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt index 8568afce37..85817ede75 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt @@ -141,7 +141,6 @@ function RemoveInstructor( cardnumber ) { [% END %] -
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/invalid-course.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/invalid-course.tt new file mode 100644 index 0000000000..d1ae392b8b --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/invalid-course.tt @@ -0,0 +1,24 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Course reserves +[% INCLUDE 'doc-head-close.inc' %] + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
    +
    +
    +
    +
    +

    Invalid course!

    +
    +
    +
    +
    +
    + + +[% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5