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

(-)a/C4/Suggestions.pm (-1 / +32 lines)
Lines 454-460 sub NewSuggestion { Link Here
454
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
454
    $suggestion->{suggesteddate} = dt_from_string unless $suggestion->{suggesteddate};
455
455
456
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
456
    my $rs = Koha::Database->new->schema->resultset('Suggestion');
457
    return $rs->create($suggestion)->id;
457
    my $new_id = $rs->create($suggestion)->id;
458
459
    my $full_suggestion = GetSuggestion( $new_id );
460
    if (
461
        my $letter = C4::Letters::GetPreparedLetter(
462
            module      => 'suggestions',
463
            letter_code => 'NEW_SUGGESTION',
464
            tables      => {
465
                'branches'    => $full_suggestion->{branchcode},
466
                'borrowers'   => $full_suggestion->{suggestedby},
467
                'suggestions' => $full_suggestion,
468
            },
469
        )
470
    ){
471
        my $emailpurchasesuggestions = C4::Context->preference("EmailPurchaseSuggestions");
472
473
        my $toaddress = ( $emailpurchasesuggestions eq "BranchEmailAddress" )
474
            ? Koha::Libraries->find($full_suggestion->{branchcode})->branchemail
475
            : C4::Context->preference( $emailpurchasesuggestions ) ;
476
477
        C4::Letters::EnqueueLetter(
478
            {
479
                letter         => $letter,
480
                borrowernumber => $full_suggestion->{suggestedby},
481
                suggestionid   => $full_suggestion->{suggestionid},
482
                to_address     => $toaddress,
483
                message_transport_type => 'email',
484
            }
485
        ) or warn "can't enqueue letter $letter";
486
    }
487
488
    return $new_id;
458
}
489
}
459
490
460
=head2 ModSuggestion
491
=head2 ModSuggestion
(-)a/installer/data/mysql/atomicupdate/bug_5770_notice.sql (-1 / +26 lines)
Line 0 Link Here
0
- 
1
INSERT IGNORE INTO `letter` (module, code, name, title, content, is_html, message_transport_type)
2
VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New Suggestion','<h3> Suggestion pending approval</h3>
3
<p><h4>Suggested by</h4>
4
 <ul>
5
   <li><<borrowers.firstname>> <<borrowers.surname>></li>
6
   <li><<borrowers.cardnumber>></li>
7
   <li><<borrowers.phone>></li>
8
   <li><<borrowers.email>></li>
9
 </ul>
10
</p>
11
<p><h4>Item on suggestion</h4>
12
 <ul>
13
   <li><b>Library : </b> <<branches.branchname>></li>
14
   <li><b>Title : </b> <<suggestions.title>></li>
15
   <li><b>Author : </b> <<suggestions.author>></li>
16
   <li><b>Copyright date : </b> <<suggestions.copyrightdate>></li>
17
   <li><b>Standard number (ISBN, ISSN or other) : </b> <<suggestions.isbn>></li>
18
   <li><b>Publisher : </b> <<suggestions.publishercode>></li>
19
   <li><b>Collection title : </b> <<suggestions.collectiontitle>></li>
20
   <li><b>Publication place : </b> <<suggestions.place>></li>
21
   <li><b>Quantity : </b> <<suggestions.quantity>></li>
22
   <li><b>Item type : </b>  <<suggestions.itemtype>></li>
23
   <li><b>Reason for suggestion : </b> <<suggestions.patronreason>></li>
24
   <li><b>Notes : </b> <<suggestions.note>></li>
25
 </ul>
26
</p>',1, 'email');

Return to bug 5770