[Koha-devel] Library limits
BOUIS Sonia
sonia.bouis at univ-lyon3.fr
Thu Jul 11 11:05:55 CEST 2019
Hello Tomas,
I don't have an opinion (I don't really understand the question in fact...) but, I'm wondering if there's any link with the question I have sent few month ago : http://koha.1045719.n5.nabble.com/Branches-limitations-for-locations-td6006382.html
Cheers,
Sonia
Message: 1
Date: Fri, 5 Jul 2019 16:46:29 -0300
From: Tomas Cohen Arazi <tomascohen at gmail.com>
To: koha-devel <koha-devel at lists.koha-community.org>
Subject: [Koha-devel] Library limits
Message-ID:
<CABZfb=WHGQoOh=xaxmJfE04UNZ_G3DpV=425EoLu9ROvv2pLqA at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi, I have filed this the following bugs now:
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23272 <- this one has patches
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23271
The idea is that we have Koha::Object::Limit::Library, currently only used in Koha::Patron::Attribute::Type, and we should use it as a reference.
But I have a question: I noticed in Koha::AuthorisedValues we overload
->search by allowing it to have a (surprise?) parameter: branchcode. I
->use
the word 'surprise' because we've been leaning to the 'least surprise'
principle and allowing to pass an attribute name that isn't in the model, seems like a surprise we would like to avoid.
I would like to propose we create an analogous Koha::Objects::Limit::Library class (notice the plural), implementing a specialized search method, with a name that clearly states the goal as discussed previously in the context of a bug I now don't remember :-D In the lines of
sub search_with_branch_limits {
my ( $self, $params, $attributes, $library_id ) = @_;
my $or =
$library_id
? {
'-or' => [
'authorised_values_branches.branchcode' => undef,
'authorised_values_branches.branchcode' => $library_id,
]
}
: {};
my $join = $library_id ? { join => 'authorised_values_branches' } : {};
$attributes //= {};
$attributes = { %$attributes, %$join };
return $self->SUPER::search( { %$params, %$or, }, $attributes ); }
Note: I'd replace the table and column names for the configured ones.
Opinions?
--
Tom?s Cohen Arazi
Theke Solutions (http://theke.io)
? +54 9351 3513384
GPG: B2F3C15F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20190705/562024dd/attachment-0001.html>
------------------------------
_______________________________________________
Koha-devel mailing list
Koha-devel at lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
End of Koha-devel Digest, Vol 164, Issue 8
******************************************
More information about the Koha-devel
mailing list