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

(-)a/Koha/Recall.pm (-1 / +26 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 451-456 sub set_cancelled { Link Here
451
    my ( $self ) = @_;
452
    my ( $self ) = @_;
452
    $self->update({ status => 'cancelled', completed => 1, completed_date => dt_from_string });
453
    $self->update({ status => 'cancelled', completed => 1, completed_date => dt_from_string });
453
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
454
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
455
456
    # send notice to recaller to pick up item
457
    my $letter = C4::Letters::GetPreparedLetter(
458
        module => 'circulation',
459
        letter_code => 'RECALL_MANUAL_CANCEL',
460
        branchcode => $self->branchcode,
461
        lang => $self->patron->lang,
462
        tables => {
463
            biblio => $self->biblionumber,
464
            borrowers => $self->borrowernumber,
465
            branches => $self->branchcode,
466
        },
467
    );
468
469
    my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->borrowernumber, message_name => 'Recall_Cancelled' });
470
    while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {
471
        if ( $transport eq 'email' ){
472
            C4::Message->enqueue($letter, $self->patron->unblessed, 'email');
473
        }
474
        if ( $transport eq 'sms' ){
475
            C4::Message->enqueue($letter, $self->patron->unblessed, 'sms');
476
        }
477
    }
478
454
    return $self;
479
    return $self;
455
}
480
}
456
481
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_attributes.pl (+12 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(q{ INSERT IGNORE INTO message_attributes (message_attribute_id, message_name, takes_days) VALUES (14, 'Recall_Cancelled', 0) });
11
    },
12
};
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_message_transports.pl (+12 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(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) });
11
    },
12
};
(-)a/installer/data/mysql/atomicupdate/bug_30295-add_RECALL_MANUAL_CANCEL_notice.pl (+24 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(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 %],
11
12
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
13
14
Title: [% biblio.title %]
15
Author: [% biblio.author %]
16
Location: [% branch.branchname %]','sms'), ('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %],
17
18
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
19
20
Title: [% biblio.title %]
21
Author: [% biblio.author %]
22
Location: [% branch.branchname %]','email') });
23
    },
24
};
(-)a/installer/data/mysql/en/mandatory/sample_notices.yml (+34 lines)
Lines 2146-2148 tables: Link Here
2146
            - "[% IF borrower.categorycode %]<li>Temporary patron category: [% borrower.categorycode %]</li>[% END %]"
2146
            - "[% IF borrower.categorycode %]<li>Temporary patron category: [% borrower.categorycode %]</li>[% END %]"
2147
            - "</ul>"
2147
            - "</ul>"
2148
            - "</p>"
2148
            - "</p>"
2149
2150
        - module: circulation
2151
          code: RECALL_MANUAL_CANCEL
2152
          branchcode: ""
2153
          name: "Recall has been cancelled"
2154
          is_html: 0
2155
          title: "Recall has been cancelled"
2156
          message_transport_type: email
2157
          lang: default
2158
          content:
2159
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2160
            - ""
2161
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2162
            - ""
2163
            - "Title: [% biblio.title %]"
2164
            - "Author: [% biblio.author %]"
2165
            - "Location: [% branch.branchname %]"
2166
2167
        - module: circulation
2168
          code: RECALL_MANUAL_CANCEL
2169
          branchcode: ""
2170
          name: "Recall has been cancelled"
2171
          is_html: 0
2172
          title: "Recall has been cancelled"
2173
          message_transport_type: sms
2174
          lang: default
2175
          content:
2176
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2177
            - ""
2178
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2179
            - ""
2180
            - "Title: [% biblio.title %]"
2181
            - "Author: [% biblio.author %]"
2182
            - "Location: [% branch.branchname %]"
(-)a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql (-1 / +2 lines)
Lines 12-15 values Link Here
12
(10, 'Hold_Reminder', 0),
12
(10, 'Hold_Reminder', 0),
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, 'Recall_Cancelled', 0);
(-)a/installer/data/mysql/mandatory/sample_notices_message_transports.sql (-1 / +3 lines)
Lines 45-48 values Link Here
45
(12, "email", 0, "circulation", "PICKUP_RECALLED_ITEM"),
45
(12, "email", 0, "circulation", "PICKUP_RECALLED_ITEM"),
46
(12, "sms",   0, "circulation", "PICKUP_RECALLED_ITEM"),
46
(12, "sms",   0, "circulation", "PICKUP_RECALLED_ITEM"),
47
(13, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
47
(13, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
48
(13, "sms",   0, "circulation", "RETURN_RECALLED_ITEM");
48
(13, "sms",   0, "circulation", "RETURN_RECALLED_ITEM"),
49
(14, "email", 0, "circulation", "RECALL_MANUAL_CANCEL"),
50
(14, "sms",   0, "circulation", "RECALL_MANUAL_CANCEL");
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (+1 lines)
Lines 36-41 Link Here
36
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
36
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
37
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
37
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
38
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
38
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
39
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span>
39
          [% ELSE %]<span>Unknown</span>
40
          [% ELSE %]<span>Unknown</span>
40
          [% END %]
41
          [% END %]
41
      </td>
42
      </td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-1 / +1 lines)
Lines 80-85 Link Here
80
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
80
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
81
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
81
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
82
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
82
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
83
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span>
83
                                                [% ELSE %]<span>Unknown</span> [% END %]</td>
84
                                                [% ELSE %]<span>Unknown</span> [% END %]</td>
84
                                            [% IF ( messaging_preference.takes_days ) %]
85
                                            [% IF ( messaging_preference.takes_days ) %]
85
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
86
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
86
- 

Return to bug 30295