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->pickup_library_id,
461
        lang => $self->patron->lang,
462
        tables => {
463
            biblio => $self->biblio_id,
464
            borrowers => $self->patron_id,
465
            branches => $self->pickup_library_id,
466
        },
467
    );
468
469
    my $messaging_preferences = C4::Members::Messaging::GetMessagingPreferences({ borrowernumber => $self->patron_id, 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 2396-2398 tables: Link Here
2396
            - "[% IF ( biblio.items.count > 0 ) %]<br>Items: <ul>[% FOREACH item IN biblio.items %]<li>[% Branches.GetName( item.holdingbranch ) | html %]"
2396
            - "[% IF ( biblio.items.count > 0 ) %]<br>Items: <ul>[% FOREACH item IN biblio.items %]<li>[% Branches.GetName( item.holdingbranch ) | html %]"
2397
            - "[% IF ( item.location ) %], [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %][% END %][% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %][% item.barcode | html %]</li>[% END %]</ul>[% END %]"
2397
            - "[% IF ( item.location ) %], [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %][% END %][% IF item.itemcallnumber %]([% item.itemcallnumber | html %])[% END %][% item.barcode | html %]</li>[% END %]</ul>[% END %]"
2398
            - "<hr></li>[% END %]</ol>"
2398
            - "<hr></li>[% END %]</ol>"
2399
2400
        - module: circulation
2401
          code: RECALL_MANUAL_CANCEL
2402
          branchcode: ""
2403
          name: "Recall has been cancelled"
2404
          is_html: 0
2405
          title: "Recall has been cancelled"
2406
          message_transport_type: email
2407
          lang: default
2408
          content:
2409
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2410
            - ""
2411
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2412
            - ""
2413
            - "Title: [% biblio.title %]"
2414
            - "Author: [% biblio.author %]"
2415
            - "Location: [% branch.branchname %]"
2416
2417
        - module: circulation
2418
          code: RECALL_MANUAL_CANCEL
2419
          branchcode: ""
2420
          name: "Recall has been cancelled"
2421
          is_html: 0
2422
          title: "Recall has been cancelled"
2423
          message_transport_type: sms
2424
          lang: default
2425
          content:
2426
            - "Dear [% borrower.firstname %] [% borrower.surname %],"
2427
            - ""
2428
            - "We regret to inform you that the item you have recalled cannot be provided. Your recall was cancelled."
2429
            - ""
2430
            - "Title: [% biblio.title %]"
2431
            - "Author: [% biblio.author %]"
2432
            - "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