From aa248c93b5a57deab1a1897836854d8eadbbad38 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 +- koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 4 +++ .../en/modules/course_reserves/course-details.tt | 10 ++----- .../en/modules/course_reserves/course-reserves.tt | 9 +------ .../prog/en/modules/course_reserves/course.tt | 1 - .../en/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 bbf67d5..bb770a3 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 a0b03e9..e1440f1 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 ebffed4..8b4e50e 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 e2af77f..1a3d4a4 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 f4062c2..1d23253 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 72f41fe..6b2f787 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 23d18ed..c757518 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 8568afc..85817ed 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 0000000..d1ae392 --- /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' %] -- 1.7.2.5