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

(-)a/Koha/Recall.pm (-1 / +27 lines)
Lines 18-24 package Koha::Recall; Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
use C4::Letters;
22
use C4::Members::Messaging;
22
use Koha::Database;
23
use Koha::Database;
23
use Koha::DateUtils qw( dt_from_string );
24
use Koha::DateUtils qw( dt_from_string );
24
use Koha::Biblios;
25
use Koha::Biblios;
Lines 469-474 sub set_cancelled { Link Here
469
    $self->update( { status => 'cancelled', completed => 1, completed_date => dt_from_string } );
470
    $self->update( { status => 'cancelled', completed => 1, completed_date => dt_from_string } );
470
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' )
471
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' )
471
        if ( C4::Context->preference('RecallsLog') );
472
        if ( C4::Context->preference('RecallsLog') );
473
474
    # send notice to recaller to pick up item
475
    my $letter = C4::Letters::GetPreparedLetter(
476
        module      => 'circulation',
477
        letter_code => 'RECALL_MANUAL_CANCEL',
478
        branchcode  => $self->pickup_library_id,
479
        lang        => $self->patron->lang,
480
        tables      => {
481
            biblio    => $self->biblio_id,
482
            borrowers => $self->patron_id,
483
            branches  => $self->pickup_library_id,
484
        },
485
    );
486
487
    my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences(
488
        { borrowernumber => $self->patron_id, message_name => 'Recall_Cancelled' } );
489
    while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {
490
        if ( $transport eq 'email' ) {
491
            C4::Message->enqueue( $letter, $self->patron->unblessed, 'email' );
492
        }
493
        if ( $transport eq 'sms' ) {
494
            C4::Message->enqueue( $letter, $self->patron->unblessed, 'sms' );
495
        }
496
    }
497
472
    return $self;
498
    return $self;
473
}
499
}
474
500
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "30295",
5
    description => "Adding message attributes for RECALL_MANUAL_CANCEL",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (14, 'Recall_Cancelled', 0) }
12
        );
13
    },
14
};
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "30295",
5
    description => "Adding message transports for RECALL_MANUAL_CANCEL notice",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{ INSERT IGNORE INTO message_transports (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code, branchcode) VALUES (14, "email", 0, "circulation", "RECALL_MANUAL_CANCEL", null), (14, "sms", 0, "circulation", "RECALL_MANUAL_CANCEL", null) }
12
        );
13
    },
14
};
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl (+26 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "30295",
5
    description => "Add RECALL_MANUAL_CANCEL email and sms notice",
6
    up          => sub {
7
        my ($args) = @_;
8
        my ( $dbh, $out ) = @$args{qw(dbh out)};
9
10
        $dbh->do(
11
            q{ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES ('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %],
12
13
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
14
15
Title: [% biblio.title %]
16
Author: [% biblio.author %]
17
Location: [% branch.branchname %]','sms'), ('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %],
18
19
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
20
21
Title: [% biblio.title %]
22
Author: [% biblio.author %]
23
Location: [% branch.branchname %]','email') }
24
        );
25
    },
26
};
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+34 lines)
Lines 2722-2724 tables: Link Here
2722
            - "[% skipped %] records skipped"
2722
            - "[% skipped %] records skipped"
2723
            - "[% in_error %] records in error"
2723
            - "[% in_error %] records in error"
2724
            - "[% total %] total"
2724
            - "[% total %] total"
2725
2726
        - module: circulation
2727
          code: RECALL_MANUAL_CANCEL
2728
          branchcode: ""
2729
          name: "Recall has been cancelled"
2730
          is_html: 0
2731
          title: "Recall has been cancelled"
2732
          message_transport_type: email
2733
          lang: default
2734
          content:
2735
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2736
            - ""
2737
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2738
            - ""
2739
            - "Title: [% biblio.title %]"
2740
            - "Author: [% biblio.author %]"
2741
            - "Location: [% branch.branchname %]"
2742
2743
        - module: circulation
2744
          code: RECALL_MANUAL_CANCEL
2745
          branchcode: ""
2746
          name: "Recall has been cancelled"
2747
          is_html: 0
2748
          title: "Recall has been cancelled"
2749
          message_transport_type: sms
2750
          lang: default
2751
          content:
2752
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2753
            - ""
2754
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2755
            - ""
2756
            - "Title: [% biblio.title %]"
2757
            - "Author: [% biblio.author %]"
2758
            - "Location: [% branch.branchname %]"
(-)a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql (-1 / +2 lines)
Lines 13-16 values Link Here
13
(11, 'Ill_update', 0),
13
(11, 'Ill_update', 0),
14
(12, 'Recall_Waiting', 0),
14
(12, 'Recall_Waiting', 0),
15
(13, 'Recall_Requested', 0),
15
(13, 'Recall_Requested', 0),
16
(14, 'Patron_Expiry', 0);
16
(14, 'Patron_Expiry', 0),
17
(15, 'Recall_Cancelled', 0);
(-)a/installer/data/mysql/mandatory/sample_notices_message_transports.sql (-1 / +3 lines)
Lines 55-58 values Link Here
55
(13, "phone",   0, "circulation", "RETURN_RECALLED_ITEM"),
55
(13, "phone",   0, "circulation", "RETURN_RECALLED_ITEM"),
56
(14, "email", 0, "members", "MEMBERSHIP_EXPIRY"),
56
(14, "email", 0, "members", "MEMBERSHIP_EXPIRY"),
57
(14, "sms",   0, "members", "MEMBERSHIP_EXPIRY"),
57
(14, "sms",   0, "members", "MEMBERSHIP_EXPIRY"),
58
(14, "phone",   0, "members", "MEMBERSHIP_EXPIRY");
58
(14, "phone",   0, "members", "MEMBERSHIP_EXPIRY"),
59
(15, "email", 0, "circulation", "RECALL_MANUAL_CANCEL"),
60
(15, "sms",   0, "circulation", "RECALL_MANUAL_CANCEL");
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (+2 lines)
Lines 57-62 Link Here
57
                        <span>Recall awaiting pickup</span>
57
                        <span>Recall awaiting pickup</span>
58
                    [% ELSIF ( messaging_preference.Recall_Requested ) %]
58
                    [% ELSIF ( messaging_preference.Recall_Requested ) %]
59
                        <span>Return recalled item</span>
59
                        <span>Return recalled item</span>
60
                    [% ELSIF ( messaging_preference.Recall_Cancelled ) %]
61
                        <span>Recall cancelled</span>
60
                    [% ELSE %]
62
                    [% ELSE %]
61
                        <span>Unknown</span>
63
                        <span>Unknown</span>
62
                    [% END %]
64
                    [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-1 / +2 lines)
Lines 103-108 Link Here
103
                                                        <span>Recall awaiting pickup</span>
103
                                                        <span>Recall awaiting pickup</span>
104
                                                    [% ELSIF ( messaging_preference.Recall_Requested ) %]
104
                                                    [% ELSIF ( messaging_preference.Recall_Requested ) %]
105
                                                        <span>Return recalled item</span>
105
                                                        <span>Return recalled item</span>
106
                                                    [% ELSIF ( messaging_preference.Recall_Cancelled ) %]
107
                                                        <span>Recall cancelled</span>
106
                                                    [% ELSE %]
108
                                                    [% ELSE %]
107
                                                        <span>Unknown</span>
109
                                                        <span>Unknown</span>
108
                                                    [% END %]</td
110
                                                    [% END %]</td
109
- 

Return to bug 30295