7 use Data::Dump qw(dump);
11 binmode STDOUT, ':encoding(UTF-8)';
15 my $barcode = $q->param('barcode');
16 warn "# barcode: $barcode\n";
17 $q->delete('barcode'); # empty form field
21 $ENV{REQUEST_URI} =~ s{/intranet/}{/cgi-bin/koha/}; # fix plack rewrite
23 print $q->header( -charset => 'utf-8' ), qq{
27 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
33 <title>Inventura</title>
39 my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($q, { tools => 'inventory' });
40 if ($status ne "ok") {
41 print "This requres tools - inventory permission";
47 $q->start_form( -autocomplete => 'off' )
48 , $q->textfield( -name => 'barcode', -autofocus => 'autofocus' )
49 , $q->submit( -value => 'Search' )
50 # , $q->checkbox( -name => 'izdatnice', -label => 'izdatnice' )
51 # , $q->checkbox( -name => 'proizvodi', -label => 'prozivodi', -checked => 1 )
55 <script type="text/javascript">
56 document.getElementsByName('barcode')[0].focus();
64 my $dbh = C4::Context->dbh;
66 warn "inventura barcode: $barcode ",dump($barcode);
71 items.biblionumber as biblionumber,
74 biblioitems.publishercode,
75 biblioitems.editionstatement,
87 join biblio on items.biblionumber = biblio.biblionumber
88 join biblioitems on items.biblionumber = biblioitems.biblionumber
94 my $sth = $dbh->prepare( $sql );
95 $sth->execute( $barcode );
98 $row = $sth->fetchrow_hashref;
100 $barcode = $row->{barcode}; # use original barcode number
103 barcode: <tt>$barcode</tt><br>
104 naslov: <b>$row->{title}</b><br>
105 autor: $row->{author}<br>
106 izdavač: $row->{publishercode}<br>
107 izdanje: $row->{editionstatement}<br>
108 godina izdanja: $row->{copyrightdate}<br>
109 inventarni broj novi: $row->{stocknumber}<br>
110 inventarni broj stari: $row->{copynumber}<br>
111 signatura: $row->{itemcallnumber}<br>
112 stalna lokacija: $row->{homebranch}<br>
113 lokacija na polici: $row->{location}<br>
114 status otpisano: $row->{withdrawn}<br>
115 status izgubljeno: $row->{itemlost}<br>
116 status uništeno: $row->{damaged}<br>
119 my $sth_update = $dbh->prepare(qq{
120 update items set datelastseen = now() where barcode = ?
122 $sth_update->execute( $barcode );
124 my $sth_inventura = $dbh->prepare(qq{
125 insert ignore into fer_inventura (date_scanned,barcode,source_id) values (date(now()), ?, ?)
127 $sth_inventura->execute( $barcode, C4::Context->userenv->{'id'} );
129 my $sth_issues = $dbh->prepare(qq{
130 select firstname,surname,userid,email from issues join borrowers on issues.borrowernumber = borrowers.borrowernumber where itemnumber = ?
133 $sth_issues->execute( $row->{'itemnumber'} );
134 while ( my $row = $sth_issues->fetchrow_hashref ) {
135 warn "# issues row ",dump($row);
136 print "issued to ", $row->{firstname}, ' ', $row->{surname}, " returning...";
137 AddReturn( $barcode, C4::Context->userenv->{'branch'} );
140 print "no barcode $barcode\n";
141 warn "ERROR: can't find $barcode\n";