Modifying Label Creation to handle no Printer Profile existence case.
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
e09c0bb918
commit
668aabcab1
4 changed files with 33 additions and 19 deletions
|
@ -73,7 +73,9 @@
|
|||
<!-- /TMPL_LOOP -->
|
||||
</select></li>
|
||||
|
||||
<li><label for="prof_id">Profile: </label><select id="prof_id" name="prof_id">
|
||||
<li><label for="prof_id">Profile: </label>
|
||||
<!-- TMPL_IF NAME="proflist" -->
|
||||
<select id="prof_id" name="prof_id">
|
||||
<!-- TMPL_LOOP NAME="proflist" -->
|
||||
<!-- TMPL_IF NAME="selected" -->
|
||||
<option value="<!-- TMPL_VAR NAME="prof_id" -->" selected="selected">
|
||||
|
@ -81,7 +83,11 @@
|
|||
<option value="<!-- TMPL_VAR NAME="prof_id" -->">
|
||||
<!-- /TMPL_IF --><!-- TMPL_VAR NAME="printername" -->/<!-- TMPL_VAR NAME="paper_bin" --></option>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</select></li>
|
||||
</select>
|
||||
<!-- TMPL_ELSE -->
|
||||
None Defined
|
||||
<!-- /TMPL_IF -->
|
||||
</li>
|
||||
|
||||
<li><label for="fontsize">Font Size:</label> <input type="text" id="fontsize" name="fontsize" size="1" value="<!-- TMPL_VAR NAME="fontsize" -->" /></li>
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@ foreach my $prof (@prof) {
|
|||
printername => $prof->{'printername'},
|
||||
paper_bin => $prof->{'paper_bin'}} );
|
||||
}
|
||||
|
||||
elsif ( !$prof ) {
|
||||
undef @proflist;
|
||||
}
|
||||
}
|
||||
|
||||
my @units = (
|
||||
|
|
|
@ -127,27 +127,31 @@ drawbox( ($left_margin), ($top_margin), ($page_width-(2*$left_margin)), ($page_h
|
|||
# Suggested proceedure: Adjust margins until both top and left margins are correct. Then adjust the label
|
||||
# height and width to correct label creep across and down page. Units are PostScript Points (72 per inch).
|
||||
|
||||
warn "Active profile: $profile->{'prof_id'}" if $DEBUG;
|
||||
warn "Active profile: " . ($profile->{'prof_id'}?$profile->{'prof_id'}:"None") if $DEBUG;
|
||||
|
||||
if ( $DEBUG ) {
|
||||
warn "-------------------------INITIAL VALUES-----------------------------";
|
||||
warn "top margin = $top_margin points\n";
|
||||
warn "left margin = $left_margin points\n";
|
||||
warn "label height = $label_height points\n";
|
||||
warn "label width = $label_width points\n";
|
||||
warn "-------------------------INITIAL VALUES-----------------------------";
|
||||
warn "top margin = $top_margin points\n";
|
||||
warn "left margin = $left_margin points\n";
|
||||
warn "label height = $label_height points\n";
|
||||
warn "label width = $label_width points\n";
|
||||
}
|
||||
|
||||
$top_margin = $top_margin + $profile->{'offset_vert'}; # controls vertical offset
|
||||
$label_height = $label_height + $profile->{'creep_vert'}; # controls vertical creep
|
||||
$left_margin = $left_margin + $profile->{'offset_horz'}; # controls horizontal offset
|
||||
$label_width = $label_width + $profile->{'creep_horz'}; # controls horizontal creep
|
||||
if ( $profile->{'prof_id'} ) {
|
||||
$top_margin = $top_margin + $profile->{'offset_vert'}; # controls vertical offset
|
||||
$label_height = $label_height + $profile->{'creep_vert'}; # controls vertical creep
|
||||
$left_margin = $left_margin + $profile->{'offset_horz'}; # controls horizontal offset
|
||||
$label_width = $label_width + $profile->{'creep_horz'}; # controls horizontal creep
|
||||
}
|
||||
|
||||
if ( $DEBUG ) {
|
||||
warn "-------------------------ADJUSTED VALUES-----------------------------";
|
||||
warn "top margin = $top_margin points\n";
|
||||
warn "left margin = $left_margin points\n";
|
||||
warn "label height = $label_height points\n";
|
||||
warn "label width = $label_width points\n";
|
||||
if ( $DEBUG && $profile->{'prof_id'} ) {
|
||||
warn "-------------------------ADJUSTED VALUES-----------------------------";
|
||||
warn "top margin = $top_margin points\n";
|
||||
warn "left margin = $left_margin points\n";
|
||||
warn "label height = $label_height points\n";
|
||||
warn "label width = $label_width points\n";
|
||||
} elsif ( $DEBUG ) {
|
||||
warn "No profile associated so no adjustment applied.";
|
||||
}
|
||||
|
||||
my $item;
|
||||
|
|
|
@ -43,7 +43,7 @@ SaveTemplate(
|
|||
|
||||
);
|
||||
|
||||
SetAssociatedProfile( $prof_id, $tmpl_id );
|
||||
SetAssociatedProfile( $prof_id, $tmpl_id ) if $prof_id;
|
||||
|
||||
print $query->redirect("./label-templates.pl");
|
||||
|
||||
|
|
Loading…
Reference in a new issue