@ -51,7 +51,7 @@ func (issue *Issue) ProjectBoardID(ctx context.Context) int64 {
func LoadIssuesFromBoard ( ctx context . Context , b * project_model . Board ) ( IssueList , error ) {
func LoadIssuesFromBoard ( ctx context . Context , b * project_model . Board ) ( IssueList , error ) {
issueList := make ( IssueList , 0 , 10 )
issueList := make ( IssueList , 0 , 10 )
if b . ID != 0 {
if b . ID > 0 {
issues , err := Issues ( ctx , & IssuesOptions {
issues , err := Issues ( ctx , & IssuesOptions {
ProjectBoardID : b . ID ,
ProjectBoardID : b . ID ,
ProjectID : b . ProjectID ,
ProjectID : b . ProjectID ,
@ -65,7 +65,7 @@ func LoadIssuesFromBoard(ctx context.Context, b *project_model.Board) (IssueList
if b . Default {
if b . Default {
issues , err := Issues ( ctx , & IssuesOptions {
issues , err := Issues ( ctx , & IssuesOptions {
ProjectBoardID : - 1 , // Issues without ProjectBoardID
ProjectBoardID : db . NoConditionID ,
ProjectID : b . ProjectID ,
ProjectID : b . ProjectID ,
SortType : "project-column-sorting" ,
SortType : "project-column-sorting" ,
} )
} )
@ -150,30 +150,3 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *user_model.U
ProjectID : newProjectID ,
ProjectID : newProjectID ,
} )
} )
}
}
// MoveIssueAcrossProjectBoards move a card from one board to another
func MoveIssueAcrossProjectBoards ( ctx context . Context , issue * Issue , board * project_model . Board ) error {
ctx , committer , err := db . TxContext ( ctx )
if err != nil {
return err
}
defer committer . Close ( )
sess := db . GetEngine ( ctx )
var pis project_model . ProjectIssue
has , err := sess . Where ( "issue_id=?" , issue . ID ) . Get ( & pis )
if err != nil {
return err
}
if ! has {
return fmt . Errorf ( "issue has to be added to a project first" )
}
pis . ProjectBoardID = board . ID
if _ , err := sess . ID ( pis . ID ) . Cols ( "project_board_id" ) . Update ( & pis ) ; err != nil {
return err
}
return committer . Commit ( )
}