From 4bf5c32a6c8a47502c3ddffd631d6b0774a90fd1 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 18 Mar 2008 13:41:36 +0000 Subject: [PATCH] Anzahl Seiten und Typ des Einbands dazu --- lib/FrBr/Books/Db/Bindungsarten.pm | 20 ++++++++++++++++++++ lib/FrBr/Books/Db/Buecher.pm | 7 +++++-- lib/FrBr/Books/Util/Book.pm | 12 +++++++++++- root/src/books/list.tt2 | 4 ++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 lib/FrBr/Books/Db/Bindungsarten.pm diff --git a/lib/FrBr/Books/Db/Bindungsarten.pm b/lib/FrBr/Books/Db/Bindungsarten.pm new file mode 100644 index 0000000..67cda49 --- /dev/null +++ b/lib/FrBr/Books/Db/Bindungsarten.pm @@ -0,0 +1,20 @@ +package FrBr::Books::Db::Bindungsarten; + +# $Id: Absence.pm 305 2008-03-14 13:53:44Z fbrehm $ +# $URL$ + +use strict; +use warnings; + +use base 'DBIx::Class'; + +__PACKAGE__->load_components("Core"); +__PACKAGE__->table("bindungsarten"); +__PACKAGE__->add_columns( + "id" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, + "art_name" => { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 250, }, +); +__PACKAGE__->set_primary_key("id"); +__PACKAGE__->add_unique_constraint("art_name", ["art_name"]); + +1; diff --git a/lib/FrBr/Books/Db/Buecher.pm b/lib/FrBr/Books/Db/Buecher.pm index e0d16e5..84e0129 100644 --- a/lib/FrBr/Books/Db/Buecher.pm +++ b/lib/FrBr/Books/Db/Buecher.pm @@ -14,19 +14,22 @@ __PACKAGE__->add_columns( "id" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, "title" => { data_type => "VARCHAR", default_value => undef, is_nullable => 0, size => 250, }, "title_original" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 250, }, + "bindungsart_id" => { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, "verlags_id" => { data_type => "INT", default_value => undef, is_nullable => 0, size => 10 }, "isbn" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 20, }, "buch_nr" => { data_type => "VARCHAR", default_value => undef, is_nullable => 1, size => 100, }, "ausgabejahr" => { data_type => "MEDIUMINT", default_value => undef, is_nullable => 1, size => 8, }, "druckjahr" => { data_type => "MEDIUMINT", default_value => undef, is_nullable => 1, size => 8, }, + "seiten" => { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, "preis" => { data_type => "FLOAT", default_value => undef, is_nullable => 1, size => 32 }, "waehrungs_id" => { data_type => "INT", default_value => undef, is_nullable => 1, size => 10 }, ); __PACKAGE__->set_primary_key("id"); -__PACKAGE__->might_have( 'waehrung' => 'FrBr::Books::Db::Waehrungen', { 'foreign.id' => 'self.waehrungs_id' } ); -__PACKAGE__->might_have( 'verlag' => 'FrBr::Books::Db::Verlage', { 'foreign.id' => 'self.verlags_id' } ); +__PACKAGE__->might_have( 'waehrung' => 'FrBr::Books::Db::Waehrungen', { 'foreign.id' => 'self.waehrungs_id' } ); +__PACKAGE__->might_have( 'verlag' => 'FrBr::Books::Db::Verlage', { 'foreign.id' => 'self.verlags_id' } ); +__PACKAGE__->might_have( 'bindungsart' => 'FrBr::Books::Db::Bindungsarten', { 'foreign.id' => 'self.bindungsart_id' } ); # Created by DBIx::Class::Schema::Loader v0.04004 @ 2008-03-17 17:53:52 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GjY80NXBYER1XlWgPukp+A diff --git a/lib/FrBr/Books/Util/Book.pm b/lib/FrBr/Books/Util/Book.pm index ec0f277..2f0ceee 100644 --- a/lib/FrBr/Books/Util/Book.pm +++ b/lib/FrBr/Books/Util/Book.pm @@ -82,16 +82,19 @@ sub get_booklist { my $b_search_params = undef; my $other_params = {}; $other_params->{'order_by'} = [ 'title' ]; - $other_params->{'join'} = [ 'waehrung', 'verlag' ]; + $other_params->{'join'} = [ 'waehrung', 'verlag', 'bindungsart' ]; $other_params->{'select'} = [ 'me.id', 'me.title', 'me.title_original', + 'me.bindungsart_id', + 'bindungsart.art_name AS `bindungsart`', 'me.verlags_id', 'me.isbn', 'me.buch_nr', 'me.ausgabejahr', 'me.druckjahr', + 'me.seiten', 'me.preis', 'me.waehrungs_id', 'waehrung.waehrungs_kuerzel', @@ -99,16 +102,20 @@ sub get_booklist { 'waehrung.umrechnung_in_euro', 'verlag.name_short AS `verlagsname_short`', 'verlag.name_long AS `verlagsname_long`', + ]; $other_params->{'as'} = [ 'id', 'title', 'title_original', + 'bindungsart_id', + 'bindungsart', 'verlags_id', 'isbn', 'buch_nr', 'ausgabejahr', 'druckjahr', + 'seiten', 'preis', 'waehrungs_id', 'waehrungs_kuerzel', @@ -125,11 +132,14 @@ sub get_booklist { $buch->{'id'} = $id; $buch->{'title'} = $book->title(); $buch->{'title_original'} = $book->title_original(); + $buch->{'bindungsart_id'} = $book->bindungsart_id(); + $buch->{'bindungsart'} = $book->get_column('bindungsart'); $buch->{'verlags_id'} = $book->verlags_id(); $buch->{'isbn'} = $book->isbn(); $buch->{'buch_nr'} = $book->buch_nr(); $buch->{'ausgabejahr'} = $book->ausgabejahr(); $buch->{'druckjahr'} = $book->druckjahr(); + $buch->{'seiten'} = $book->seiten(); $buch->{'preis'} = $book->preis(); $buch->{'waehrungs_id'} = $book->waehrungs_id(); $buch->{'waehrungs_kuerzel'} = $book->get_column('waehrungs_kuerzel'); diff --git a/root/src/books/list.tt2 b/root/src/books/list.tt2 index 3c4688b..25ddfdf 100644 --- a/root/src/books/list.tt2 +++ b/root/src/books/list.tt2 @@ -17,6 +17,8 @@ Buch-Nummer Ausgabejahr Preis + Seiten + Typ [%- FOREACH book IN books -%][% buch_id = book.id %] @@ -28,6 +30,8 @@ [% book.buch_nr %] [% book.ausgabejahr %] [% book.preis | format '%0.2f' | replace('\.', ',') %][% IF book.waehrungs_kuerzel %] [% book.waehrungs_kuerzel %][% END %] + [% book.seiten %] + [% book.bindungsart %] [% END -%] -- 2.39.5