From de31d838c4bacbf81b475c027fc4ea74b1befd03 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 21 May 2014 12:08:00 +0200 Subject: [PATCH] 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 --- .../intranet-tmpl/prog/en/modules/acqui/invoice-files.tt | 11 ++++++++--- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt | 6 ++++-- t/db_dependent/Koha_Misc_Files.t | 9 ++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt index 1121536..08ca3cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice-files.tt +++ b/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 ?") ) ); + }); }); //]]> @@ -62,9 +65,11 @@ [% f.file_name | html %] [% f.file_type | html %] [% f.file_description | html %] - [% f.date_uploaded | $KohaDates %] + + [% f.date_uploaded | $KohaDates %] + [% f.file_size %] - Delete + Delete Download [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index 911ff81..8056c1d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/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 @@ [% f.file_name | html %] [% f.file_type | html %] [% f.file_description | html %] - [% f.date_uploaded | $KohaDates %] + + [% f.date_uploaded | $KohaDates %] + [% END %] diff --git a/t/db_dependent/Koha_Misc_Files.t b/t/db_dependent/Koha_Misc_Files.t index d88da5c..6a51126 100755 --- a/t/db_dependent/Koha_Misc_Files.t +++ b/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; -- 2.0.0.rc2