Actualizacion de steps y reordenamiento

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-02-21 10:27:18 -04:00
parent 71d2fb889e
commit eb4347e36c
2 changed files with 27 additions and 7 deletions

View File

@@ -1949,18 +1949,39 @@ class Task
foreach ($aSteps as $dataStep) { foreach ($aSteps as $dataStep) {
if ((in_array($dataStep['step_position'], $range)) && ($dataStep['step_uid'] != $step_uid)) { if ((in_array($dataStep['step_position'], $range)) && ($dataStep['step_uid'] != $step_uid)) {
$stepChangeIds[] = $dataStep['step_uid']; $stepChangeIds[] = $dataStep['step_uid'];
$stepChangePos[] = $dataStep['step_position'];
} }
} }
foreach ($stepChangeIds as $value) { foreach ($stepChangeIds as $key => $value) {
if ($modPos == 'UP') { if ($modPos == 'UP') {
G::pr("Cambiar el step $value por un pos mas bajo"); $tempPos = ((int)$stepChangePos[$key])-1;
$this->changePosStep($value, $tempPos);
} else { } else {
G::pr("Cambiar el step $value por un pos mas alto"); $tempPos = ((int)$stepChangePos[$key])+1;
$this->changePosStep($value, $tempPos);
} }
} }
G::pr("Cambiar el step $step_uid por un pos $newPos"); $this->changePosStep($step_uid, $newPos);
die; }
/**
* Validate Process Uid
* @var string $pro_uid. Uid for process
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return string
*/
public function changePosStep ($step_uid, $pos)
{
$data = array(
'STEP_UID' => $step_uid,
'STEP_POSITION' => $pos
);
$oStep = new \Step();
$oStep->update($data);
} }
/** /**

View File

@@ -120,7 +120,6 @@ class Activity extends Api
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid")); $task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
$response = $task->getSteps($act_uid); $response = $task->getSteps($act_uid);
return $response; return $response;
} catch (\Exception $e) { } catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
@@ -161,7 +160,7 @@ class Activity extends Api
* *
* @return void * @return void
* *
* @url GET /:prj_uid/activity/:act_uid/step-move/:step_uid/:step_uid_rel/:type_change * @url PUT /:prj_uid/activity/:act_uid/step-move/:step_uid/:step_uid_rel/:type_change
*/ */
public function doPutStepsMoves ($prj_uid, $act_uid, $step_uid, $step_uid_rel, $type_change) public function doPutStepsMoves ($prj_uid, $act_uid, $step_uid, $step_uid_rel, $type_change)
{ {