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

(-)a/C4/Members.pm (-2 / +22 lines)
Lines 325-335 sub GetMemberDetails { Link Here
325
    my $query;
325
    my $query;
326
    my $sth;
326
    my $sth;
327
    if ($borrowernumber) {
327
    if ($borrowernumber) {
328
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE  borrowernumber=?");
328
        $sth = $dbh->prepare("
329
            SELECT borrowers.*,
330
                   category_type,
331
                   categories.description,
332
                   categories.BlockExpiredPatronOpacActions,
333
                   reservefee,
334
                   enrolmentperiod 
335
            FROM borrowers 
336
            LEFT JOIN categories ON borrowers.categorycode=categories.categorycode 
337
            WHERE borrowernumber = ?
338
        ");
329
        $sth->execute($borrowernumber);
339
        $sth->execute($borrowernumber);
330
    }
340
    }
331
    elsif ($cardnumber) {
341
    elsif ($cardnumber) {
332
        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?");
342
        $sth = $dbh->prepare("
343
            SELECT borrowers.*,
344
                   category_type,
345
                   categories.description,
346
                   categories.BlockExpiredPatronOpacActions,
347
                   reservefee,
348
                   enrolmentperiod 
349
            FROM borrowers 
350
            LEFT JOIN categories ON borrowers.categorycode = categories.categorycode 
351
            WHERE cardnumber = ?
352
        ");
333
        $sth->execute($cardnumber);
353
        $sth->execute($cardnumber);
334
    }
354
    }
335
    else {
355
    else {
(-)a/admin/categorie.pl (-116 / +207 lines)
Lines 46-87 use C4::Output; Link Here
46
use C4::Dates;
46
use C4::Dates;
47
use C4::Form::MessagingPreferences;
47
use C4::Form::MessagingPreferences;
48
48
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=~ s/\'/\\\'/g;
52
    $searchstring =~ s/\'/\\\'/g;
53
	my @data=split(' ',$searchstring);
53
    my @data  = split( ' ', $searchstring );
54
	my $count=@data;
54
    my $count = @data;
55
	my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode");
55
    my $sth   = $dbh->prepare("SELECT * FROM categories WHERE (description LIKE ?) ORDER BY category_type, description, categorycode");
56
	$sth->execute("$data[0]%");
56
    $sth->execute("$data[0]%");
57
	my @results;
57
    my @results;
58
	while (my $data=$sth->fetchrow_hashref){
59
	push(@results,$data);
60
	}
61
	#  $sth->execute;
62
	$sth->finish;
63
	return (scalar(@results),\@results);
64
}
65
58
66
my $input = new CGI;
59
    while ( my $data = $sth->fetchrow_hashref ) {
67
my $searchfield=$input->param('description');
60
        push( @results, $data );
68
my $script_name="/cgi-bin/koha/admin/categorie.pl";
61
    }
69
my $categorycode=$input->param('categorycode');
70
my $op = $input->param('op');
71
62
72
my ($template, $loggedinuser, $cookie)
63
    #  $sth->execute;
73
    = get_template_and_user({template_name => "admin/categorie.tmpl",
64
    $sth->finish;
74
			     query => $input,
65
    return ( scalar(@results), \@results );
75
			     type => "intranet",
66
}
76
			     authnotrequired => 0,
77
                 flagsrequired => {parameters => 'parameters_remaining_permissions'},
78
			     debug => 1,
79
			     });
80
67
68
my $input         = new CGI;
69
my $searchfield   = $input->param('description');
70
my $script_name   = "/cgi-bin/koha/admin/categorie.pl";
71
my $categorycode  = $input->param('categorycode');
72
my $op            = $input->param('op');
73
my $block_expired = $input->param("block_expired");
81
74
82
$template->param(script_name => $script_name,
75
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
83
		 categorycode => $categorycode,
76
    {   template_name   => "admin/categorie.tmpl",
84
		 searchfield => $searchfield);
77
        query           => $input,
78
        type            => "intranet",
79
        authnotrequired => 0,
80
        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
81
        debug           => 1,
82
    }
83
);
84
85
$template->param(
86
    script_name  => $script_name,
87
    categorycode => $categorycode,
88
    searchfield  => $searchfield
89
);
85
90
86
91
87
################## ADD_FORM ##################################
92
################## ADD_FORM ##################################
Lines 94-103 if ($op eq 'add_form') { Link Here
94
    my @selected_branches;
99
    my @selected_branches;
95
	if ($categorycode) {
100
	if ($categorycode) {
96
		my $dbh = C4::Context->dbh;
101
		my $dbh = C4::Context->dbh;
97
		my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
102
        my $sth=$dbh->prepare("
103
            SELECT * 
104
            FROM categories 
105
            WHERE categorycode = ?
106
        ");
98
		$sth->execute($categorycode);
107
		$sth->execute($categorycode);
99
		$data=$sth->fetchrow_hashref;
108
		$data = $sth->fetchrow_hashref;
100
101
        $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?");
109
        $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?");
102
        $sth->execute( $categorycode );
110
        $sth->execute( $categorycode );
103
        while ( my $branch = $sth->fetchrow_hashref ) {
111
        while ( my $branch = $sth->fetchrow_hashref ) {
Lines 119-140 if ($op eq 'add_form') { Link Here
119
        };
127
        };
120
    }
128
    }
121
129
122
	$template->param(description        => $data->{'description'},
130
    $template->param(
123
				enrolmentperiod         => $data->{'enrolmentperiod'},
131
        description                        => $data->{'description'},
124
				enrolmentperioddate     => C4::Dates::format_date($data->{'enrolmentperioddate'}),
132
        enrolmentperiod                    => $data->{'enrolmentperiod'},
125
				upperagelimit           => $data->{'upperagelimit'},
133
        enrolmentperioddate                => C4::Dates::format_date( $data->{'enrolmentperioddate'} ),
126
				dateofbirthrequired     => $data->{'dateofbirthrequired'},
134
        upperagelimit                      => $data->{'upperagelimit'},
127
				enrolmentfee            => sprintf("%.2f",$data->{'enrolmentfee'}),
135
        dateofbirthrequired                => $data->{'dateofbirthrequired'},
128
				overduenoticerequired   => $data->{'overduenoticerequired'},
136
        enrolmentfee                       => sprintf( "%.2f", $data->{'enrolmentfee'} ),
129
				issuelimit              => $data->{'issuelimit'},
137
        overduenoticerequired              => $data->{'overduenoticerequired'},
130
				reservefee              => sprintf("%.2f",$data->{'reservefee'}),
138
        issuelimit                         => $data->{'issuelimit'},
131
                                hidelostitems           => $data->{'hidelostitems'},
139
        reservefee                         => sprintf( "%.2f", $data->{'reservefee'} ),
132
				category_type           => $data->{'category_type'},
140
        hidelostitems                      => $data->{'hidelostitems'},
133
                SMSSendDriver => C4::Context->preference("SMSSendDriver"),
141
        category_type                      => $data->{'category_type'},
134
                TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"),
142
        SMSSendDriver                      => C4::Context->preference("SMSSendDriver"),
135
				"type_".$data->{'category_type'} => 1,
143
        TalkingTechItivaPhone              => C4::Context->preference("TalkingTechItivaPhoneNotification"),
136
                branches_loop           => \@branches_loop,
144
        branches_loop                      => \@branches_loop,
137
				);
145
        SMSSendDriver                      => C4::Context->preference("SMSSendDriver"),
146
        BlockExpiredPatronOpacActions      => $data->{'BlockExpiredPatronOpacActions'},
147
        "type_" . $data->{'category_type'} => 1,
148
    );
149
    
138
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
150
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
139
        C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template);
151
        C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template);
140
    }
152
    }
Lines 148-166 if ($op eq 'add_form') { Link Here
148
	if($input->param('enrolmentperioddate')){
160
	if($input->param('enrolmentperioddate')){
149
	    $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) );
161
	    $input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) );
150
	}
162
	}
151
	
163
152
	if ($is_a_modif) {
164
	if ($is_a_modif) {
153
            my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?");
165
            my $sth=$dbh->prepare("
154
            $sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode'));
166
                UPDATE categories 
167
                SET description=?,
168
                    enrolmentperiod=?, 
169
                    enrolmentperioddate=?,
170
                    upperagelimit=?,
171
                    dateofbirthrequired=?,
172
                    enrolmentfee=?,
173
                    reservefee=?,
174
                    hidelostitems=?,
175
                    overduenoticerequired=?,
176
                    category_type=?,
177
                    BlockExpiredPatronOpacActions=? 
178
                WHERE categorycode=?"
179
            );
180
            $sth->execute(
181
                map { $input->param($_) } (
182
                    'description',
183
                    'enrolmentperiod',
184
                    'enrolmentperioddate',
185
                    'upperagelimit',
186
                    'dateofbirthrequired',
187
                    'enrolmentfee',
188
                    'reservefee',
189
                    'hidelostitems',
190
                    'overduenoticerequired',
191
                    'category_type',
192
                    'block_expired',
193
                    'categorycode'
194
                )
195
            );
155
            my @branches = $input->param("branches");
196
            my @branches = $input->param("branches");
156
            if ( @branches ) {
197
            if ( @branches ) {
157
                $sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?");
198
                $sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?");
158
                $sth->execute( $input->param( "categorycode" ) );
199
                $sth->execute( $input->param( "categorycode" ) );
159
                $sth = $dbh->prepare(
200
                $sth = $dbh->prepare("
160
                    "INSERT INTO categories_branches
201
                    INSERT INTO categories_branches ( categorycode, branchcode )
161
                                ( categorycode, branchcode )
202
                    VALUES ( ?, ? )
162
                                VALUES ( ?, ? )"
203
                ");
163
                );
164
                for my $branchcode ( @branches ) {
204
                for my $branchcode ( @branches ) {
165
                    next if not $branchcode;
205
                    next if not $branchcode;
166
                    $sth->bind_param( 1, $input->param( "categorycode" ) );
206
                    $sth->bind_param( 1, $input->param( "categorycode" ) );
Lines 169-200 if ($op eq 'add_form') { Link Here
169
                }
209
                }
170
            }
210
            }
171
            $sth->finish;
211
            $sth->finish;
172
        } else {
212
    } else {
173
            my $sth=$dbh->prepare("INSERT INTO categories  (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)");
213
        my $sth=$dbh->prepare("
174
            $sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type'));
214
            INSERT INTO categories (
175
            $sth->finish;
215
                categorycode,
176
        }
216
                description,
177
    if (C4::Context->preference('EnhancedMessagingPreferences')) {
217
                enrolmentperiod,
178
        C4::Form::MessagingPreferences::handle_form_action($input, 
218
                enrolmentperioddate,
179
                                                           { categorycode => $input->param('categorycode') }, $template);
219
                upperagelimit,
220
                dateofbirthrequired,
221
                enrolmentfee,
222
                reservefee,
223
                hidelostitems,
224
                overduenoticerequired,
225
                category_type,
226
                BlockExpiredPatronOpacActions
227
            ) 
228
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
229
        $sth->execute(
230
            map { $input->param($_) } (
231
                'categorycode',
232
                'description',
233
                'enrolmentperiod',
234
                'enrolmentperioddate',
235
                'upperagelimit',
236
                'dateofbirthrequired',
237
                'enrolmentfee',
238
                'reservefee',
239
                'hidelostitems',
240
                'overduenoticerequired',
241
                'category_type',
242
                'block_expired'
243
            )
244
        );
245
        $sth->finish;
246
    }
247
    if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
248
        C4::Form::MessagingPreferences::handle_form_action( $input, { categorycode => $input->param('categorycode') }, $template );
180
    }
249
    }
181
	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>";
250
	print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>";
182
	exit;
251
	exit;
183
252
184
													# END $OP eq ADD_VALIDATE
253
# END $OP eq ADD_VALIDATE
185
################## DELETE_CONFIRM ##################################
254
################## DELETE_CONFIRM ##################################
186
# called by default form, used to confirm deletion of data in DB
255
# called by default form, used to confirm deletion of data in DB
187
} elsif ($op eq 'delete_confirm') {
256
} elsif ($op eq 'delete_confirm') {
188
	$template->param(delete_confirm => 1);
257
	$template->param(delete_confirm => 1);
189
258
190
	my $dbh = C4::Context->dbh;
259
	my $dbh = C4::Context->dbh;
191
	my $sth=$dbh->prepare("select count(*) as total from borrowers where categorycode=?");
260
	my $sth=$dbh->prepare("SELECT count(*) AS total FROM borrowers WHERE categorycode = ?");
192
	$sth->execute($categorycode);
261
	$sth->execute($categorycode);
193
	my $total = $sth->fetchrow_hashref;
262
	my $total = $sth->fetchrow_hashref;
194
	$sth->finish;
263
	$sth->finish;
195
	$template->param(total => $total->{'total'});
264
	$template->param(total => $total->{'total'});
196
	
265
197
	my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?");
266
    my $sth2 = $dbh->prepare("
267
        SELECT *
268
        FROM categories 
269
        WHERE categorycode = ?
270
    ");
198
	$sth2->execute($categorycode);
271
	$sth2->execute($categorycode);
199
	my $data=$sth2->fetchrow_hashref;
272
	my $data=$sth2->fetchrow_hashref;
200
	$sth2->finish;
273
	$sth2->finish;
Lines 202-219 if ($op eq 'add_form') { Link Here
202
		$template->param(totalgtzero => 1);
275
		$template->param(totalgtzero => 1);
203
	}
276
	}
204
277
205
        $template->param(       description             => $data->{'description'},
278
    $template->param(
206
                                enrolmentperiod         => $data->{'enrolmentperiod'},
279
        description                   => $data->{'description'},
207
                                enrolmentperioddate     => C4::Dates::format_date($data->{'enrolmentperioddate'}),
280
        enrolmentperiod               => $data->{'enrolmentperiod'},
208
                                upperagelimit           => $data->{'upperagelimit'},
281
        enrolmentperioddate           => C4::Dates::format_date( $data->{'enrolmentperioddate'} ),
209
                                dateofbirthrequired     => $data->{'dateofbirthrequired'},
282
        upperagelimit                 => $data->{'upperagelimit'},
210
                                enrolmentfee            =>  sprintf("%.2f",$data->{'enrolmentfee'}),
283
        dateofbirthrequired           => $data->{'dateofbirthrequired'},
211
                                overduenoticerequired   => $data->{'overduenoticerequired'},
284
        enrolmentfee                  => sprintf( "%.2f", $data->{'enrolmentfee'} ),
212
                                issuelimit              => $data->{'issuelimit'},
285
        overduenoticerequired         => $data->{'overduenoticerequired'},
213
                                reservefee              =>  sprintf("%.2f",$data->{'reservefee'}),
286
        issuelimit                    => $data->{'issuelimit'},
214
                                hidelostitems           => $data->{'hidelostitems'},
287
        reservefee                    => sprintf( "%.2f", $data->{'reservefee'} ),
215
                                category_type           => $data->{'category_type'},
288
        hidelostitems                 => $data->{'hidelostitems'},
216
                                );
289
        category_type                 => $data->{'category_type'},
290
        BlockExpiredPatronOpacActions => $data->{'BlockExpiredPatronOpacActions'},
291
    );
217
													# END $OP eq DELETE_CONFIRM
292
													# END $OP eq DELETE_CONFIRM
218
################## DELETE_CONFIRMED ##################################
293
################## DELETE_CONFIRMED ##################################
219
# called by delete_confirm, used to effectively confirm deletion of data in DB
294
# called by delete_confirm, used to effectively confirm deletion of data in DB
Lines 229-279 if ($op eq 'add_form') { Link Here
229
304
230
													# END $OP eq DELETE_CONFIRMED
305
													# END $OP eq DELETE_CONFIRMED
231
} else { # DEFAULT
306
} else { # DEFAULT
232
	$template->param(else => 1);
307
    $template->param(else => 1);
233
	my @loop;
308
    my @loop;
234
	my ($count,$results)=StringSearch($searchfield,'web');
309
    my ($count,$results) = StringSearch($searchfield,'web');
310
    
235
    my $dbh = C4::Context->dbh;
311
    my $dbh = C4::Context->dbh;
236
    my $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?");
312
    my $sth = $dbh->prepare("
237
	for (my $i=0; $i < $count; $i++){
313
        SELECT b.branchcode, 
314
               b.branchname 
315
        FROM categories_branches AS cb, 
316
             branches AS b 
317
        WHERE cb.branchcode = b.branchcode 
318
          AND cb.categorycode = ?
319
    ");
320
321
    for (my $i=0; $i < $count; $i++){
238
        $sth->execute( $results->[$i]{'categorycode'} );
322
        $sth->execute( $results->[$i]{'categorycode'} );
323
239
        my @selected_branches;
324
        my @selected_branches;
240
        while ( my $branch = $sth->fetchrow_hashref ) {
325
        while ( my $branch = $sth->fetchrow_hashref ) {
241
            push @selected_branches, $branch;
326
            push @selected_branches, $branch;
242
        }
327
        }
243
		my %row = (
328
244
		        categorycode            => $results->[$i]{'categorycode'},
329
        my %row = (
245
				description             => $results->[$i]{'description'},
330
            categorycode            => $results->[$i]{'categorycode'},
246
				enrolmentperiod         => $results->[$i]{'enrolmentperiod'},
331
            description             => $results->[$i]{'description'},
247
				enrolmentperioddate     => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}),
332
            enrolmentperiod         => $results->[$i]{'enrolmentperiod'},
248
				upperagelimit           => $results->[$i]{'upperagelimit'},
333
            enrolmentperioddate     => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}),
249
				dateofbirthrequired     => $results->[$i]{'dateofbirthrequired'},
334
            upperagelimit           => $results->[$i]{'upperagelimit'},
250
				enrolmentfee            => sprintf("%.2f",$results->[$i]{'enrolmentfee'}),
335
            dateofbirthrequired     => $results->[$i]{'dateofbirthrequired'},
251
				overduenoticerequired   => $results->[$i]{'overduenoticerequired'},
336
            enrolmentfee            => sprintf("%.2f",$results->[$i]{'enrolmentfee'}),
252
				issuelimit              => $results->[$i]{'issuelimit'},
337
            overduenoticerequired   => $results->[$i]{'overduenoticerequired'},
253
				reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'}),
338
            issuelimit              => $results->[$i]{'issuelimit'},
254
                                hidelostitems           => $results->[$i]{'hidelostitems'},
339
            reservefee              => sprintf("%.2f",$results->[$i]{'reservefee'}),
255
				category_type           => $results->[$i]{'category_type'},
340
            hidelostitems           => $results->[$i]{'hidelostitems'},
256
                "type_".$results->[$i]{'category_type'} => 1,
341
            category_type           => $results->[$i]{'category_type'},
257
                branches                => \@selected_branches,
342
            block_syspref           => 1,
343
            branches                => \@selected_branches,
344
            "type_".$results->[$i]{'category_type'} => 1,
258
        );
345
        );
346
259
        if (C4::Context->preference('EnhancedMessagingPreferences')) {
347
        if (C4::Context->preference('EnhancedMessagingPreferences')) {
260
            my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
348
            my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
261
            $row{messaging_prefs} = $brief_prefs if @$brief_prefs;
349
            $row{messaging_prefs} = $brief_prefs if @$brief_prefs;
262
        }
350
        }
263
		push @loop, \%row;
351
        
264
	}
352
        push @loop, \%row;
265
	$template->param(loop => \@loop);
353
    }
266
	# check that I (institution) and C (child) exists. otherwise => warning to the user
354
267
    $sth=$dbh->prepare("select category_type from categories where category_type='C'");
355
    $template->param(loop => \@loop);
268
	$sth->execute;
356
    # check that I (institution) and C (child) exists. otherwise => warning to the user
269
	my ($categoryChild) = $sth->fetchrow;
357
270
	$template->param(categoryChild => $categoryChild);
358
    $sth = $dbh->prepare("select category_type from categories where category_type='C'");
271
	$sth=$dbh->prepare("select category_type from categories where category_type='I'");
359
    $sth->execute;
272
	$sth->execute;
360
    my ($categoryChild) = $sth->fetchrow;
273
	my ($categoryInstitution) = $sth->fetchrow;
361
    $template->param(categoryChild => $categoryChild);
274
	$template->param(categoryInstitution => $categoryInstitution);
275
	$sth->finish;
276
362
363
    $sth = $dbh->prepare("select category_type from categories where category_type='I'");
364
    $sth->execute;
365
    my ($categoryInstitution) = $sth->fetchrow;
366
    $template->param(categoryInstitution => $categoryInstitution);
367
    $sth->finish;
277
368
278
} #---- END $OP eq DEFAULT
369
} #---- END $OP eq DEFAULT
279
output_html_with_http_headers $input, $cookie, $template->output;
370
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 438-443 CREATE TABLE `categories` ( -- this table shows information related to Koha patr Link Here
438
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
438
  `reservefee` decimal(28,6) default NULL, -- cost to place holds
439
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
439
  `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no)
440
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
440
  `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff)
441
  `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this categori can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BLockExpiredPAtronOpacACtions
441
  PRIMARY KEY  (`categorycode`),
442
  PRIMARY KEY  (`categorycode`),
442
  UNIQUE KEY `categorycode` (`categorycode`)
443
  UNIQUE KEY `categorycode` (`categorycode`)
443
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
444
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 418-420 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
418
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo');
418
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo');
419
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice');
419
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacItemLocation','callnum','Show the shelving location of items in the opac','callnum|ccode|location','Choice');
420
INSERT INTO systempreferences (variable,value,explanation,options,type)  VALUES('TrackClicks','0','Track links clicked',NULL,'Integer');
420
INSERT INTO systempreferences (variable,value,explanation,options,type)  VALUES('TrackClicks','0','Track links clicked',NULL,'Integer');
421
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BlockExpiredPatronOpacActions', 'yes', 'Set whether an expired patron can perform opac actions such as placing a hold or reserve, can be overridden on a per patron-type basis',NULL,'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+17 lines)
Lines 6476-6481 if ( CheckVersion($DBversion) ) { Link Here
6476
    SetVersion($DBversion);
6476
    SetVersion($DBversion);
6477
}
6477
}
6478
6478
6479
$DBversion = "3.11.00.XXX";
6480
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6481
    $dbh->do("
6482
        INSERT INTO systempreferences (variable,value,explanation,options,type)
6483
        VALUES (
6484
            'BlockExpiredPatronOpacActions', 
6485
            'yes', 
6486
            'Set whether an expired patron can perform opac actions such as placing a hold or reserve, can be overridden on a per patron-type basis',
6487
            NULL,
6488
            'YesNo'
6489
        )
6490
    ");
6491
    $dbh->do("ALTER TABLE `categories` ADD COLUMN `BlockExpiredPatronOpacActions` TINYINT(1) DEFAULT 0 NOT NULL");
6492
    print "Upgraded to $DBversion done (Bug 6739 - expired patrons not blocked from opac actions)\n";
6493
    SetVersion ($DBversion);
6494
}
6495
=head1 FUNCTIONS
6479
6496
6480
=head1 FUNCTIONS
6497
=head1 FUNCTIONS
6481
6498
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categorie.tt (+8 lines)
Lines 198-203 Link Here
198
        <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
198
        <span>Select All if this category type must to be displayed all the time. Otherwise select librairies you want to associate with this value.
199
        </span>
199
        </span>
200
    </li>
200
    </li>
201
    <li><label for="block_expired">Block expired patrons</label>
202
        <select name="block_expired" id="block_expired">
203
            <option value="-1" [% IF ( BlockExpiredPatronOpacActions == -1  ) %] selected="selected" [% END %]> Follow system preference BlockExpiredPatronOpacActions </option>
204
            <option value="1"  [% IF ( BlockExpiredPatronOpacActions == 1   ) %] selected="selected" [% END %]> Block </option>
205
            <option value="0"  [% IF ( BlockExpiredPatronOpacActions == 0   ) %] selected="selected" [% END %]> Don't block </option>
206
        </select>
207
        Should patrons of this category be blocked from opac actions such as renew and reserve when their cards have expired.
208
    </li>
201
    </ol>
209
    </ol>
202
</fieldset>
210
</fieldset>
203
211
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+7 lines)
Lines 493-498 OPAC: Link Here
493
                  yes: Allow
493
                  yes: Allow
494
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
494
            - opac users to share private lists with other patrons. This feature is not active yet but will be released soon
495
495
496
        -
497
            - pref: BlockExpiredPatronOpacActions
498
              choices:
499
                yes: "Block"
500
                no: "Don't Block"
501
            - expired patrons from opac actions such as placing a hold or renew, the setting for a patron category takes priority over this
502
496
    Privacy:
503
    Privacy:
497
        -
504
        -
498
            - pref: AnonSuggestions
505
            - pref: AnonSuggestions
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 91-97 Patrons: Link Here
91
           class: integer
91
           class: integer
92
         - characters long.
92
         - characters long.
93
     -
93
     -
94
         - Show a notice that a patron is about to expire
94
         - Show a notice if the patron is about to expire or has expired
95
         - pref: NotifyBorrowerDeparture
95
         - pref: NotifyBorrowerDeparture
96
           class: integer
96
           class: integer
97
         - days beforehand.
97
         - days beforehand.
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (+3 lines)
Lines 210-215 Link Here
210
            [% IF ( bad_data ) %]
210
            [% IF ( bad_data ) %]
211
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
211
              <div id="bad_data" class="dialog alert">ERROR: Internal error: incomplete hold request.</div>
212
            [% END %]
212
            [% END %]
213
            [% IF ( expired_patron ) %]
214
                <div id="expired_patron" class="dialog alert"><p><strong>Sorry</strong>, you cannot place holds because your library card has expired.<p><p>Please contact your librarian if you wish to renew your card</p></div>
215
            [% END %]
213
          [% ELSE %]
216
          [% ELSE %]
214
            [% IF ( none_available ) %]
217
            [% IF ( none_available ) %]
215
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
218
                <div id="none_available" class="dialog alert"><strong>Sorry</strong>, none of these items can be placed on hold.
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (+11 lines)
Lines 96-103 $.tablesorter.addParser({ Link Here
96
        <div class="dialog alert" id="warnexpired">
96
        <div class="dialog alert" id="warnexpired">
97
            <strong>Please note:</strong><span> Your card has expired. Please contact the library for more information.</span>
97
            <strong>Please note:</strong><span> Your card has expired. Please contact the library for more information.</span>
98
        </div>
98
        </div>
99
        [% ELSIF ( BORROWER_INF.warnexpired ) %]
100
        <div class="dialog alert">
101
                <string>Please note:</string><span> You card has expired as of [% BORROWER_INF.warnexpired %]. Please contact the library if you wish to renew your subscription.</span>
102
        </div>
99
        [% END %]
103
        [% END %]
100
104
105
        [% IF ( RENEW_ERROR ) %]
106
        <div class="dialog alert">
107
                <string>Please note:</string><span> You're renew failed with the following error: [% RENEW_ERROR %]</span>
108
        </div>
109
        [% END %]
110
111
101
        [% IF ( patron_flagged ) %]
112
        [% IF ( patron_flagged ) %]
102
		<div class="dialog alert">
113
		<div class="dialog alert">
103
        <ul>
114
        <ul>
(-)a/opac/opac-renew.pl (-35 / +43 lines)
Lines 29-78 use C4::Circulation; Link Here
29
use C4::Auth;
29
use C4::Auth;
30
use C4::Items;
30
use C4::Items;
31
use C4::Members;
31
use C4::Members;
32
use Date::Calc qw( Today Date_to_Days );
32
my $query = new CGI;
33
my $query = new CGI;
33
34
34
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35
	{
36
    {
36
		  template_name   => "opac-user.tmpl",
37
        template_name   => "opac-user.tmpl",
37
		  query           => $query,
38
        query           => $query,
38
		  type            => "opac",
39
        type            => "opac",
39
		  authnotrequired => 0,
40
        authnotrequired => 0,
40
		  flagsrequired   => { borrow => 1 },
41
        flagsrequired   => { borrow => 1 },
41
		  debug           => 1,
42
        debug           => 1,
42
	}
43
    }
43
); 
44
); 
44
my @items          = $query->param('item');
45
my @items          = $query->param('item');
45
46
46
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
47
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
47
48
48
my $errorstring='';
49
my $errorstring='';
49
for my $itemnumber ( @items ) {
50
my $member_details = GetMemberDetails($borrowernumber);
50
    my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
51
# BlockExpiredPatronOpacActions syspref 0 is false, 1 is true. BlockExpiredPatronOpacActions for categories (from GetMemberDetails) -1 means use syspref, 0 is false, 1 is true (where false means dont block, true means block)
51
    if ( $status == 1 && $opacrenew == 1 ) {
52
if( ($member_details->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Conext->preference('BlockExpiredPatronOpacActions') : $member_details->{'BlockExpiredPatronOpacActions'})
52
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
53
    && Date_to_Days( Today() ) > Date_to_Days( split /-/, $member_details->{'dateexpiry'} ) ){
53
	my $branchcode;
54
   $errorstring='unable to renew as your card has expired';
54
	if ($renewalbranch eq 'itemhomebranch'){
55
} else {
55
	    my $item = GetItem($itemnumber);
56
    for my $itemnumber ( @items ) {
56
	    $branchcode=$item->{'homebranch'};
57
        my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
57
	}
58
        if ( $status == 1 && $opacrenew == 1 ) {
58
	elsif ($renewalbranch eq 'patronhomebranch'){
59
            my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
59
	    my $borrower = GetMemberDetails($borrowernumber);
60
            my $branchcode;
60
	    $branchcode = $borrower->{'branchcode'};
61
            if ($renewalbranch eq 'itemhomebranch'){
61
	}
62
                my $item = GetItem($itemnumber);
62
	elsif ($renewalbranch eq 'checkoutbranch'){
63
                $branchcode=$item->{'homebranch'};
63
	    my $issue = GetOpenIssue($itemnumber);
64
            }
64
	    $branchcode = $issue->{'branchcode'};
65
            elsif ($renewalbranch eq 'patronhomebranch'){
65
	}
66
                my $borrower = GetMemberDetails($borrowernumber);
66
	elsif ($renewalbranch eq 'NULL'){
67
                $branchcode = $borrower->{'branchcode'};
67
	    $branchcode='';
68
            }
68
	}
69
            elsif ($renewalbranch eq 'checkoutbranch'){
69
	else {
70
                my $issue = GetOpenIssue($itemnumber);
70
	    $branchcode='OPACRenew'
71
                $branchcode = $issue->{'branchcode'};
71
	}
72
            }
72
        AddRenewal( $borrowernumber, $itemnumber, $branchcode);
73
            elsif ($renewalbranch eq 'NULL'){
73
    }
74
                $branchcode='';
74
    else {
75
            }
75
	$errorstring .= $error ."|";
76
            else {
77
                $branchcode='OPACRenew'
78
            }
79
            AddRenewal( $borrowernumber, $itemnumber, $branchcode);
80
        }
81
        else {
82
            $errorstring .= $error ."|";
83
        }
76
    }
84
    }
77
}
85
}
78
86
(-)a/opac/opac-reserve.pl (+11 lines)
Lines 35-40 use C4::Branch; # GetBranches Link Here
35
use C4::Overdues;
35
use C4::Overdues;
36
use C4::Debug;
36
use C4::Debug;
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
use Date::Calc qw/Today Date_to_Days/;
38
# use Data::Dumper;
39
# use Data::Dumper;
39
40
40
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
41
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
Lines 65-70 sub get_out { Link Here
65
# get borrower information ....
66
# get borrower information ....
66
my ( $borr ) = GetMemberDetails( $borrowernumber );
67
my ( $borr ) = GetMemberDetails( $borrowernumber );
67
68
69
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
70
if( $borr->{'BlockExpiredPatronOpacActions'} == -1 ? C4::Context->preference("BlockExpiredPatronOpacActions") : $borr->{'BlockExpiredPatronOpacActions'} ) {
71
72
    if( Date_to_Days( Today() ) > Date_to_Days( split /-/, $borr->{'dateexpiry'} ) ){
73
        # cannot reserve, their card has expired and the rules set mean this is not allowed
74
        $template->param( message=>1, expired_patron=>1 );
75
        get_out($query, $cookie, $template->output);
76
    }
77
}
78
68
# Pass through any reserve charge
79
# Pass through any reserve charge
69
if ($borr->{reservefee} > 0){
80
if ($borr->{reservefee} > 0){
70
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
81
    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
(-)a/opac/opac-user.pl (-76 / +74 lines)
Lines 12-20 Link Here
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
#
14
#
15
# You should have received a copy of the GNU General Public License along
15
# You should have received a copy of the GNU General Public License along with
16
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
# Suite 330, Boston, MA  02111-1307 USA
18
18
19
19
20
use strict;
20
use strict;
Lines 65-74 my ( $template, $borrowernumber, $cookie ) = get_template_and_user( Link Here
65
    }
65
    }
66
);
66
);
67
67
68
my $show_priority;
68
my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
69
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
70
    m/priority/ and $show_priority = 1;
71
}
72
my $patronupdate = $query->param('patronupdate');
69
my $patronupdate = $query->param('patronupdate');
73
my $canrenew = 1;
70
my $canrenew = 1;
74
71
Lines 110-116 if ( $borr->{amountoutstanding} > $no_renewal_amt ) { Link Here
110
    $canrenew = 0;
107
    $canrenew = 0;
111
    $template->param(
108
    $template->param(
112
        renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
109
        renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ),
113
        renewal_blocked_fines_amountoutstanding => sprintf( '%.02f', $borr->{amountoutstanding} ),
114
    );
110
    );
115
}
111
}
116
112
Lines 125-143 my @bordat; Link Here
125
$bordat[0] = $borr;
121
$bordat[0] = $borr;
126
122
127
# Warningdate is the date that the warning starts appearing
123
# Warningdate is the date that the warning starts appearing
128
if ( $borr->{dateexpiry} && Date_to_Days( $today_year, $today_month, $today_day ) > Date_to_Days( $warning_year, $warning_month, $warning_day ) ) {
124
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
129
    $borr->{'warnexpired'} = 1;
125
    my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) - Date_to_Days( $today_year, $today_month, $today_day );
130
}
126
    if ( $days_to_expiry < 0 ) {
131
elsif ( $borr->{dateexpiry} && C4::Context->preference('NotifyBorrowerDeparture') &&
127
132
        Date_to_Days(Add_Delta_Days($warning_year, $warning_month, $warning_day,- C4::Context->preference('NotifyBorrowerDeparture'))) <
128
        #borrower card has expired, warn the borrower
133
        Date_to_Days( $today_year, $today_month, $today_day ) ) {
129
        $borr->{'warnexpired'} = $borr->{'dateexpiry'};
130
    } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) {
131
134
        # borrower card soon to expire, warn the borrower
132
        # borrower card soon to expire, warn the borrower
135
        $borr->{'warndeparture'} = $borr->{dateexpiry};
133
        $borr->{'warndeparture'} = $borr->{dateexpiry};
136
        if (C4::Context->preference('ReturnBeforeExpiry')){
134
        if ( C4::Context->preference('ReturnBeforeExpiry') ) {
137
            $borr->{'returnbeforeexpiry'} = 1;
135
            $borr->{'returnbeforeexpiry'} = 1;
138
        }
136
        }
137
    }
139
}
138
}
140
139
140
# pass on any renew errors to the template for displaying
141
$template->param( RENEW_ERROR => $query->param('renew_error') ) if $query->param('renew_error');
141
142
142
$template->param(   BORROWER_INFO     => \@bordat,
143
$template->param(   BORROWER_INFO     => \@bordat,
143
                    borrowernumber    => $borrowernumber,
144
                    borrowernumber    => $borrowernumber,
Lines 145-150 $template->param( BORROWER_INFO => \@bordat, Link Here
145
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
146
                    OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0,
146
                    surname           => $borr->{surname},
147
                    surname           => $borr->{surname},
147
                    showname          => $borr->{showname},
148
                    showname          => $borr->{showname},
149
148
                );
150
                );
149
151
150
#get issued items ....
152
#get issued items ....
Lines 156-210 my @issuedat; Link Here
156
my $itemtypes = GetItemTypes();
158
my $itemtypes = GetItemTypes();
157
my $issues = GetPendingIssues($borrowernumber);
159
my $issues = GetPendingIssues($borrowernumber);
158
if ($issues){
160
if ($issues){
159
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
161
	foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
160
        # check for reserves
162
		# check for reserves
161
        my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
163
		my ( $restype, $res, undef ) = CheckReserves( $issue->{'itemnumber'} );
162
        if ( $restype ) {
164
		if ( $restype ) {
163
            $issue->{'reserved'} = 1;
165
			$issue->{'reserved'} = 1;
164
        }
166
		}
165
167
		
166
        my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
168
		my ( $total , $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
167
        my $charges = 0;
169
		my $charges = 0;
168
        foreach my $ac (@$accts) {
170
		foreach my $ac (@$accts) {
169
            if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
171
			if ( $ac->{'itemnumber'} == $issue->{'itemnumber'} ) {
170
                $charges += $ac->{'amountoutstanding'}
172
				$charges += $ac->{'amountoutstanding'}
171
                  if $ac->{'accounttype'} eq 'F';
173
				  if $ac->{'accounttype'} eq 'F';
172
                $charges += $ac->{'amountoutstanding'}
174
				$charges += $ac->{'amountoutstanding'}
173
                  if $ac->{'accounttype'} eq 'FU';
175
				  if $ac->{'accounttype'} eq 'L';
174
                $charges += $ac->{'amountoutstanding'}
176
			}
175
                  if $ac->{'accounttype'} eq 'L';
177
		}
176
            }
178
		$issue->{'charges'} = $charges;
177
        }
179
178
        $issue->{'charges'} = $charges;
180
		# check if item is renewable
179
181
		my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
180
        # check if item is renewable
182
		($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
181
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
182
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
183
        if($status && C4::Context->preference("OpacRenewalAllowed")){
183
        if($status && C4::Context->preference("OpacRenewalAllowed")){
184
            $issue->{'status'} = $status;
184
            $issue->{'status'} = $status;
185
        }
185
        }
186
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
186
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
187
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
187
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
188
188
189
        if ( $issue->{'overdue'} ) {
189
		if ( $issue->{'overdue'} ) {
190
            push @overdues, $issue;
190
			push @overdues, $issue;
191
            $overdues_count++;
191
			$overdues_count++;
192
            $issue->{'overdue'} = 1;
192
			$issue->{'overdue'} = 1;
193
        }
193
		}
194
        else {
194
		else {
195
            $issue->{'issued'} = 1;
195
			$issue->{'issued'} = 1;
196
        }
196
		}
197
        # imageurl:
197
		# imageurl:
198
        my $itemtype = $issue->{'itemtype'};
198
		my $itemtype = $issue->{'itemtype'};
199
        if ( $itemtype ) {
199
		if ( $itemtype ) {
200
            $issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
200
			$issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
201
            $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
201
			$issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
202
        }
202
		}
203
        push @issuedat, $issue;
203
		push @issuedat, $issue;
204
        $count++;
204
		$count++;
205
205
		
206
        my $isbn = GetNormalizedISBN($issue->{'isbn'});
206
		my $isbn = GetNormalizedISBN($issue->{'isbn'});
207
        $issue->{normalized_isbn} = $isbn;
207
		$issue->{normalized_isbn} = $isbn;
208
208
209
                # My Summary HTML
209
                # My Summary HTML
210
                if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
210
                if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
Lines 216-222 if ($issues){ Link Here
216
                    $issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
216
                    $issue->{biblionumber} ? $my_summary_html =~ s/{BIBLIONUMBER}/$issue->{biblionumber}/g : $my_summary_html =~ s/{BIBLIONUMBER}//g;
217
                    $issue->{MySummaryHTML} = $my_summary_html;
217
                    $issue->{MySummaryHTML} = $my_summary_html;
218
                }
218
                }
219
    }
219
	}
220
}
220
}
221
$template->param( ISSUES       => \@issuedat );
221
$template->param( ISSUES       => \@issuedat );
222
$template->param( issues_count => $count );
222
$template->param( issues_count => $count );
Lines 256-268 foreach my $res (@reserves) { Link Here
256
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
256
    if ( $res->{'expirationdate'} eq '0000-00-00' ) {
257
      $res->{'expirationdate'} = '';
257
      $res->{'expirationdate'} = '';
258
    }
258
    }
259
259
    
260
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
260
    $res->{'waiting'} = 1 if $res->{'found'} eq 'W';
261
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
261
    $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
262
    my $biblioData = GetBiblioData($res->{'biblionumber'});
262
    my $biblioData = GetBiblioData($res->{'biblionumber'});
263
    $res->{'reserves_title'} = $biblioData->{'title'};
263
    $res->{'reserves_title'} = $biblioData->{'title'};
264
    if ($show_priority) {
264
    if ($OPACDisplayRequestPriority) {
265
        $res->{'priority'} ||= '';
265
        $res->{'priority'} = '' if $res->{'priority'} eq '0';
266
    }
266
    }
267
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
267
    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
268
}
268
}
Lines 272-278 foreach my $res (@reserves) { Link Here
272
272
273
$template->param( RESERVES       => \@reserves );
273
$template->param( RESERVES       => \@reserves );
274
$template->param( reserves_count => $#reserves+1 );
274
$template->param( reserves_count => $#reserves+1 );
275
$template->param( showpriority=>$show_priority );
275
$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
276
276
277
my @waiting;
277
my @waiting;
278
my $wcount = 0;
278
my $wcount = 0;
Lines 288-294 foreach my $res (@reserves) { Link Here
288
        if ( ( $res->{'found'} eq 'W' ) ) {
288
        if ( ( $res->{'found'} eq 'W' ) ) {
289
            my $item = $res->{'itemnumber'};
289
            my $item = $res->{'itemnumber'};
290
            $item = GetBiblioFromItemNumber($item,undef);
290
            $item = GetBiblioFromItemNumber($item,undef);
291
            $res->{'wait'}= 1;
291
            $res->{'wait'}= 1; 
292
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
292
            $res->{'holdingbranch'}=$item->{'holdingbranch'};
293
            $res->{'biblionumber'}=$item->{'biblionumber'};
293
            $res->{'biblionumber'}=$item->{'biblionumber'};
294
            $res->{'barcode'} = $item->{'barcode'};
294
            $res->{'barcode'} = $item->{'barcode'};
Lines 314-320 foreach my $res (@reserves) { Link Here
314
    # can be cancelled
314
    # can be cancelled
315
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
315
    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
316
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
316
    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
317
317
    
318
}
318
}
319
319
320
$template->param( WAITING => \@waiting );
320
$template->param( WAITING => \@waiting );
Lines 338-349 if (C4::Context->preference('BakerTaylorEnabled')) { Link Here
338
if (C4::Context->preference("OPACAmazonCoverImages") or 
338
if (C4::Context->preference("OPACAmazonCoverImages") or 
339
    C4::Context->preference("GoogleJackets") or
339
    C4::Context->preference("GoogleJackets") or
340
    C4::Context->preference("BakerTaylorEnabled") or
340
    C4::Context->preference("BakerTaylorEnabled") or
341
    C4::Context->preference("SyndeticsCoverImages")) {
341
	C4::Context->preference("SyndeticsCoverImages")) {
342
        $template->param(JacketImages=>1);
342
        $template->param(JacketImages=>1);
343
}
343
}
344
344
345
if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
345
if ( GetMessagesCount( $borrowernumber, 'B' ) ) {
346
    $template->param( bor_messages => 1 );
346
	$template->param( bor_messages => 1 );
347
}
347
}
348
348
349
if ( $borr->{'opacnote'} ) {
349
if ( $borr->{'opacnote'} ) {
Lines 354-370 if ( $borr->{'opacnote'} ) { Link Here
354
}
354
}
355
355
356
$template->param(
356
$template->param(
357
    bor_messages_loop    => GetMessages( $borrowernumber, 'B', 'NONE' ),
357
    bor_messages_loop	=> GetMessages( $borrowernumber, 'B', 'NONE' ),
358
    waiting_count      => $wcount,
358
    waiting_count      => $wcount,
359
    patronupdate => $patronupdate,
359
    patronupdate => $patronupdate,
360
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
360
    OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
361
    userview => 1,
361
    userview => 1,
362
    dateformat    => C4::Context->preference("dateformat"),
362
);
363
);
363
364
364
$template->param(
365
$template->param( DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar() );
365
    SuspendHoldsOpac => C4::Context->preference('SuspendHoldsOpac'),
366
$template->param( AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds') );
366
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
367
);
368
367
369
output_html_with_http_headers $query, $cookie, $template->output;
368
output_html_with_http_headers $query, $cookie, $template->output;
370
369
371
- 

Return to bug 6739