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

(-)a/C4/Serials.pm (-1 / +2 lines)
Lines 1161-1167 sub ModSerialStatus { Link Here
1161
                    WHERE  subscriptionid = ?";
1161
                    WHERE  subscriptionid = ?";
1162
        $sth = $dbh->prepare($query);
1162
        $sth = $dbh->prepare($query);
1163
        $sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid );
1163
        $sth->execute( $newlastvalue1, $newlastvalue2, $newlastvalue3, $newinnerloop1, $newinnerloop2, $newinnerloop3, $subscriptionid );
1164
        NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate, undef, $notes, $routingnotes );
1164
        my $newnote = C4::Context->preference('PreserveSerialNotes') ? $notes : "";
1165
        NewIssue( $newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextpubdate, $nextpubdate, undef, $newnote, $routingnotes );
1165
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1166
        # check if an alert must be sent... (= a letter is defined & status became "arrived"
1166
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1167
        if ( $subscription->{letter} && $status == ARRIVED && $oldstatus != ARRIVED ) {
1167
            require C4::Letters;
1168
            require C4::Letters;
(-)a/installer/data/mysql/atomicupdate/Bug_23416_add_PreserveSerialNotes_pref.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q|
4
        INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
5
        ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo');
6
    |);
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 23416 - Add PreserveSerialNotes syspref)\n";
10
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 480-485 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
480
('PayPalSignature',  '', NULL ,  'Your PayPal API signature',  'Free'),
480
('PayPalSignature',  '', NULL ,  'Your PayPal API signature',  'Free'),
481
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
481
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
482
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
482
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
483
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
483
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
484
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
484
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
485
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
485
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
486
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/serials.pref (+6 lines)
Lines 56-58 Serials: Link Here
56
            yes: Make
56
            yes: Make
57
            no: Do not make
57
            no: Do not make
58
        - previous serial automatically available when receiving a new serial issue. The previous issue can also be set to another item type when receiving a new one. Please note that the item-level_itypes syspref must be set to specific item.
58
        - previous serial automatically available when receiving a new serial issue. The previous issue can also be set to another item type when receiving a new one. Please note that the item-level_itypes syspref must be set to specific item.
59
    -
60
        - pref: PreserveSerialNotes
61
          choices:
62
            yes: Do
63
            no: Do not
64
        - prefill the notes from the last 'Arrived' serial when generating the next 'Expected' issue.
(-)a/t/db_dependent/Serials.t (-2 / +18 lines)
Lines 18-24 use Koha::DateUtils; Link Here
18
use Koha::Acquisition::Booksellers;
18
use Koha::Acquisition::Booksellers;
19
use t::lib::Mocks;
19
use t::lib::Mocks;
20
use t::lib::TestBuilder;
20
use t::lib::TestBuilder;
21
use Test::More tests => 48;
21
use Test::More tests => 49;
22
22
23
BEGIN {
23
BEGIN {
24
    use_ok('C4::Serials');
24
    use_ok('C4::Serials');
Lines 371-376 subtest "Do not generate an expected if one already exists" => sub { Link Here
371
    is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" );
371
    is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" );
372
};
372
};
373
373
374
subtest "PreserveSerialNotes preference" => sub {
375
    plan tests => 2;
376
    my ($expected_serial) = GetSerials2( $subscriptionid, [1] );
377
378
    t::lib::Mocks::mock_preference( 'PreserveSerialNotes', 1 );
379
380
    C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' );
381
    @serialsByStatus = C4::Serials::findSerialsByStatus( 1, $subscriptionid );
382
    is( $serialsByStatus[0]->{note},$expected_serial->{note}, "note passed through if supposed to");
383
384
    t::lib::Mocks::mock_preference( 'PreserveSerialNotes', 0 );
385
    $expected_serial = $serialsByStatus[0];
386
    C4::Serials::ModSerialStatus( $expected_serial->{serialid}, 'NO.20', $publisheddate, $publisheddate, $publisheddate, '1', 'an useless note' );
387
    is( $serialsByStatus[0]->{note},$expected_serial->{note}, "note not passed through if not supposed to");
388
389
};
390
374
subtest "NewSubscription" => sub {
391
subtest "NewSubscription" => sub {
375
    plan tests => 1;
392
    plan tests => 1;
376
    my $subscriptionid = NewSubscription(
393
    my $subscriptionid = NewSubscription(
377
- 

Return to bug 23416