Bugzilla – Attachment 18860 Details for
Bug 10448
Changing framework when cataloguing clears all fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10448 - Changing framework when cataloguing clears all fields
0001-Bug-10448-Changing-framework-when-cataloguing-clears.patch (text/plain), 5.10 KB, created by
David Cook
on 2013-06-12 02:51:16 UTC
(
hide
)
Description:
Bug 10448 - Changing framework when cataloguing clears all fields
Filename:
MIME Type:
Creator:
David Cook
Created:
2013-06-12 02:51:16 UTC
Size:
5.10 KB
patch
obsolete
>From a77c4e8ab52560b6e3a2cf1647eb843be971de60 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 12 Jun 2013 11:24:09 +1000 >Subject: [PATCH] Bug 10448 - Changing framework when cataloguing clears all > fields > >This patch changes the Changefwk Javascript function so that it passes >the "op" value and the "biblionumberdata" (as the biblionumber) from >addbiblio.pl back to itself, when submitting the form in order to >change the framework. > >The reason we need to do this is because the form in addbiblio.tt >is hard-coded to always submit an "op" value of "addbiblio". Currently, >we need to have it hard-coded to "addbiblio", because all the magic >happens in addbiblio.pl when there is an "op" of "addbiblio". If we >always passed the "actual" "op" value, such as "duplicate", nothing >would ever happen when we clicked "save". It seems to me that this >is a flaw in the design of addbiblio.pl. > >If we pass the "op" and "biblionumber" when changing frameworks, we're >able to tell addbiblio.pl that we're still wanting to "duplicate" this >"X" biblionumber. However, by having the form still hard-coded to >"addbiblio", when we hit save, the form will do the magic, check if >it's a duplicate, and save the record (or prompt for action if it >is a duplicate). > >-- > >I also noticed that if you make changes to a record, then change >the framework before saving, your changes get cleared (since the >original record from the database is loaded when the page reloads). >It seems to me that this is a bug. Changing the framework should >change the layout while preserving the content. I think most users >would assume that when changing the framework. > >This patch also introduces another hidden input into addbiblio.tt and >the Changefwk Javascript called "changed_framework". Basically, if >the Changefwk Javascript is run, it tells addbiblio.pl that the >framework is changed, and it uses the posted data from the form >(which we have been modifying) instead of reloading the record from >the database. > >-- > >Test Plan: > >A) Before Applying Patch: > >To Show That Changing the Framework Erases All Fields When >Duplicating a Record: > >1) Go to any bib record >2) Go to Edit > Edit as new (duplicate). You should see filled >in fields. >3) Change the framework to any other framework than the one >that is currently specified. >4) Note that every single field is now blank > >To Show That Changing the Record then Changing the Framework >Ignores Changes, When Editing a Record > >5) Go to any bib record >6) Go to Edit. >7) Change the title of the record to "I've changed the title". >8) Change the framework to any other framework than the one that is currently specified. >9) Look at the title. You'll notice it is the original title, and NOT "I've changed the title". > >B) Apply the Patch > >Also, clear your memcache and shift+refresh your screen. You don't want to use cached templates/javascript. > >C) After Applying the Patch > >Repeat Steps 1-3 and 5-8. > >You should now notice that changing the framework when duplicating the item does not clear all the fields. > >You should also notice that any changes you make prior to changing the framework will still exist after changing it. >--- > cataloguing/addbiblio.pl | 6 +++++- > .../prog/en/modules/cataloguing/addbiblio.tt | 5 ++++- > 2 files changed, 9 insertions(+), 2 deletions(-) > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 3a5b7c5..7028544 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -739,6 +739,7 @@ if ($frameworkcode eq 'FA'){ > $userflags = 'fast_cataloging'; > } > >+my $changed_framework = $input->param('changed_framework'); > $frameworkcode = &GetFrameworkCode($biblionumber) > if ( $biblionumber and not($frameworkcode) and $op ne 'addbiblio' ); > >@@ -962,7 +963,10 @@ elsif ( $op eq "delete" ) { > $biblionumber = ""; > } > >- if ( $record ne -1 ) { >+ if($changed_framework eq "changed"){ >+ $record = TransformHtmlToMarc( $input ); >+ } >+ elsif( $record ne -1 ) { > #FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding > eval { > my $uxml = $record->as_xml; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 26f8fa7..3f2dfcc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -286,7 +286,9 @@ function GetZ3950Terms(){ > > function Changefwk(FwkList) { > var f = document.f; >- f.op.value = ""; >+ f.op.value = "[% op %]"; >+ f.biblionumber.value = "[% biblionumberdata %]"; >+ f.changed_framework.value = "changed"; > f.submit(); > } > >@@ -427,6 +429,7 @@ function Changefwk(FwkList) { > <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" /> > <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> > <input type="hidden" name="breedingid" value="[% breedingid %]" /> >+ <input type="hidden" name="changed_framework" value="" /> > > <div id="addbibliotabs" class="toptabs numbered"> > <ul> >-- >1.7.7.4 >
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 10448
:
18860
|
18987
|
19447