push @errors, "ERROR_invalid_cardnumber";
}
}
+
if ($data{'sex'} eq '' && $categorycode ne "I"){
push @errors, "ERROR_gender";
$nok=1;
push @errors, "ERROR_city";
$nok=1;
}
+ if (C4::Context->preference("IndependantBranches")) {
+ my $userenv = C4::Context->userenv;
+ if ($userenv->{flags} != 1){
+ unless ($userenv->{branch} eq $data{'branchcode'}){
+ push @errors, "ERROR_branch";
+ $nok=1;
+ }
+ }
+ }
if ($nok) {
foreach my $error (@errors) {
$template->param( $error => 1);
} else {
$data=borrdata('',$borrowernumber);
}
+ if (C4::Context->preference("IndependantBranches")) {
+ my $userenv = C4::Context->userenv;
+ if ($userenv->{flags} != 1 && $data->{branchcode}){
+ unless ($userenv->{branch} eq $data->{'branchcode'}){
+ print $input->redirect("/cgi-bin/koha/members/members-home.pl");
+ }
+ }
+ }
if ($actionType eq 'Add'){
$template->param( updtype => 'I');
} else {
$template->param( updtype => 'M');
}
- my $cardnumber=C4::Members::fixup_cardnumber($data->{'cardnumber'});
+ my $cardnumber=$data->{'cardnumber'};
+ $cardnumber=fixup_cardnumber($data->{'cardnumber'}) if $actionType eq 'Add';
if ($data->{'sex'} eq 'F'){
$template->param(female => 1);
}
my @relshipdata;
while (@relationships) {
my $relship = shift @relationships;
+ next unless $relship;
my %row = ('relationship' => $relship);
if ($data->{'altrelationship'} eq $relship) {
- $row{'selected'}=' selected';
+ $row{'selected'}=' selected = "selected"';
} else {
$row{'selected'}='';
}
'name' => $flags{$key}[0],
'html' => $flags{$key}[1]);
if ($data->{$key}) {
- $row{'yes'}=' checked';
+ $row{'yes'}=' checked="checked"';
$row{'no'}='';
} else {
$row{'yes'}='';
- $row{'no'}=' checked';
+ $row{'no'}=' checked="checked"';
}
push(@flagdata, \%row);
}
my @select_branch;
my %select_branches;
my $branches=getbranches();
+ my $default;
foreach my $branch (keys %$branches) {
- push @select_branch, $branch;
- $select_branches{$branch} = $branches->{$branch}->{'branchname'};
+ if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) {
+ push @select_branch, $branch;
+ $select_branches{$branch} = $branches->{$branch}->{'branchname'};
+ $default = $data->{'branchcode'};
+ } else {
+ push @select_branch, $branch if ($branch eq C4::Context->userenv->{'branch'});
+ $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'});
+ $default = C4::Context->userenv->{'branch'};
+ }
}
+
my $CGIbranch=CGI::scrolling_list( -name => 'branchcode',
-id => 'branchcode',
-values => \@select_branch,
-labels => \%select_branches,
-size => 1,
-multiple => 0 );
+
+ my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data->{'sort1'});
+ if ($CGIsort1) {
+ $template->param(CGIsort1 => $CGIsort1);
+ } else {
+ $template->param( sort1 => $data->{'sort1'});
+ }
+
+ my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data->{'sort2'});
+ if ($CGIsort2) {
+ $template->param(CGIsort2 =>$CGIsort2);
+ } else {
+ $template->param( sort2 => $data->{'sort2'});
+ }
+
+ my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data->{'sort1'});
+ if ($CGIsort1) {
+ $template->param(CGIsort1 => $CGIsort1);
+ } else {
+ $template->param( sort1 => $data->{'sort1'});
+ }
+ my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data->{'sort2'});
+ if ($CGIsort2) {
+ $template->param(CGIsort2 =>$CGIsort2);
+ } else {
+ $template->param( sort2 => $data->{'sort2'});
+ }
+
$template->param( actionType => $actionType,
destination => $destination,
borrowernumber => $borrowernumber,
expiry => format_date($data->{'expiry'}),
cardnumber => $cardnumber,
dateofbirth => $data->{'dateofbirth'},
- sort1 => $data->{'sort1'},
- sort2 => $data->{'sort2'},
dateformat => display_date_format(),
modify => $modify,
CGIbranch => $CGIbranch);