NAME

Liz::FlavioSet - FlavioSet module


SYNOPSIS

 use Liz::FlavioSet;

 $flavioset = new Liz::FlavioSet;


EXAMPLES

 #!/usr/local/bin/perl

 use Liz::FlavioSet;


DESCRIPTION

The Liz::FlavioSet package allows for very simple storage of sets of flavio's (a virtual currency). As such it can function as a database for transactions associated with a client or a project.


Incorporate into Client Module

The Liz::FlavioSet module itself works best when incorporated into a client module because it moves the responsibility of aquiring a connection to a database to the client module and it allows any customisation to take place transparently to the developer.

Take for example the FlavioSet method of HN.pm module:

 sub FlavioSet {

 # Obtain the parameters
 # Start the set using the $client handle as the database handle
 # Return the finished object

 my( $client,$token ) = @_;
 my( $flavioset ) = Liz::FlavioSet->new( $token,$client );
 $flavioset;
 }

Because of the above code in HN.pm, it is now possible to write the following code:

 $client = new HN;
 $flavioset = $client->FlavioSet( 'intra-office' );

Note that the database connection of the flavioset is hidden in the creation of the $client object.


CLASS METHODS

The following methods can be called without an object specification, but as a class method such as Liz::FlavioSet->method().


flaviosets

Return list of file identification names of all flaviosets in the database specified. Usually not called by itself, but rather incorporated inside a Client Module.

Input Parameters

 1 Liz::SQL compatible handle or reference to routine that performs connect
   (default: &Connect from caller's namespace)
 2 wildcard specification to match
   (default: all)
Output Parameters

 1 reference to list of identification names in the current database
 2 reference to hash with full names
Example

 $client = new HN;
 ($id,$name) = $client->FlavioSets;
 $flaviosets = @{$id};
 print "All $flaviosets flaviosets in Hospitality Net:\n";
 foreach( @{$id} ) {
   print " FlavioSet '$$name{$_}' ($_)\n";
 }

In HN.pm:

 sub FlavioSets { Liz::FlavioSet->flaviosets( @_ ) }


new

Create a new Liz::FlavioSet object. Creates connection or re-establishes connection with the MySQL database. Usually not called by itself, but rather incorporated inside a Client Module.

Input Parameters

 1 identification name of file set
   (default: default file set for database)
 2 Liz::SQL compatible handle or reference to routine that performs connect
   (default: &Connect from caller's namespace)
Output Parameters

 1 instantiated object
 2 flag: whether the FlavioSet was just created
Example

 $client = new HN;
 $file = $client->FlavioSet( 'technology' );

In HN.pm:

 sub FlavioSet { Liz::FlavioSet->new( $_[1],$_[0] ) }


CONTENT METHODS

The following methods allow changes to information that is associated with an entire flavioset.


AddTransaction

Quickly add a transaction to an FlavioSet without having to open a separate Liz::FlavioSet::Transaction object.

Input Parameters

 1 amount
 2 creditorID
 3 debtorID
 4 description
   (default: none)
 5 options
   (default: none)
 6 status
   (default: 0, between 0..255)
Output Parameters

 1 ID with which the Transaction was created
Example

 $vsb->FlavioSet( 'folders' )->AddTransaction( $amount,$contactID,$self );


Name

Specify or return the current name of the flavioset object. The name can be anything to further identify the goal of the flavioset.

Input Parameters

 1 new name of flavioset
   (default: no change)
Output Parameters

 1 current/old name of flavioset
Example

 $xxlink = new xxLINK;
 $flavioset = $xxlink->FlavioSet( 'eurest' );
 $flavioset->Name( 'Eurestjes' );


TRANSACTION METHODS

The following methods allow changes to a single transaction in a FlavioSet.


Transaction

Create a new Liz::FlavioSet::Transaction object, either from existing information or for a new entry. For more documentation, see the Liz::FlavioSet::Transaction object itself.

Input Parameters

 1 ID to create Transaction object with
   (default: none = new file)
Output Parameters

 1 instantiated Transaction object
Example

 $client = new HN;
 $flavioset = $client->FlavioSet( 'technology' );

 $transaction = $flavioset->Transaction;
 $transaction = $flavioset->Transaction( $transactionID );


List

Return an SQL statement handle for a list of transactions.

The following fields may be specified with the 2nd parameter:

 ID
 The ID of the transaction

 amount
 Amount of the transaction

 creditorID
 The ID of the creditor of the transaction

 debtorID
 The ID of the debtor of the transaction

 description
 The description of the transaction

 IP
 Packed IP-number of creditor

 created
 Timestamp value when this transaction was created

 updated
 Timestamp when the transaction was last updated

 options
 Options associated with the transaction

 status
 The status of this transaction
Input Parameters

 1 fields to return (comma delimited)
   (default: 'ID,amount,creditorID,debtorID,description,IP,created,updated,options,status' );
 2 fieldname on which to order the result
   (default: 'created')
 3 extra condition to be applied
   (default: none)
Output Parameters

 1 SQL statement handle (on which method "fetchrow" can be applied)


OCASet

Return the OCASet object that is associated with the FlavioSet for external contacts and clients. Since there are direct methods for creating Contact and Organization, this is mainly an internal method.

Output Parameters

 1 OCASet object
Example

 $xxlink = new xxLINK;
 $flavioset = $xxlink->FlavioSet;
 $ocaset = $flavioset->OCASet;


Contact

Create a new Liz::FlavioSet::Contact object, either from existing information or for a new entry. For more documentation, see the Liz::OCASet::Contact object itself.

Input Parameters

 1 ID/lastname to create Contact object with
   (default: none = new contact)
 2 firstname to create Contact object with
   (default: none)
 3 prefix to create Contact object with
   (default: none)
 4 sortname of contact (name on which contact should be sorted)
   (default: same as name if 1st parameter is name)
Output Parameters

 1 instantiated Liz::FlavioSet::Contact object
Example

 $xxlink = new xxLINK;
 $flavioset = $xxlink->FlavioSet;

 $contact = $flavioset->Contact;
 $contact = $flavioset->Contact( 'Mattijsen','Elizabeth' );
 $contact = $flavioset->Contact( $contactID );


Organization

Create a new Liz::FlavioSet::Organization object, either from existing information or for a new entry. For more documentation, see the Liz::OCASet::Organization object itself.

Input Parameters

 1 ID/name to create Organization object with
   (default: none = new organization)
 2 sortname of organization (name on which organization should be sorted)
   (default: same as name if 1st parameter is name)
Output Parameters

 1 instantiated Liz::FlavioSet::Organization object
Example

 $xxlink = new xxLINK;
 $flavioset = $xxlink->FlavioSet;

 $organization = $flavioset->Organization;
 $organization = $flavioset->Organization( $organizationID );


Contacts

Return an SQL-statement(-like) handle that contains a selection of the Contacts available in the FlavioSet. The following field names can be specified with the first parameter:

 ID
 The ID of the Contact.  Can be used as parameter on the L<Contact>
 method.

 email
 The email address of the Contact, e.g. 'wendy@xxLINK.nl'.

 name
 The name (either last name or complete name, depending on implementation)
 of the Contact, e.g. 'Dijk'.

 firstname
 The first name of the Contact, e.g. 'Wendy'.

 prefix
 The prefix of the last name of the Contact, e.g. 'van'.

 phone
 The phone number of the Contact.

 fax
 The fax number of the Contact.

 status
 The status of the Contact: this can be any number between 0 and 255 inclusive.
 Status 255 usually means "automatic addition, should be reviewed".

 updated
 Timestamp when the Contact record was last updated in the database.

 created
 Timestamp when the Contact record was created in the database.

 sortname
 The string on which the Contact can be sorted.  It usually consists of
 the name field, followed by the firstname and prefix field, all in
 lowercase and with all non-alphanumeric characters removed.

 addressID
 The ID of the Address information of the Contact.  If non-zero, can be
 used to create an L<Address> object with.

 organizationID
 The ID of the Organization information of the Contact.  If non-zero, can be
 used to create an L<Organization> object with.

 genderID
 The ID of the Gender of the Contact.  Can be changed to the appropriate
 string by using the L<IDs2Strings> method.

 titleID
 The ID of the Title of the Contact.  Can be changed to the appropriate
 string by using the L<IDs2Strings> method.

 positionID
 The ID of the Position of the Contact.  Can be changed to the appropriate
 string by using the L<IDs2Strings> method.

 options
 The Options associated with the Contact.  Meaning of the options is
 entirely up to the implementation.

 data
 The extra Data associated with the Contact.  Meaning of the data is
 entirely up to the implementation.
Input Parameters

 1 fields to return for each Contact, seperated by comma's
   (default: 'ID,email,name,firstname,prefix,phone,fax,status,updated,created,sortname,addressID,organizationID,genderID,titleID,positionID,options,data')
 2 extra SQL condition to apply
   (default: none)
 3 order in which to return the finds
   (default: sortname)
 4 which records should be returned
   (default: all )
Output Parameters

 1 SQL-like statement handle (on which method "fetchrow" can be applied)
Examples

 $result = $flavioset->Contacts;
 $result = $flavioset->Contacts( 'firstname,prefix,name,email','status=255' );


Organizations

Return an SQL-statement(-like) handle that contains a selection of the Organizations available in the FlavioSet. The following field names can be specified with the first parameter:

 ID
 The ID of the Organization.  Can be used as parameter on the L<Organization>
 method.

 email
 The email address of the Organization, e.g. 'info@xxLINK.nl'.

 name
 The name of the Organization, e.g. 'xxLINK Internet Services'.

 phone
 The phone number of the Organization.

 fax
 The fax number of the Organization.

 status
 The status of the Organization: this can be any number between 0 and 255
 inclusive.  Status 255 usually means "automatic addition, should be reviewed".

 updated
 Timestamp when the Organization record was last updated in the database.

 created
 Timestamp when the Organization record was created in the database.

 sortname
 The string on which the Organization can be sorted.  It usually consists of
 the name field in lowercase and with all non-alphanumeric characters removed.

 addressID
 The ID of the Address information of the Organization.  If non-zero, can be
 used to create an L<Address> object with.

 contactID
 The ID of the main Contact information of the Organization.  If non-zero,
 can be used to create a L<Contact> object with.

 typeID
 The ID of the Type of the Organization.  Can be changed to the appropriate
 string by using the L<IDs2Strings> method.

 options
 The Options associated with the Organization.  Meaning of the options is
 entirely up to the implementation.

 data
 The extra Data associated with the Organization.  Meaning of the data is
 entirely up to the implementation.
Input Parameters

 1 fields to return for each Organization, seperated by comma's
   (default: 'ID,email,name,phone,fax,status,updated,created,sortname,addressID,contactID,typeID,options,data')
 2 extra SQL condition to apply
   (default: none)
 3 order in which to return the finds
   (default: sortname)
 4 which records should be returned
   (default: all )
Output Parameters

 1 SQL-like statement handle (on which method "fetchrow" can be applied)
Examples

 $result = $flavioset->Organizations;
 $result = $flavioset->Organizations( 'name,email','status=255' );


AUTHOR

Elizabeth Mattijsen ( lizperl@INC.nl )


COPYRIGHT

(C) 2000 International Network Consultants


HISTORY

Version 0.10, 18 April 2000

First version of this true Perl module.