Bugzilla – Attachment 42964 Details for
Bug 14924
Remove C4::Dates from members/memberentry.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF]Bug 14924 - Remove C4::Dates from members/memberentry.pl
SIGNED-OFFBug-14924---Remove-C4Dates-from-membersm.patch (text/plain), 3.82 KB, created by
Héctor Eduardo Castro Avalos
on 2015-09-29 21:23:11 UTC
(
hide
)
Description:
[SIGNED-OFF]Bug 14924 - Remove C4::Dates from members/memberentry.pl
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2015-09-29 21:23:11 UTC
Size:
3.82 KB
patch
obsolete
>From 2d82ff9fa5b0909b73393af6c2702230ca0089c2 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Tue, 29 Sep 2015 17:32:56 +0200 >Subject: [PATCH] [SIGNED-OFF]Bug 14924 - Remove C4::Dates from > members/memberentry.pl > >This patch removes C4::Dates from members/memberentry.pl > >To test: >- Apply patch >- Add and edit patrons with and without birthdate as > mandatory field (syspref BorrowerMandatoryField) >- Verify that dates (birtdate, registration, expiration) > display and are stored correctly > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >Works as advertised. Tested with syspref BorrowerMandatoryField and >table borrowers.dateofbirth >--- > members/memberentry.pl | 26 +++++++++----------------- > 1 file changed, 9 insertions(+), 17 deletions(-) > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 5841022..1a0f83b 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -35,7 +35,6 @@ use C4::Members; > use C4::Members::Attributes; > use C4::Members::AttributeTypes; > use C4::Koha; >-use C4::Dates qw/format_date format_date_in_iso/; > use C4::Log; > use C4::Letters; > use C4::Branch; # GetBranches >@@ -168,20 +167,11 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) > } > } > >- my $dateobject = C4::Dates->new(); >- my $syspref = $dateobject->regexp(); # same syspref format for all 3 dates >- my $iso = $dateobject->regexp('iso'); # > foreach (qw(dateenrolled dateexpiry dateofbirth)) { > next unless exists $newdata{$_}; > my $userdate = $newdata{$_} or next; >- if ($userdate =~ /$syspref/) { >- $newdata{$_} = format_date_in_iso($userdate); # if they match syspref format, then convert to ISO >- } elsif ($userdate =~ /$iso/) { >- warn "Date $_ ($userdate) is already in ISO format"; >- } else { >- ($userdate eq '0000-00-00') and warn "Data error: $_ is '0000-00-00'"; >- $template->param( "ERROR_$_" => 1 ); # else ERROR! >- push(@errors,"ERROR_$_"); >+ if ( $userdate ) { >+ $newdata{$_} = output_pref({ dt => dt_from_string( $userdate ), dateformat => 'iso', dateonly => 1 }); > } > } > # check permission to modify login info. >@@ -361,7 +351,7 @@ if ($op eq 'save' || $op eq 'insert'){ > > if ( ($op eq 'modify' || $op eq 'insert' || $op eq 'save'|| $op eq 'duplicate') and ($step == 0 or $step == 3 )){ > unless ($newdata{'dateexpiry'}){ >- my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso'); >+ my $arg2 = $newdata{'dateenrolled'} || output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); > $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); > } > } >@@ -657,10 +647,10 @@ if ($nok) { > #Formatting data for display > > if (!defined($data{'dateenrolled'}) or $data{'dateenrolled'} eq ''){ >- $data{'dateenrolled'}=C4::Dates->today('iso'); >+ $data{'dateenrolled'} = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); > } > if ( $op eq 'duplicate' ) { >- $data{'dateenrolled'} = C4::Dates->today('iso'); >+ $data{'dateenrolled'} = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); > $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, $data{'dateenrolled'} ); > } > if (C4::Context->preference('uppercasesurnames')) { >@@ -669,8 +659,10 @@ if (C4::Context->preference('uppercasesurnames')) { > } > > foreach (qw(dateenrolled dateexpiry dateofbirth)) { >- $data{$_} = format_date($data{$_}); # back to syspref for display >- $template->param( $_ => $data{$_}); >+ if ( $data{$_} ) { >+ $data{$_} = output_pref({ dt => dt_from_string( $data{$_} ), dateonly => 1 }); # back to syspref for display >+ } >+ $template->param( $_ => $data{$_}); > } > > if (C4::Context->preference('ExtendedPatronAttributes')) { >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14924
:
42953
|
42964
|
43028
|
43065
|
43217
|
43220