View | Details | Raw Unified | Return to bug 28556
Collapse All | Expand All

(-)a/C4/Letters.pm (+1 lines)
Lines 740-745 sub _parseletter_sth { Link Here
740
    ($table eq 'old_issues'   )    ? "SELECT * FROM $table WHERE     issue_id = ?"  :
740
    ($table eq 'old_issues'   )    ? "SELECT * FROM $table WHERE     issue_id = ?"  :
741
    ($table eq 'reserves'     )    ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?"             :
741
    ($table eq 'reserves'     )    ? "SELECT * FROM $table WHERE borrowernumber = ? and biblionumber = ?"             :
742
    ($table eq 'borrowers'    )    ? "SELECT * FROM $table WHERE borrowernumber = ?"                                  :
742
    ($table eq 'borrowers'    )    ? "SELECT * FROM $table WHERE borrowernumber = ?"                                  :
743
    ($table eq 'guarantor'    )    ? "SELECT * FROM borrowers INNER JOIN borrower_relationships ON borrower_relationships.guarantee_id = ? WHERE borrowernumber = borrower_relationships.guarantor_id "                               :
743
    ($table eq 'branches'     )    ? "SELECT * FROM $table WHERE     branchcode = ?"                                  :
744
    ($table eq 'branches'     )    ? "SELECT * FROM $table WHERE     branchcode = ?"                                  :
744
    ($table eq 'suggestions'  )    ? "SELECT * FROM $table WHERE   suggestionid = ?"                                  :
745
    ($table eq 'suggestions'  )    ? "SELECT * FROM $table WHERE   suggestionid = ?"                                  :
745
    ($table eq 'aqbooksellers')    ? "SELECT * FROM $table WHERE             id = ?"                                  :
746
    ($table eq 'aqbooksellers')    ? "SELECT * FROM $table WHERE             id = ?"                                  :
(-)a/C4/Overdues.pm (+1 lines)
Lines 821-826 sub parse_overdues_letter { Link Here
821
    if ( my $p = $params->{'branchcode'} ) {
821
    if ( my $p = $params->{'branchcode'} ) {
822
        $tables{'branches'} = $p;
822
        $tables{'branches'} = $p;
823
    }
823
    }
824
    $tables{guarantor}=$params->{'borrowernumber'};
824
825
825
    my $active_currency = Koha::Acquisition::Currencies->get_active;
826
    my $active_currency = Koha::Acquisition::Currencies->get_active;
826
827
(-)a/tools/letter.pl (-5 / +11 lines)
Lines 227-233 sub add_form { Link Here
227
    my $field_selection;
227
    my $field_selection;
228
    push @{$field_selection}, add_fields('branches');
228
    push @{$field_selection}, add_fields('branches');
229
    if ($module eq 'reserves') {
229
    if ($module eq 'reserves') {
230
        push @{$field_selection}, add_fields('borrowers', 'reserves', 'biblio', 'biblioitems', 'items');
230
        push @{$field_selection}, add_fields('borrowers', 'borrower_relationships', 'reserves', 'biblio', 'biblioitems', 'items');
231
    }
231
    }
232
    elsif ( $module eq 'acquisition' ) {
232
    elsif ( $module eq 'acquisition' ) {
233
        push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'items');
233
        push @{$field_selection}, add_fields('aqbooksellers', 'aqorders', 'biblio', 'items');
Lines 239-255 sub add_form { Link Here
239
        push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription', 'biblio', 'biblioitems');
239
        push @{$field_selection}, add_fields('aqbooksellers', 'serial', 'subscription', 'biblio', 'biblioitems');
240
    }
240
    }
241
    elsif ($module eq 'serial') {
241
    elsif ($module eq 'serial') {
242
        push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial');
242
        push @{$field_selection}, add_fields('branches', 'biblio', 'biblioitems', 'borrowers', 'borrower_relationships', 'subscription', 'serial');
243
    }
243
    }
244
    elsif ($module eq 'suggestions') {
244
    elsif ($module eq 'suggestions') {
245
        push @{$field_selection}, add_fields('suggestions', 'borrowers', 'biblio');
245
        push @{$field_selection}, add_fields('suggestions', 'borrowers', 'borrower_relationships', 'biblio');
246
    }
246
    }
247
    else {
247
    else {
248
        push @{$field_selection}, add_fields('biblio','biblioitems'),
248
        push @{$field_selection}, add_fields('biblio','biblioitems'),
249
            add_fields('items'),
249
            add_fields('items'),
250
            {value => 'items.content', text => 'items.content'},
250
            {value => 'items.content', text => 'items.content'},
251
            {value => 'items.fine',    text => 'items.fine'},
251
            {value => 'items.fine',    text => 'items.fine'},
252
            add_fields('borrowers');
252
            add_fields('borrowers'),
253
            add_fields('borrower_relationships');
253
        if ($module eq 'circulation') {
254
        if ($module eq 'circulation') {
254
            push @{$field_selection}, add_fields('additional_contents', 'recalls');
255
            push @{$field_selection}, add_fields('additional_contents', 'recalls');
255
256
Lines 496-501 sub get_columns_for { Link Here
496
497
497
    my $sql = "SHOW COLUMNS FROM $table";# TODO not db agnostic
498
    my $sql = "SHOW COLUMNS FROM $table";# TODO not db agnostic
498
    my $table_prefix = $table . q|.|;
499
    my $table_prefix = $table . q|.|;
500
    
501
    if($table eq 'borrower_relationships'){
502
        $sql = "SHOW COLUMNS FROM borrowers";# TODO not db agnostic
503
        $table_prefix = 'guarantor' . q|.|;
504
    }
505
499
    my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
506
    my $rows = C4::Context->dbh->selectall_arrayref($sql, { Slice => {} });
500
    for my $row (@{$rows}) {
507
    for my $row (@{$rows}) {
501
        next if $row->{'Field'} eq 'timestamp'; # this is really an irrelevant field and there may be other common fields that should be excluded from the list
508
        next if $row->{'Field'} eq 'timestamp'; # this is really an irrelevant field and there may be other common fields that should be excluded from the list
502
- 

Return to bug 28556