[freeside-commits] freeside/FS/FS msg_template.pm, NONE, 1.1 Schema.pm, 1.222, 1.223 AccessRight.pm, 1.52, 1.53

Ivan,,, ivan at wavetail.420.am
Mon Jul 12 06:17:45 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv16951/FS/FS

Modified Files:
	Schema.pm AccessRight.pm 
Added Files:
	msg_template.pm 
Log Message:
message templates, RT#8896

--- NEW FILE: msg_template.pm ---
package FS::msg_template;

use strict;
use base qw( FS::Record );
use FS::Record qw( qsearch qsearchs );

=head1 NAME

FS::msg_template - Object methods for msg_template records

=head1 SYNOPSIS

  use FS::msg_template;

  $record = new FS::msg_template \%hash;
  $record = new FS::msg_template { 'column' => 'value' };

  $error = $record->insert;

  $error = $new_record->replace($old_record);

  $error = $record->delete;

  $error = $record->check;

=head1 DESCRIPTION

An FS::msg_template object represents a customer message template.
FS::msg_template inherits from FS::Record.  The following fields are currently
supported:

=over 4

=item msgnum

primary key

=item msgname

msgname

=item agentnum

agentnum

=item mime_type

mime_type

=item body

body

=item disabled

disabled


=back

=head1 METHODS

=over 4

=item new HASHREF

Creates a new template.  To add the template to the database, see L<"insert">.

Note that this stores the hash reference, not a distinct copy of the hash it
points to.  You can ask the object for a copy with the I<hash> method.

=cut

# the new method can be inherited from FS::Record, if a table method is defined

sub table { 'msg_template'; }

=item insert

Adds this record to the database.  If there is an error, returns the error,
otherwise returns false.

=cut

# the insert method can be inherited from FS::Record

=item delete

Delete this record from the database.

=cut

# the delete method can be inherited from FS::Record

=item replace OLD_RECORD

Replaces the OLD_RECORD with this one in the database.  If there is an error,
returns the error, otherwise returns false.

=cut

# the replace method can be inherited from FS::Record

=item check

Checks all fields to make sure this is a valid template.  If there is
an error, returns the error, otherwise returns false.  Called by the insert
and replace methods.

=cut

# the check method should currently be supplied - FS::Record contains some
# data checking routines

sub check {
  my $self = shift;

  my $error = 
    $self->ut_numbern('msgnum')
    || $self->ut_text('msgname')
    || $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
    || $self->ut_textn('mime_type')
    || $self->ut_anything('body')
    || $self->ut_enum('disabled', [ '', 'Y' ] )
  ;
  return $error if $error;

  $self->mime_type('text/html') unless $self->mime_type;

  $self->SUPER::check;
}

=back

=head1 BUGS

=head1 SEE ALSO

L<FS::Record>, schema.html from the base documentation.

=cut

1;


Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -w -d -r1.222 -r1.223
--- Schema.pm	1 Jul 2010 01:53:49 -0000	1.222
+++ Schema.pm	12 Jul 2010 13:17:42 -0000	1.223
@@ -2906,6 +2906,20 @@
       'index'       => [ [ 'billbatchnum' ], [ 'optionname' ] ],
     },
 
+    'msg_template' => {
+      'columns' => [
+        'msgnum',     'serial',     '',      '', '', '',
+        'msgname',   'varchar',     '', $char_d, '', '',
+        'agentnum',      'int', 'NULL',      '', '', '',
+        'mime_type', 'varchar',     '', $char_d, '', '',
+        'body',         'blob', 'NULL',      '', '', '',
+        'disabled',     'char', 'NULL',       1, '', '', 
+      ],
+      'primary_key' => 'msgnum',
+      'unique'      => [ ['msgname', 'mime_type'] ],
+      'index'       => [ ['agentnum'], ]
+    },
+
 
 
     # name type nullability length default local

Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -w -d -r1.52 -r1.53
--- AccessRight.pm	17 Jun 2010 02:08:52 -0000	1.52
+++ AccessRight.pm	12 Jul 2010 13:17:42 -0000	1.53
@@ -288,6 +288,9 @@
     'Edit billing events',
     { rightname=>'Edit global billing events', global=>1 },
 
+    'Edit templates',
+    { rightname=>'Edit global templates', global=>1 },
+
     'Edit inventory',
     { rightname=>'Edit global inventory', global=>1 },
   



More information about the freeside-commits mailing list