Go to the source code of this file.
Functions | |
| trackers_transition_get_update ($group_id) | |
| trackers_transition_get_other_field_update ($transition_id) | |
| trackers_transition_update_other_field ($transition_id, $field_name, $value_id) | |
| trackers_transition_update_item ($item_id, $transition_id_array, $changes) | |
|
|
Definition at line 65 of file transition.php. References $result, db_numrows(), and db_query(). Referenced by trackers_transition_update_item(). 00066 { 00067 $result = db_query("SELECT update_field_name,update_value_id FROM trackers_field_transition_other_field_update WHERE transition_id='".$transition_id."'"); 00068 if (!db_numrows($result)) 00069 { return false; } 00070 00071 # returning an array does not work afterward in while statements. the current workaround is 00072 # to return the result as it is. It is ugly, feel free to improve. 00073 return $result; 00074 #return db_fetch_array($result); 00075 }
|
|
|
Definition at line 26 of file transition.php. References $field_id, $from, db_fetch_array(), db_numrows(), and db_query(). Referenced by trackers_data_get_transition(). 00027 { 00028 $field_transition = array(); 00029 $field_transition_sql = "SELECT transition_id,field_id,from_value_id,to_value_id,is_allowed,notification_list ". 00030 "FROM trackers_field_transition ". 00031 "WHERE group_id='".$group_id."' AND artifact='".ARTIFACT."' "; 00032 00033 $field_transition_result = db_query($field_transition_sql); 00034 if ($field_transition_result && db_numrows($field_transition_result) > 0) 00035 { 00036 while ($this_transition = db_fetch_array($field_transition_result)) 00037 { 00038 $field_id = $this_transition['field_id']; 00039 00040 if (!array_key_exists($field_id, $field_transition)) 00041 { $field_transition[$field_id] = array(); } 00042 00043 $from = $this_transition['from_value_id']; 00044 if ($from == "0") 00045 { $from = "any"; } 00046 if (!array_key_exists($from, $field_transition[$field_id])) 00047 { $field_transition[$field_id][$from] = array(); } 00048 00049 $to = $this_transition['to_value_id']; 00050 if (!array_key_exists($to, $field_transition[$field_id][$from])) 00051 { $field_transition[$field_id][$from][$to] = array(); } 00052 00053 $field_transition[$field_id][$from][$to]['transition_id'] = $this_transition['transition_id']; 00054 $field_transition[$field_id][$from][$to]['allowed'] = $this_transition['is_allowed']; 00055 $field_transition[$field_id][$from][$to]['notification_list'] = $this_transition['notification_list']; 00056 } 00057 } 00058 return $field_transition; 00059 }
|
|
||||||||||||||||
|
Definition at line 122 of file transition.php. References $registered, $upd_list, $update, db_fetch_array(), db_query(), trackers_data_add_history(), trackers_data_get_label(), and trackers_transition_get_other_field_update(). Referenced by trackers_data_handle_update(). 00123 { 00124 # Array in which we ll store field to updates 00125 $toupdate = array(); 00126 00127 # Extract transitions updates 00128 if (is_array($transition_id_array)) 00129 { 00130 while (list(,$transition_id) = each($transition_id_array)) 00131 { 00132 # Make sure we have a valid entry 00133 if (!$transition_id) 00134 { continue; } 00135 00136 # Get list of register updated for this transition 00137 $registered = trackers_transition_get_other_field_update($transition_id); 00138 00139 # No result? skip it 00140 if (!$registered) 00141 { continue; } 00142 else 00143 { 00144 # Run the list of registered updates for this transition 00145 while ($update = db_fetch_array($registered)) 00146 { 00147 # Skip it if it already on the list to be changed 00148 if ((is_array($changes) && !array_key_exists($update['update_field_name'], $changes)) && 00149 !array_key_exists($update['update_field_name'], $toupdate)) 00150 { 00151 # Add to the list of planned updates 00152 $toupdate[$update['update_field_name']] = $update['update_value_id']; 00153 # If we close the item, update the closed_date field 00154 if ($update['update_field_name'] == 'status_id' && 00155 $update['update_value_id'] == '3') 00156 { 00157 $toupdate['close_date'] = time(); 00158 } 00159 00160 } 00161 } 00162 } 00163 00164 } 00165 00166 # Now update fields 00167 unset($upd_list); 00168 while (list($field,$value) = each($toupdate)) 00169 { 00170 if ($value) 00171 { 00172 trackers_data_add_history($field, 00173 'transition-other-field-update', 00174 $value, 00175 $item_id); 00176 fb(sprintf(_("Automatic update of %s due to transitions settings"),trackers_data_get_label($field))); 00177 $upd_list .= "$field='$value',"; 00178 $exists = 1; 00179 } 00180 } 00181 00182 if ($exists) 00183 { 00184 # Update database silently, we may have no rows to update 00185 db_query("UPDATE ".ARTIFACT." SET ".trim($upd_list, ",")." WHERE bug_id='$item_id'"); 00186 00187 } 00188 00189 00190 } 00191 00192 return true; 00193 }
|
|
||||||||||||||||
|
Definition at line 78 of file transition.php. References $sql, db_affected_rows(), db_query(), and db_result. 00079 { 00080 # If value_id is equal to 0, we are in the delete case 00081 if ($value_id == 0) 00082 { 00083 # We do not set LIMIT 1: if there were several entries for the same transition and 00084 # field name, it was a bug anyway. 00085 if (db_affected_rows(db_query("DELETE FROM trackers_field_transition_other_field_update WHERE transition_id='$transition_id' AND update_field_name='$field_name'")) > 0) 00086 { 00087 fb(_("Other Field update deleted")); 00088 return true; 00089 } 00090 00091 fb_dberror(); 00092 return false; 00093 } 00094 00095 fb("other $transition_id, $field_name, $value_id", 1); 00096 # Otherwise, we first check if there is such "other field update configured" and do 00097 # INSERT or UPDATE accordingly 00098 $id = db_result(db_query("SELECT other_field_update_id FROM trackers_field_transition_other_field_update WHERE transition_id='$transition_id' AND update_field_name='$field_name' LIMIT 1"), 00099 0, 00100 'other_field_update_id'); 00101 if ($id) 00102 { 00103 $sql = "UPDATE trackers_field_transition_other_field_update SET update_value_id='$value_id' WHERE other_field_update_id='$id'"; 00104 } 00105 else 00106 { 00107 $sql = "INSERT INTO trackers_field_transition_other_field_update (transition_id,update_field_name,update_value_id) VALUES ('$transition_id','$field_name','$value_id')"; 00108 } 00109 if (db_affected_rows(db_query($sql))) 00110 { 00111 fb_dbsuccess(); 00112 return true; 00113 } 00114 00115 fb_dberror(); 00116 return false; 00117 }
|
1.4.4