3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
23 use C4::Interface::CGI::Output;
27 my $dbh = C4::Context->dbh;
29 my $op = $query->param('op');
30 my $barcodetype = $query->param('barcodetype');
31 my $title = $query->param('title');
32 my $isbn = $query->param('isbn');
33 my $itemtype = $query->param('itemtype');
34 my $bcn = $query->param('bcn');
35 my $dcn = $query->param('dcn');
36 my $classif = $query->param('classif');
37 my $itemcallnumber = $query->param('itemcallnumber');
38 my $subclass = $query->param('subclass');
39 my $author = $query->param('author');
40 my $tmpl_id = $query->param('tmpl_id');
41 my $itemnumber = $query->param('itemnumber');
42 my $summary = $query->param('summary');
43 my $startlabel = $query->param('startlabel');
44 my $printingtype = $query->param('printingtype');
45 my $guidebox = $query->param('guidebox');
46 my $fontsize = $query->param('fontsize');
50 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
52 template_name => "barcodes/label-manager.tmpl",
56 flagsrequired => { tools => 1 },
61 if ( $op eq 'save_conf' ) {
63 $barcodetype, $title, $isbn, $itemtype,
64 $bcn, $dcn, $classif, $subclass,
65 $itemcallnumber, $author, $tmpl_id, $printingtype,
66 $guidebox, $startlabel
70 elsif ( $op eq 'add' ) {
71 my $query2 = "INSERT INTO labels ( itemnumber ) values ( ? )";
72 my $sth2 = $dbh->prepare($query2);
73 $sth2->execute($itemnumber);
76 elsif ( $op eq 'deleteall' ) {
77 my $query2 = "DELETE FROM labels";
78 my $sth2 = $dbh->prepare($query2);
82 elsif ( $op eq 'delete' ) {
83 warn "MASON, deleting label..";
84 my $query2 = "DELETE FROM labels where itemnumber = ?";
85 my $sth2 = $dbh->prepare($query2);
86 $sth2->execute($itemnumber);
90 # first lets do a read of the labels table , to get the a list of the
91 # currently entered items to be prinited
96 my $query3 = "Select * from labels";
97 my $sth = $dbh->prepare($query3);
100 my $cnt = $sth->rows;
102 while ( my $data = $sth->fetchrow_hashref ) {
104 # lets get some summary info from each item
106 select * from biblio,biblioitems,items where itemnumber=? and
107 items.biblioitemnumber=biblioitems.biblioitemnumber and
108 biblioitems.biblionumber=biblio.biblionumber";
110 my $sth1 = $dbh->prepare($query1);
111 $sth1->execute( $data->{'itemnumber'} );
112 my $data1 = $sth1->fetchrow_hashref();
114 $data1->{'labelno'} = $i1;
115 $data1->{'summary'} =
116 "$data1->{'barcode'}, $data1->{'title'}, $data1->{'isbn'}";
118 push( @resultsloop, $data1 );
125 # this script can be run from the side nav, and is not passed a value for $startrow
126 # so lets get it from the DB
128 my $dbh = C4::Context->dbh;
129 my $query2 = "SELECT * FROM labels_conf LIMIT 1";
130 my $sth = $dbh->prepare($query2);
133 my $data = $sth->fetchrow_hashref;
136 #calc-ing number of sheets
138 #$sheets_needed = ceil($sheets_needed); # rounding up int's
140 #my $tot_labels = ( $sheets_needed * 8 );
141 #my $start_results = ( $number_of_results + $startrow );
142 #my $labels_remaining = ( $tot_labels - $start_results );
145 resultsloop => \@resultsloop,
147 # startrow => $startrow,
148 # sheets => $sheets_needed,
149 # labels_remaining => $labels_remaining,
150 intranetcolorstylesheet =>
151 C4::Context->preference("intranetcolorstylesheet"),
152 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
153 IntranetNav => C4::Context->preference("IntranetNav"),
155 output_html_with_http_headers $query, $cookie, $template->output;