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

(-)a/C4/Letters.pm (-4 / +17 lines)
Lines 389-406 sub SendAlerts { Link Here
389
    if ( $type eq 'issue' ) {
389
    if ( $type eq 'issue' ) {
390
390
391
        # prepare the letter...
391
        # prepare the letter...
392
        # search the biblionumber
392
        # search the subscriptionid
393
        my $sth =
393
        my $sth =
394
          $dbh->prepare(
394
          $dbh->prepare(
395
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
395
            "SELECT subscriptionid FROM serial WHERE serialid=?");
396
        $sth->execute($externalid);
396
        $sth->execute($externalid);
397
        my ($biblionumber) = $sth->fetchrow
397
        my ($subscriptionid) = $sth->fetchrow
398
          or warn( "No subscription for '$externalid'" ),
398
          or warn( "No subscription for '$externalid'" ),
399
             return;
399
             return;
400
400
401
        # search the biblionumber
402
        $sth =
403
          $dbh->prepare(
404
            "SELECT biblionumber FROM subscription WHERE subscriptionid=?");
405
        $sth->execute($subscriptionid);
406
        my ($biblionumber) = $sth->fetchrow
407
          or warn( "No biblionumber for '$subscriptionid'" ),
408
             return;
409
401
        my %letter;
410
        my %letter;
402
        # find the list of borrowers to alert
411
        # find the list of borrowers to alert
403
        my $alerts = getalert( '', 'issue', $externalid );
412
        my $alerts = getalert( '', 'issue', $subscriptionid );
404
        foreach (@$alerts) {
413
        foreach (@$alerts) {
405
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
414
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
406
            my $email = $borinfo->{email} or next;
415
            my $email = $borinfo->{email} or next;
Lines 417-422 sub SendAlerts { Link Here
417
                    'biblio'      => $biblionumber,
426
                    'biblio'      => $biblionumber,
418
                    'biblioitems' => $biblionumber,
427
                    'biblioitems' => $biblionumber,
419
                    'borrowers'   => $borinfo,
428
                    'borrowers'   => $borinfo,
429
                    'subscription' => $subscriptionid,
430
                    'serial' => $externalid,
420
                },
431
                },
421
                want_librarian => 1,
432
                want_librarian => 1,
422
            ) or return;
433
            ) or return;
Lines 758-763 sub _parseletter_sth { Link Here
758
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                                  :
769
    ($table eq 'aqorders'     ) ? "SELECT * FROM $table WHERE    ordernumber = ?"                                  :
759
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                                  :
770
    ($table eq 'opac_news'    ) ? "SELECT * FROM $table WHERE          idnew = ?"                                  :
760
    ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" :
771
    ($table eq 'borrower_modifications') ? "SELECT * FROM $table WHERE verification_token = ?" :
772
    ($table eq 'subscription') ? "SELECT * FROM $table WHERE subscriptionid = ?" :
773
    ($table eq 'serial') ? "SELECT * FROM $table WHERE serialid = ?" :
761
    undef ;
774
    undef ;
762
    unless ($query) {
775
    unless ($query) {
763
        warn "ERROR: No _parseletter_sth query for table '$table'";
776
        warn "ERROR: No _parseletter_sth query for table '$table'";
(-)a/C4/Serials.pm (-1 / +1 lines)
Lines 1149-1155 sub ModSerialStatus { Link Here
1149
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1149
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1150
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1150
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1151
            require C4::Letters;
1151
            require C4::Letters;
1152
            C4::Letters::SendAlerts( 'issue', $subscription->{subscriptionid}, $subscription->{letter} );
1152
            C4::Letters::SendAlerts( 'issue', $serialid, $subscription->{letter} );
1153
        }
1153
        }
1154
    }
1154
    }
1155
1155
(-)a/tools/letter.pl (-1 / +3 lines)
Lines 213-218 sub add_form { Link Here
213
            push @{$field_selection}, {value => "biblio.$_", text => ucfirst $_ };
213
            push @{$field_selection}, {value => "biblio.$_", text => ucfirst $_ };
214
        }
214
        }
215
    }
215
    }
216
    elsif ($module eq 'serial') {
217
        push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial');
218
    }
216
    elsif ($module eq 'suggestions') {
219
    elsif ($module eq 'suggestions') {
217
        push @{$field_selection}, add_fields('suggestions', 'borrowers', 'biblio');
220
        push @{$field_selection}, add_fields('suggestions', 'borrowers', 'biblio');
218
    }
221
    }
219
- 

Return to bug 13972