Bug 22393: (follow-up) Corrections for QA feedback

We correct the behviour of 'amount' being passed back to the template
and add a work around for the existance of deleted_items alongside a FK
to items in the accountlines table.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2020-04-21 15:54:45 +01:00 committed by Jonathan Druart
parent 0d19d9fa44
commit 484061a44e
2 changed files with 9 additions and 4 deletions

View File

@ -104,8 +104,10 @@
this.form.desc.value = this.options[this.selectedIndex].value;
this.form.amount.value = type_fees[this.options[this.selectedIndex].value];
});
[% UNLESS amount.defined %]
$("#maninvoice #desc").val($("#maninvoice #type option:selected").text());
$("#maninvoice #amount").val(type_fees[$("#maninvoice #type option:selected").val()]);
[% END %]
$("#maninvoice #type").change(function(){
$("#maninvoice #desc").val($(this).find("option:selected").text());
$("#maninvoice #amount").val(type_fees[$(this).val()]);

View File

@ -109,6 +109,7 @@ if ($add) {
# If barcode is passed, attempt to find the associated item
my $failed;
my $item_id;
my $olditem; # FIXME: When items and deleted_items are merged, we can remove this
my $issue_id;
if ($barcode) {
my $item = Koha::Items->find( { barcode => $barcode } );
@ -116,9 +117,11 @@ if ($add) {
$item_id = $item->itemnumber;
}
else {
$item = Koha::Old::Items->find( { barcode => $barcode } );
if ($item) {
$item_id = $item->itemnumber;
$item = Koha::Old::Items->search( { barcode => $barcode },
{ order_by => { -desc => 'timestamp' }, rows => 1 } );
if ($item->count) {
$item_id = $item->next->itemnumber;
$olditem = 1;
}
else {
$template->param( error => 'itemnumber' );
@ -158,7 +161,7 @@ if ($add) {
interface => 'intranet',
library_id => $library_id,
type => $debit_type,
item_id => $item_id,
( $olditem ? () : ( item_id => $item_id ) ),
issue_id => $issue_id
}
);