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

(-)a/C4/Circulation.pm (-15 / +29 lines)
Lines 3252-3270 sub SendCirculationAlert { Link Here
3252
        message_name   => $message_name{$type},
3252
        message_name   => $message_name{$type},
3253
    });
3253
    });
3254
    my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
3254
    my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
3255
    my $letter =  C4::Letters::GetPreparedLetter (
3256
        module => 'circulation',
3257
        letter_code => $type,
3258
        branchcode => $branch,
3259
        tables => {
3260
            $issues_table => $item->{itemnumber},
3261
            'items'       => $item->{itemnumber},
3262
            'biblio'      => $item->{biblionumber},
3263
            'biblioitems' => $item->{biblionumber},
3264
            'borrowers'   => $borrower,
3265
            'branches'    => $branch,
3266
        }
3267
    ) or return;
3268
3255
3269
    my @transports = keys %{ $borrower_preferences->{transports} };
3256
    my @transports = keys %{ $borrower_preferences->{transports} };
3270
    # warn "no transports" unless @transports;
3257
    # warn "no transports" unless @transports;
Lines 3273-3287 sub SendCirculationAlert { Link Here
3273
        my $message = C4::Message->find_last_message($borrower, $type, $_);
3260
        my $message = C4::Message->find_last_message($borrower, $type, $_);
3274
        if (!$message) {
3261
        if (!$message) {
3275
            #warn "create new message";
3262
            #warn "create new message";
3263
            my $letter =  C4::Letters::GetPreparedLetter (
3264
                module => 'circulation',
3265
                letter_code => $type,
3266
                branchcode => $branch,
3267
                message_transport_type => $_,
3268
                tables => {
3269
                    $issues_table => $item->{itemnumber},
3270
                    'items'       => $item->{itemnumber},
3271
                    'biblio'      => $item->{biblionumber},
3272
                    'biblioitems' => $item->{biblionumber},
3273
                    'borrowers'   => $borrower,
3274
                    'branches'    => $branch,
3275
                }
3276
            ) or return;
3276
            C4::Message->enqueue($letter, $borrower, $_);
3277
            C4::Message->enqueue($letter, $borrower, $_);
3277
        } else {
3278
        } else {
3278
            #warn "append to old message";
3279
            #warn "append to old message";
3280
            my $letter =  C4::Letters::GetPreparedLetter (
3281
                module => 'circulation',
3282
                letter_code => $type,
3283
                branchcode => $branch,
3284
                message_transport_type => $_,
3285
                tables => {
3286
                    $issues_table => $item->{itemnumber},
3287
                    'items'       => $item->{itemnumber},
3288
                    'biblio'      => $item->{biblionumber},
3289
                    'biblioitems' => $item->{biblionumber},
3290
                    'borrowers'   => $borrower,
3291
                    'branches'    => $branch,
3292
                }
3293
            ) or return;
3279
            $message->append($letter);
3294
            $message->append($letter);
3280
            $message->update;
3295
            $message->update;
3281
        }
3296
        }
3282
    }
3297
    }
3283
3298
3284
    return $letter;
3299
    return;
3285
}
3300
}
3286
3301
3287
=head2 updateWrongTransfer
3302
=head2 updateWrongTransfer
3288
- 

Return to bug 12344