From 0b6741ad9a9b0729ce79144026dbc1f657609def Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 4 Dec 2007 17:40:50 -0600 Subject: [PATCH] members subdir - Dates.pm integration and warnings fixes. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- members/boraccount.pl | 2 +- members/borrowers_details.pl | 2 +- members/guarantor_search.pl | 2 +- members/member-picupload.pl | 3 +- members/memberentry.pl | 59 ++++++++++++++++-------------------- members/readingrec.pl | 2 +- 6 files changed, 31 insertions(+), 39 deletions(-) diff --git a/members/boraccount.pl b/members/boraccount.pl index c1dd6a093c..96da012b76 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -25,7 +25,7 @@ use strict; use C4::Auth; use C4::Output; -use C4::Date; +use C4::Dates; use CGI; use C4::Members; diff --git a/members/borrowers_details.pl b/members/borrowers_details.pl index f3317c667a..5ada76e9e9 100755 --- a/members/borrowers_details.pl +++ b/members/borrowers_details.pl @@ -31,7 +31,7 @@ use C4::Context; use C4::Output; use C4::Members; use C4::Koha; -use C4::Date; +use C4::Dates; use C4::Input; use C4::Log; my $input = new CGI; diff --git a/members/guarantor_search.pl b/members/guarantor_search.pl index 8059b72c9d..4e0d37a0a4 100755 --- a/members/guarantor_search.pl +++ b/members/guarantor_search.pl @@ -26,7 +26,7 @@ use C4::Output; use CGI; #op -use C4::Date; +use C4::Dates; use C4::Members; my $input = new CGI; diff --git a/members/member-picupload.pl b/members/member-picupload.pl index 6ca68a754b..c6f6afc7a8 100755 --- a/members/member-picupload.pl +++ b/members/member-picupload.pl @@ -37,7 +37,6 @@ my $borrowernumber = $input->param('borrowernumber'); my $photo = $input->param('photo'); my $template_name; -my $upload_dir= my $htdocs = C4::Context->config('intrahtdocs'); my $upload_dir = $htdocs."/borrowerimages"; if($photo eq ""){ @@ -73,4 +72,4 @@ else { ); output_html_with_http_headers $input, $cookie, $template->output; } -print $input->redirect("http://intranet/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); \ No newline at end of file +print $input->redirect("http://intranet/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); diff --git a/members/memberentry.pl b/members/memberentry.pl index 555fd66967..41502022d1 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -32,7 +32,7 @@ use C4::Context; use C4::Output; use C4::Members; use C4::Koha; -use C4::Date; +use C4::Dates; use C4::Input; use C4::Log; use C4::Branch; # GetBranches @@ -108,8 +108,8 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') { $newdata{$key} =~ s/\"/"/gg unless $key eq 'borrowernotes' or $key eq 'opacnote'; } $newdata{'dateenrolled'}=format_date_in_iso($newdata{'dateenrolled'}) if ($newdata{dateenrolled}); - $newdata{'dateexpiry'}=format_date_in_iso($newdata{'dateexpiry'}) if ($newdata{dateexpiry}); - $newdata{'dateofbirth'}=format_date_in_iso($newdata{'dateofbirth'}) if ($newdata{dateofbirth}); + $newdata{'dateexpiry'} =format_date_in_iso($newdata{'dateexpiry'} ) if ($newdata{dateexpiry}); + $newdata{'dateofbirth'} =format_date_in_iso($newdata{'dateofbirth'} ) if ($newdata{dateofbirth}); # check permission to modify login info. if ($borrower_data && ($borrower_data->{'category_type'} eq 'S') && (! C4::Auth::haspermission($dbh,$userenv->{'id'},{'staffaccess'=>1}))) { $noUpdateLogin =1; @@ -190,16 +190,11 @@ if ($op eq 'save' || $op eq 'insert'){ if ($op eq 'modify' || $op eq 'insert'){ unless ($newdata{'dateexpiry'}){ - if ($newdata{'dateenrolled'}){ - $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$newdata{'dateenrolled'}); - } else { - my $today= sprintf('%04d-%02d-%02d', Today()); - $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$today) ; - } + my $arg2 = $newdata{'dateenrolled'} || sprintf('%04d-%02d-%02d', Today()); + $newdata{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2); } } - if ($op eq 'insert'){ # Check if the userid is unique unless ($nok){ @@ -228,8 +223,7 @@ if ($op eq 'save'){ &ModMember(%newdata); if ($destination eq "circ") { print $input->redirect("/cgi-bin/koha/circ/circulation.pl?findborrower=$data{'cardnumber'}"); - } - else { + } else { print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); } } @@ -311,7 +305,8 @@ if ($select_city eq '' ){ my $selectcity=&getidcity($data{'city'}); $default_city=$selectcity; } -my($cityid,$name_city)=GetCities(); +my($cityid); +($cityid,$name_city)=GetCities(); $template->param( city_cgipopup => 1) if ($cityid ); my $citypopup = CGI::popup_menu(-name=>'select_city', -id => 'select_city', @@ -327,8 +322,8 @@ my($roadtypeid,$road_type)=GetRoadTypes(); my $roadpopup = CGI::popup_menu(-name=>'streettype', -id => 'streettype', -values=>$roadtypeid, - -labels=>$road_type, - -override => 1, + -labels=>$road_type, + -override => 1, -default=>$default_roadtype ); @@ -336,10 +331,10 @@ my $default_borrowertitle; $default_borrowertitle=$data{'title'} ; my($borrowertitle)=GetTitles(); my $borrotitlepopup = CGI::popup_menu(-name=>'title', - -id => 'btitle', - -values=>$borrowertitle, - -override => 1, - -default=>$default_borrowertitle + -id => 'btitle', + -values=>$borrowertitle, + -override => 1, + -default=>$default_borrowertitle ); @@ -426,7 +421,6 @@ if (C4::Context->preference("memberofinstitution")){ -size => 5, -multiple => 'true' - ); } @@ -436,10 +430,8 @@ if (C4::Context->preference("memberofinstitution")){ my $CGIsort1 = buildCGIsort("Bsort1","sort1",$data{'sort1'}); if ($CGIsort1) { $template->param(CGIsort1 => $CGIsort1); - $template->param( sort1 => $data{'sort1'}); -} else { - $template->param( sort1 => $data{'sort1'}); } +$template->param( sort1 => $data{'sort1'}); my $CGIsort2 = buildCGIsort("Bsort2","sort2",$data{'sort2'}); if ($CGIsort2) { @@ -460,14 +452,15 @@ if ($data{'dateenrolled'} eq ''){ my $today= sprintf('%04d-%02d-%02d', Today()); $data{'dateenrolled'}=$today; } -$data{'surname'}=uc($data{'surname'}) if C4::Context->preference('uppercasesurnames'); -$data{'dateenrolled'}=format_date($data{'dateenrolled'}); -$data{'dateexpiry'}=format_date($data{'dateexpiry'}); -$data{'contactname'}=uc($data{'contactname'}) if C4::Context->preference('uppercasesurnames'); -$data{'dateofbirth'} = format_date($data{'dateofbirth'}); - -$template->param( "showguarantor" => 1) if ($category_type!~/A|I|S/);# associate with step to know where u are -$template->param( "showguarantor" => 0) if ($category_type=~/A|I|S/);# associate with step to know where u are +if (C4::Context->preference('uppercasesurnames')) { + $data{'surname'} =uc($data{'surname'} ); + $data{'contactname'}=uc($data{'contactname'}); +} +$data{'dateenrolled'} = format_date($data{'dateenrolled'}); +$data{'dateexpiry'} = format_date($data{'dateexpiry'}); +$data{'dateofbirth'} = format_date($data{'dateofbirth'}); + +$template->param( "showguarantor" => ($category_type=~/A|I|S/) ? 0 : 1); # associate with step to know where you are warn "$step"; $template->param(%data); $template->param( "step_$step" => 1) if $step;# associate with step to know where u are @@ -475,7 +468,7 @@ $template->param( "step" => $step) if $step;# associate with step to know where $template->param( BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript category_type => $category_type,#to know the category type of the borrower - DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(), + DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), select_city => $select_city, "$category_type" => 1,# associate with step to know where u are destination => $destination,#to know wher u come from and wher u must go in redirect @@ -493,7 +486,7 @@ $template->param( borrotitlepopup => $borrotitlepopup, guarantorinfo => $guarantorinfo, flagloop => \@flagdata, - dateformat => display_date_format(), + dateformat => C4::Dates->new()->visual(), check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function modify => $modify, nok => $nok,#flag to konw if an error diff --git a/members/readingrec.pl b/members/readingrec.pl index a7ef3a47c5..10e8919302 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -26,7 +26,7 @@ use C4::Output; use CGI; use C4::Members; -use C4::Date; +use C4::Dates; my $input=new CGI; -- 2.39.5