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

(-)a/Koha/Borrower/Debarments.pm (-1 / +1 lines)
Lines 44-50 Koha::Borrower::Debarments - Module for managing borrower debarments Link Here
44
44
45
=head2 GetDebarments
45
=head2 GetDebarments
46
46
47
my $arrayref = GetDebarments( $borrowernumber, { key => $value } );
47
my $arrayref = GetDebarments({ borrowernumber => $borrowernumber [, key => $value ] );
48
48
49
=cut
49
=cut
50
50
(-)a/tools/import_borrowers.pl (-1 / +34 lines)
Lines 46-51 use C4::Members; Link Here
46
use C4::Members::Attributes qw(:all);
46
use C4::Members::Attributes qw(:all);
47
use C4::Members::AttributeTypes;
47
use C4::Members::AttributeTypes;
48
use C4::Members::Messaging;
48
use C4::Members::Messaging;
49
use Koha::Borrower::Debarments;
49
50
50
use Text::CSV;
51
use Text::CSV;
51
# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals:
52
# Text::CSV::Unicode, even in binary mode, fails to parse lines with these diacriticals:
Lines 258-263 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
258
                $template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber);
259
                $template->param('lastinvalid'=>$borrower{'surname'}.' / '.$borrowernumber);
259
                next LINE;
260
                next LINE;
260
            }
261
            }
262
            if ( $borrower{debarred} ) {
263
                # Check to see if this debarment already exists
264
                my $debarrments = GetDebarments(
265
                    {
266
                        borrowernumber => $borrowernumber,
267
                        expiration     => $borrower{debarred},
268
                        comment        => $borrower{debarredcomment}
269
                    }
270
                );
271
                # If it doesn't, then add it!
272
                unless (@$debarrments) {
273
                    AddDebarment(
274
                        {
275
                            borrowernumber => $borrowernumber,
276
                            expiration     => $borrower{debarred},
277
                            comment        => $borrower{debarredcomment}
278
                        }
279
                    );
280
                }
281
            }
261
            if ($extended) {
282
            if ($extended) {
262
                if ($ext_preserve) {
283
                if ($ext_preserve) {
263
                    my $old_attributes = GetBorrowerAttributes($borrowernumber);
284
                    my $old_attributes = GetBorrowerAttributes($borrowernumber);
Lines 274-286 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
274
                $borrower{'cardnumber'} = fixup_cardnumber(undef);
295
                $borrower{'cardnumber'} = fixup_cardnumber(undef);
275
            }
296
            }
276
            if ($borrowernumber = AddMember(%borrower)) {
297
            if ($borrowernumber = AddMember(%borrower)) {
298
299
                if ( $borrower{debarred} ) {
300
                    AddDebarment(
301
                        {
302
                            borrowernumber => $borrowernumber,
303
                            expiration     => $borrower{debarred},
304
                            comment        => $borrower{debarredcomment}
305
                        }
306
                    );
307
                }
308
277
                if ($extended) {
309
                if ($extended) {
278
                    SetBorrowerAttributes($borrowernumber, $patron_attributes);
310
                    SetBorrowerAttributes($borrowernumber, $patron_attributes);
279
                }
311
                }
312
280
                if ($set_messaging_prefs) {
313
                if ($set_messaging_prefs) {
281
                    C4::Members::Messaging::SetMessagingPreferencesFromDefaults({ borrowernumber => $borrowernumber,
314
                    C4::Members::Messaging::SetMessagingPreferencesFromDefaults({ borrowernumber => $borrowernumber,
282
                                                                                  categorycode => $borrower{categorycode} });
315
                                                                                  categorycode => $borrower{categorycode} });
283
                }
316
                }
317
284
                $imported++;
318
                $imported++;
285
                $template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber);
319
                $template->param('lastimported'=>$borrower{'surname'}.' / '.$borrowernumber);
286
            } else {
320
            } else {
287
- 

Return to bug 11287