[Koha-devel] Question about Schema

Jonathan Druart jonathan.druart at bugs.koha-community.org
Fri Aug 28 10:37:34 CEST 2015


2015-08-27 18:50 GMT+01:00 Philippe Blouin <philippe.blouin at inlibro.com>:
> Already took two this morning.  Same pills for head and back aches :)
>
> I thought I tried the
>
> issue.item.biblioitemnumber.biblionumber.title
>
> idea, and it didn't work.  But maybe I just wrote biblioitems.biblionumber
> or some other variation.  I'll try again.

It should work, let me know if it doesn't.

> Thanks a LOT for the help.  This does lead me to two followup questions:
>
> 1) I thoought the Schema file was created automatically.  Why is there a
> biblioitemnumber and no biblionumber, while both are in Item ?

Show create table items should give you an answer :)

> 2) You can just refer me a link for this one, I understand this is large:
> When are the "subs" accessed?  accessing
>
> issue.item.biblioitemnumber.biblionumber.title

It comes from the DBIx::Class magic, I don't know...
 You can set the DBIC debug flag and look at the sql queries generated.

> could mean 4 different db access, live when displaying the TT.  Or is the
> whole tree loaded as soon as we handle the issue (which would be a huge
> access potentially useless).
>
> Thanks again!
>
> Philippe Blouin,
> Responsable du développement informatique
>
> Tél.  : (888) 604-2627
> philippe.blouin at inLibro.com
>
> inLibro | pour esprit libre | www.inLibro.com
> On 08/27/2015 12:01 PM, Jonathan Druart wrote:
>
> The item var used in the template comes from C4::Circ::AddIssue
> (called from circ/circulation.pl on checking out an item) which return
> a DBIx::Class resultset of Issue.
>
> Koha::Schema::Result::Issue has a item relationship
> (belongs_to('item')), so the issue.item.barcode displays what we want.
> But Koha::Schema::Result::Item (returned by issue.item) does not have
> a biblio relationship, it has a "biblioitemnumber", but
> biblioitemnumber will return you a Koha::Schema::Result::Biblioitem
> which has a relationship to biblio!!!! wonderful isn't it?
>
> One thing can be weird: Why it does not explode :) Certainly because TT is
> kind.
>
> So, something like issue.item.biblioitemnumber.biblionumber.title should
> work...
> C4::Biblio::GetTitleByIssuenumber could also be fun, but you will have
> to provide unit tests.
>
> Don't forget to take a tablet to relieve the headache...
>
> 2015-08-27 16:27 GMT+01:00 Philippe Blouin <philippe.blouin at inlibro.com>:
>
> Hahaha.  Yeah, that part I get.  :)
>
> But I was somewhat hoping that this forum was also about allowing people to
> ask technical questions about the code, not just being a closed conversation
> between knowledgeable people about the next release/next big thing.
>
> In the case of 14726, I would have thought the generated part of the Schema
> would contain the link item->biblio.  But maybe
> 1) it's something that failed (so the bug is in the Schema generation)
> 2) it's something that must be coded (but why?)
> 3) it's too obvious, I'm just clueless...  Which is somewhat an unsatisfying
> answer. :)
>
> Thanks,
>
> Philippe Blouin,
> Responsable du développement informatique
>
> Tél.  : (888) 604-2627
> philippe.blouin at inLibro.com
>
> inLibro | pour esprit libre | www.inLibro.com
> On 08/27/2015 11:16 AM, Jonathan Druart wrote:
>
> You know what's next, I won't explain you ;) (do, pay or wait)
> What's the bug number?
>
> 2015-08-27 15:15 GMT+01:00 Philippe Blouin <philippe.blouin at inlibro.com>:
>
> A bug has been filled.  What next?
> Isn't it a good forum to ask "what happened"/"what's missing" ?
>
> Philippe Blouin,
> Responsable du développement informatique
>
> Tél.  : (888) 604-2627
> philippe.blouin at inLibro.com
>
> inLibro | pour esprit libre | www.inLibro.com
> On 08/25/2015 10:27 AM, Jonathan Druart wrote:
>
> You can fill a bug report, it's a bug :)
>
> 2015-08-25 14:57 GMT+01:00 Philippe Blouin <philippe.blouin at inlibro.com>:
>
> Simple question I'm sure, but there's this bug in circulation.tt that shows
> I haven't played much with the new Schema structure:
>
> (circulation.tt, line 672)
> [% IF ( issue ) %]
>     <div class="lastchecked">
>         <p><strong>Checked out: </strong>[% issue.item.biblio.title %] ([%
> issue.item.barcode %]). Due on [% issue.date_due | $KohaDates %]</p>
>     </div>
> [% END %]
>
> This (in bold) never shows up.  The item.biblio link, well, it doesn't
> exists in the Result::Item per my understanding.  Whatever I tried with
> biblioitem(s) in between didn't pan either.
>
> Suggestions would be appreciated.
>
> (If this is indeed a bug and not a code 18, I'll be happy to do the
> "paperwork" to file it in)
>
> Thanks,
> Blou
>
>
>
>
> _______________________________________________
> 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/
>
> _______________________________________________
> 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/
>
>
>
> _______________________________________________
> 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/
>
> _______________________________________________
> 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/
>
>
> _______________________________________________
> 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/
>
>


More information about the Koha-devel mailing list