[vhffs-dev] [2262] abort when validating objects which are not waiting for validation |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 2262
Author: gradator
Date: 2015-01-05 20:41:06 +0100 (Mon, 05 Jan 2015)
Log Message:
-----------
abort when validating objects which are not waiting for validation
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Object.pm
trunk/vhffs-api/src/Vhffs/Panel/Moderation.pm
Modified: trunk/vhffs-api/src/Vhffs/Object.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Object.pm 2014-12-14 19:18:12 UTC (rev 2261)
+++ trunk/vhffs-api/src/Vhffs/Object.pm 2015-01-05 19:41:06 UTC (rev 2262)
@@ -612,6 +612,8 @@
my $vhffs = $self->get_vhffs;
my $user = $self->get_owner;
+ return 0 if $self->get_status != Vhffs::Constants::WAITING_FOR_VALIDATION;
+
$self->set_status( Vhffs::Constants::WAITING_FOR_CREATION );
$self->set_refuse_reason( '' );
@@ -685,6 +687,8 @@
my $vhffs = $self->get_vhffs;
my $user = $self->get_owner;
+ return 0 if $self->get_status != Vhffs::Constants::WAITING_FOR_VALIDATION;
+
$self->set_status( Vhffs::Constants::VALIDATION_REFUSED );
$self->set_refuse_reason( $reason );
@@ -837,8 +841,8 @@
my $self = shift;
my $description = shift;
- return -1 unless defined $description;
- return -1 if( $self->get_status != Vhffs::Constants::VALIDATION_REFUSED );
+ return 0 unless defined $description;
+ return 0 if( $self->get_status != Vhffs::Constants::VALIDATION_REFUSED );
$self->set_description( $description );
$self->set_status( Vhffs::Constants::WAITING_FOR_VALIDATION );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Moderation.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Moderation.pm 2014-12-14 19:18:12 UTC (rev 2261)
+++ trunk/vhffs-api/src/Vhffs/Panel/Moderation.pm 2015-01-05 19:41:06 UTC (rev 2262)
@@ -71,7 +71,9 @@
return;
}
- if( defined $refuse and $message !~ /\S/) {
+ if ($object->get_status != Vhffs::Constants::WAITING_FOR_VALIDATION) {
+ $panel->add_error( gettext('Object is not waiting for validation') );
+ } elsif( defined $refuse and $message !~ /\S/) {
$panel->add_error( gettext('You have to enter a refuse reason') );
} else {
if(defined $refuse) {