Bugzilla – Attachment 39522 Details for
Bug 14206
notices using non email templates can't be deleted from the staff client
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14206 Adds delete function for non email templates
Bug-14206-Adds-delete-function-for-non-email-templ.patch (text/plain), 4.58 KB, created by
Jonathan Druart
on 2015-05-26 13:16:21 UTC
(
hide
)
Description:
Bug 14206 Adds delete function for non email templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-05-26 13:16:21 UTC
Size:
4.58 KB
patch
obsolete
>From ec176e70a82e506652ef546bfa3bd6f2e2ba9c21 Mon Sep 17 00:00:00 2001 >From: Indranil Das Gupta <indradg@gmail.com> >Date: Fri, 22 May 2015 03:49:10 +0530 >Subject: [PATCH] Bug 14206 Adds delete function for non email templates >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >C4::Letters::getletter() is called in tools/letter.pl by the function >delete_confirm() to display the selected notice for deletion. Due to >current implementation of getletter(), a notice that does not use >the 'email' template (but uses any/all of the other templates - sms, >print or phone) can't be deleted from the staff client. > >This patch adds deletion capability for notices that do not use email >template, but uses any/all of the other templates i.e. sms, print or >phone. This also adds 2 tests to t/db_dependent/Letters.t for testing >both conditions - a) when message_transport_type is specified b) when >it is not. > >Test plan >========= > >1/ Go to Tools -> Notices & Slips. Add a new notice only for print, > leave 'Library' and 'Koha module' options as default selections. > Enter 'KOHA_14206' and 'Koha Test 14206' against Code and Name > respectively, and 'Test' and 'Test Message' for subject and body. > Leave the Email, Phone and SMS tabs blank. Save the notice. >2/ On the notices listing page the new notice will be listed. Try to > delete it. It will load the 'Delete notice' dialog form, but the > table will not show any data under <th>s - 'Library', 'Module', > 'Code' or 'Name'. >3/ Click the "Yes, delete" button. The page will be submitted and the > Notices listing reloaded. The print-only KOHA_14206 notice should > continue to exist. This is *wrong*. >4/ Apply this patch >5/ Reload the listings page and click on the 'Delete' link for Notice > KOHA_14206. This time, it should show the data under 'Module', > 'Code' or 'Name' at least. >6/ Click on 'Yes, delete'. The page should submit and the listing page > reload. This time KOHA_14206 will be gone. >7/ Run prove -v t/db_dependent/Letters.t > All tests should PASS without any error. > >Followed test plan. Works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> >--- > C4/Letters.pm | 7 ++++--- > t/db_dependent/Letters.t | 8 +++++++- > 2 files changed, 11 insertions(+), 4 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index c7751ca..db9f987 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -207,8 +207,7 @@ sub GetLettersAvailableForALibrary { > our %letter; > sub getletter { > my ( $module, $code, $branchcode, $message_transport_type ) = @_; >- $message_transport_type ||= 'email'; >- >+ $message_transport_type //= '%'; > > if ( C4::Context->preference('IndependentBranches') > and $branchcode >@@ -226,7 +225,8 @@ sub getletter { > my $sth = $dbh->prepare(q{ > SELECT * > FROM letter >- WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '') AND message_transport_type = ? >+ WHERE module=? AND code=? AND (branchcode = ? OR branchcode = '') >+ AND message_transport_type LIKE ? > ORDER BY branchcode DESC LIMIT 1 > }); > $sth->execute( $module, $code, $branchcode, $message_transport_type ); >@@ -237,6 +237,7 @@ sub getletter { > return { %$line }; > } > >+ > =head2 DelLetter > > DelLetter( >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index f53e75b..6ac9f58 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 58; >+use Test::More tests => 60; > use Test::MockModule; > use Test::Warn; > >@@ -173,6 +173,12 @@ is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); > is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); > is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); > >+# Regression test for Bug 14206 >+$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('FFL','my module','my code','my name',1,?,?,'print')|, undef, $title, $content ); >+my $letter14206_a = C4::Letters::getletter('my module', 'my code', 'FFL' ); >+is( $letter14206_a->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type not passed, correct mtt detected' ); >+my $letter14206_b = C4::Letters::getletter('my module', 'my code', 'FFL', 'print'); >+is( $letter14206_b->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type passed, correct mtt detected' ); > > # addalert > my $type = 'my type'; >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14206
:
39270
|
39272
|
39283
|
39315
|
39316
|
39321
|
39342
|
39353
|
39354
|
39376
|
39380
|
39467
|
39512
| 39522 |
39523