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 452-457 sub set_cancelled { Link Here
452
    my ( $self ) = @_;
453
    my ( $self ) = @_;
453
    $self->update({ status => 'cancelled', completed => 1, completed_date => dt_from_string });
454
    $self->update({ status => 'cancelled', completed => 1, completed_date => dt_from_string });
454
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
455
    C4::Log::logaction( 'RECALLS', 'CANCEL', $self->id, "Recall cancelled", 'INTRANET' ) if ( C4::Context->preference('RecallsLog') );
456
457
    # send notice to recaller to pick up item
458
    my $letter = C4::Letters::GetPreparedLetter(
459
        module => 'circulation',
460
        letter_code => 'RECALL_MANUAL_CANCEL',
461
        branchcode => $self->pickup_library_id,
462
        lang => $self->patron->lang,
463
        tables => {
464
            biblio => $self->biblio_id,
465
            borrowers => $self->patron_id,
466
            branches => $self->pickup_library_id,
467
        },
468
    );
469
470
    my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->patron_id, message_name => 'Recall_Cancelled' });
471
    while ( my ( $transport, $letter_code ) = each %{ $messaging_preferences->{transports} } ) {
472
        if ( $transport eq 'email' ){
473
            C4::Message->enqueue($letter, $self->patron->unblessed, 'email');
474
        }
475
        if ( $transport eq 'sms' ){
476
            C4::Message->enqueue($letter, $self->patron->unblessed, 'sms');
477
        }
478
    }
479
455
    return $self;
480
    return $self;
456
}
481
}
457
482
(-)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 2502-2504 tables: Link Here
2502
            - "Your hold on [% hold.biblio.title %] ([% hold.biblio.id %]) has been confirmed."
2502
            - "Your hold on [% hold.biblio.title %] ([% hold.biblio.id %]) has been confirmed."
2503
            - "You will be notified by the library when your item is available for pickup."
2503
            - "You will be notified by the library when your item is available for pickup."
2504
            - "Thank you!"
2504
            - "Thank you!"
2505
2506
        - module: circulation
2507
          code: RECALL_MANUAL_CANCEL
2508
          branchcode: ""
2509
          name: "Recall has been cancelled"
2510
          is_html: 0
2511
          title: "Recall has been cancelled"
2512
          message_transport_type: email
2513
          lang: default
2514
          content:
2515
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2516
            - ""
2517
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2518
            - ""
2519
            - "Title: [% biblio.title %]"
2520
            - "Author: [% biblio.author %]"
2521
            - "Location: [% branch.branchname %]"
2522
2523
        - module: circulation
2524
          code: RECALL_MANUAL_CANCEL
2525
          branchcode: ""
2526
          name: "Recall has been cancelled"
2527
          is_html: 0
2528
          title: "Recall has been cancelled"
2529
          message_transport_type: sms
2530
          lang: default
2531
          content:
2532
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2533
            - ""
2534
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2535
            - ""
2536
            - "Title: [% biblio.title %]"
2537
            - "Author: [% biblio.author %]"
2538
            - "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 50-53 values Link Here
50
(12, "phone",   0, "circulation", "PICKUP_RECALLED_ITEM"),
50
(12, "phone",   0, "circulation", "PICKUP_RECALLED_ITEM"),
51
(13, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
51
(13, "email", 0, "circulation", "RETURN_RECALLED_ITEM"),
52
(13, "sms",   0, "circulation", "RETURN_RECALLED_ITEM"),
52
(13, "sms",   0, "circulation", "RETURN_RECALLED_ITEM"),
53
(13, "phone",   0, "circulation", "RETURN_RECALLED_ITEM");
53
(13, "phone",   0, "circulation", "RETURN_RECALLED_ITEM"),
54
(14, "email", 0, "circulation", "RECALL_MANUAL_CANCEL"),
55
(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 78-83 Link Here
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
78
                                                [% ELSIF ( messaging_preference.Auto_Renewals ) %]<span>Auto renewal</span>
79
                                                [% ELSIF ( Koha.Preference('UseRecalls') && 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 ( Koha.Preference('UseRecalls') && 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" aria-label="Choose how many days in advance you wish to receive notice">
84
                                                <td><select class="input-mini" name="[% messaging_preference.message_attribute_id | html %]-DAYS" aria-label="Choose how many days in advance you wish to receive notice">
84
- 

Return to bug 30295