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

(-)a/C4/Letters.pm (-9 / +15 lines)
Lines 365-370 sub SendAlerts { Link Here
365
        my $dataorders;
365
        my $dataorders;
366
        my $action;
366
        my $action;
367
        my $basketno;
367
        my $basketno;
368
        my %loops;
368
        if ( $type eq 'claimacquisition') {
369
        if ( $type eq 'claimacquisition') {
369
            $strsth = qq{
370
            $strsth = qq{
370
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
371
            SELECT aqorders.*,aqbasket.*,biblio.*,biblioitems.*
Lines 430-454 sub SendAlerts { Link Here
430
            $sthorders = $dbh->prepare($strsth);
431
            $sthorders = $dbh->prepare($strsth);
431
            $sthorders->execute($basketno);
432
            $sthorders->execute($basketno);
432
            $dataorders = $sthorders->fetchall_arrayref( {} );
433
            $dataorders = $sthorders->fetchall_arrayref( {} );
434
            %loops = (
435
                aqorders => [ map { $_->{ordernumber} } @$dataorders ]
436
            );
433
        }
437
        }
434
438
435
        my $sthbookseller =
439
        my $booksellerid = $dataorders->[0]->{booksellerid};
436
          $dbh->prepare("select * from aqbooksellers where id=?");
437
        $sthbookseller->execute( $dataorders->[0]->{booksellerid} );
438
        my $databookseller = $sthbookseller->fetchrow_hashref;
439
440
        my $addressee =  $type eq 'claimacquisition' || $type eq 'orderacquisition' ? 'acqprimary' : 'serialsprimary';
440
        my $addressee =  $type eq 'claimacquisition' || $type eq 'orderacquisition' ? 'acqprimary' : 'serialsprimary';
441
441
442
        my $sthcontact =
442
        my $sthcontact =
443
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
443
          $dbh->prepare("SELECT * FROM aqcontacts WHERE booksellerid=? AND $type=1 ORDER BY $addressee DESC");
444
        $sthcontact->execute( $dataorders->[0]->{booksellerid} );
444
        $sthcontact->execute( $booksellerid );
445
        my $datacontact = $sthcontact->fetchrow_hashref;
445
        my $datacontact = $sthcontact->fetchrow_hashref;
446
446
447
        my @email;
447
        my @email;
448
        my @cc;
448
        my @cc;
449
        push @email, $datacontact->{email}           if ( $datacontact && $datacontact->{email} );
449
        push @email, $datacontact->{email}           if ( $datacontact && $datacontact->{email} );
450
        unless (@email) {
450
        unless (@email) {
451
            warn "Bookseller $dataorders->[0]->{booksellerid} without emails";
451
            warn "Bookseller $booksellerid without emails";
452
            return { error => "no_email" };
452
            return { error => "no_email" };
453
        }
453
        }
454
        my $addlcontact;
454
        my $addlcontact;
Lines 463-473 sub SendAlerts { Link Here
463
            branchcode => $userenv->{branch},
463
            branchcode => $userenv->{branch},
464
            tables => {
464
            tables => {
465
                'branches'      => $userenv->{branch},
465
                'branches'      => $userenv->{branch},
466
                'aqbooksellers' => $databookseller,
466
                'aqbooksellers' => $booksellerid,
467
                'aqcontacts'    => $datacontact,
467
                'aqcontacts'    => $datacontact,
468
                'aqbasket'      => $basketno,
468
                'aqbasket'      => $basketno,
469
            },
469
            },
470
            repeat => $dataorders,
470
            repeat => $dataorders,
471
            loops => \%loops,
471
            want_librarian => 1,
472
            want_librarian => 1,
472
        ) or return { error => "no_letter" };
473
        ) or return { error => "no_letter" };
473
474
Lines 1650-1655 sub _get_tt_params { Link Here
1650
            plural   => 'baskets',
1651
            plural   => 'baskets',
1651
            pk       => 'basketno',
1652
            pk       => 'basketno',
1652
        },
1653
        },
1654
        aqbooksellers => {
1655
            module   => 'Koha::Acquisition::Booksellers',
1656
            singular => 'bookseller',
1657
            plural   => 'booksellers',
1658
            pk       => 'id',
1659
        },
1653
        biblio => {
1660
        biblio => {
1654
            module   => 'Koha::Biblios',
1661
            module   => 'Koha::Biblios',
1655
            singular => 'biblio',
1662
            singular => 'biblio',
1656
- 

Return to bug 31858