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

(-)a/C4/Circulation.pm (-15 / +29 lines)
Lines 3145-3163 sub SendCirculationAlert { Link Here
3145
        message_name   => $message_name{$type},
3145
        message_name   => $message_name{$type},
3146
    });
3146
    });
3147
    my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
3147
    my $issues_table = ( $type eq 'CHECKOUT' || $type eq 'RENEWAL' ) ? 'issues' : 'old_issues';
3148
    my $letter =  C4::Letters::GetPreparedLetter (
3149
        module => 'circulation',
3150
        letter_code => $type,
3151
        branchcode => $branch,
3152
        tables => {
3153
            $issues_table => $item->{itemnumber},
3154
            'items'       => $item->{itemnumber},
3155
            'biblio'      => $item->{biblionumber},
3156
            'biblioitems' => $item->{biblionumber},
3157
            'borrowers'   => $borrower,
3158
            'branches'    => $branch,
3159
        }
3160
    ) or return;
3161
3148
3162
    my @transports = keys %{ $borrower_preferences->{transports} };
3149
    my @transports = keys %{ $borrower_preferences->{transports} };
3163
    # warn "no transports" unless @transports;
3150
    # warn "no transports" unless @transports;
Lines 3166-3180 sub SendCirculationAlert { Link Here
3166
        my $message = C4::Message->find_last_message($borrower, $type, $_);
3153
        my $message = C4::Message->find_last_message($borrower, $type, $_);
3167
        if (!$message) {
3154
        if (!$message) {
3168
            #warn "create new message";
3155
            #warn "create new message";
3156
            my $letter =  C4::Letters::GetPreparedLetter (
3157
                module => 'circulation',
3158
                letter_code => $type,
3159
                branchcode => $branch,
3160
                message_transport_type => $_,
3161
                tables => {
3162
                    $issues_table => $item->{itemnumber},
3163
                    'items'       => $item->{itemnumber},
3164
                    'biblio'      => $item->{biblionumber},
3165
                    'biblioitems' => $item->{biblionumber},
3166
                    'borrowers'   => $borrower,
3167
                    'branches'    => $branch,
3168
                }
3169
            ) or return;
3169
            C4::Message->enqueue($letter, $borrower, $_);
3170
            C4::Message->enqueue($letter, $borrower, $_);
3170
        } else {
3171
        } else {
3171
            #warn "append to old message";
3172
            #warn "append to old message";
3173
            my $letter =  C4::Letters::GetPreparedLetter (
3174
                module => 'circulation',
3175
                letter_code => $type,
3176
                branchcode => $branch,
3177
                message_transport_type => $_,
3178
                tables => {
3179
                    $issues_table => $item->{itemnumber},
3180
                    'items'       => $item->{itemnumber},
3181
                    'biblio'      => $item->{biblionumber},
3182
                    'biblioitems' => $item->{biblionumber},
3183
                    'borrowers'   => $borrower,
3184
                    'branches'    => $branch,
3185
                }
3186
            ) or return;
3172
            $message->append($letter);
3187
            $message->append($letter);
3173
            $message->update;
3188
            $message->update;
3174
        }
3189
        }
3175
    }
3190
    }
3176
3191
3177
    return $letter;
3192
    return;
3178
}
3193
}
3179
3194
3180
=head2 updateWrongTransfer
3195
=head2 updateWrongTransfer
3181
- 

Return to bug 12344