[Koha-patches] [PATCH] Analytical records - move host field population to a C4 routine, all changes in pl files to call new routine

Chris Cormack chrisc at catalyst.net.nz
Wed Nov 17 04:38:14 CET 2010


Hi,

This patch wouldnt apply, the following 2 analytical records one applied
ok.

Cannot fall back to three-way merge.
Patch failed at 0001 Analytical records - move host field population to
a C4 routine, all changes in pl files to call new routine

Chris


* savitra.sirohi at osslabs.biz (savitra.sirohi at osslabs.biz) wrote:
> From: Amit Gupta <amit.gupta at osslabs.biz>
> 
> ---
>  C4/Biblio.pm             |   25 +++++++++++++++++++++++++
>  cataloguing/addbiblio.pl |   11 ++---------
>  cataloguing/linkitem.pl  |    9 +--------
>  3 files changed, 28 insertions(+), 17 deletions(-)
> 
> diff --git a/C4/Biblio.pm b/C4/Biblio.pm
> index eb0b248..eb6ea42 100644
> --- a/C4/Biblio.pm
> +++ b/C4/Biblio.pm
> @@ -84,6 +84,7 @@ BEGIN {
>        &GetFrameworkCode
>        &GetPublisherNameFromIsbn
>        &TransformKohaToMarc
> +      &PrepHostMarcField
>  
>        &CountItemsIssued
>      );
> @@ -1663,6 +1664,30 @@ sub TransformKohaToMarc {
>      return $record;
>  }
>  
> +=head2 PrepHostMarcField
> +
> +    $hostfield = PrepHostMarcField ( $hostbiblionumber )
> +
> +This function returns a host field populated with data from the host record, the field can then be added to an analytical record
> +
> +=cut
> +
> +sub PrepHostMarcField {
> +	my ($hostbiblionumber,$hostitemnumber) = @_;
> +        my $hostrecord = GetMarcBiblio($hostbiblionumber);
> +
> +	my $hostmarcfield = MARC::Field->new(
> +			773, '', '',
> +			'w' => $hostbiblionumber,
> +                        'o' => $hostitemnumber,
> +                        'a' => $hostrecord->subfield('245','a'),
> +                        'x' => $hostrecord->subfield('245','x')
> +                );
> +
> +    return $hostmarcfield;
> +}
> +
> +
>  =head2 TransformKohaToMarcOneField
>  
>      $record = TransformKohaToMarcOneField( $sth, $record, $kohafieldname, $value, $frameworkcode );
> diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
> index 28aad1f..f0c94e0 100755
> --- a/cataloguing/addbiblio.pl
> +++ b/cataloguing/addbiblio.pl
> @@ -890,18 +890,11 @@ if (($biblionumber) && !($breedingid)){
>  if ($breedingid) {
>      ( $record, $encoding ) = MARCfindbreeding( $breedingid ) ;
>  }
> -#populate 773 if hostbiblionumber is available
> +#populate hostfield if hostbiblionumber is available
>  if ($hostbiblionumber){
> -        my $hostrecord = &GetMarcBiblio($hostbiblionumber);
>  	$record=MARC::Record->new();
>  	$record->leader('');
> -	my $field = MARC::Field->new(
> -              773, '', '',
> -              'w' => $hostbiblionumber,
> -              'o' => $hostitemnumber,
> -		'a' => $hostrecord->subfield('245','a'),
> -		'x' => $hostrecord->subfield('245','x')
> -		);
> +        my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber);
>  	$record->append_fields($field);
>  }
>  
> diff --git a/cataloguing/linkitem.pl b/cataloguing/linkitem.pl
> index bff001e..1504875 100755
> --- a/cataloguing/linkitem.pl
> +++ b/cataloguing/linkitem.pl
> @@ -55,16 +55,9 @@ if ($barcode && $biblionumber) {
>  
>      if ($hostitemnumber) {
>  	my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber);
> -	my $hostrecord = GetMarcBiblio($hostbiblionumber);
>  
>  	if ($hostbiblionumber) {
> -	        my $field = MARC::Field->new(
> -			773, '', '',
> -			'w' => $hostbiblionumber,
> -			'o' => $hostitemnumber,
> -               		'a' => $hostrecord->subfield('245','a'),
> -	                'x' => $hostrecord->subfield('245','x')
> -                );
> +	        my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber);
>  		$biblio->append_fields($field);
>  
>  		my $modresult = ModBiblio($biblio, $biblionumber, ''); 
> -- 
> 1.5.4.5
> 
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/

-- 
Chris Cormack
Catalyst IT Ltd.
+64 4 803 2238
PO Box 11-053, Manners St, Wellington 6142, New Zealand
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: </pipermail/koha-patches/attachments/20101117/d89cb515/attachment.pgp>


More information about the Koha-patches mailing list