Browse Source

Bug 3050: QA follow-up

1/ Use the usual way for ordering dates in table
2/ Add a confirmation dialog box on deleting a file
3/ Add some UTs

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
MM-OPAC/theme_dep
Jonathan Druart 8 years ago
committed by Galen Charlton
parent
commit
059107ca75
  1. 11
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt
  2. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt
  3. 9
      t/db_dependent/Koha_Misc_Files.t

11
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt

@ -11,13 +11,16 @@
$("#invoice_files_details_table").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
{ "aTargets": [ 3 ], "sType": "natural" }
{ "aTargets": [ "title-string" ], "sType": "title-string" }
],
bInfo: false,
bPaginate: false,
bFilter: false,
sDom: "t"
}));
$("a.delete_file").click(function(){
return ( confirm( _("Are you sure you want to delete this file ?") ) );
});
});
//]]>
</script>
@ -62,9 +65,11 @@
<td><a href="?invoiceid=[% invoiceid %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
<td>[% f.file_type | html %]</td>
<td>[% f.file_description | html %]</td>
<td><!-- [% f.date_uploaded %] -->[% f.date_uploaded | $KohaDates %]</td>
<td class="title-string">
<span title="[% f.date_uploaded %]">[% f.date_uploaded | $KohaDates %]</span>
</td>
<td>[% f.file_size %]</td>
<td><a href="?invoiceid=[% invoiceid %]&amp;op=delete&amp;file_id=[% f.file_id %]">Delete</a></td>
<td><a class="delete_file" href="?invoiceid=[% invoiceid %]&amp;op=delete&amp;file_id=[% f.file_id %]">Delete</a></td>
<td><a href="?invoiceid=[% invoiceid %]&amp;op=download&amp;file_id=[% f.file_id %]">Download</a></td>
</tr>
[% END %]

6
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

@ -31,7 +31,7 @@
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
$("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ 3 ], "sType": "natural" }
{ "aTargets": [ "title-string" ], "sType": "title-string" }
],
bInfo: false,
bPaginate: false,
@ -229,7 +229,9 @@
<td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]&amp;op=download&amp;view=1&amp;file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
<td>[% f.file_type | html %]</td>
<td>[% f.file_description | html %]</td>
<td><!-- [% f.date_uploaded %] -->[% f.date_uploaded | $KohaDates %]</td>
<td class="title-string">
<span title="[% f.date_uploaded %]">[% f.date_uploaded | $KohaDates %]</span>
</td>
</tr>
[% END %]
</tbody>

9
t/db_dependent/Koha_Misc_Files.t

@ -5,7 +5,7 @@
use Modern::Perl;
use C4::Context;
use Test::More tests => 27;
use Test::More tests => 30;
BEGIN {
use_ok('Koha::Misc::Files');
@ -16,6 +16,7 @@ $dbh->{AutoCommit} = 0;
$dbh->{RaiseError} = 1;
## new() parameter handling check
is(Koha::Misc::Files->new(), undef, "new() param check test/0");
is(Koha::Misc::Files->new(recordid => 12), undef, "new() param check test/1");
is(Koha::Misc::Files->new(recordid => 'aa123', tabletag => 'ttag_a'), undef, "new() param check test/2");
@ -76,10 +77,12 @@ $files_a_123_infos = $mf_a_123->GetFilesInfo();
is(scalar @$files_a_123_infos, 3, "GetFilesInfo() result count after DelFile()");
## DelAllFiles() tests
$mf_a_123->DelAllFiles();
my $number_of_deleted_files_a_123 = $mf_a_123->DelAllFiles();
is( $number_of_deleted_files_a_123, 3, "DelAllFiles returns the number of deleted files/1" );
$files_a_123_infos = $mf_a_123->GetFilesInfo();
is(scalar @$files_a_123_infos, 0, "GetFilesInfo() result count after DelAllFiles()/1");
$mf_b_221->DelAllFiles();
my $number_of_deleted_files_b_221 = $mf_b_221->DelAllFiles();
is( $number_of_deleted_files_b_221, 1, "DelAllFiles returns the number of deleted files/2" );
is(scalar @{$mf_b_221->GetFilesInfo()}, 0, "GetFilesInfo() result count after DelAllFiles()/2");
$dbh->rollback;

Loading…
Cancel
Save