Moving tasks - Forced move

The form now supports forced move when a move breaks dependencies.
This commit is contained in:
Emmanuel BENOîT 2016-01-04 11:48:36 +01:00
parent 4470e6d7d3
commit 991d1a0aa9

View file

@ -585,6 +585,11 @@ class Ctrl_TaskMove
$id = $this->form->field( 'id' ); $id = $this->form->field( 'id' );
$target = $this->form->field( 'target' ); $target = $this->form->field( 'target' );
$tasks = $this->form->field( 'tasks[]' ); $tasks = $this->form->field( 'tasks[]' );
try {
$force = ( (int) $this->getParameter( 'force' , 'POST' ) == 1 );
} catch ( ParameterException $e ) {
$force = false;
}
$tFull = $target->value( ); $tFull = $target->value( );
if ( strlen( $tFull ) < 2 ) { if ( strlen( $tFull ) < 2 ) {
@ -597,7 +602,7 @@ class Ctrl_TaskMove
$error = Loader::DAO( 'tasks' )->moveTasks( $error = Loader::DAO( 'tasks' )->moveTasks(
$type->value( ) === 's' , (int) $id->value( ) , $type->value( ) === 's' , (int) $id->value( ) ,
$toTask , $toId , $tasks->value( ) , $toTask , $toId , $tasks->value( ) ,
false ); // FIXME: should be read from the form $force );
switch ( $error ) { switch ( $error ) {
@ -621,7 +626,12 @@ class Ctrl_TaskMove
break; break;
case 5: case 5:
$tasks->putError( 'Dependencies would be broken (FIXME: force mode)' ); $tasks->putError( 'Dependencies would be broken' );
$this->form->addField( Loader::Create( 'Field' , 'force' , 'select' )
->setMandatory( false )
->setDescription( 'Break dependencies:' )
->addOption( '0' , 'No' )
->addOption( '1' , 'Yes' ) );
break; break;
default: default: