<<

NAME

C4::Labels::Profile - A class for creating and manipulating profile objects in Koha

ABSTRACT

This module provides methods for creating, retrieving, and otherwise manipulating label profile objects used by Koha to create and export labels.

METHODS

new()

    Invoking the I<new> method constructs a new profile object containing the default values for a template.
    The following parameters are optionally accepted as key => value pairs:

        C<printer_name>         The name of the printer to which this profile applies.
        C<template_id>          The template to which this profile may be applied. NOTE: There may be multiple profiles which may be applied to the same template.
        C<paper_bin>            The paper bin of the above printer to which this profile applies. NOTE: printer name, template id, and paper bin must form a unique combination.
        C<offset_horz>          Amount of compensation for horizontal offset (position of text on a single label). This amount is measured in the units supplied by the units parameter in this profile.
        C<offset_vert>          Amount of compensation for vertical offset.
        C<creep_horz>           Amount of compensation for horizontal creep (tendency of text to 'creep' off of the labels over the span of the entire page).
        C<creep_vert>           Amount of compensation for vertical creep.
        C<units>                The units of measure used for this template. These B<must> match the measures you supply above or
                                bad things will happen to your document. NOTE: The only supported units at present are:
. POINT = Postscript Points (This is the base unit in the Koha label creator.)
. AGATE = Adobe Agates (5.1428571 points per)
. INCH = US Inches (72 points per)
. MM = SI Millimeters (2.83464567 points per)
. CM = SI Centimeters (28.3464567 points per)
    example:
        C<my $profile = C4::Labels::Profile->new(); # Creates and returns a new profile object>

        C<my $profile = C4::Labels::Profile->new(template_id => 1, paper_bin => 'Bypass Tray', offset_horz => 0.02, units => 'POINT'); # Creates and returns a new profile object using
            the supplied values to override the defaults>

    B<NOTE:> This profile is I<not> written to the database until save() is invoked. You have been warned!

retrieve(profile_id => $profile_id, convert => 1)

    Invoking the I<retrieve> method constructs a new profile object containing the current values for profile_id. The method returns a new object upon success and 1 upon failure.
    Errors are logged to the Apache log. One further option maybe accessed. See the examples below for further description.

    examples:

        C<my $profile = C4::Labels::Profile->retrieve(profile_id => 1); # Retrieves profile record 1 and returns an object containing the record>

        C<my $profile = C4::Labels::Profile->retrieve(profile_id => 1, convert => 1); # Retrieves profile record 1, converts the units to points and returns an object containing the record>

delete()

    Invoking the delete method attempts to delete the profile from the database. The method returns -1 upon failure. Errors are logged to the Apache log.
    NOTE: This method may also be called as a function and passed a key/value pair simply deleteing that profile from the database. See the example below.

    examples:
        C<my $exitstat = $profile->delete(); # to delete the record behind the $profile object>
        C<my $exitstat = C4::Labels::Profile::delete(profile_id => 1); # to delete profile record 1>

save()

    Invoking the I<save> method attempts to insert the profile into the database if the profile is new and update the existing profile record if the profile exists. The method returns
    the new record profile_id upon success and -1 upon failure (This avoids conflicting with a record profile_id of 1). Errors are logged to the Apache log.

    example:
        C<my $exitstat = $profile->save(); # to save the record behind the $profile object>

get_attr($attribute)

    Invoking the I<get_attr> method will return the value of the requested attribute or -1 on errors.

    example:
        C<my $value = $profile->get_attr($attribute);>

set_attr(attribute => value, attribute_2 => value)

    Invoking the I<set_attr> method will set the value of the supplied attributes to the supplied values. The method accepts key/value pairs separated by commas.

    example:
        $profile->set_attr(attribute => value);

AUTHOR

Chris Nighswonger <cnighswonger AT foundations DOT edu>

COPYRIGHT

Copyright 2009 Foundations Bible College.

LICENSE

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.

You should have received a copy of the GNU General Public License along with Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

DISCLAIMER OF WARRANTY

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.

<<