X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=patroncards%2Fedit-batch.pl;h=4897e5f4e626be297bfa540e70ed1b397c12edfe;hb=8524994eda7a780738d556dd7ea462e2ac9403a1;hp=47f08969668459af84bb9904af89d716870ce2ce;hpb=a97aab0212f2d41221df3b387d57e1dd03f539e9;p=koha.git diff --git a/patroncards/edit-batch.pl b/patroncards/edit-batch.pl index 47f0896966..4897e5f4e6 100755 --- a/patroncards/edit-batch.pl +++ b/patroncards/edit-batch.pl @@ -14,9 +14,9 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -28,8 +28,8 @@ use autouse 'Data::Dumper' => qw(Dumper); use C4::Auth qw(get_template_and_user); use C4::Output qw(output_html_with_http_headers); use C4::Branch qw(get_branch_code_from_name); -use C4::Creators::Lib 1.000000 qw(get_card_summary html_table); -use C4::Patroncards::Batch 1.000000; +use C4::Creators; +use C4::Patroncards; my $cgi = new CGI; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -60,7 +60,7 @@ my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number'); my @borrower_numbers = $cgi->param('borrower_number') if $cgi->param('borrower_number'); my $errstr = $cgi->param('error') || ''; -my $branch_code = get_branch_code_from_name($template->param('LoginBranchname')); +my $branch_code = C4::Context->userenv->{'branch'}; if ($op eq 'remove') { $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); @@ -109,9 +109,9 @@ elsif ($op eq 'edit') { $batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id); } elsif ($op eq 'new') { - if (!$branch_code) { + if ($branch_code eq '') { 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; + print $cgi->redirect("manage.pl?card_element=batch&error=203"); exit; } $batch = C4::Patroncards::Batch->new(branch_code => $branch_code); @@ -119,7 +119,7 @@ elsif ($op eq 'new') { } else { warn sprintf('Batch edit interface called an unsupported operation: %s',$op); - print $cgi->redirect("manage.pl?card_element=batch&error=202") if $err; + print $cgi->redirect("manage.pl?card_element=batch&error=202"); exit; }