ProjectRelatedTimecardEntries
From Wikipedia
Project related times in other modules:
Project related time in module <NAME_OF_MODULE> (=todo, helpdesk, etc).
Replace <NAME_OF_MODULE> with the type of the affected module.
1. Display form:
1.1 Find out the name of the variable tht inidcates the link to a project. Usually that's $field[proj] or $field[project].
1.2 Display the form in module_forms.php
// include lib
include_once($lib_path."/timeproj.inc.php");
// string where the html will be written to
$project_specific_times = "";
// the form needs only to be displayed if the item is linked to a project
// and if the project-module is activated
if (!empty($fields['project']['value']) && PHPR_PROJECTS) {
$project_specific_times = timeproj_get_list_box($ID, '<NAME_OF_MODULE>', $user_ID);
}
// print out the form somewhere on the page
echo $project_specific_times;
2. Handle formdata:
2.1
include_once($lib_path."/timeproj.inc.php");
2.2 Actions that need to be handeled in module_data.php:
2.2.1 Modification of the project related items: add/delete:
// modify project-related times
if (isset($timeproj_add) || isset($timeproj_delete)) {
timeproj_insert_record($user_ID, $ID, $project, '<NAME_OF_MODULE>', $timeproj_add);
timeproj_delete_record($timeproj_delete);
}
2.2.2 Modification of the parent item (e.g. the todo): deletion, reassignment to new project
Delete: add the following lines to the delete_record($ID) function of the module and to all other places where the item can be deleted
// delete entry in timeproj-table
timeproj_unlink_moduletimes($ID, '<NAME_OF_MODULE>');
Modify: add the following lines to all places where the item can be updated to a new project. $project must be replaced by the variable holding the projectId
// update project-related times
timeproj_change_project_id ('<NAME_OF_MODULE>', $ID, $project);
3. Check modifications :-)

