Bugzilla – Attachment 127856 Details for
Bug 29113
New "code" field for additional contents is not useful for the end users
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29113: Hide code for additional contents and generate it
Bug-29113-Hide-code-for-additional-contents-and-ge.patch (text/plain), 4.33 KB, created by
Marcel de Rooy
on 2021-11-19 10:53:13 UTC
(
hide
)
Description:
Bug 29113: Hide code for additional contents and generate it
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-11-19 10:53:13 UTC
Size:
4.33 KB
patch
obsolete
>From cc56afa880816017b861205c06c819fd84f3375e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 4 Oct 2021 16:28:49 +0200 >Subject: [PATCH] Bug 29113: Hide code for additional contents and generate it >Content-Type: text/plain; charset=utf-8 > >additional_contents.code is used to group DB rows together. Each row >represent one content in a given language, and the code is used to know >they are translation of the lang='default' one. > >It's not really useful for the end user and we could hide it and >generate it. > >Test plan: >Create/Edit/Delete additional contents (news and HTML customizations) >and confirm that they are correctly grouped together. >You need several languages installed to test this patch correctly. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/tools/additional-contents.tt | 12 +----------- > tools/additional-contents.pl | 15 ++++++++++++--- > 2 files changed, 13 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 61ba7886f5..9a3932ef07 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -178,20 +178,10 @@ > > <form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate"> > <input type="hidden" name="op" value="add_validate" /> >- <input type="hidden" name="id" value="[% additional_content.idnew | html %]" /> > <input type="hidden" name="category" value="[% category | html %]" /> >+ <input type="hidden" name="code" value="[% additional_content.code | html %]" /> > <fieldset class="rows"> > <ol> >- <li> >- [% IF additional_content %] >- <span class="label">Code:</span> [% additional_content.code | html %] >- <input type="hidden" id="code" name="code" value="[% additional_content.code | html %]" /> >- [% ELSE %] >- <label for="code" class="required">Code:</label> >- <input type="text" id="code" name="code" size="20" maxlength="20" value="" required="required"/> >- <span class="required">Required</span> >- [% END %] >- </li> > <li> > <label for="location">Display location:</label> > <select id="location" name="location"> >diff --git a/tools/additional-contents.pl b/tools/additional-contents.pl >index 2e87f23d68..dcbc8d7a79 100755 >--- a/tools/additional-contents.pl >+++ b/tools/additional-contents.pl >@@ -107,7 +107,7 @@ elsif ( $op eq 'add_validate' ) { > my $number = $cgi->param('number'); > > my $success = 1; >- for my $lang ( @lang ) { >+ for my $lang ( sort {$a ne 'default'} @lang ) { # Process 'default' first > my $title = shift @title; > my $content = shift @content; > my $additional_content = Koha::AdditionalContents->find( >@@ -161,7 +161,7 @@ elsif ( $op eq 'add_validate' ) { > my $additional_content = Koha::AdditionalContent->new( > { > category => $category, >- code => $code, >+ code => $code || 'tmp_code', > location => $location, > branchcode => $branchcode, > title => $title, >@@ -173,7 +173,16 @@ elsif ( $op eq 'add_validate' ) { > borrowernumber => $borrowernumber, > } > )->store; >- eval { $additional_content->store; }; >+ eval { >+ $additional_content->store; >+ unless ($code) { >+ $additional_content->discard_changes; >+ $code = $category eq 'news' >+ ? 'News_' . $additional_content->idnew >+ : $location . '_' . $additional_content->idnew; >+ $additional_content->code($code)->store; >+ } >+ }; > if ($@) { > $success = 0; > push @messages, { type => 'error', code => 'error_on_insert' }; >-- >2.20.1
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 29113
:
125695
|
125696
|
125861
|
127365
|
127856
|
127857
|
127989
|
127990