Lines 114-138
if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') {
Link Here
|
114 |
$newdata{$key} = $input->param($key) if (defined $input->param($key)); |
114 |
$newdata{$key} = $input->param($key) if (defined $input->param($key)); |
115 |
$newdata{$key} =~ s/\"/"/gg unless $key eq 'borrowernotes' or $key eq 'opacnote'; |
115 |
$newdata{$key} =~ s/\"/"/gg unless $key eq 'borrowernotes' or $key eq 'opacnote'; |
116 |
} |
116 |
} |
117 |
my $dateobject = C4::Dates->new(); |
117 |
my $dateobject = C4::Dates->new(); |
118 |
my $syspref = $dateobject->regexp(); # same syspref format for all 3 dates |
118 |
my $syspref = $dateobject->regexp(); # same syspref format for all 3 dates |
119 |
my $iso = $dateobject->regexp('iso'); # |
119 |
my $iso = $dateobject->regexp('iso'); # |
120 |
foreach (qw(dateenrolled dateexpiry dateofbirth)) { |
120 |
foreach (qw(dateenrolled dateexpiry dateofbirth)) { |
121 |
my $userdate = $newdata{$_} or next; |
121 |
my $userdate = $newdata{$_} or next; |
122 |
if ($userdate =~ /$syspref/) { |
122 |
if ($userdate =~ /$syspref/) { |
123 |
$newdata{$_} = format_date_in_iso($userdate); # if they match syspref format, then convert to ISO |
123 |
$newdata{$_} = format_date_in_iso($userdate); # if they match syspref format, then convert to ISO |
124 |
} elsif ($userdate =~ /$iso/) { |
124 |
} elsif ($userdate =~ /$iso/) { |
125 |
warn "Date $_ ($userdate) is already in ISO format"; |
125 |
warn "Date $_ ($userdate) is already in ISO format"; |
126 |
} else { |
126 |
} else { |
127 |
($userdate eq '0000-00-00') and warn "Data error: $_ is '0000-00-00'"; |
127 |
($userdate eq '0000-00-00') and warn "Data error: $_ is '0000-00-00'"; |
128 |
$template->param( "ERROR_$_" => 1 ); # else ERROR! |
128 |
$template->param( "ERROR_$_" => 1 ); # else ERROR! |
129 |
push(@errors,"ERROR_$_"); |
129 |
push(@errors,"ERROR_$_"); |
130 |
} |
130 |
} |
131 |
} |
131 |
} |
132 |
# check permission to modify login info. |
132 |
# check permission to modify login info. |
133 |
if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($dbh,$userenv->{'id'},{'staffaccess'=>1})) ) { |
133 |
if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($dbh,$userenv->{'id'},{'staffaccess'=>1})) ) { |
134 |
$NoUpdateLogin =1; |
134 |
$NoUpdateLogin =1; |
135 |
} |
135 |
} |
136 |
} |
136 |
} |
137 |
|
137 |
|
138 |
#############test for member being unique ############# |
138 |
#############test for member being unique ############# |
Lines 224-230
if ($op eq 'save' || $op eq 'insert'){
Link Here
|
224 |
} |
224 |
} |
225 |
} |
225 |
} |
226 |
|
226 |
|
227 |
if ($op eq 'modify' || $op eq 'insert'){ |
227 |
if ($op eq 'modify' || $op eq 'insert' || $op eq 'save' ){ |
228 |
unless ($newdata{'dateexpiry'}){ |
228 |
unless ($newdata{'dateexpiry'}){ |
229 |
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); |
229 |
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); |
230 |
$newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); |
230 |
$newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); |
Lines 315-325
if (C4::Context->preference("IndependantBranches")) {
Link Here
|
315 |
} |
315 |
} |
316 |
} |
316 |
} |
317 |
if ($op eq 'add'){ |
317 |
if ($op eq 'add'){ |
318 |
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); |
318 |
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); |
319 |
$data{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); |
319 |
$data{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); |
320 |
$template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1, step_4 => 1); |
320 |
$template->param( updtype => 'I',step_1=>1,step_2=>1,step_3=>1, step_4 => 1); |
321 |
|
321 |
} |
322 |
} |
|
|
323 |
if ($op eq "modify") { |
322 |
if ($op eq "modify") { |
324 |
$template->param( updtype => 'M',modify => 1 ); |
323 |
$template->param( updtype => 'M',modify => 1 ); |
325 |
$template->param( step_1=>1,step_2=>1,step_3=>1, step_4 => 1) unless $step; |
324 |
$template->param( step_1=>1,step_2=>1,step_3=>1, step_4 => 1) unless $step; |
326 |
- |
|
|