Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #829: Under maintenance project should not get back to "Draft… #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package org.sigmah.shared.dto.referential;

/*
* #%L
* Sigmah
* %%
* Copyright (C) 2010 - 2016 URD
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/

package org.sigmah.shared.dto.referential;
/*
* #%L
* Sigmah
* %%
* Copyright (C) 2010 - 2016 URD
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/

import org.sigmah.client.i18n.I18N;
import org.sigmah.shared.command.result.Result;
Expand Down Expand Up @@ -134,6 +134,9 @@ public static Pair<Boolean, String> isValidStatusChange(final ProjectModelStatus
// "USED" status is only allowed to shift to "UNAVAILABLE" status.
return new Pair<Boolean, String>(false, I18N.CONSTANTS.usedModelStatusChangeError());

} else if (currentStatus == ProjectModelStatus.USED && !currentModel.isUnderMaintenance() && targetStatus == ProjectModelStatus.DRAFT) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test doesn't seem to match with issue description. Your line of code sends an error if a project model status which is Used and NOT under maintenance is changed to Draft. But actually, the issue appears for project model in Used and under maintenance status.

return new Pair<Boolean, String>(false, I18N.CONSTANTS.usedModelStatusChangeError());

} else {
// Others cases are all allowed.
return new Pair<Boolean, String>(true, null);
Expand Down