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 (13, '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 (13, "email", 0, "circulation", "RECALL_MANUAL_CANCEL", null), (13, "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 1780-1782 tables: Link Here
1780
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1780
            - "<p>This is to confirm that someone enabled two factor authentication on your account.</p>"
1781
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1781
            - "<p>If you did not do this, someone else may be using your account. Please contact technical support.</p>"
1782
            - "<p>Your library</p>"
1782
            - "<p>Your library</p>"
1783
1784
        - module: circulation
1785
          code: RECALL_MANUAL_CANCEL
1786
          branchcode: ""
1787
          name: "Recall has been cancelled"
1788
          is_html: 0
1789
          title: "Recall has been cancelled"
1790
          message_transport_type: email
1791
          lang: default
1792
          content:
1793
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
1794
            - ""
1795
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
1796
            - ""
1797
            - "Title: [% biblio.title %]"
1798
            - "Author: [% biblio.author %]"
1799
            - "Location: [% branch.branchname %]"
1800
1801
        - module: circulation
1802
          code: RECALL_MANUAL_CANCEL
1803
          branchcode: ""
1804
          name: "Recall has been cancelled"
1805
          is_html: 0
1806
          title: "Recall has been cancelled"
1807
          message_transport_type: sms
1808
          lang: default
1809
          content:
1810
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
1811
            - ""
1812
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
1813
            - ""
1814
            - "Title: [% biblio.title %]"
1815
            - "Author: [% biblio.author %]"
1816
            - "Location: [% branch.branchname %]"
(-)a/installer/data/mysql/mandatory/sample_notices_message_attributes.sql (-1 / +2 lines)
Lines 11-14 values Link Here
11
(9, 'Auto_Renewals', 0),
11
(9, 'Auto_Renewals', 0),
12
(10, 'Hold_Reminder', 0),
12
(10, 'Hold_Reminder', 0),
13
(11, 'Recall_Waiting', 0),
13
(11, 'Recall_Waiting', 0),
14
(12, 'Recall_Requested', 0);
14
(12, 'Recall_Requested', 0),
15
(13, 'Recall_Cancelled', 0);
(-)a/installer/data/mysql/mandatory/sample_notices_message_transports.sql (-1 / +3 lines)
Lines 42-45 values Link Here
42
(11, "email", 0, "circulation", "PICKUP_RECALLED_ITEM"),
42
(11, "email", 0, "circulation", "PICKUP_RECALLED_ITEM"),
43
(11, "sms",   0, "circulation", "PICKUP_RECALLED_ITEM"),
43
(11, "sms",   0, "circulation", "PICKUP_RECALLED_ITEM"),
44
(12, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
44
(12, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
45
(12, "sms",   0, "circulation", "RETURN_RECALLED_ITEM");
45
(12, "sms",   0, "circulation", "RETURN_RECALLED_ITEM"),
46
(13, "email", 0, "circulation", "RECALL_MANUAL_CANCEL"),
47
(13, "sms",   0, "circulation", "RECALL_MANUAL_CANCEL");
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc (-2 / +3 lines)
Lines 30-37 Link Here
30
          [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span>
30
          [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span>
31
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
31
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
32
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
32
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
33
          [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
33
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
34
          [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
34
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
35
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span>
35
          [% ELSE %]<span>Unknown</span>
36
          [% ELSE %]<span>Unknown</span>
36
          [% END %]
37
          [% END %]
37
      </td>
38
      </td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt (-3 / +3 lines)
Lines 76-83 Link Here
76
                                                [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span>
76
                                                [% ELSIF ( messaging_preference.Ill_ready ) %]<span>Interlibrary loan ready</span>
77
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
77
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]<span>Interlibrary loan unavailable</span>
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
79
                                                [% ELSIF ( messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
79
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]<span>Recall awaiting pickup</span>
80
                                                [% ELSIF ( messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
80
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]<span>Return recalled item</span>
81
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]<span>Recall cancelled</span>
81
                                                [% ELSE %]<span>Unknown</span> [% END %]</td>
82
                                                [% ELSE %]<span>Unknown</span> [% END %]</td>
82
                                            [% IF ( messaging_preference.takes_days ) %]
83
                                            [% IF ( messaging_preference.takes_days ) %]
83
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
84
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS">
84
- 

Return to bug 30295