# Where are the Variables defined?

**URL:** <https://kanboard.discourse.group/t/where-are-the-variables-defined/3084>\
**Category:** Open Discussions\
**Created:** [March 20, 2024, 10:43am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084 "2024-03-20T10:43:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 20, 2024, 10:43am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/1 "2024-03-20T10:43:30Z")

</div>

Hi everyone,  
i am new in kanboard and as well as in Programming. Can someone help me plz where is the Variable dest\_column\_id defined? in the Class TaskmoveColumnAssigned.php.

farthermore I wanna duplicate a task in other projekt I will post my code below. The goal is to have a destination Column in which the task in other Projekt duplicated. i have tryed but its not working. I appreciate any help. tnx

public function getActionRequiredParameters()  
{  
return array(  
‘column\_id’ =\> t(‘Column’),  
‘project\_id’ =\> t(‘Project’),  
‘dst\_column\_id’ =\> t(‘Destination Column’),  
);  
}

```
/**
 * Get the required parameter for the event
 *
 * @access public
 * @return string[]
 */
public function getEventRequiredParameters()
{
    return array(
        'task_id',
        'task' => array(
            'project_id',
            'column_id',
            'dst_column_id'
            
        )
    );
}

/**
 * Execute the action (duplicate the task to another project)
 *
 * @access public
 * @param array $data Event data dictionary
 * @return bool True if the action was executed or false when not executed
 */
public function doAction(array $data)
{
    $destination_column_id = $this->columnModel->getAll($this->getParam('project_id'));
    return (bool) $this->taskProjectDuplicationModel->duplicateToProject(
        $data['task_id'],
        $this->getParam('project_id'),
        null,
         $destination_column_id 
    ); 
}

/**
 * Check if the event data meet the action condition
 *
 * @access public
 * @param array $data Event data dictionary
 * @return bool
 */
public function hasRequiredCondition(array $data)
{
    if( $data['task']['column_id'] == $this->getParam('column_id') &&
        $data['task']['project_id'] != $this->getParam('project_id') &&
        $data['task']['dst_column_id'] != $this->getParam('column_id')&&
        $data['task']['project_id'] != $this->getParam('project_id')
)
{

```

return true;  
}  
return false;  
}  
}

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 20, 2024, 2:43pm UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/2 "2024-03-20T14:43:47Z")

</div>

> [@khan](#):
>
> dest\_column\_id

The **dest\_column\_id** either an array key or a parameter.

Maybe not an easy topic to start programming.

> **[PHP Associative Arrays](https://www.w3schools.com/php/php_arrays_associative.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

---

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 20, 2024, 2:57pm UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/3 "2024-03-20T14:57:17Z")

</div>

tnx for the reply sir do u have any Idea?  
what I am doing wrong in the code that i had posted before. I defined a Destination Column and the target is that I wanna duplicate a Task in a specific project and in a specific Column.

for example duplicating the task  
source column: Ready  
project : any project of choice  
Destination Column: done

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 21, 2024, 7:42am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/4 "2024-03-21T07:42:06Z")

</div>

Your code snippet is incomplete and not well formatted. Please try to edit your post or publish a link where your code can be reviewed and/or fixed.

- BTW, what exactly fails? Any errors?
- Did you register this action properly?
- …

---

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 21, 2024, 9:44am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/5 "2024-03-21T09:44:50Z")

</div>

> **[GitHub - LBAK420/Kanboard-Duplicate-a-Task: Duplicated a Task To a specific...](https://github.com/LBAK420/Kanboard-Duplicate-a-Task)**
>
> Duplicated a Task To a specific Column of the Choice Project - GitHub - LBAK420/Kanboard-Duplicate-a-Task: Duplicated a Task To a specific Column of the Choice Project

it gives me no error. The problem is on the user interface in the Destination Column it show me the Standard Column not the Columns of the choice Project that i had chosen.  
The Action is already registered i wanna only make some changes in it.

---

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 21, 2024, 11:36am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/6 "2024-03-21T11:36:11Z")

</div>

do u have any solution for me Sir @alfredb that i can solve the problem?

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 21, 2024, 3:48pm UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/7 "2024-03-21T15:48:58Z")

</div>

Yes, I took a little more time than I expected. Here is my solution:

```diff
diff --git a/TaskDuplicateAnotherProject.php b/TaskDuplicateAnotherProject.php
index f4e7cd0..2274b59 100644
--- a/TaskDuplicateAnotherProject.php
+++ b/TaskDuplicateAnotherProject.php
@@ -66,8 +66,6 @@ class TaskDuplicateAnotherProject extends Base
             'task' => array(
                 'project_id',
                 'column_id',
-               
-                
             )
         );
     }
@@ -81,15 +79,15 @@ class TaskDuplicateAnotherProject extends Base
      */
     public function doAction(array $data)
     {
-
- $destination_column_id = $this->columnModel->getAll($this->getParam('project_id'));
+ // This will return an array of ids, not a single id!
+ // $destination_column_id = $this->columnModel->getAll($this->getParam('project_id'));
         return (bool) $this->taskProjectDuplicationModel->duplicateToProject(
- $data['task_id'],
- $this->getParam('project_id'),
- $this->getParam('dest_column_id'),
- null,
- $destination_column_id 
- );  
+ $data['task_id'], // task
+ $this->getParam('project_id'), // project
+ // $this->getParam('dest_column_id'), // WRONG, misplaced
+ null, // swimline
+ $this->getParam('dest_column_id') // dest column
+ );
     }
 
     /**
@@ -101,13 +99,10 @@ class TaskDuplicateAnotherProject extends Base
      */
     public function hasRequiredCondition(array $data)
     {
- error_log(print_r($data, TRUE));
- return false;
- return $data['task']['column_id'] == $this->getParam('column_id') &&
- $data['task']['project_id'] != $this->getParam('project_id')&&
- $data['task']['column_id'] != $this->getParam('dest_column_id');
-         
-
+ return
+ $data['task']['column_id'] == $this->getParam('column_id') &&
+ $data['task']['project_id'] != $this->getParam('project_id') &&
+ ;
     }
-    
+
 }

```

This works as it should.  
But the fixing the definition dialog is another, more difficult story. Remaining things to do/solve:

- The selector for _dest\_column\_id_ still shows the column list of the actual project, rather than from the selected target project.
- Whenever the project selection changes, the column list must be updated. This needs JavaScript, I guess.

I’ll have another look, whenever I find some time.

---

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 22, 2024, 1:37pm UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/8 "2024-03-22T13:37:36Z")

</div>

tnx for the solution I had tryed same thing before but unfortunately it did not worked as I wished. For sure to make it dynamic it need javascript. And I think I have to make a column for destination column in the table of Column. I mean i have to insert a query

---

<div class="post-metadata">

**Author:** ![alfredb](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/alfredb/32/1051_2.png) [@alfredb](https://kanboard.discourse.group/u/alfredb)\
**Post date:** [March 22, 2024, 2:12pm UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/9 "2024-03-22T14:12:04Z")

</div>

> [@khan](#):
>
> And I think I have to make a column for destination column in the table of Column. I mean i have to insert a query

This I don’t understand. Why? More details, please.

And always keep in mind, that you should **NEVER** modify any Kanboard code directly. This is considered as a bad practice.

---

<div class="post-metadata">

**Author:** ![khan](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@khan](https://kanboard.discourse.group/u/khan)\
**Post date:** [March 26, 2024, 7:48am UTC](https://kanboard.discourse.group/t/where-are-the-variables-defined/3084/10 "2024-03-26T07:48:23Z")

</div>

I thought that I have to insert a destination Column in Column but I was wrong. tnx for Advice I won’t modefiy the code directly any more.
