Bugzilla – Attachment 11379 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 items when ordering
0001-Bug-8307-Set-a-value-for-items-when-ordering.patch (text/plain), 4.78 KB, created by
Jonathan Druart
on 2012-08-06 10:12:56 UTC
(
hide
)
Description:
Bug 8307: Set a value for items when ordering
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-08-06 10:12:56 UTC
Size:
4.78 KB
patch
obsolete
>From 8dec62b880f8ca8801e442cbe6ec5b6c682488c0 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 1/1] Bug 8307: Set a value for items when ordering > >If items are created when ordering, this patch allows to add a value for >a field. > >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 AcqItemStatusWhenReceived : set "995$o=5" > >When ordering the item, default status will be 4 ; when receiving the >item, status will be changed from 4 to 5 >--- > acqui/finishreceive.pl | 13 +++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 13 +++++++++++++ > .../en/modules/admin/preferences/acquisitions.pref | 3 +++ > 4 files changed, 30 insertions(+), 0 deletions(-) > >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index 84391f5..9218278 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -98,6 +98,19 @@ if ($quantityrec > $origquantityrec ) { > my @received_items = (); > if(C4::Context->preference('AcqCreateItem') eq 'ordering') { > @received_items = $input->param('items_to_receive'); >+ my ( $field, $value ) = split '=', C4::Context->preference("AcqItemStatusWhenReceived"); >+ my $frameworkcode = GetFrameworkCode($biblionumber); >+ my ( $itemfield ) = GetMarcFromKohaField( 'items.itemnumber', $frameworkcode ); >+ if ( $field and $field =~ /^$itemfield\$/ and $value ) { >+ my ( $fv, $sfv ) = split '\$', $field; >+ for my $in ( @received_items ) { >+ my $item = C4::Items::GetMarcItem( $biblionumber, $in ); >+ foreach ( $item->field($itemfield) ) { >+ $_->update( $sfv => $value ); >+ } >+ C4::Items::ModItemFromMarc( $item, $biblionumber, $in ); >+ } >+ } > } > > # save the quantity received. >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index f5a18b2..c729dfc 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -374,3 +374,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( > INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free'); >+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 ed0c674..a730cf9 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5635,6 +5635,19 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+ >+ >+$DBversion = "3.09.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("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');"); >+ print "Upgrade to $DBversion done (Added AcqItemStatusWhenReceived 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 ebae997..cafdfd0 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: > - The default tax rate is > - pref: gist > - (enter in numeric form, 0.12 for 12%) >+ - >+ - pref: AcqItemStatusWhenReceived >+ - Set a status for item when items are created when receiving (e.g. 995$o=5) > > Printing: > - >-- >1.7.7.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 8307
:
10472
|
11379
|
11525
|
13463
|
16235
|
16250
|
18605
|
18606
|
18607
|
18608