'Insert runtime parameter' has now more options for the SQL reports : 'cash register', 'debit types' and 'credit types'
Test plan:
1)Home > Reports > Create from SQL
2)Click on 'Insert runtime parameter' and notice the current options
3)Apply patch and repeat 2)
4)New parameters are now available
5)A simple SQL request to try 'credit_types' option : SELECT * FROM account_credit_types WHERE code = <<Credit types|credit_types>>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=29796
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
'itemtypes',
'cn_source',
'categorycode',
- 'biblio_framework' );
+ 'biblio_framework',
+ 'cash_registers',
+ 'debit_types',
+ 'credit_types' );
return \%reserved_authorised_values;
}
$("#paramLabel").val( _("Patron category") );
$("#param_category").val("categorycode");
break;
+ case "insertCashregister":
+ modalTitle.text( _("Insert cash register parameter") );
+ $("#paramLabel").val( _("Cash register") );
+ $("#param_category").val("cash_registers");
+ break;
+ case "insertDebittypes":
+ modalTitle.text( _("Insert debit types parameter") );
+ $("#paramLabel").val( _("Debit types") );
+ $("#param_category").val("debit_types");
+ break;
+ case "insertCredittypes":
+ modalTitle.text( _("Insert credit types parameter") );
+ $("#paramLabel").val( _("Credit types") );
+ $("#param_category").val("credit_types");
+ break;
case "insertList":
modalTitle.text( _("Insert list parameter") );
$("#paramLabel").val( _("List of values") );
<li><a href="#" class="insertParam" id="insertBranches">Libraries</a></li>
<li><a href="#" class="insertParam" id="insertList">List</a></li>
<li><a href="#" class="insertParam" id="insertCategorycode">Patron categories</a></li>
+ <li><a href="#" class="insertParam" id="insertCashregister">Cash register</a></li>
+ <li><a href="#" class="insertParam" id="insertDebittypes">Debit types</a></li>
+ <li><a href="#" class="insertParam" id="insertCredittypes">Credit types</a></li>
<li><a href="#" class="insertParam" id="insertText">Text field</a></li>
</ul>
</div>
%authorised_lib = map { $_->categorycode => $_->description } @patron_categories;
push @authorised_values, $_->categorycode for @patron_categories;
}
+ elsif ( $authorised_value eq "cash_registers" ) {
+ my $sth = $dbh->prepare("SELECT id, name FROM cash_registers ORDER BY description");
+ $sth->execute;
+ while ( my ( $id, $name ) = $sth->fetchrow_array ) {
+ push @authorised_values, $id;
+ $authorised_lib{$id} = $name;
+ }
+ }
+ elsif ( $authorised_value eq "debit_types" ) {
+ my $sth = $dbh->prepare("SELECT code, description FROM account_debit_types ORDER BY code");
+ $sth->execute;
+ while ( my ( $code, $description ) = $sth->fetchrow_array ) {
+ push @authorised_values, $code;
+ $authorised_lib{$code} = $description;
+ }
+ }
+ elsif ( $authorised_value eq "credit_types" ) {
+ my $sth = $dbh->prepare("SELECT code, description FROM account_credit_types ORDER BY code");
+ $sth->execute;
+ while ( my ( $code, $description ) = $sth->fetchrow_array ) {
+ push @authorised_values, $code;
+ $authorised_lib{$code} = $description;
+ }
+ }
else {
if ( Koha::AuthorisedValues->search({ category => $authorised_value })->count ) {
my $query = '
'categorycode' => 1,
'biblio_framework' => 1,
'list' => 1,
+ 'cash_registers' => 1,
+ 'debit_types' => 1,
+ 'credit_types' => 1
);
my $reserved_authorised_values = GetReservedAuthorisedValues();
};
subtest 'IsAuthorisedValueValid' => sub {
- plan tests => 9;
+ plan tests => 12;
ok( IsAuthorisedValueValid('LOC'),
'User defined authorised value category is valid');