Lines 49-56
use C4::Form::MessagingPreferences;
Link Here
|
49 |
sub StringSearch { |
49 |
sub StringSearch { |
50 |
my ($searchstring,$type)=@_; |
50 |
my ($searchstring,$type)=@_; |
51 |
my $dbh = C4::Context->dbh; |
51 |
my $dbh = C4::Context->dbh; |
|
|
52 |
$searchstring //= ''; |
52 |
$searchstring=~ s/\'/\\\'/g; |
53 |
$searchstring=~ s/\'/\\\'/g; |
53 |
my @data=split(' ',$searchstring); |
54 |
my @data=split(' ',$searchstring); |
|
|
55 |
push @data,q{} if $#data==-1; |
54 |
my $count=@data; |
56 |
my $count=@data; |
55 |
my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode"); |
57 |
my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode"); |
56 |
$sth->execute("$data[0]%"); |
58 |
$sth->execute("$data[0]%"); |
Lines 67-73
my $input = new CGI;
Link Here
|
67 |
my $searchfield=$input->param('description'); |
69 |
my $searchfield=$input->param('description'); |
68 |
my $script_name="/cgi-bin/koha/admin/categorie.pl"; |
70 |
my $script_name="/cgi-bin/koha/admin/categorie.pl"; |
69 |
my $categorycode=$input->param('categorycode'); |
71 |
my $categorycode=$input->param('categorycode'); |
70 |
my $op = $input->param('op'); |
72 |
my $op = $input->param('op') // ''; |
71 |
|
73 |
|
72 |
my ($template, $loggedinuser, $cookie) |
74 |
my ($template, $loggedinuser, $cookie) |
73 |
= get_template_and_user({template_name => "admin/categorie.tmpl", |
75 |
= get_template_and_user({template_name => "admin/categorie.tmpl", |
Lines 106-112
if ($op eq 'add_form') {
Link Here
|
106 |
$sth->finish; |
108 |
$sth->finish; |
107 |
} |
109 |
} |
108 |
|
110 |
|
109 |
$data->{'enrolmentperioddate'} = undef if ($data->{'enrolmentperioddate'} eq '0000-00-00'); |
111 |
$data->{'enrolmentperioddate'} = undef if ($data->{'enrolmentperioddate'} && $data->{'enrolmentperioddate'} eq '0000-00-00'); |
|
|
112 |
$data->{'category_type'} //= ''; |
110 |
|
113 |
|
111 |
my $branches = GetBranches; |
114 |
my $branches = GetBranches; |
112 |
my @branches_loop; |
115 |
my @branches_loop; |
Lines 121-133
if ($op eq 'add_form') {
Link Here
|
121 |
|
124 |
|
122 |
$template->param(description => $data->{'description'}, |
125 |
$template->param(description => $data->{'description'}, |
123 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
126 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
124 |
enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), |
127 |
enrolmentperioddate => $data->{'enrolmentperioddate'}, |
125 |
upperagelimit => $data->{'upperagelimit'}, |
128 |
upperagelimit => $data->{'upperagelimit'}, |
126 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
129 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
127 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), |
130 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'} || 0), |
128 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
131 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
129 |
issuelimit => $data->{'issuelimit'}, |
132 |
issuelimit => $data->{'issuelimit'}, |
130 |
reservefee => sprintf("%.2f",$data->{'reservefee'}), |
133 |
reservefee => sprintf("%.2f",$data->{'reservefee'} || 0), |
131 |
hidelostitems => $data->{'hidelostitems'}, |
134 |
hidelostitems => $data->{'hidelostitems'}, |
132 |
category_type => $data->{'category_type'}, |
135 |
category_type => $data->{'category_type'}, |
133 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
136 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
Lines 202-210
if ($op eq 'add_form') {
Link Here
|
202 |
$template->param(totalgtzero => 1); |
205 |
$template->param(totalgtzero => 1); |
203 |
} |
206 |
} |
204 |
|
207 |
|
|
|
208 |
$data->{'enrolmentperioddate'} = undef if ($data->{'enrolmentperioddate'} && $data->{'enrolmentperioddate'} eq '0000-00-00'); |
205 |
$template->param( description => $data->{'description'}, |
209 |
$template->param( description => $data->{'description'}, |
206 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
210 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
207 |
enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), |
211 |
enrolmentperioddate => $data->{'enrolmentperioddate'}, |
208 |
upperagelimit => $data->{'upperagelimit'}, |
212 |
upperagelimit => $data->{'upperagelimit'}, |
209 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
213 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
210 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), |
214 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), |
Lines 240-250
if ($op eq 'add_form') {
Link Here
|
240 |
while ( my $branch = $sth->fetchrow_hashref ) { |
244 |
while ( my $branch = $sth->fetchrow_hashref ) { |
241 |
push @selected_branches, $branch; |
245 |
push @selected_branches, $branch; |
242 |
} |
246 |
} |
|
|
247 |
my $enrolmentperioddate = $results->[$i]{'enrolmentperioddate'}; |
248 |
if (defined($enrolmentperioddate) && $enrolmentperioddate eq '0000-00-00') { |
249 |
$enrolmentperioddate = undef; |
250 |
} |
243 |
my %row = ( |
251 |
my %row = ( |
244 |
categorycode => $results->[$i]{'categorycode'}, |
252 |
categorycode => $results->[$i]{'categorycode'}, |
245 |
description => $results->[$i]{'description'}, |
253 |
description => $results->[$i]{'description'}, |
246 |
enrolmentperiod => $results->[$i]{'enrolmentperiod'}, |
254 |
enrolmentperiod => $results->[$i]{'enrolmentperiod'}, |
247 |
enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), |
255 |
enrolmentperioddate => $enrolmentperioddate, |
248 |
upperagelimit => $results->[$i]{'upperagelimit'}, |
256 |
upperagelimit => $results->[$i]{'upperagelimit'}, |
249 |
dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, |
257 |
dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, |
250 |
enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), |
258 |
enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), |