Bugzilla – Attachment 18605 Details for
Bug 8307
Set a value for items when receiving
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8307: Set a value for subfields when receiving
Bug-8307-Set-a-value-for-subfields-when-receiving.patch (text/plain), 5.06 KB, created by
Marcel de Rooy
on 2013-06-03 07:58:07 UTC
(
hide
)
Description:
Bug 8307: Set a value for subfields when receiving
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-06-03 07:58:07 UTC
Size:
5.06 KB
patch
obsolete
>From 19ec0c81c57ea2ec44be95026cd609b3c95662ac Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 18 May 2012 13:42:36 +0200 >Subject: [PATCH] Bug 8307: Set a value for subfields when receiving >Content-Type: text/plain; charset=utf-8 > >If items are created when ordering, this patch allows to add a value for >some items subfields. > >Test plan: >Define status for items.notforloan (mapping 995$o in unimarc), for >example 4:On order, 5:On treatment > >Set the Syspref AcqCreateItem on "ordering". > >ACQ framework : set default value = 4 for 995$o (in unimarc) > >Syspref AcqItemSetSubfieldsWhenReceived : set "o=5|b='foo bar'" > >When ordering the item, default status will be 4 ; when receiving the >item, status will be changed from 4 to 5. The subfield b have to contain >'foo bar' > >Signed-off-by: Frederic Durand <frederic.durand@unilim.fr> >--- > acqui/finishreceive.pl | 16 +++++++++++++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 9 +++++++++ > .../en/modules/admin/preferences/acquisitions.pref | 3 +++ > 4 files changed, 28 insertions(+), 1 deletions(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 5ca2c98..8318ea8 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -62,6 +62,21 @@ if ($quantityrec > $origquantityrec ) { > my @received_items = (); > if(C4::Context->preference('AcqCreateItem') eq 'ordering') { > @received_items = $input->param('items_to_receive'); >+ my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived"); >+ if ( @affects ) { >+ my $frameworkcode = GetFrameworkCode($biblionumber); >+ my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $frameworkcode ); >+ for my $in ( @received_items ) { >+ my $item = C4::Items::GetMarcItem( $biblionumber, $in ); >+ for my $affect ( @affects ) { >+ my ( $sf, $v ) = split q{=}, $affect; >+ foreach ( $item->field($itemfield) ) { >+ $_->update( $sf => $v ); >+ } >+ } >+ C4::Items::ModItemFromMarc( $item, $biblionumber, $in ); >+ } >+ } > } > > $order->{rrp} = $rrp; >@@ -136,7 +151,6 @@ if ($quantityrec > $origquantityrec ) { > NewOrderItem($itemnumber, $new_ordernumber); > } > } >- > } > > update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 31485bc..7f141c4 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -427,3 +427,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo'); > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AcqItemStatusWhenReceived','0','This syspref set a status for item when items are created when receiving (e.g. 995\$o=5)','','Free'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index f3a90d8..821e69e 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6983,6 +6983,15 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( > SetVersion($DBversion); > } > >+$DBversion = "3.11.00.XXX"; >+if(CheckVersion($DBversion)) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AcqItemSetSubfieldsWhenReceived','','Set subfields for item when items are created when receiving (e.g. o=5|a="foo bar")','','Free'); >+ }); >+ print "Upgrade to $DBversion done (Added AcqItemSetSubfieldsWhenReceived syspref)\n"; >+ SetVersion($DBversion); >+} >+ > > =head1 FUNCTIONS > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >index 1ec49ff..7472321 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref >@@ -35,6 +35,9 @@ Acquisitions: > - Default tax rates are > - pref: gist > - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |) >+ - >+ - pref: AcqItemSetSubfieldsWhenReceived >+ - Set subfields for item when items are created when receiving (e.g. o=5|a="foo bar") > > Printing: > - >-- >1.7.7.6
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 8307
:
10472
|
11379
|
11525
|
13463
|
16235
|
16250
|
18605
|
18606
|
18607
|
18608