@@ -258,7 +258,7 @@ public function search(Request $request, $project_key)
258258 $ limit = 10 ;
259259 }
260260
261- $ query ->take ($ limit )->orderBy ('created_at ' , 'asc ' );
261+ $ query ->take ($ limit )->orderBy ('created_at ' , 'desc ' );
262262 $ issues = $ query ->get ();
263263 return Response ()->json ([ 'ecode ' => 0 , 'data ' => parent ::arrange ($ issues ) ]);
264264 }
@@ -624,11 +624,11 @@ public function getOptions($project_key)
624624 // get project types
625625 $ types = Provider::getTypeListExt ($ project_key , [ 'user ' => $ users , 'assignee ' => $ assignees , 'state ' => $ states , 'resolution ' => $ resolutions , 'priority ' => $ priorities , 'version ' => $ versions , 'module ' => $ modules , 'epic ' => $ epics , 'labels ' => $ labels ]);
626626 // get project sprints
627- $ sprint_nos = [];
627+ $ new_sprints = [];
628628 $ sprints = Provider::getSprintList ($ project_key );
629629 foreach ($ sprints as $ sprint )
630630 {
631- $ sprint_nos [] = strval ( $ sprint ['no ' ]) ;
631+ $ new_sprints [] = [ ' no ' => $ sprint ['no ' ], ' name ' => $ sprint [ ' name ' ] ] ;
632632 }
633633 // get defined fields
634634 $ fields = Provider::getFieldList ($ project_key );
@@ -654,7 +654,7 @@ public function getOptions($project_key)
654654 'labels ' => $ labels ,
655655 'versions ' => $ versions ,
656656 'epics ' => $ epics ,
657- 'sprints ' => $ sprint_nos ,
657+ 'sprints ' => $ new_sprints ,
658658 'filters ' => $ filters ,
659659 'display_columns ' => $ display_columns ,
660660 'timetrack ' => $ timetrack ,
@@ -2130,19 +2130,26 @@ public function getOptionsForExport($project_key)
21302130 }
21312131
21322132 $ modules = [];
2133- $ module_list = Provider::getModuleList ($ project_key );
2133+ $ module_list = Provider::getModuleList ($ project_key );
21342134 foreach ($ module_list as $ module )
21352135 {
21362136 $ modules [$ module ->id ] = $ module ->name ;
21372137 }
21382138
21392139 $ epics = [];
2140- $ epic_list = Provider::getEpicList ($ project_key );
2140+ $ epic_list = Provider::getEpicList ($ project_key );
21412141 foreach ($ epic_list as $ epic )
21422142 {
21432143 $ epics [$ epic ['_id ' ]] = $ epic ['name ' ];
21442144 }
21452145
2146+ $ sprints = [];
2147+ $ sprint_list = Provider::getSprintList ($ project_key );
2148+ foreach ($ sprint_list as $ sprint )
2149+ {
2150+ $ sprints [$ sprint ['no ' ]] = $ sprint ['name ' ];
2151+ }
2152+
21462153 $ fields = [];
21472154 $ field_list = Provider::getFieldList ($ project_key );
21482155 foreach ($ field_list as $ field )
@@ -2177,6 +2184,7 @@ public function getOptionsForExport($project_key)
21772184 'versions ' => $ versions ,
21782185 'modules ' => $ modules ,
21792186 'epics ' => $ epics ,
2187+ 'sprints ' => $ sprints ,
21802188 'fields ' => $ fields ,
21812189 ];
21822190
@@ -2917,7 +2925,15 @@ public function export($project_key, $export_fields, $issues)
29172925 }
29182926 else if ($ fk == 'sprints ' )
29192927 {
2920- $ tmp [] = 'Sprint ' . implode (', ' , $ issue [$ fk ]);
2928+ $ new_sprints = [];
2929+ foreach ($ issue [$ fk ] as $ sn )
2930+ {
2931+ if (isset ($ sprints [$ sn ]))
2932+ {
2933+ $ new_sprints [] = $ sprints [$ sn ];
2934+ }
2935+ }
2936+ $ tmp [] = implode (', ' , $ new_sprints );
29212937 }
29222938 else if ($ fk == 'labels ' )
29232939 {
@@ -3168,15 +3184,15 @@ public function batchUpdate($project_key, $ids, $values)
31683184
31693185 if ($ field ->type == 'DateTimePicker ' || $ field ->type == 'DatePicker ' )
31703186 {
3171- if ($ this ->isTimestamp ($ val ) === false )
3187+ if ($ val && $ this ->isTimestamp ($ val ) === false )
31723188 {
31733189 throw new \UnexpectedValueException ('the format of datepicker field is incorrect. ' , -11122 );
31743190 }
31753191 $ updValues [$ key ] = $ val ;
31763192 }
31773193 else if ($ field ->type == 'TimeTracking ' )
31783194 {
3179- if (!$ this ->ttCheck ($ val ))
3195+ if ($ val && !$ this ->ttCheck ($ val ))
31803196 {
31813197 throw new \UnexpectedValueException ('the format of timetracking field is incorrect. ' , -11102 );
31823198 }
@@ -3207,6 +3223,17 @@ public function batchUpdate($project_key, $ids, $values)
32073223 }
32083224 $ updValues [$ key . '_ids ' ] = $ new_user_ids ;
32093225 }
3226+ else if ($ field ->type === 'Number ' || $ field ->type === 'Integer ' )
3227+ {
3228+ if ($ val === '' )
3229+ {
3230+ $ updValues [$ key ] = '' ;
3231+ }
3232+ else
3233+ {
3234+ $ updValues [$ key ] = $ field ->type === 'Number ' ? floatVal ($ val ) : intVal ($ val );
3235+ }
3236+ }
32103237 else
32113238 {
32123239 $ updValues [$ key ] = $ val ;
0 commit comments