+++ /dev/null
-marginBottom = 25
-pageType = A4
-columns = 5
-systemDpi = 96
-labelHeigth = 21
-rows = 13
-marginLeft = 2
-labelWidth = 41
+++ /dev/null
-<div id="submenu">
- <a href="/cgi-bin/koha/barcodes/barcodes.pl">home</a>
- <a href="/cgi-bin/koha/barcodes/barcodesGenerator.pl">barcodes generator</a>
- <a href="/cgi-bin/koha/barcodes/label-home.pl">label</a>
-</div>
-
-<div id="main">
<a href="/cgi-bin/koha/tools/import.pl">Import</a>
<a href="/cgi-bin/koha/tools/letter.pl">Letters</a>
<a href="/cgi-bin/koha/tools/breeding.pl">Reservoir</a>
- <a href="/cgi-bin/koha/tools/barcodes.pl">Barcodes</a>
+ <a href="/cgi-bin/koha/labels/labels-home.pl">Labels</a>
<a href="/cgi-bin/koha/tools/overduerules.pl">overdue rules</a>
<a href="/cgi-bin/koha/tools/viewlog.pl">Log viewer</a>
</div>
+++ /dev/null
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-tools.inc" -->
-
-<!-- START OF ADD COUNTRY CODE PANEL -->
-<div class="countryPanel" id="addCountryCode">
- <form action="/cgi-bin/koha/barcodes/barcodes.pl" method="post" style="display:inline">
- <input type="hidden" name="addCode" value="1" />
-<h4>Add a new Country Code</h4>
-<ul>
- <li><label for="countryName">Country Name:</label> <input type="text" size="10" id="countryName" name="countryName" /></li>
- <li><label for="countryCode">Country Code:</label> <input type="text" size="3" id="countryCode" name="countryCode" /></li>
-</ul>
-<input type="submit" name="submit" id="submit" value="Save Code"/>
-<input type="button" name="cancel" id="cancel" value="Cancel" onclick="document.getElementById('addCountryCode').style.display = 'none'" />
- </form>
-</div>
-
-<!-- END OF ADD COUNTRY CODE PANEL -->
-
- <h1>Barcodes Generator</h1>
- <h3>Generate barcodes from inventory codes</h3>
- <ul>
- <li>Select a range of inventary codes. You can choose a continuous range or individual inventory codes</li>
- <li>Select the standard type to generate barcodes.</li>
- <li>Define the page size for output the PDF.</li>
- <li>Depending on page size, Koha will show you how the page is arranged
- for each barcode. You can define wich point to start printing the page.
- </li>
- </ul>
-
-<!-- TMPL_IF NAME="ERROR" -->Can't find inventory codes in that range. Please try again.<!-- /TMPL_IF -->
-
- <form id="formulario" method="post" action="<!-- TMPL_VAR NAME="SCRIPT_NAME" -->" name="form1" onsubmit="return checkFields(this);" target="_blank">
- <label for="rangeType">Type of Interval: </label><!-- TMPL_VAR NAME="RANGE_TYPE" -->
-
-<div id="continuous" class="panel" style="display:inline">
- <ul>
- <li><label for="from">From:</label><input id="from" type="text" name="from" size="20" /></li>
- <li><label for="to">To:</label><input id="to" type="text" name="to" size="20" /></li>
- </ul>
-</div>
-
-
- <div id="individuals" class="panel" style="display:none; background-color: #ffffff;">
-<label for="inventaryCode">Inventory Code: </label><input id="inventaryCode" type="text" name="inventaryCode" size="20" />
-<a href="#" onclick="addItem(); return false;">[+]</a>
-<a href="#" onclick="removeItem(); return false;">[-]</a>
-<select id="inventaryList" size="5" style="width:150px">
-</select>
-<input type="hidden" id="individualCodes" name="individualCodes">
-</div>
-
-<p>
-<label for="numbersystem">Country Code: </label><!-- TMPL_VAR NAME="NUMBER_SYSTEM" --><a href="#" onClick="addCountryCode(); return false;">[+]</a></p>
-
-<p> <label for="pageType">Page Size</label><input type="text" id="pageType" name="pageType" readonly="readonly" disabled="disabled" value="<!-- TMPL_VAR NAME="PAGES" -->" size="10" /><a href="/cgi-bin/koha/barcodes/printerConfig.pl">[Go to Printer Configuration]</a></p>
-
-
-<p><label for="text_under_label">Text under label</label>
- <input type="text" id="text_under_label" name="text_under_label" size="40" value="<!-- TMPL_VAR name="text_under_label -->" /> If this field is empty, author and title will be used instead</p>
-
- <table>
- <tr>
- <th colspan="<!-- TMPL_VAR NAME="COL_SPAN" -->">Label number to start printing</th>
- </tr>
- <!-- TMPL_LOOP NAME="LABEL_TABLE" -->
- <tr>
- <!-- TMPL_LOOP NAME="columns" -->
- <td>
- <input type="radio" id="label" value="<!-- TMPL_VAR NAME="tagname" -->" name="label" <!-- TMPL_VAR NAME="check" -->> Label <!-- TMPL_VAR NAME="labelname" --></td>
- <!-- /TMPL_LOOP -->
- </tr>
- <!-- /TMPL_LOOP -->
- </table>
-
-<input type="submit" value="Generate Barcodes" name="B1">
-<input type="reset" value="Clear Fields" name="B2">
-</form>
-
-<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
-
<td><a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a></td>
<td>Create printable labels and barcodes from catalog data.</td>
</tr>
-<tr>
- <td><a href="/cgi-bin/koha/tools/barcodes.pl">Label generator</a></td>
- <td>Generate spine labels and barcodes</td>
-</tr>
<tr>
<td><a href="/cgi-bin/koha/tools/holidays.pl">Holidays</a></td>
<td>Define holidays (days where the library is closed)</td>
+++ /dev/null
-#!/usr/bin/perl
-
-# script to generate items barcodes
-# written 07/04
-# by Veleda Matias - matias_veleda@hotmail.com - Physics Library UNLP Argentina and
-# Casta�eda Sebastian - seba3c@yahoo.com.ar - Physics Library UNLP Argentina and
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Auth;
-use C4::Output;
-
-
-use C4::Context;
-use C4::Barcodes::PrinterConfig;
-
-
-
-# This function returns the path to deal with the correct files, considering
-# templates set and language.
-sub getPath {
- my $type = shift @_;
- my $templatesSet = C4::Context->preference('template');
- my $lang = C4::Context->preference('opaclanguages');
- if ($type eq "intranet") {
- return "$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
- } else {
- return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
- }
-}
-
-# Load a configuration file. Before use this function, check if that file exists.
-sub loadConfFromFile {
- my $fileName = shift @_;
- my %keyValues;
- open FILE, "<$fileName";
- while (<FILE>) {
- chomp;
- if (/\s*([\w_]*)\s*=\s*([\[\]\<\>\w_\s:@,\.-]*)\s*/) {
- $keyValues{$1} = $2;
- }
- }
- close FILE;
- return %keyValues;
-}
-
-# Save settings to a configuration file. It delete previous configuration settings.
-sub saveConfToFile {
- my $fileName = shift @_;
- my %keyValues = %{shift @_};
- my $i;
- open FILE, ">$fileName";
- my $i;
- foreach $i (keys(%keyValues)) {
- print FILE $i." = ".$keyValues{$i}."\n";
- }
- close FILE;
-}
-
-# Load the config file.
-my $filenameConf = &getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
-my %labelConfig = &loadConfFromFile($filenameConf);
-
-my $input = new CGI;
-# Defines type of page to use in the printer process
-my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($labelConfig{'rows'}, $labelConfig{'columns'});
-
-# It creates a list of posible intervals to choose codes to generate
-my %list = ('continuous' => 'Continuous Range of items', 'individuals' => 'Individual Codes');
-my @listValues = keys(%list);
-my $rangeType = CGI::scrolling_list(-name => 'rangeType',
- -values => \@listValues,
- -labels => \%list,
- -size => 1,
- -default => ['continuous'],
- -multiple => 0,
- -id => "rangeType",
- -onChange => "changeRange(this)");
-# It creates a list of posible standard codifications. First checks if the user has just added a new code.
-if ($input->param('addCode')) {
- my $newCountryName = $input->param('countryName');
- my $newCountryCode = $input->param('countryCode');
-
- my $countryCodesFilename = &getPath("intranet")."/includes/countryCodes/countryCodes.dat";
- open COUNTRY_CODES, ">>$countryCodesFilename";
- print COUNTRY_CODES $newCountryCode." = ".$newCountryName."\n";
- close COUNTRY_CODES;
-}
-
-# Takes the country codes from a file and use them to set the country list.
-my $countryCodes = &getPath("intranet")."/includes/countryCodes/countryCodes.dat";
-my %list = &loadConfFromFile($countryCodes);
-@listValues = keys(%list);
-my $number_system = CGI::scrolling_list(-name => 'numbersystem',
- -values => \@listValues,
- -labels => \%list,
- -size => 1,
- -multiple => 0);
-
-# Set the script name
-my $script_name = "/cgi-bin/koha/tools/barcodesGenerator.pl";
-
-
-# Get the template to use
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "barcodes/barcodes.tmpl",
- type => "intranet",
- query => $input,
- authnotrequired => 0,
- flagsrequired => {tools => 1},
- debug => 1,
- });
-
-# Replace the template values with the real ones
-$template->param(SCRIPT_NAME => $script_name);
-$template->param(NUMBER_SYSTEM => $number_system);
-$template->param(PAGES => $labelConfig{'pageType'});
-$template->param(RANGE_TYPE => $rangeType);
-$template->param(LABEL_TABLE => \@labelTable);
-$template->param(COL_SPAN => $labelConfig{'columns'});
-if ($input->param('error')) {
- $template->param(ERROR => 1);
-} else {
- $template->param(ERROR => 0);
-}
-# Shows the template with the real values replaced
-output_html_with_http_headers $input, $cookie, $template->output;
+++ /dev/null
-#!/usr/bin/perl
-
-# script to generate items barcodes
-# written 07/04
-# by Veleda Matias - matias_veleda@hotmail.com - Physics Library UNLP Argentina and
-# Castañeda Sebastian - seba3c@yahoo.com.ar - Physics Library UNLP Argentina and
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
-
-require Exporter;
-
-use strict;
-
-use CGI;
-use C4::Context;
-use C4::Output;
-
-use PDF::API2;
-use PDF::API2::Page;
-use PDF::API2::PDF::Utils;
-use C4::Barcodes::PrinterConfig;
-use Time::localtime;
-
-
-# This function returns the path to deal with the correct files, considering
-# templates set and language.
-sub getPath {
- my $type = shift @_;
- my $templatesSet = C4::Context->preference('template');
- my $lang = C4::Context->preference('opaclanguages');
- if ($type eq "intranet") {
- return "$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
- } else {
- return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
- }
-}
-
-# Load a configuration file. Before use this function, check if that file exists.
-sub loadConfFromFile {
- my $fileName = shift @_;
- my %keyValues;
- open FILE, "<$fileName";
- while (<FILE>) {
- chomp;
- if (/\s*([\w_]*)\s*=\s*([\[\]\<\>\w_\s:@,\.-]*)\s*/) {
- $keyValues{$1} = $2;
- }
- }
- close FILE;
- return %keyValues;
-}
-
-# Save settings to a configuration file. It delete previous configuration settings.
-sub saveConfToFile {
- my $fileName = shift @_;
- my %keyValues = %{shift @_};
- my $i;
- open FILE, ">$fileName";
- my $i;
- foreach $i (keys(%keyValues)) {
- print FILE $i." = ".$keyValues{$i}."\n";
- }
- close FILE;
-}
-
-# Load the config file.
-my $filenameConf = &getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
-my %labelConfig = &loadConfFromFile($filenameConf);
-
-# Creates a CGI object and take its parameters
-my $cgi = new CGI;
-my $from = $cgi->param('from');
-my $to = $cgi->param('to');
-my $individualCodes = $cgi->param('individualCodes');
-my $rangeType = $cgi->param('rangeType');
-my $pageType = $cgi->param('pages');
-my $label = $cgi->param('label');
-my $numbersystem = $cgi->param('numbersystem');
-my $text_under_label = $cgi->param('text_under_label');
-
-# Generate the checksum from an inventary code
-sub checksum {
-
- sub calculateDigit {
- my $code = shift @_;
- my $sum = 0;
- my $odd_parity = 1;
- my $i;
- for ($i = length($code) - 1; $i >= 0; $i--){
- if ( $odd_parity ) {
- $sum = $sum + ( 3 * substr($code, $i, 1) );
- } else {
- $sum = $sum + substr($code, $i, 1); }
- $odd_parity = !$odd_parity;
- }
- my $check_digit = 10 - ($sum%10);
- if ($check_digit==10) {
- $check_digit=0;
- }
- return $code.$check_digit;
- }
-
- my $currentCode = shift @_;
- $currentCode = &calculateDigit($currentCode);
- return $currentCode;
-}
-
-# Assigns a temporary name to the PDF file
-sub assingFilename {
- my ($from, $to) = @_;
- my $ip = $cgi->remote_addr();
- my $random = int(rand(1000000));
- my $timeObj = localtime();
- my ($day, $month, $year, $hour, $min, $sec) = ($timeObj->mday,
- $timeObj->mon + 1,
- $timeObj->year + 1900,
- $timeObj->hour,
- $timeObj->min,
- $timeObj->sec);
- my $tmpFileName = $random.'-'.$ip.'-(From '.$from.' to '.$to.')-['.$day.'.'.$month.'.'.$year.']-['.$hour.':'.$min.':'.$sec.'].pdf';
- return $tmpFileName;
-}
-sub getCallnum {
-#grabs a callnumber for the specified barcode
-my ($barcode) = @_;
-my $query = "select dewey from items,biblioitems where items.biblionumber=biblioitems.biblionumber and items.barcode=?";
-my $dbh = C4::Context->dbh;
-my $sth = $dbh->prepare($query);
-$sth->execute($barcode);
-my ($callnum) = $sth->fetchrow_array();
-warn "Call number is:".$barcode;
-return $callnum;
-}
-# Takes inventary codes from database and if they are between
-# the interval specify by parameters, it generates the correspond barcodes
-sub barcodesGenerator {
- my ($from, $to, $rangeType, $individualCodes,$text_under_label) = @_;
- # Returns a database handler
- my $dbh = C4::Context->dbh;
- # Create the query to database
- # Assigns a temporary filename for the pdf file
- my $tmpFileName = &assingFilename($from, $to);
- # warn "range type: ".$rangeType;
- if ($rangeType eq 'continuous') {
- # Set the temp directory for pdf´s files
- if (!defined($ENV{'TEMP'})) {
- $ENV{'TEMP'} = '/tmp/';
- }
- $tmpFileName = $ENV{'TEMP'}.$tmpFileName;
- # Creates a PDF object
- my $pdf = PDF::API2->new(-file => $tmpFileName);
- # Set the positions where barcodes are going to be placed
- C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, $labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});
- C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});
- # Creates a font object
- my $tr = $pdf->corefont('Helvetica-Bold');
- # Barcode position
- my ($page, $gfx, $text);
- for (my $code=$from; $code<=$to; $code++) {
- # Generetase checksum
- my $codeC = &checksum($code);
- # Generate the corresponde barcode to $code
- # warn "Code is :-->".$codeC."<--";
- my $barcode = $pdf->barcode(-font => $tr, # The font object to use
- -type => 'ean128', # Standard of codification
- -code => $codeC, # Text to codify
- -extn => '012345', # Barcode extension (if it is aplicable)
- -umzn => 10, # Top limit of the finished bar
- -lmzn => 10, # Bottom limit of the finished bar
- -zone => 15, # Bars size
- -quzn => 0, # Space destinated for legend
- -ofwt => 0.01, # Bars width
- -fnsz => 8, # Font size
- -text => ''
- );
-
- (my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label) = C4::Barcodes::PrinterConfig::getLabelPosition(
- $label,
- $pdf,
- $page,
- $gfx,
- $text,
- $tr,
- $pageType);
- # Assigns a barcodes to $gfx
- $gfx->barcode($barcode, $x, $y , (72/$labelConfig{'systemDpi'}));
- # Assigns the additional information to the barcode (Legend)
- $text->translate($x - 48, $y - 22);
- warn "code is ".$codeC;
- if ($text_under_label) {
- $text->text($text_under_label);
- } else {
- $text->text(getCallnum($code));
- }
- }
- # Writes the objects added in $gfx to $page
- $pdf->finishobjects($page,$gfx, $text);
- # Save changes to the PDF
- $pdf->saveas;
- # Close the conection with the PDF file
- $pdf->end;
- # Show the PDF file
- print $cgi->redirect("/cgi-bin/koha/barcodes/pdfViewer.pl?tmpFileName=$tmpFileName");
- } else {
- my $rangeCondition;
- if ($individualCodes ne "") {
- $rangeCondition = "AND (I.barcode IN " . $individualCodes . ")";
- } else {
- $rangeCondition = "AND (I.barcode >= " . $from . " AND I.barcode <=" . $to . " )";
- }
- warn "above the query";
- my $query = "SELECT CONCAT('$numbersystem',REPEAT('0',((12 - LENGTH('$numbersystem')) - LENGTH(I.barcode))), I.barcode) AS Codigo, I.dewey as dewey B.title, B.author FROM biblio B, items I WHERE (I.biblionumber = B.biblioNumber ) " .$rangeCondition. " AND (I.barcode <> 'FALTA') ORDER BY Codigo";
-
- # Prepare the query
- my $sth = $dbh->prepare($query);
- # Executes the query
- $sth->execute;
- if ($sth->rows) { # There are inventary codes
- # Set the temp directory for pdf´s files
- if (!defined($ENV{'TEMP'})) {
- $ENV{'TEMP'} = '/tmp/';
- }
- # Assigns a temporary filename for the pdf file
- my $tmpFileName = &assingFilename($from, $to);
- $tmpFileName = $ENV{'TEMP'}.$tmpFileName;
- # Creates a PDF object
- my $pdf = PDF::API2->new(-file => $tmpFileName);
- # Set the positions where barcodes are going to be placed
- C4::Barcodes::PrinterConfig::setPositionsForX($labelConfig{'marginLeft'}, $labelConfig{'labelWidth'}, $labelConfig{'columns'}, $labelConfig{'pageType'});
- C4::Barcodes::PrinterConfig::setPositionsForY($labelConfig{'marginBottom'}, $labelConfig{'labelHeigth'}, $labelConfig{'rows'}, $labelConfig{'pageType'});
- # Creates a font object
- my $tr = $pdf->corefont('Helvetica-Bold');
- # Barcode position
- my ($page, $gfx, $text);
- while (my ($code,$dewey,$title,$author) = $sth->fetchrow_array) {
- # Generetase checksum
- $code = &checksum($code);
- # Generate the corresponde barcode to $code
- my $barcode = $pdf->barcode(-font => $tr, # The font object to use
- -type => 'ean13', # Standard of codification
- -code => $code, # Text to codify
- -extn => '012345', # Barcode extension (if it is aplicable)
- -umzn => 10, # Top limit of the finished bar
- -lmzn => 10, # Bottom limit of the finished bar
- -zone => 15, # Bars size
- -quzn => 0, # Space destinated for legend
- -ofwt => 0.01, # Bars width
- -fnsz => 8, # Font size
- -text => ''
- );
-
- (my $x, my $y, $pdf, $page, $gfx, $text, $tr, $label) = C4::Barcodes::PrinterConfig::getLabelPosition(
- $label,
- $pdf,
- $page,
- $gfx,
- $text,
- $tr,
- $pageType);
- # Assigns a barcodes to $gfx
- $gfx->barcode($barcode, $x, $y , (72/$labelConfig{'systemDpi'}));
- # Assigns the additional information to the barcode (Legend)
- $text->translate($x - 48, $y - 22);
- if ($text_under_label) {
- $text->text($text_under_label);
- } else {
- warn "here a dewey:".$dewey;
- $text->text(substr $dewey, 0, 30);
- $text->translate($x - 48, $y - 29);
- #$text->text(substr $author, 0, 30);
- }
- }
- # Writes the objects added in $gfx to $page
- $pdf->finishobjects($page,$gfx, $text);
- # Save changes to the PDF
- $pdf->saveas;
- # Close the conection with the PDF file
- $pdf->end;
- # Show the PDF file
- print $cgi->redirect("/cgi-bin/koha/tools/pdfViewer.pl?tmpFileName=$tmpFileName");
- } else {
- # Rollback and shows the error legend
- print $cgi->redirect("/cgi-bin/koha/tools/barcodes.pl?error=1");
- }
- $sth->finish;
- }
-}
-
-barcodesGenerator($from, $to, $rangeType, $individualCodes,$text_under_label);
+++ /dev/null
-#!/usr/bin/perl
-
-# script to set the labels configuration for the printer process.
-# written 07/04
-# by Veleda Matias - matias_veleda@hotmail.com - Physics Library UNLP Argentina and
-
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
-
-require Exporter;
-
-use strict;
-use CGI;
-use PDF::API2;
-use PDF::API2::Page;
-use PDF::API2::PDF::Utils;
-
-use C4::Context;
-use C4::Output;
-use C4::Auth;
-
-# This function returns the path to deal with the correct files, considering
-# templates set and language.
-sub getPath {
- my $type = shift @_;
- my $templatesSet = C4::Context->preference('template');
- my $lang = C4::Context->preference('opaclanguages');
- if ($type eq "intranet") {
- return "$ENV{'DOCUMENT_ROOT'}/intranet-tmpl/$templatesSet/$lang";
- } else {
- return "$ENV{'DOCUMENT_ROOT'}/opac-tmpl/$templatesSet/$lang";
- }
-}
-
-# Load a configuration file.
-sub loadConfFromFile {
- my $fileName = shift @_;
- my %keyValues;
- open FILE, "<$fileName";
- while (<FILE>) {
- chomp;
- if (/\s*([\w_]*)\s*=\s*([\[\]\<\>\w_\s:@,\.-]*)\s*/) {
- $keyValues{$1} = $2;
- }
- }
- close FILE;
- return %keyValues;
-}
-
-# Save settings to a configuration file.
-sub saveConfToFile {
- my $fileName = shift @_;
- my %keyValues = %{shift @_};
- my $i;
- open FILE, ">$fileName";
- my $i;
- foreach $i (keys(%keyValues)) {
- print FILE $i." = ".$keyValues{$i}."\n";
- }
- close FILE;
-}
-
-# Creates a CGI object and take his parameters
-my $input = new CGI;
-
-if ($input->param('saveSettings')) {
- my $labelConf = &getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
- my %newConfiguration = (pageType => $input->param('pageType'),
- columns => $input->param('columns'),
- rows => $input->param('rows'),
- systemDpi => $input->param('systemDpi'),
- labelWidth => $input->param('labelWidth'),
- labelHeigth => $input->param('labelHeigth'),
- marginBottom => $input->param('marginBottom'),
- marginLeft => $input->param('marginLeft'));
- saveConfToFile($labelConf, \%newConfiguration);
- print $input->redirect('/cgi-bin/koha/barcodes/barcodes.pl')
-}
-
-# Get the template to use
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "tools/printerConfig.tmpl",
- type => "intranet",
- query => $input,
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
- });
-
-my $filenameConf = &getPath("intranet")."/includes/labelConfig/itemsLabelConfig.conf";
-my %labelConfig = &loadConfFromFile($filenameConf);
-
-$template->param(COLUMNS => $labelConfig{'columns'});
-$template->param(ROWS => $labelConfig{'rows'});
-$template->param(SYSTEM_DPI => $labelConfig{'systemDpi'});
-$template->param(LABEL_WIDTH => $labelConfig{'labelWidth'});
-$template->param(LABEL_HEIGTH => $labelConfig{'labelHeigth'});
-$template->param(MARGIN_TOP => $labelConfig{'marginBottom'});
-$template->param(MARGIN_LEFT => $labelConfig{'marginLeft'});
-$template->param(SCRIPT_NAME => '/cgi-bin/koha/tools/printerConfig.pl');
-$template->param("$labelConfig{'pageType'}" => 1);
-output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file