@@ -, +, @@ --- 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(-) --- a/acqui/finishreceive.pl +++ a/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. --- a/installer/data/mysql/sysprefs.sql +++ a/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'); --- a/installer/data/mysql/updatedatabase.pl +++ a/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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ a/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: - --