From: rettenbe Date: Thu, 21 Feb 2008 15:06:27 +0000 (+0000) Subject: timestamp updates at jobdb are forbidden while status is 'processing' X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d933a72ec7a51a698e7b91b94d2f24df2228f7aa;p=gosa.git timestamp updates at jobdb are forbidden while status is 'processing' git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9029 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/GosaPackages.pm b/gosa-si/modules/GosaPackages.pm index 772955f12..14c5209ae 100644 --- a/gosa-si/modules/GosaPackages.pm +++ b/gosa-si/modules/GosaPackages.pm @@ -531,25 +531,29 @@ sub update_status_jobdb_entry { # conditions # no timestamp update if status eq waiting - + my $res_hash = $main::job_db->select_dbentry("SELECT * FROM $table $where AND status='processing' "); + if( (0 != keys(%$res_hash)) && ($update =~ /timestamp/i) ) { + $error ++; + $out_xml = "1there is no timestamp update allowed while status is 'processing'"; + } + + if( $error == 0 ) { + my $sql_statement = "UPDATE $table $update $where"; + # execute db query + my $db_res = $main::job_db->update_dbentry($sql_statement); - my $sql_statement = "UPDATE $table $update $where"; -print STDERR "================================================\n"; -print STDERR "$sql_statement\n"; - # execute db query - my $db_res = $main::job_db->update_dbentry($sql_statement); + # check success of db update + if( not $db_res > 0 ) { $error++; }; - # check success of db update - if( not $db_res > 0 ) { $error++; }; + } } if( $error == 0) { - $out_xml = "
answer
$server_addressGOSA0
"; + $out_xml = "0"; } - my @out_msg_l = ( $out_xml ); - -print STDERR $out_xml."\n"; - + + my $out_msg = sprintf("
answer
%sGOSA%s
", $server_address, $out_xml); + my @out_msg_l = ( $out_msg ); return @out_msg_l; } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index f2c316851..02efe6cb9 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -30,6 +30,7 @@ if($sock->connected()){ $data = "
gosa_reload_ldap_config
GOSA00:1B:77:04:8A:6C
"; # update +$data = "
gosa_update_status_jobdb_entry
GOSAGOSA 00:01:6c:9d:b9:fa 23450101000000XXXXXXXXXXXXXXx
"; #$data = "
gosa_update_status_jobdb_entry
GOSAGOSA waiting processing update
"; # query @@ -60,7 +61,7 @@ $data = "
gosa_reload_ldap_config
GOSAwrite($data);