https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28567
--- Comment #18 from Marcel de Rooy <[email protected]> --- (In reply to Jonathan Druart from comment #17) > > In this case I would opt for the Koha::Objects instead of copying the same > > code in controller scripts. > > > > Object:new > > # Remove the arguments which exist, are not defined but NOT NULL to > > use the default value > > my $columns_info = $schema->resultset( $class->_type > > )->result_source->columns_info; > > for my $column_name ( keys %$attributes ) { > > my $c_info = $columns_info->{$column_name}; > > next if $c_info->{is_nullable}; > > next if not exists $attributes->{$column_name} or defined > > $attributes->{$column_name}; > > delete $attributes->{$column_name}; > > } > > Why not set $attributes->{$column_name} = $c_info->{default_value} if > > defined and delete only if not? > > We just ignore if set. This is completely different code (we are dealing > with NOT NULL values). What's the question exactly, what do you suggest? Can > we discuss it somewhere else? :D This code comes into play since admin/branches calls: my $library = Koha::Library->new If Koha::Object->new here passed the default SQL value of 1, we could eliminate the mentioned confusing construction. Actually in the above comment even a reference to default value is made, but the code does not do it. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
