[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2022-10-14 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Katrin Fischer  changed:

   What|Removed |Added

   Keywords|rel_22_05_candidate |

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2021-10-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Jonathan Druart  changed:

   What|Removed |Added

   Keywords|rel_21_11_candidate |rel_22_05_candidate

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2021-05-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Jonathan Druart  changed:

   What|Removed |Added

   Keywords|rel_21_05_candidate |rel_21_11_candidate

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-11-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Jonathan Druart  changed:

   What|Removed |Added

   Keywords|rel_20_11_target|rel_21_05_candidate

--- Comment #19 from Jonathan Druart  
---
We lost our way here.
I updated PERL15 and marked it a defacto rule.

Is anyone interested in moving this on for 21.05? I will help them as much as I
can. Just let me know!

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-22 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #18 from Tomás Cohen Arazi  ---
Koha::Object is trapping DBIC exceptions and converting them into
Koha::Exception* and we are shifting into using them everywhere. They get
properly propagated if not catch locally, so I guess there will be places in
which we could catch exceptions. But those would be specific cases.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-15 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #17 from David Cook  ---
(In reply to Julian Maurice from comment #16)
> In my opinion "maybe we will want to add something here" is not a good
> reason to refactor code. If that "maybe" ever comes true, then you can
> refactor the code while making the change. No need to do it now.

Given the number of legacy projects I've maintained over the years, we'll just
have to agree to disagree on that one ;).

> Note that I also tend to prefer your version, but I'm happy with both.
> If it ain't broke don't fix it ;)

True enough. There are better hills to die on heh.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #16 from Julian Maurice  ---
(In reply to David Cook from comment #15)
> If it doesn't die, what happens if you want to add a check to that object?
> Maybe you only want to return the guarantor under certain conditions. It
> probably makes sense to add that check here rather than in every caller of
> this method. To do that, you'd have to refactor to use the syntax I
> described anyway. Or maybe you're doing some debugging because the guarantor
> being returned isn't correct. You can't add any logging in this code unless
> you refactor to the syntax I described.

In my opinion "maybe we will want to add something here" is not a good reason
to refactor code. If that "maybe" ever comes true, then you can refactor the
code while making the change. No need to do it now.

Note that I also tend to prefer your version, but I'm happy with both.
If it ain't broke don't fix it ;)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-09 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #15 from David Cook  ---
(In reply to Julian Maurice from comment #14)
> What is there to check in this particular situation ? _new_from_dbic either
> dies or return a blessed object. If it dies then Koha::Patron::guarantor
> should die too, if it returns a blessed object, then there is nothing to
> check.

That's an interesting perspective. 

If it dies, it's probably going to bring down that entire Plack worker. That
seems problematic to me. We could try to trap the error in the caller, but in
practice that is rare in Koha. That being said, even if it doesn't die, we need
to handle a non-fatal exception too. Maybe it is better to die in the grand
scheme of things, as it'll more easily show code bugs and bad data.

If it doesn't die, what happens if you want to add a check to that object?
Maybe you only want to return the guarantor under certain conditions. It
probably makes sense to add that check here rather than in every caller of this
method. To do that, you'd have to refactor to use the syntax I described
anyway. Or maybe you're doing some debugging because the guarantor being
returned isn't correct. You can't add any logging in this code unless you
refactor to the syntax I described.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-09 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #14 from Julian Maurice  ---
(In reply to David Cook from comment #13)
> I've noticed a lot of Koha code directly returning the output of a method
> call, and it drives me crazy. We should do more data validation. It'll mean
> fewer bugs and easier maintenance.

What is there to check in this particular situation ? _new_from_dbic either
dies or return a blessed object. If it dies then Koha::Patron::guarantor should
die too, if it returns a blessed object, then there is nothing to check.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

David Cook  changed:

   What|Removed |Added

 CC||dc...@prosentient.com.au

--- Comment #13 from David Cook  ---
Honest question:

Why do this:
sub guarantor {
my $self = shift;
my $guarantor_rs = $self->_result->guarantorid;
return unless $guarantor_rs;
return Koha::Patron->_new_from_dbic($gaurantor_rs);
}

Instead of this:
sub guarantor {
my $self = shift;
my $guarantor;
my $guarantor_rs = $self->_result->guarantorid;
if ($guarantor_rs){
$guarantor = Koha::Patron->_new_from_dbic($gaurantor_rs);
}
return $guarantor;
}

I admit that the latter has 3 more lines than the former, but the latter is way
easier to read, easier to debug, and easier to add error-handling.

Actually, that latter should probably double-check the output of
Koha::Patron->_new_from_dbic() before returning.

I've noticed a lot of Koha code directly returning the output of a method call,
and it drives me crazy. We should do more data validation. It'll mean fewer
bugs and easier maintenance.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-07-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Nicolas Legrand  changed:

   What|Removed |Added

 Depends on||25951


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25951
[Bug 25951] Koha::Objects using the DBIx::Class relationships in Koha::Hold and
Koha::Item
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-05-01 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

   Keywords|rel_20_05_candidate |rel_20_11_target

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-02-18 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Jonathan Druart  changed:

   What|Removed |Added

   See Also||https://bugs.koha-community
   ||.org/bugzilla3/show_bug.cgi
   ||?id=14818

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-02-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407
Bug 22407 depends on bug 22684, which changed state.

Bug 22684 Summary: Make Acquisition::Basket->bookseller match the code guidlines
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22684

   What|Removed |Added

 Status|Failed QA   |RESOLVED
 Resolution|--- |WONTFIX

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-02-03 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407
Bug 22407 depends on bug 22686, which changed state.

Bug 22686 Summary: Koha::Acquisition::Bookseller->contacts should match the 
coding guidline
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22686

   What|Removed |Added

 Status|Needs Signoff   |RESOLVED
 Resolution|--- |DUPLICATE

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2020-01-02 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

   Keywords||rel_20_05_target

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407
Bug 22407 depends on bug 22701, which changed state.

Bug 22701 Summary: Make items prefetchable from Koha::Biblio
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22701

   What|Removed |Added

 Status|Pushed to Master|RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407
Bug 22407 depends on bug 22700, which changed state.

Bug 22700 Summary: Make biblio_metadata prefetchable from Koha::Biblio
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22700

   What|Removed |Added

 Status|Pushed to Master|RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-16 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #12 from Tomás Cohen Arazi  ---
(In reply to Martin Renvoize from comment #11)
> We could also use 'skip_relationships' in our dbicdump script to prevent
> outputting superfluous relationships given we can't/won't use them until
> we've manually written code in the corresponding Koha::Object class.. this
> way we would end up being much more explicit about what relationships were
> building (and as such reduce the load time/run time memory use form building
> massive dbic object full of unreachable expensive relationship accessors.

I agree with this, but it would require  us first finish setting our custom
relationships. At least the ones we use.

> That.. or we could start using the dbic recommended way of doing db work and
> go from schema to database rather than the other way around  and ditch the
> script entirely.

That's not gonna happen unless someone takes care of it, and it is not a simple
task, changing the community workflow and upgrade scripts.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #11 from Martin Renvoize  ---
We could also use 'skip_relationships' in our dbicdump script to prevent
outputting superfluous relationships given we can't/won't use them until we've
manually written code in the corresponding Koha::Object class.. this way we
would end up being much more explicit about what relationships were building
(and as such reduce the load time/run time memory use form building massive
dbic object full of unreachable expensive relationship accessors.

That.. or we could start using the dbic recommended way of doing db work and go
from schema to database rather than the other way around  and ditch the script
entirely.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #10 from Tomás Cohen Arazi  ---
(In reply to Martin Renvoize from comment #9)
> This has me wondering.. we're often renaming relationships within
> Koha::Objects (understandably as often our db derived ones are horrible
> because of poor initial db design).  Should this guideline also introduce a
> requirement to match the relation name in the dbic class up to the relation
> name in the Koha::Object?  It wouldn't be hard to add relations with such
> names and would lead to cleaner, easier to guess, prefetch strings.

I'm all for renaming relations like you say. I've tried myself to (a) migrate
some methods into matching this guideline and (b) use it in a real life
scenario and can say the only uncomfortable step was (b), due to the relation
naming issues. See bug 22696.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-13 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #9 from Martin Renvoize  ---
This has me wondering.. we're often renaming relationships within Koha::Objects
(understandably as often our db derived ones are horrible because of poor
initial db design).  Should this guideline also introduce a requirement to
match the relation name in the dbic class up to the relation name in the
Koha::Object?  It wouldn't be hard to add relations with such names and would
lead to cleaner, easier to guess, prefetch strings.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Depends on||22701


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22701
[Bug 22701] Make items prefetchable from Koha::Biblio
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-12 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Tomás Cohen Arazi  changed:

   What|Removed |Added

 Depends on||22700


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22700
[Bug 22700] Make biblio_metadata prefetchable from Koha::Biblio
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #8 from Martin Renvoize  ---
I've started this off.. but there's a huge number of classes to go through :(

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

 Depends on||22686


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22686
[Bug 22686] Koha::Acquisition::Bookseller->contacts should match the coding
guidline
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

 Depends on||22685


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22685
[Bug 22685] Koha::Acquisition::Bookseller->baskets returns a dbic resultset
rather than Koha::Objects
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

 Depends on||22684


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22684
[Bug 22684] Make Acquisition::Basket->bookseller match the code guidlines
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-11 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Martin Renvoize  changed:

   What|Removed |Added

 Depends on||22683


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22683
[Bug 22683] Make issue and old_issue prefetchable from Koha::Account::Line
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-10 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #7 from Martin Renvoize  ---
DRAFT:

Within PERL15 under Koha::Object

Koha::Object relationship accessors should be written to allow 'prefetch'

For example one should use:

sub guarantor {
my $self = shift;
my $guarantor_rs = $self->_result->guarantorid;
return unless $guarantor_rs;
return Koha::Patron->_new_from_dbic($gaurantor_rs);
}

One should not use:

sub guarantor {
my $self = shift;
return Koha::Patrons->find( $self->guarantorid() );
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-08 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #6 from Katrin Fischer  ---
I have added it to the next meetings agenda, but as I am no expert for this
topic it would be nice if someone could write up a proposal here.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #5 from Kyle M Hall  ---
(In reply to Katrin Fischer from comment #4)
> Do you still want to propose a coding guideline here, maybe for next dev
> meeting?

I believe we should.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-04-04 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Katrin Fischer  changed:

   What|Removed |Added

 CC||katrin.fisc...@bsz-bw.de

--- Comment #4 from Katrin Fischer  ---
Do you still want to propose a coding guideline here, maybe for next dev
meeting?

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-02-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #3 from Jonathan Druart  
---
We have already everything in our code:

Koha::Item->biblio
 93 sub biblio {
 94 my ( $self ) = @_;
 95 my $biblio_rs = $self->_result->biblio;
 96 return Koha::Biblio->_new_from_dbic( $biblio_rs );
 97 }

Koha::Item->checkout
121 sub checkout {
122 my ( $self ) = @_;
123 my $checkout_rs = $self->_result->issue;
124 return unless $checkout_rs;
125 return Koha::Checkout->_new_from_dbic( $checkout_rs );
126 }

Koha::Item->current_holds
271 sub current_holds {
272 my ( $self ) = @_;
273 my $attributes = { order_by => 'priority' };
274 my $dtf = Koha::Database->new->schema->storage->datetime_parser;
275 my $params = {
276 itemnumber => $self->itemnumber,
277 suspend => 0,
278 -or => [
279 reservedate => { '<=' => $dtf->format_date(dt_from_string) },
280 waitingdate => { '!=' => undef },
281 ],
282 };
283 my $hold_rs = $self->_result->reserves->search( $params, $attributes );
284 return Koha::Holds->_new_from_dbic($hold_rs);
285 }

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-02-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #2 from Tomás Cohen Arazi  ---
(In reply to Jonathan Druart from comment #1)
> Yes, and no.
> 
> You can only do that if you know the patron has a guarantor, which is not
> always true.
> 
> You must do:
> sub guarantor {
> my ( $self ) = @_;
> my $guarantor_rs = $self->_result->guarantorid;
> return unless $guarantor_rs;
> return Koha::Patron->_new_from_dbic($guarantor_rs);
> }
> 
> I am definitely in favor of that, we should have a guideline about it IMO.

The pattern should cover the one-to-many use case as well. And yes, the idea is
to propose a coding guideline!

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/

[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-02-26 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

--- Comment #1 from Jonathan Druart  
---
Yes, and no.

You can only do that if you know the patron has a guarantor, which is not
always true.

You must do:
sub guarantor {
my ( $self ) = @_;
my $guarantor_rs = $self->_result->guarantorid;
return unless $guarantor_rs;
return Koha::Patron->_new_from_dbic($guarantor_rs);
}

I am definitely in favor of that, we should have a guideline about it IMO.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-02-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Nick Clemens  changed:

   What|Removed |Added

 CC||martin.renvoize@ptfs-europe
   ||.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/


[Koha-bugs] [Bug 22407] OMNIBUS: Use DBIC relations to fetch related object rather than searching for the object

2019-02-25 Thread bugzilla-daemon
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22407

Nick Clemens  changed:

   What|Removed |Added

 CC||jonathan.dru...@bugs.koha-c
   ||ommunity.org,
   ||julian.maur...@biblibre.com
   ||,
   ||k...@bywatersolutions.com,
   ||m.de.r...@rijksmuseum.nl,
   ||tomasco...@gmail.com

-- 
You are receiving this mail because:
You are watching all bug changes.
___
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://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/