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
26 my $dbh = C4::Context->dbh;
28 my $op = $query->param('op');
29 my $barcodetype = $query->param('barcodetype');
30 my $title = $query->param('title');
31 my $isbn = $query->param('isbn');
32 my $itemtype = $query->param('itemtype');
33 my $bcn = $query->param('bcn');
34 my $dcn = $query->param('dcn');
35 my $classif = $query->param('classif');
36 my $itemcallnumber = $query->param('itemcallnumber');
37 my $subclass = $query->param('subclass');
38 my $author = $query->param('author');
39 my $tmpl_id = $query->param('tmpl_id');
40 my $itemnumber = $query->param('itemnumber');
41 my $summary = $query->param('summary');
42 my $startlabel = $query->param('startlabel');
43 my $printingtype = $query->param('printingtype');
44 my $guidebox = $query->param('guidebox');
45 my $fontsize = $query->param('fontsize');
49 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
51 template_name => "barcodes/label-manager.tmpl",
55 flagsrequired => { tools => 1 },
60 if ( $op eq 'save_conf' ) {
62 $barcodetype, $title, $isbn, $itemtype,
63 $bcn, $dcn, $classif, $subclass,
64 $itemcallnumber, $author, $tmpl_id, $printingtype,
65 $guidebox, $startlabel
69 elsif ( $op eq 'add' ) {
70 my $query2 = "INSERT INTO labels ( itemnumber ) values ( ? )";
71 my $sth2 = $dbh->prepare($query2);
72 $sth2->execute($itemnumber);
75 elsif ( $op eq 'deleteall' ) {
76 my $query2 = "DELETE FROM labels";
77 my $sth2 = $dbh->prepare($query2);
81 elsif ( $op eq 'delete' ) {
82 warn "MASON, deleting label..";
83 my $query2 = "DELETE FROM labels where itemnumber = ?";
84 my $sth2 = $dbh->prepare($query2);
85 $sth2->execute($itemnumber);
89 # first lets do a read of the labels table , to get the a list of the
90 # currently entered items to be prinited
95 my $query3 = "Select * from labels";
96 my $sth = $dbh->prepare($query3);
101 while ( my $data = $sth->fetchrow_hashref ) {
103 # lets get some summary info from each item
105 select * from biblio,biblioitems,items where itemnumber=? and
106 items.biblioitemnumber=biblioitems.biblioitemnumber and
107 biblioitems.biblionumber=biblio.biblionumber";
109 my $sth1 = $dbh->prepare($query1);
110 $sth1->execute( $data->{'itemnumber'} );
111 my $data1 = $sth1->fetchrow_hashref();
113 $data1->{'labelno'} = $i1;
114 $data1->{'summary'} =
115 "$data1->{'barcode'}, $data1->{'title'}, $data1->{'isbn'}";
117 push( @resultsloop, $data1 );
124 # this script can be run from the side nav, and is not passed a value for $startrow
125 # so lets get it from the DB
127 my $dbh = C4::Context->dbh;
128 my $query2 = "SELECT * FROM labels_conf LIMIT 1";
129 my $sth = $dbh->prepare($query2);
132 my $data = $sth->fetchrow_hashref;
135 #calc-ing number of sheets
137 #$sheets_needed = ceil($sheets_needed); # rounding up int's
139 #my $tot_labels = ( $sheets_needed * 8 );
140 #my $start_results = ( $number_of_results + $startrow );
141 #my $labels_remaining = ( $tot_labels - $start_results );
144 resultsloop => \@resultsloop,
146 # startrow => $startrow,
147 # sheets => $sheets_needed,
148 # labels_remaining => $labels_remaining,
149 intranetcolorstylesheet =>
150 C4::Context->preference("intranetcolorstylesheet"),
151 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
152 IntranetNav => C4::Context->preference("IntranetNav"),
154 output_html_with_http_headers $query, $cookie, $template->output;