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

(-)a/C4/Items.pm (-1 / +1 lines)
Lines 2997-3003 sub ToggleNewStatus { Link Here
2997
        my $query = q|
2997
        my $query = q|
2998
            SELECT items.biblionumber, items.itemnumber
2998
            SELECT items.biblionumber, items.itemnumber
2999
            FROM items
2999
            FROM items
3000
            LEFT JOIN biblioitems ON items.biblioitemnumber = items.itemnumber
3000
            LEFT JOIN biblioitems ON biblioitems.biblionumber = items.biblionumber
3001
            WHERE 1
3001
            WHERE 1
3002
        |;
3002
        |;
3003
        for my $condition ( @$conditions ) {
3003
        for my $condition ( @$conditions ) {
(-)a/t/db_dependent/Items/ToggleNewStatus.t (-2 / +24 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 15;
4
use Test::More tests => 16;
5
use MARC::Record;
5
use MARC::Record;
6
use MARC::Field;
6
use MARC::Field;
7
use DateTime;
7
use DateTime;
Lines 31-36 my $record = MARC::Record->new(); Link Here
31
$record->append_fields(
31
$record->append_fields(
32
    MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
32
    MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
33
    MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
33
    MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
34
    MARC::Field->new('942', ' ', ' ', c => 'ITEMTYPE_T'),
34
);
35
);
35
my ($biblionumber, undef) = C4::Biblio::AddBiblio($record, '');
36
my ($biblionumber, undef) = C4::Biblio::AddBiblio($record, '');
36
37
Lines 258-260 C4::Items::ToggleNewStatus( { rules => \@rules } ); Link Here
258
$modified_item = C4::Items::GetItem( $itemnumber );
259
$modified_item = C4::Items::GetItem( $itemnumber );
259
is( $modified_item->{new}, 'new_updated_value', q|ToggleNewStatus: conditions multiple: the 2 conditions match, the new value is updated|);
260
is( $modified_item->{new}, 'new_updated_value', q|ToggleNewStatus: conditions multiple: the 2 conditions match, the new value is updated|);
260
261
261
- 
262
@rules = (
263
    {
264
        conditions => [
265
            {
266
                field => 'biblioitems.itemtype',
267
                value => 'ITEMTYPE_T',
268
            },
269
        ],
270
        substitutions => [
271
            {
272
                field => 'items.new',
273
                value => 'another_new_updated_value',
274
             },
275
        ],
276
        duration => '0',
277
    },
278
);
279
280
C4::Items::ToggleNewStatus( { rules => \@rules } );
281
282
$modified_item = C4::Items::GetItem( $itemnumber );
283
is( $modified_item->{new}, 'another_new_updated_value', q|ToggleNewStatus: conditions on biblioitems|);

Return to bug 11023