From: Arnie P. v. a. <we...@ma...> - 2009-08-29 16:28:31
|
Log Message: ----------- This fixes the bug reported Blake Thornton Hardcopy Error by Blake Thornton - Thursday, 27 August 2009, 09:47 PM # when students don't select any sets the size of @setIDs is 1 with a null character in $setIDs[0]. # when professors don't select any sets the size of @setIDs is 0. # the following test "unless ((@setIDs) and ($setIDs[0] =~ /\S+/))" catches both cases and prevents # warning nessages in the case of a professor's empty array. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator: Hardcopy.pm Revision Data ------------- Index: Hardcopy.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v retrieving revision 1.99 retrieving revision 1.100 diff -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -u -r1.99 -r1.100 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -159,10 +159,15 @@ unless (@userIDs) { $self->addbadmessage("Please select at least one user and try again."); $validation_failed = 1; - } - unless (@setIDs) { + } + +# when students don't select any sets the size of @setIDs is 1 with a null character in $setIDs[0]. +# when professors don't select any sets the size of @setIDs is 0. +# the following test "unless ((@setIDs) and ($setIDs[0] =~ /\S+/))" catches both cases and prevents +# warning nessages in the case of a professor's empty array. + unless ((@setIDs) and ($setIDs[0] =~ /\S+/)) { $self->addbadmessage("Please select at least one set and try again."); - $validation_failed = 1; + $validation_failed = 1; } # is the user allowed to request multiple sets/users at a time? |