View | Details | Raw Unified | Return to bug 11513
Collapse All | Expand All

(-)a/admin/categorie.pl (-11 / +24 lines)
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
    if ($data->{'enrolmentperioddate'} && $data->{'enrolmentperioddate'} eq '0000-00-00') {
112
        $data->{'enrolmentperioddate'} = undef;
113
    }
114
    $data->{'category_type'} //= '';
110
115
111
    my $branches = GetBranches;
116
    my $branches = GetBranches;
112
    my @branches_loop;
117
    my @branches_loop;
Lines 121-133 if ($op eq 'add_form') { Link Here
121
126
122
	$template->param(description        => $data->{'description'},
127
	$template->param(description        => $data->{'description'},
123
				enrolmentperiod         => $data->{'enrolmentperiod'},
128
				enrolmentperiod         => $data->{'enrolmentperiod'},
124
				enrolmentperioddate     => C4::Dates::format_date($data->{'enrolmentperioddate'}),
129
                         enrolmentperioddate     => $data->{'enrolmentperioddate'},
125
				upperagelimit           => $data->{'upperagelimit'},
130
				upperagelimit           => $data->{'upperagelimit'},
126
				dateofbirthrequired     => $data->{'dateofbirthrequired'},
131
				dateofbirthrequired     => $data->{'dateofbirthrequired'},
127
				enrolmentfee            => sprintf("%.2f",$data->{'enrolmentfee'}),
132
                         enrolmentfee            => sprintf("%.2f",$data->{'enrolmentfee'} || 0),
128
				overduenoticerequired   => $data->{'overduenoticerequired'},
133
				overduenoticerequired   => $data->{'overduenoticerequired'},
129
				issuelimit              => $data->{'issuelimit'},
134
				issuelimit              => $data->{'issuelimit'},
130
				reservefee              => sprintf("%.2f",$data->{'reservefee'}),
135
                         reservefee              => sprintf("%.2f",$data->{'reservefee'} || 0),
131
                                hidelostitems           => $data->{'hidelostitems'},
136
                                hidelostitems           => $data->{'hidelostitems'},
132
				category_type           => $data->{'category_type'},
137
				category_type           => $data->{'category_type'},
133
                SMSSendDriver => C4::Context->preference("SMSSendDriver"),
138
                SMSSendDriver => C4::Context->preference("SMSSendDriver"),
Lines 202-216 if ($op eq 'add_form') { Link Here
202
		$template->param(totalgtzero => 1);
207
		$template->param(totalgtzero => 1);
203
	}
208
	}
204
209
210
    if ($data->{'enrolmentperioddate'} && $data->{'enrolmentperioddate'} eq '0000-00-00') {
211
        $data->{'enrolmentperioddate'} = undef;
212
    }
205
        $template->param(       description             => $data->{'description'},
213
        $template->param(       description             => $data->{'description'},
206
                                enrolmentperiod         => $data->{'enrolmentperiod'},
214
                                enrolmentperiod         => $data->{'enrolmentperiod'},
207
                                enrolmentperioddate     => C4::Dates::format_date($data->{'enrolmentperioddate'}),
215
                                enrolmentperioddate     => $data->{'enrolmentperioddate'},
208
                                upperagelimit           => $data->{'upperagelimit'},
216
                                upperagelimit           => $data->{'upperagelimit'},
209
                                dateofbirthrequired     => $data->{'dateofbirthrequired'},
217
                                dateofbirthrequired     => $data->{'dateofbirthrequired'},
210
                                enrolmentfee            =>  sprintf("%.2f",$data->{'enrolmentfee'}),
218
                                enrolmentfee            =>  sprintf("%.2f",$data->{'enrolmentfee'} || 0),
211
                                overduenoticerequired   => $data->{'overduenoticerequired'},
219
                                overduenoticerequired   => $data->{'overduenoticerequired'},
212
                                issuelimit              => $data->{'issuelimit'},
220
                                issuelimit              => $data->{'issuelimit'},
213
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
221
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'} || 0),
214
                                hidelostitems           => $data->{'hidelostitems'},
222
                                hidelostitems           => $data->{'hidelostitems'},
215
                                category_type           => $data->{'category_type'},
223
                                category_type           => $data->{'category_type'},
216
                                );
224
                                );
Lines 240-256 if ($op eq 'add_form') { Link Here
240
        while ( my $branch = $sth->fetchrow_hashref ) {
248
        while ( my $branch = $sth->fetchrow_hashref ) {
241
            push @selected_branches, $branch;
249
            push @selected_branches, $branch;
242
        }
250
        }
251
        my $enrolmentperioddate = $results->[$i]{'enrolmentperioddate'};
252
    if ($enrolmentperioddate && $enrolmentperioddate eq '0000-00-00') {
253
        $enrolmentperioddate = undef;
254
    }
255
    $results->[$i]{'category_type'} //= '';
243
		my %row = (
256
		my %row = (
244
		        categorycode            => $results->[$i]{'categorycode'},
257
		        categorycode            => $results->[$i]{'categorycode'},
245
				description             => $results->[$i]{'description'},
258
				description             => $results->[$i]{'description'},
246
				enrolmentperiod         => $results->[$i]{'enrolmentperiod'},
259
				enrolmentperiod         => $results->[$i]{'enrolmentperiod'},
247
				enrolmentperioddate     => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}),
260
                        enrolmentperioddate     => $enrolmentperioddate,
248
				upperagelimit           => $results->[$i]{'upperagelimit'},
261
				upperagelimit           => $results->[$i]{'upperagelimit'},
249
				dateofbirthrequired     => $results->[$i]{'dateofbirthrequired'},
262
				dateofbirthrequired     => $results->[$i]{'dateofbirthrequired'},
250
				enrolmentfee            => sprintf("%.2f",$results->[$i]{'enrolmentfee'}),
263
                        enrolmentfee            => sprintf("%.2f",$results->[$i]{'enrolmentfee'} || 0),
251
				overduenoticerequired   => $results->[$i]{'overduenoticerequired'},
264
				overduenoticerequired   => $results->[$i]{'overduenoticerequired'},
252
				issuelimit              => $results->[$i]{'issuelimit'},
265
				issuelimit              => $results->[$i]{'issuelimit'},
253
				reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'}),
266
                        reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'} || 0),
254
                                hidelostitems           => $results->[$i]{'hidelostitems'},
267
                                hidelostitems           => $results->[$i]{'hidelostitems'},
255
				category_type           => $results->[$i]{'category_type'},
268
				category_type           => $results->[$i]{'category_type'},
256
                "type_".$results->[$i]{'category_type'} => 1,
269
                "type_".$results->[$i]{'category_type'} => 1,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (-2 / +2 lines)
Lines 1-3 Link Here
1
[% USE KohaDates -%]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
3
<title>Koha &rsaquo; Administration &rsaquo; Patron categories &rsaquo; [% IF ( add_form ) %][% IF ( categorycode ) %]Modify category '[% categorycode |html %]'[% ELSE %]New category[% END %][% END %]
3
[% IF ( add_validate ) %]Data recorded[% END %]
4
[% IF ( add_validate ) %]Data recorded[% END %]
Lines 151-157 Link Here
151
	<li><label for="enrolmentperiod" style="width:6em;">In months: </label>
152
	<li><label for="enrolmentperiod" style="width:6em;">In months: </label>
152
		<input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
153
		<input type="text" name="enrolmentperiod" id="enrolmentperiod" size="3" maxlength="3" value="[% IF ( enrolmentperiod ) %][% enrolmentperiod %][% END %]" /> months</li>
153
	<li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
154
	<li><label for="enrolmentperioddate" style="width:6em;">Until date: </label>
154
        <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate %]" />
155
        <input type="text" name="enrolmentperioddate" id="enrolmentperioddate" value="[% enrolmentperioddate | $KohaDates %]" />
155
		<div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
156
		<div id="enrolmentmessage" class="hint" style="margin-left:0;">Cannot have "months" and "until date" at the same time</div>
156
	</li>
157
	</li>
157
	</ol>
158
	</ol>
158
- 

Return to bug 11513