Bugzilla – Attachment 1781 Details for
Bug 4019
Lists Merge Issues
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH] BZ4019 : Lists Merge Issue
0001-BZ4019-Lists-Merge-Issue.patch (text/plain), 4.66 KB, created by
Chris Cormack
on 2009-12-31 10:47:00 UTC
(
hide
)
Description:
[PATCH] BZ4019 : Lists Merge Issue
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2009-12-31 10:47:00 UTC
Size:
4.66 KB
patch
obsolete
>From 5451efa38d5249239f9135b8d2e58d21b027a3f6 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Thu, 31 Dec 2009 11:37:25 +0100 >Subject: [PATCH] BZ4019 : Lists Merge Issue > >Removes deprecated virtualshelves/merge.pl as well as the link to it. >Records merging is done by selecting two records from a list's content. >--- > .../prog/en/modules/virtualshelves/shelves.tmpl | 1 - > virtualshelves/merge.pl | 137 -------------------- > 2 files changed, 0 insertions(+), 138 deletions(-) > delete mode 100755 virtualshelves/merge.pl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl >index 5a808bd..d0998c8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl >@@ -346,7 +346,6 @@ function placeHold () { > <!-- TMPL_IF NAME="mine" --> > <form action="merge.pl" method="get"> > <input type="hidden" name="shelf" value="<!-- TMPL_VAR NAME="shelf" -->" /> >- <input type="submit" class="editshelf" value="Merge" /> > </form> > <form action="shelves.pl" method="get"> > <input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelf" -->" /> >diff --git a/virtualshelves/merge.pl b/virtualshelves/merge.pl >deleted file mode 100755 >index bff5aa7..0000000 >--- a/virtualshelves/merge.pl >+++ /dev/null >@@ -1,137 +0,0 @@ >-#! /usr/bin/perl >-# vim: enc=utf-8 fdm=marker fdn=1 sw=4 >-use utf8; >-use strict; >-use warnings; >-use Devel::SimpleTrace; >-use Storable qw< freeze thaw >; >-use C4::Auth; >-use C4::Context; >-use C4::Biblio; >-use C4::VirtualShelves; >-use YAML; >-use CGI; >- >-sub debug { print STDERR @_,"\n" } >- >-# Global values {{{ >-my $query = CGI->new; >-my $sessionID = (checkauth($query))[2]; >-my $session = C4::Auth::get_session( $sessionID ); >- >-my ( $template, $user, $cookie ) = get_template_and_user { >- qw( >- template_name virtualshelves/merge.tmpl >- type intranet >- authnotrequired 0 >- ) >- , query => $query >- , flagsrequired => {} >-}; >-# }}} >-# Functions {{{ >- >-sub render { >- use C4::Output; >- $template->param( session => $sessionID ); >- output_html_with_http_headers $query, $cookie, $template->output; >-} >- >-sub maybe_lost { >- $template->param( maybe_lost => 1 ); >- render; exit; >-} >- >-sub fields_to_merge { $session->param('fields_to_merge') } >- >-# global values ... but only for nextid >- >-my $selection_id = 0; >-sub nextid { $selection_id++ } >- >-sub prepare_subfield { { key => $$_[0], value => $$_[1] } } >- >-sub prepare_field { >- my $ready = { >- field => freeze($_) >- , from => shift >- , tag => $_->tag >- , id => nextid >- }; >- >- if ( $_->is_control_field ) { >- $$ready{control} = 1; >- } else { >- $$ready{subfields} = [ map prepare_subfield, $_->subfields ] >- }; >- >- $ready; >-} >- >-sub fields_by_tag { $$a{tag} cmp $$b{tag} } >- >-sub build_records { >- my $newbiblio = MARC::Record->new; >- my $items = MARC::Record->new; >- my ( $selected_fields ) = @_; >- my $stored_fields = $session->param('fields'); >- my $kept_biblio = $stored_fields->[0]->{id}; >- my %biblio_to_delete; >- >- for ( @$stored_fields ) { >- my $from = $$_{from}; >- $biblio_to_delete{ $from } = 1; >- >- if ( $$_{tag} eq '995' ) { >- if ( $from != $kept_biblio ) { >- $items->append_fields( thaw $$_{field} ) >- } >- } else { >- if ( exists $$selected_fields{ $$_{id} } ) { >- $newbiblio->append_fields( thaw $$_{field} ) >- } >- } >- } >- delete $biblio_to_delete{ $kept_biblio }; >- ( $newbiblio, $kept_biblio, $items, [ values %biblio_to_delete ] ); >-} >- >-sub clear_session { (shift)->clear([qw< fields shelf >]) } >- >-# }}} >-# the controller {{{ >- >-if ( my %field_selection = map { $_ => 1 } $query->param('selected_field') ) { >- my ($record, $number, $items, $delete ) = build_records( \%field_selection ); >- ModBiblio( $record, $number, GetFrameworkCode( $number )); >- AddItems( $items, $number ); >- for ( @$delete ) { >- if ( my $error = DelBiblio($_) ) { >- die $error >- } >- } >-} else { >- my $shelf = $query->param('shelf') or maybe_lost; >- if ( my @records = C4::VirtualShelves::each_biblionumbers { >- { id => $_, record => GetMarcBiblio($_) } >- } $shelf >- ) { >- my @fields = sort {fields_by_tag} map { >- my ( $id , $record ) = @$_{qw< id record >}; >- map { prepare_field($id) } $record->fields; >- } @records; >- my @store = ( fields => \@fields ); >- >- for ($session) { >- clear_session($_); >- $_->param(@store, shelf => $shelf ); >- } >- $template->param(@store); >- } else { >- die "GET LOST ?"; >- } >-} >- >-render; >- >-# }}} >-- >1.6.3.3 >
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 4019
: 1781