6 use Test
::More tests
=> 28;
11 my $item_mod_fixes_1 = {
18 my $item_mod_fixes_2 = {
25 my $item_mod_fixes_3 = {
32 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_1);
33 is
($item_mod_fixes_1->{'notforloan'}, 0, 'null notforloan fixed during mod');
34 is
($item_mod_fixes_1->{'damaged'}, 0, 'null damaged fixed during mod');
35 is
($item_mod_fixes_1->{'wthdrawn'}, 0, 'null wthdrawn fixed during mod');
36 is
($item_mod_fixes_1->{'itemlost'}, 0, 'null itemlost fixed during mod');
38 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_2);
39 is
($item_mod_fixes_2->{'notforloan'}, 0, 'empty notforloan fixed during mod');
40 is
($item_mod_fixes_2->{'damaged'}, 0, 'empty damaged fixed during mod');
41 is
($item_mod_fixes_2->{'wthdrawn'}, 0, 'empty wthdrawn fixed during mod');
42 is
($item_mod_fixes_2->{'itemlost'}, 0, 'empty itemlost fixed during mod');
44 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_3);
45 is
($item_mod_fixes_3->{'notforloan'}, 1, 'do not clobber notforloan during mod');
46 is
($item_mod_fixes_3->{'damaged'}, 2, 'do not clobber damaged during mod');
47 is
($item_mod_fixes_3->{'wthdrawn'}, 3, 'do not clobber wthdrawn during mod');
48 is
($item_mod_fixes_3->{'itemlost'}, 4, 'do not clobber itemlost during mod');
51 itemnotes
=> 'newitem',
54 C4
::Items
::_set_defaults_for_add
($item_to_add_1);
55 ok
(exists $item_to_add_1->{'dateaccessioned'}, 'dateaccessioned added to new item');
56 like
($item_to_add_1->{'dateaccessioned'}, qr/^\d\d\d\d-\d\d-\d\d$/ , 'new dateaccessioned is dddd-dd-dd');
57 is
($item_to_add_1->{'itemnotes'}, 'newitem', 'itemnotes not clobbered');
59 my $item_add_fixes_1 = {
66 my $item_add_fixes_2 = {
73 my $item_add_fixes_3 = {
80 C4
::Items
::_set_defaults_for_add
($item_add_fixes_1);
81 is
($item_add_fixes_1->{'notforloan'}, 0, 'null notforloan fixed during add');
82 is
($item_add_fixes_1->{'damaged'}, 0, 'null damaged fixed during add');
83 is
($item_add_fixes_1->{'wthdrawn'}, 0, 'null wthdrawn fixed during add');
84 is
($item_add_fixes_1->{'itemlost'}, 0, 'null itemlost fixed during add');
86 C4
::Items
::_set_defaults_for_add
($item_add_fixes_2);
87 is
($item_add_fixes_2->{'notforloan'}, 0, 'empty notforloan fixed during add');
88 is
($item_add_fixes_2->{'damaged'}, 0, 'empty damaged fixed during add');
89 is
($item_add_fixes_2->{'wthdrawn'}, 0, 'empty wthdrawn fixed during add');
90 is
($item_add_fixes_2->{'itemlost'}, 0, 'empty itemlost fixed during add');
92 C4
::Items
::_set_defaults_for_add
($item_add_fixes_3);
93 is
($item_add_fixes_3->{'notforloan'}, 1, 'do not clobber notforloan during mod');
94 is
($item_add_fixes_3->{'damaged'}, 2, 'do not clobber damaged during mod');
95 is
($item_add_fixes_3->{'wthdrawn'}, 3, 'do not clobber wthdrawn during mod');
96 is
($item_add_fixes_3->{'itemlost'}, 4, 'do not clobber itemlost during mod');