6 use Test
::More tests
=> 28;
10 use override_context_prefs
;
14 my $item_mod_fixes_1 = {
21 my $item_mod_fixes_2 = {
28 my $item_mod_fixes_3 = {
35 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_1);
36 is
($item_mod_fixes_1->{'notforloan'}, 0, 'null notforloan fixed during mod');
37 is
($item_mod_fixes_1->{'damaged'}, 0, 'null damaged fixed during mod');
38 is
($item_mod_fixes_1->{'wthdrawn'}, 0, 'null wthdrawn fixed during mod');
39 is
($item_mod_fixes_1->{'itemlost'}, 0, 'null itemlost fixed during mod');
41 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_2);
42 is
($item_mod_fixes_2->{'notforloan'}, 0, 'empty notforloan fixed during mod');
43 is
($item_mod_fixes_2->{'damaged'}, 0, 'empty damaged fixed during mod');
44 is
($item_mod_fixes_2->{'wthdrawn'}, 0, 'empty wthdrawn fixed during mod');
45 is
($item_mod_fixes_2->{'itemlost'}, 0, 'empty itemlost fixed during mod');
47 C4
::Items
::_do_column_fixes_for_mod
($item_mod_fixes_3);
48 is
($item_mod_fixes_3->{'notforloan'}, 1, 'do not clobber notforloan during mod');
49 is
($item_mod_fixes_3->{'damaged'}, 2, 'do not clobber damaged during mod');
50 is
($item_mod_fixes_3->{'wthdrawn'}, 3, 'do not clobber wthdrawn during mod');
51 is
($item_mod_fixes_3->{'itemlost'}, 4, 'do not clobber itemlost during mod');
54 itemnotes
=> 'newitem',
57 C4
::Items
::_set_defaults_for_add
($item_to_add_1);
58 ok
(exists $item_to_add_1->{'dateaccessioned'}, 'dateaccessioned added to new item');
59 like
($item_to_add_1->{'dateaccessioned'}, qr/^\d\d\d\d-\d\d-\d\d$/ , 'new dateaccessioned is dddd-dd-dd');
60 is
($item_to_add_1->{'itemnotes'}, 'newitem', 'itemnotes not clobbered');
62 my $item_add_fixes_1 = {
69 my $item_add_fixes_2 = {
76 my $item_add_fixes_3 = {
83 C4
::Items
::_set_defaults_for_add
($item_add_fixes_1);
84 is
($item_add_fixes_1->{'notforloan'}, 0, 'null notforloan fixed during add');
85 is
($item_add_fixes_1->{'damaged'}, 0, 'null damaged fixed during add');
86 is
($item_add_fixes_1->{'wthdrawn'}, 0, 'null wthdrawn fixed during add');
87 is
($item_add_fixes_1->{'itemlost'}, 0, 'null itemlost fixed during add');
89 C4
::Items
::_set_defaults_for_add
($item_add_fixes_2);
90 is
($item_add_fixes_2->{'notforloan'}, 0, 'empty notforloan fixed during add');
91 is
($item_add_fixes_2->{'damaged'}, 0, 'empty damaged fixed during add');
92 is
($item_add_fixes_2->{'wthdrawn'}, 0, 'empty wthdrawn fixed during add');
93 is
($item_add_fixes_2->{'itemlost'}, 0, 'empty itemlost fixed during add');
95 C4
::Items
::_set_defaults_for_add
($item_add_fixes_3);
96 is
($item_add_fixes_3->{'notforloan'}, 1, 'do not clobber notforloan during mod');
97 is
($item_add_fixes_3->{'damaged'}, 2, 'do not clobber damaged during mod');
98 is
($item_add_fixes_3->{'wthdrawn'}, 3, 'do not clobber wthdrawn during mod');
99 is
($item_add_fixes_3->{'itemlost'}, 4, 'do not clobber itemlost during mod');