Initial commit.
This commit is contained in:
71
lib/perl5/Selima/ListPref/AcctReps.pm
Normal file
71
lib/perl5/Selima/ListPref/AcctReps.pm
Normal file
@@ -0,0 +1,71 @@
|
||||
# Selima Website Content Management System
|
||||
# AcctReps.pm: The accounting report list preference administration.
|
||||
|
||||
# Copyright (c) 2007-2018 imacat.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Author: imacat <imacat@mail.imacat.idv.tw>
|
||||
# First written: 2007-10-01
|
||||
|
||||
package Selima::ListPref::AcctReps;
|
||||
use 5.008;
|
||||
use strict;
|
||||
use warnings;
|
||||
use base qw(Selima::ListPref);
|
||||
|
||||
use Fcntl qw(:flock);
|
||||
|
||||
use Selima::CallForm;
|
||||
use Selima::DataVars qw($DBH);
|
||||
use Selima::HTTP;
|
||||
|
||||
use Selima::Checker::ListPref;
|
||||
use Selima::Processor::ListPref::AcctReps;
|
||||
|
||||
# main: Change the list preference
|
||||
sub main : method {
|
||||
local ($_, %_);
|
||||
my ($self, $error, $processor);
|
||||
$self = $_[0];
|
||||
# Lock the necessary tables
|
||||
$DBH->lock("userpref" => LOCK_EX);
|
||||
|
||||
$error = $self->_check_post();
|
||||
# If an error occurs
|
||||
if (defined $error) {
|
||||
$$error{"isform"} = 0;
|
||||
error_redirect $error;
|
||||
|
||||
# Else, save the data
|
||||
} else {
|
||||
$processor = new Selima::Processor::ListPref::AcctReps($self->{"form"});
|
||||
$processor->process;
|
||||
http_303 $self->{"referer"};
|
||||
}
|
||||
}
|
||||
|
||||
# _check_post: Check the list preference form
|
||||
sub _check_post : method {
|
||||
local ($_, %_);
|
||||
my ($self, $checker, $error);
|
||||
$self = $_[0];
|
||||
# Run the checker
|
||||
$checker = new Selima::Checker::ListPref($self->{"form"});
|
||||
$error = $checker->check(qw(domain listsize));
|
||||
return $error if defined $error;
|
||||
# OK
|
||||
return;
|
||||
}
|
||||
|
||||
return 1;
|
||||
Reference in New Issue
Block a user