From: Chris Nighswonger Date: Thu, 4 Feb 2010 15:20:46 +0000 (-0500) Subject: Bugfix: Adding error trapping for missing or invalid branch code X-Git-Tag: v3.02.00-alpha2~513 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=a97aab0212f2d41221df3b387d57e1dd03f539e9;hp=5a929b0c16bee0f03cfe9501f691c0c57eca4c82;p=koha.git Bugfix: Adding error trapping for missing or invalid branch code This patch adds code to trap, log, and return an intelligent message to the user when a missing or invalid branch code is passed in. This condition can occur if the user is logged in as the kohaadmin or the user has multiple instances of the staff client open and has switched users in some instance. Signed-off-by: Galen Charlton --- diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/error-messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/error-messages.inc index 0d1c43f0f8..7eb0fe85a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/error-messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/error-messages.inc @@ -79,6 +79,8 @@ window.onload=function(){ An unsupported operation was attempted on . Please have your system administrator check the error log for details. An error has occurred. Please ask your system administrator to check the error log for more details. + + A non-existent or invalid branch code was supplied. Please verify that you have a branch selected. An error has occurred while attempting to upload the image file. Please ask you system administrator to check the error log for more details. diff --git a/patroncards/edit-batch.pl b/patroncards/edit-batch.pl index 9c3a57d406..47f0896966 100755 --- a/patroncards/edit-batch.pl +++ b/patroncards/edit-batch.pl @@ -105,10 +105,15 @@ elsif ($op eq 'de_duplicate') { exit; } } -elsif ($op = 'edit') { +elsif ($op eq 'edit') { $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); } elsif ($op eq 'new') { + if (!$branch_code) { + warn sprintf('Batch edit interface called with an invalid/non-existent branch code: %s',$branch_code ? $branch_code : 'NULL'); + print $cgi->redirect("manage.pl?card_element=batch&error=203") if $err; + exit; + } $batch = C4::Patroncards::Batch->new(branch_code => $branch_code); $batch_id = $batch->get_attr('batch_id'); }