mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
#8228 Fixed print_log
This commit is contained in:
parent
90739088f4
commit
f52dc0c319
@ -343,6 +343,23 @@ sub update_conf_txt ($$$$) {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
# PRINT HELP AND CHECK ERRORS FUNCTIONS
|
||||||
|
###############################################################################
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# log wrapper
|
||||||
|
###############################################################################
|
||||||
|
sub print_log ($) {
|
||||||
|
my ($msg) = @_;
|
||||||
|
|
||||||
|
print $msg; # show message
|
||||||
|
|
||||||
|
$msg =~ s/\n+$//;
|
||||||
|
logger( $conf, "($progname) $msg", 10); # save to logging file
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Disable a entire group
|
# Disable a entire group
|
||||||
@ -759,11 +776,6 @@ sub pandora_validate_event_id ($$$) {
|
|||||||
sub pandora_update_user_from_hash ($$$$) {
|
sub pandora_update_user_from_hash ($$$$) {
|
||||||
my ($parameters, $where_column, $where_value, $dbh) = @_;
|
my ($parameters, $where_column, $where_value, $dbh) = @_;
|
||||||
|
|
||||||
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
|
|
||||||
print_log "[ERROR] This node is configured with centralized mode. To update a user go to metaconsole. \n\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value});
|
my $user_id = db_process_update($dbh, 'tusuario', $parameters, {$where_column => $where_value});
|
||||||
return $user_id;
|
return $user_id;
|
||||||
}
|
}
|
||||||
@ -990,7 +1002,7 @@ sub pandora_get_calendar_id ($$) {
|
|||||||
sub pandora_get_same_day_id ($$) {
|
sub pandora_get_same_day_id ($$) {
|
||||||
my ($dbh, $same_day) = @_;
|
my ($dbh, $same_day) = @_;
|
||||||
|
|
||||||
my $weeks = { 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8};
|
my %weeks = ('monday' => 1, 'tuesday' => 2, 'wednesday' => 3, 'thursday' => 4, 'friday' => 5, 'saturday' => 6, 'sunday' => 7, 'holiday' => 8);
|
||||||
|
|
||||||
return defined ($weeks{$same_day}) ? $weeks{$same_day} : -1;
|
return defined ($weeks{$same_day}) ? $weeks{$same_day} : -1;
|
||||||
}
|
}
|
||||||
@ -1012,25 +1024,6 @@ sub pandora_delete_special_day ($$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
###############################################################################
|
|
||||||
# PRINT HELP AND CHECK ERRORS FUNCTIONS
|
|
||||||
###############################################################################
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# log wrapper
|
|
||||||
###############################################################################
|
|
||||||
sub print_log ($) {
|
|
||||||
my ($msg) = @_;
|
|
||||||
|
|
||||||
print $msg; # show message
|
|
||||||
|
|
||||||
$msg =~ s/\n+$//;
|
|
||||||
logger( $conf, "($progname) $msg", 10); # save to logging file
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Print a parameter error and exit the program.
|
# Print a parameter error and exit the program.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -3051,10 +3044,15 @@ sub cli_create_user() {
|
|||||||
|
|
||||||
sub cli_user_update() {
|
sub cli_user_update() {
|
||||||
my ($user_id,$field,$new_value) = @ARGV[2..4];
|
my ($user_id,$field,$new_value) = @ARGV[2..4];
|
||||||
|
|
||||||
|
if(is_metaconsole($conf) != 1 && pandora_get_tconfig_token ($dbh, 'centralized_management', '')) {
|
||||||
|
print_log "[ERROR] This node is configured with centralized mode. To update a user go to metaconsole. \n\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
my $user_exists = get_user_exists ($dbh, $user_id);
|
my $user_exists = get_user_exists ($dbh, $user_id);
|
||||||
exist_check($user_exists,'user',$user_id);
|
exist_check($user_exists,'user',$user_id);
|
||||||
|
|
||||||
if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') {
|
if($field eq 'email' || $field eq 'phone' || $field eq 'is_admin' || $field eq 'language' || $field eq 'id_skin') {
|
||||||
# Fields admited, no changes
|
# Fields admited, no changes
|
||||||
}
|
}
|
||||||
@ -5537,7 +5535,7 @@ sub cli_get_agents() {
|
|||||||
|
|
||||||
my $head_print = 0;
|
my $head_print = 0;
|
||||||
|
|
||||||
use Data::Dumper;
|
# use Data::Dumper;
|
||||||
|
|
||||||
|
|
||||||
foreach my $agent (@agents) {
|
foreach my $agent (@agents) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user