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

(-)a/C4/Reports/Guided.pm (-1 / +4 lines)
Lines 936-942 sub GetReservedAuthorisedValues { Link Here
936
                              'itemtypes',
936
                              'itemtypes',
937
                              'cn_source',
937
                              'cn_source',
938
                              'categorycode',
938
                              'categorycode',
939
                              'biblio_framework' );
939
                              'biblio_framework',
940
                              'cash_registers',
941
                              'debit_types',
942
                              'credit_types' );
940
943
941
   return \%reserved_authorised_values;
944
   return \%reserved_authorised_values;
942
}
945
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-1 / +23 lines)
Lines 1207-1213 Link Here
1207
                                    <span class="required">Required</span>
1207
                                    <span class="required">Required</span>
1208
                                </li>
1208
                                </li>
1209
                                [% PROCESS group_and_subgroup_selection %]
1209
                                [% PROCESS group_and_subgroup_selection %]
1210
1211
                                [% IF (public) %]
1210
                                [% IF (public) %]
1212
                                    <li>
1211
                                    <li>
1213
                                        <label for="public">Report is public:</label>
1212
                                        <label for="public">Report is public:</label>
Lines 1632-1637 Link Here
1632
                    $("#paramLabel").val( _("Patron category") );
1631
                    $("#paramLabel").val( _("Patron category") );
1633
                    $("#param_category").val("categorycode");
1632
                    $("#param_category").val("categorycode");
1634
                    break;
1633
                    break;
1634
1635
                case "insertCashregister":
1636
                    modalTitle.text( _("Insert cash register parameter") );
1637
                    $("#paramLabel").val( _("Cash register") );
1638
                    $("#param_category").val("cash_registers");
1639
                    break;
1640
                case "insertDebittypes":
1641
                    modalTitle.text( _("Insert debit types parameter") );
1642
                    $("#paramLabel").val( _("Debit types") );
1643
                    $("#param_category").val("debit_types");
1644
                    break;
1645
                case "insertCredittypes":
1646
                    modalTitle.text( _("Insert credit types parameter") );
1647
                    $("#paramLabel").val( _("Credit types") );
1648
                    $("#param_category").val("credit_types");
1649
                    break;
1650
1651
                
1652
1653
1635
                case "insertList":
1654
                case "insertList":
1636
                    modalTitle.text( _("Insert list parameter") );
1655
                    modalTitle.text( _("Insert list parameter") );
1637
                    $("#paramLabel").val( _("List of values") );
1656
                    $("#paramLabel").val( _("List of values") );
Lines 2387-2392 Link Here
2387
            <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2406
            <li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
2388
            <li><a href="#" class="insertParam" id="insertList">List</a></li>
2407
            <li><a href="#" class="insertParam" id="insertList">List</a></li>
2389
            <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2408
            <li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
2409
            <li><a href="#" class="insertParam" id="insertCashregister">Cash register</a></li>
2410
            <li><a href="#" class="insertParam" id="insertDebittypes">Debit types</a></li>
2411
            <li><a href="#" class="insertParam" id="insertCredittypes">Credit types</a></li>
2390
            <li><a href="#" class="insertParam" id="insertText">Text field</a></li>
2412
            <li><a href="#" class="insertParam" id="insertText">Text field</a></li>
2391
        </ul>
2413
        </ul>
2392
    </div>
2414
    </div>
(-)a/reports/guided_reports.pl (-1 / +26 lines)
Lines 773-778 elsif ($phase eq 'Run this report'){ Link Here
773
                        %authorised_lib = map { $_->categorycode => $_->description } @patron_categories;
773
                        %authorised_lib = map { $_->categorycode => $_->description } @patron_categories;
774
                        push @authorised_values, $_->categorycode for @patron_categories;
774
                        push @authorised_values, $_->categorycode for @patron_categories;
775
                    }
775
                    }
776
                    elsif ( $authorised_value eq "cash_registers" ) {
777
                        my $sth = $dbh->prepare("SELECT id, name FROM cash_registers ORDER BY description");
778
                        $sth->execute;
779
                        while ( my ( $id, $name ) = $sth->fetchrow_array ) {
780
                            push @authorised_values, $id;
781
                            $authorised_lib{$id} = $name;
782
                        }
783
                    }
784
                    elsif ( $authorised_value eq "debit_types" ) {
785
                        my $sth = $dbh->prepare("SELECT code, description FROM account_debit_types ORDER BY code");
786
                        $sth->execute;
787
                        while ( my ( $code, $description ) = $sth->fetchrow_array ) {
788
                           push @authorised_values, $code;
789
                           $authorised_lib{$code} = $description;
790
                        }
791
                    }
792
                    elsif ( $authorised_value eq "credit_types" ) {
793
                        my $sth = $dbh->prepare("SELECT code, description FROM account_credit_types ORDER BY code");
794
                        $sth->execute;
795
                        while ( my ( $code, $description ) = $sth->fetchrow_array ) {
796
                           push @authorised_values, $code;
797
                           $authorised_lib{$code} = $description;
798
                        }
799
                    }
776
                    else {
800
                    else {
777
                        if ( Koha::AuthorisedValues->search({ category => $authorised_value })->count ) {
801
                        if ( Koha::AuthorisedValues->search({ category => $authorised_value })->count ) {
778
                            my $query = '
802
                            my $query = '
Lines 812-817 elsif ($phase eq 'Run this report'){ Link Here
812
836
813
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all };
837
                push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid, 'name' => $text.$sep.$authorised_value_all, 'include_all' => $all };
814
            }
838
            }
839
815
            $template->param('sql'         => $sql,
840
            $template->param('sql'         => $sql,
816
                            'name'         => $name,
841
                            'name'         => $name,
817
                            'sql_params'   => \@tmpl_parameters,
842
                            'sql_params'   => \@tmpl_parameters,
Lines 875-881 elsif ($phase eq 'Run this report'){ Link Here
875
        push @errors, { no_sql_for_id => $report_id };
900
        push @errors, { no_sql_for_id => $report_id };
876
    }
901
    }
877
}
902
}
878
903
                            
879
elsif ($phase eq 'Export'){
904
elsif ($phase eq 'Export'){
880
905
881
	# export results to tab separated text or CSV
906
	# export results to tab separated text or CSV
(-)a/t/db_dependent/Reports/Guided.t (-2 / +4 lines)
Lines 118-123 subtest 'GetReservedAuthorisedValues' => sub { Link Here
118
        'categorycode' => 1,
118
        'categorycode' => 1,
119
        'biblio_framework' => 1,
119
        'biblio_framework' => 1,
120
        'list' => 1,
120
        'list' => 1,
121
        'cash_registers' => 1,
122
        'debit_types' => 1,
123
        'credit_types' => 1
121
    );
124
    );
122
125
123
    my $reserved_authorised_values = GetReservedAuthorisedValues();
126
    my $reserved_authorised_values = GetReservedAuthorisedValues();
Lines 126-132 subtest 'GetReservedAuthorisedValues' => sub { Link Here
126
};
129
};
127
130
128
subtest 'IsAuthorisedValueValid' => sub {
131
subtest 'IsAuthorisedValueValid' => sub {
129
    plan tests => 9;
132
    plan tests => 12;
130
    ok( IsAuthorisedValueValid('LOC'),
133
    ok( IsAuthorisedValueValid('LOC'),
131
        'User defined authorised value category is valid');
134
        'User defined authorised value category is valid');
132
135
133
- 

Return to bug 29767