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

(-)a/Koha/Recall.pm (-1 / +25 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 450-455 sub set_cancelled { Link Here
450
    my ( $self ) = @_;
451
    my ( $self ) = @_;
451
    $self->update({ status => 'cancelled', old => 1, cancellationdate => dt_from_string });
452
    $self->update({ status => 'cancelled', old => 1, cancellationdate => dt_from_string });
452
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->recall_id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
453
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->recall_id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
454
455
    # send notice to recaller to pick up item
456
    my $letter = C4::Letters::GetPreparedLetter(
457
        module => 'circulation',
458
        letter_code => 'RECALL_MANUAL_CANCEL',
459
        branchcode => $self->branchcode,
460
        lang => $self->patron->lang,
461
        tables => {
462
            biblio => $self->biblionumber,
463
            borrowers => $self->borrowernumber,
464
            branches => $self->branchcode,
465
        },
466
    );
467
468
    my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->borrowernumber, message_name => 'Recall_Cancelled' });
469
    while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {        if ( $transport eq 'email' ){
470
            C4::Message->enqueue($letter, $self->patron->unblessed, 'email');
471
        }
472
        if ( $transport eq 'sms' ){
473
            C4::Message->enqueue($letter, $self->patron->unblessed, 'sms');
474
        }
475
    }
476
453
    return $self;
477
    return $self;
454
}
478
}
455
479
(-)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 1668-1670 tables: Link Here
1668
            - "A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>."
1668
            - "A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>."
1669
            - ""
1669
            - ""
1670
            - "Thank you!"
1670
            - "Thank you!"
1671
1672
        - module: circulation
1673
          code: RECALL_MANUAL_CANCEL
1674
          branchcode: ""
1675
          name: "Recall has been cancelled"
1676
          is_html: 0
1677
          title: "Recall has been cancelled"
1678
          message_transport_type: email
1679
          lang: default
1680
          content:
1681
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
1682
            - ""
1683
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
1684
            - ""
1685
            - "Title: [% biblio.title %]"
1686
            - "Author: [% biblio.author %]"
1687
            - "Location: [% branch.branchname %]"
1688
1689
        - module: circulation
1690
          code: RECALL_MANUAL_CANCEL
1691
          branchcode: ""
1692
          name: "Recall has been cancelled"
1693
          is_html: 0
1694
          title: "Recall has been cancelled"
1695
          message_transport_type: sms
1696
          lang: default
1697
          content:
1698
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
1699
            - ""
1700
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
1701
            - ""
1702
            - "Title: [% biblio.title %]"
1703
            - "Author: [% biblio.author %]"
1704
            - "Location: [% branch.branchname %]"
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (-1 / +15 lines)
Lines 259-265 Thank you!','sms'), Link Here
259
259
260
A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>.
260
A recall that you requested on the following item: <<biblio.title>> / <<biblio.author>> (<<items.barcode>>) is now ready for you to pick up at <<recalls.branchcode>>. Please pick up your item by <<recalls.expirationdate>>.
261
261
262
Thank you!','sms');
262
Thank you!','sms'),
263
('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %],
264
265
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
266
267
Title: [% biblio.title %]
268
Author: [% biblio.author %]
269
Location: [% branch.branchname %]','sms'),
270
('circulation','RECALL_MANUAL_CANCEL','','Recall has been cancelled','0','Recall has been cancelled','Dear [% borrower.firstname %] [% borrower.surname %],
271
272
We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled.
273
274
Title: [% biblio.title %]
275
Author: [% biblio.author %]
276
Location: [% branch.branchname %]','email');
263
277
264
INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
278
INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`, `lang`) VALUES
265
('circulation', 'ACCOUNT_PAYMENT', '', 'Account payment', 0, 'Account payment', '[%- USE Price -%]\r\nA payment of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis payment affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'),
279
('circulation', 'ACCOUNT_PAYMENT', '', 'Account payment', 0, 'Account payment', '[%- USE Price -%]\r\nA payment of [% credit.amount * -1 | $Price %] has been applied to your account.\r\n\r\nThis payment affected the following fees:\r\n[%- FOREACH o IN offsets %]\r\nDescription: [% o.debit.description %]\r\nAmount paid: [% o.amount * -1 | $Price %]\r\nAmount remaining: [% o.debit.amountoutstanding | $Price %]\r\n[% END %]', 'email', 'default'),
(-)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 ) %]Interlibrary loan ready
30
          [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
31
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
31
          [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
32
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal
32
          [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal
33
          [% ELSIF ( messaging_preference.Recall_Waiting ) %]Recall awaiting pickup
33
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]Recall awaiting pickup
34
          [% ELSIF ( messaging_preference.Recall_Requested ) %]Return recalled item
34
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]Return recalled item
35
          [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]Recall cancelled
35
          [% ELSE %]Unknown [% END %]</td>
36
          [% ELSE %]Unknown [% END %]</td>
36
      [% IF ( messaging_preference.takes_days ) %]
37
      [% IF ( messaging_preference.takes_days ) %]
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 ) %]Interlibrary loan ready
76
                                                [% ELSIF ( messaging_preference.Ill_ready ) %]Interlibrary loan ready
77
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
77
                                                [% ELSIF ( messaging_preference.Ill_unavailable ) %]Interlibrary loan unavailable
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]Auto renewal
79
                                                [% ELSIF ( messaging_preference.Recall_Waiting ) %]Recall awaiting pickup
79
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Waiting ) %]Recall awaiting pickup
80
                                                [% ELSIF ( messaging_preference.Recall_Requested ) %]Return recalled item
80
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Requested ) %]Return recalled item
81
                                                [% ELSIF ( Koha.Preference('UseRecalls') && messaging_preference.Recall_Cancelled ) %]Recall cancelled
81
                                                [% ELSE %]Unknown [% END %]</td>
82
                                                [% ELSE %]Unknown [% 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