Bugzilla – Attachment 62682 Details for
Bug 14598
itemtype is not set on statistics by C4::Circulation::AddReturn
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Set itemtype on stats - Rennes 2 version
set_itemtype_on_stats_r2.pl (text/plain), 1.64 KB, created by
Gwendal JONCOUR
on 2017-04-25 14:09:09 UTC
(
hide
)
Description:
Set itemtype on stats - Rennes 2 version
Filename:
MIME Type:
Creator:
Gwendal JONCOUR
Created:
2017-04-25 14:09:09 UTC
Size:
1.64 KB
patch
obsolete
>use Modern::Perl; >use C4::Context; > >use Koha::Items; > >my $start = time; > >my $dbh = C4::Context->dbh; > >my $sth = $dbh->prepare(q{ > SELECT DISTINCT itemnumber > FROM statistics > WHERE ( type = "return" OR type = "localuse" ) > AND itemtype IS NULL; >}); >$sth->execute(); > >my $ilevel_itypes = C4::Context->preference('item-level_itypes'); > >while ( my ($itemnumber) = $sth->fetchrow_array ) { > my $effective_itemtype; > my $itype_sth = $dbh->prepare(q{ > SELECT biblionumber, itype > FROM items > WHERE itemnumber = ? > UNION > SELECT biblionumber, itype > FROM deleteditems > WHERE itemnumber = ? > }); > $itype_sth->execute($itemnumber,$itemnumber); > my ($biblionumber, $item_itype) = $itype_sth->fetchrow_array; > if ($ilevel_itypes and defined $item_itype) { > $effective_itemtype = $item_itype; > } else { > warn "item-level_itypes set but no itype defined for item ($itemnumber)" if $ilevel_itypes; > my $btype_sth = $dbh->prepare(q{ > SELECT itemtype > FROM biblioitems > WHERE biblionumber = ? > UNION > SELECT itemtype > FROM deletedbiblioitems > WHERE biblionumber = ? > }); > $btype_sth->execute($biblionumber,$biblionumber); > my ($biblio_itype) = $btype_sth->fetchrow_array; > $effective_itemtype = $biblio_itype; > } > > my $update_sth = $dbh->prepare(q{ > UPDATE statistics > SET itemtype=? > WHERE itemnumber=? AND itemtype IS NULL > }); > $update_sth->execute( $effective_itemtype, $itemnumber ); > say "Set itemtype $effective_itemtype to item $itemnumber"; >} >
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 Raw
Actions:
View
Attachments on
bug 14598
:
41198
|
41199
|
41200
|
41201
|
41202
|
41203
|
41204
|
41205
|
41383
|
41384
|
41385
|
41627
|
41628
|
41629
|
41637
|
42171
|
42177
|
44665
|
44666
|
44667
|
44668
|
45030
|
45047
|
45838
|
45843
|
45844
|
46546
|
46877
|
47108
|
47109
|
47110
|
47111
|
47112
|
47113
|
47114
|
47115
|
47116
|
49797
|
49798
|
49799
|
49800
|
49801
|
49802
|
49803
|
49804
|
49805
|
49807
|
49963
|
49964
|
49965
|
49966
|
49967
|
49968
|
49969
|
49970
|
49971
|
49972
|
49978
|
49979
|
49980
|
49981
|
49982
|
49983
|
49984
|
49985
|
49986
|
49987
|
49988
|
50018
|
56941
|
56942
|
56943
|
56944
|
56945
|
56946
|
56947
|
56948
|
56949
|
56950
|
56951
|
56952
|
56953
|
62539
|
62555
| 62682