[Koha-bugs] [Bug 8007] Discharge management
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Wed Jan 8 19:45:50 CET 2014
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8007
--- Comment #41 from Chris Cormack <chris at bigballofwax.co.nz> ---
Comment on attachment 24026
--> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=24026
Bug 8007: Discharge management
Review of attachment 24026:
--> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=8007&attachment=24026)
-----------------------------------------------------------------
Just a couple of quick comments, I'll do more.
I have to say, I am really not a fan of the ::DataObject:: and ::Service::
idea. I may be overruled on that I guess. I'd prefer a Discharge class I think.
::: Koha/DataObject/Discharge.pm
@@ +24,5 @@
> + );
> +
> + bless $self, $class;
> + return $self;
> +}
You don't need this, Class::Accessor does this new for you.
Including populating the accessors. Thats one of the reasons for using it :)
You just call it like this.
my $discharge = Koha::DataObject::Discharge->new({borrowernumber => $number,
needed => $needed, validated => $validated});
@@ +54,5 @@
> + my $data = $rs->single( { borrower => $self->borrowernumber } );
> + $self->needed( $data->needed );
> + $self->validated( $data->validated );
> + return $self;
> +}
You could have based this class on Koha::Database and done things like
use base qw/Koha::Database/;
sub fetch {
my $self = shift;
my $self->schema->resultset('Discharge')->single( { borrower =>
$self->borrowernumber});
etc
I am a little worried setting a packagewide rs is not safe when run under
persistence. But I would need to check that. DBIX::Class is smart, and does
pooling and connection reuse for us, we don't need to do it ourselves.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list