Bugzilla – Attachment 13463 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.17 KB, created by
Jonathan Druart
on 2012-11-15 15:23:42 UTC
(
hide
)
Description:
Bug 8307: Set a value for subfields when receiving
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-11-15 15:23:42 UTC
Size:
5.17 KB
patch
obsolete
>From 28d400782ff361c9ba494ddc7795cac967c20df8 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 > >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' >--- > acqui/finishreceive.pl | 16 +++++++++++++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++ > .../en/modules/admin/preferences/acquisitions.pref | 3 +++ > 4 files changed, 33 insertions(+), 1 deletion(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 0ea16ca..cd8ae85 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -63,6 +63,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; >@@ -137,7 +152,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 a4e4102..018e746 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -386,3 +386,4 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); > INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); >+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 518f23a..5d459c5 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6055,6 +6055,20 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+ >+ >+$DBversion = "3.09.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($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 > > =head2 TableExists($table) >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.10.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 8307
:
10472
|
11379
|
11525
|
13463
|
16235
|
16250
|
18605
|
18606
|
18607
|
18608