예제 #1
0
파일: index.php 프로젝트: ADDAdev/Dolibarr
     $username = $userstatic->getNomUrl(0, 0);
 }
 print "<tr " . $bc[$var] . ">";
 //print '<td>'.$username.'</td>';
 print '<td>';
 $projectstatic->id = $obj->projectid;
 $projectstatic->ref = $obj->ref;
 $projectstatic->title = $obj->title;
 print $projectstatic->getNomUrl(1, '', 16);
 //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
 print '</td>';
 print '<td>';
 if (!empty($obj->taskid)) {
     $tasktmp->id = $obj->taskid;
     $tasktmp->ref = $obj->label;
     print $tasktmp->getNomUrl(1, 'withproject');
 } else {
     print $langs->trans("NoTasks");
 }
 print '</td>';
 print '<td>' . dol_print_date($db->jdate($obj->dateo), 'day') . '</td>';
 print '<td>' . dol_print_date($db->jdate($obj->datee), 'day') . '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->planned_workload, 'all');
 print '</a></td>';
 print '<td align="right">';
 print $obj->taskid > 0 ? $obj->progress . '%' : '';
 print '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->timespent, 'all');
 print '</a></td>';
예제 #2
0
        			print '&nbsp;';
        		}
        		print '</td>';
        	}
        	// Status
        	if (! empty($arrayfields['p.fk_statut']['checked']))
        	{
        	    print '<td>';
        	    print $projectstatic->getLibStatut(1);
        	    print '</td>';
        	}
        	// Ref
        	if (! empty($arrayfields['t.ref']['checked']))
        	{
        	    print '<td>';
        	    print $taskstatic->getNomUrl(1,'withproject');
        	    print '</td>';
        	}        	 
    	    // Label
        	if (! empty($arrayfields['t.label']['checked']))
        	{
        	    print '<td>';
        	    print $taskstatic->label;
        	    print '</td>';
        	}
        	// Date start
        	if (! empty($arrayfields['t.dateo']['checked']))
        	{
				print '<td class="center">';
	    		print dol_print_date($db->jdate($obj->date_start),'day');
	    		print '</td>';
예제 #3
0
/**
 * Show task lines with a particular parent
 * @param 	$inc				Counter that count number of lines legitimate to show (for return)
 * @param 	$parent				Id of parent task to start
 * @param 	$lines				Array of all tasks
 * @param 	$level				Level of task
 * @param 	$var				Color
 * @param 	$showproject		Show project columns
 * @param	$taskrole			Array of roles of user for each tasks
 * @param	$projectsListId		List of id of project allowed to user (separated with comma)
 */
function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject, &$taskrole, $projectsListId = '')
{
    global $user, $bc, $langs;
    $lastprojectid = 0;
    $projectstatic = new Project($db);
    $taskstatic = new Task($db);
    $projectsArrayId = explode(',', $projectsListId);
    $numlines = sizeof($lines);
    $total = 0;
    for ($i = 0; $i < $numlines; $i++) {
        if ($parent == 0) {
            $level = 0;
        }
        // Process line
        // print "i:".$i."-".$lines[$i]->fk_project.'<br>';
        if ($lines[$i]->fk_parent == $parent) {
            // Show task line.
            $showline = 1;
            $showlineingray = 0;
            // If there is filters to use
            if (is_array($taskrole)) {
                // If task not legitimate to show, search if a legitimate task exists later in tree
                if (!isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent) {
                    // So search if task has a subtask legitimate to show
                    $foundtaskforuserdeeper = 0;
                    SearchTaskInChild($foundtaskforuserdeeper, $lines[$i]->id, $lines, $taskrole);
                    //print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>';
                    if ($foundtaskforuserdeeper > 0) {
                        $showlineingray = 1;
                        // We will show line but in gray
                    } else {
                        $showline = 0;
                        // No reason to show line
                    }
                }
            }
            if ($showline) {
                // Break on a new project
                if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) {
                    $var = !$var;
                    $lastprojectid = $lines[$i]->fk_project;
                }
                print "<tr " . $bc[$var] . ">\n";
                // Project
                if ($showproject) {
                    print "<td>";
                    //var_dump($taskrole);
                    if ($showlineingray) {
                        print '<i>';
                    }
                    $projectstatic->id = $lines[$i]->fk_project;
                    $projectstatic->ref = $lines[$i]->projectref;
                    $projectstatic->public = $lines[$i]->public;
                    if ($lines[$i]->public || in_array($lines[$i]->fk_project, $projectsArrayId)) {
                        print $projectstatic->getNomUrl(1);
                    } else {
                        print $projectstatic->getNomUrl(1, 'nolink');
                    }
                    if ($showlineingray) {
                        print '</i>';
                    }
                    print "</td>";
                }
                // Ref of task
                print '<td>';
                if ($showlineingray) {
                    print '<i>' . img_object('', 'projecttask') . ' ' . $lines[$i]->id . '</i>';
                } else {
                    $taskstatic->id = $lines[$i]->id;
                    $taskstatic->ref = $lines[$i]->id;
                    $taskstatic->label = $taskrole[$lines[$i]->id] ? $langs->trans("YourRole") . ': ' . $taskrole[$lines[$i]->id] : '';
                    print $taskstatic->getNomUrl(1);
                }
                print '</td>';
                // Title of task
                print "<td>";
                if ($showlineingray) {
                    print '<i>';
                } else {
                    print '<a href="' . DOL_URL_ROOT . '/projet/tasks/task.php?id=' . $lines[$i]->id . '">';
                }
                for ($k = 0; $k < $level; $k++) {
                    print "&nbsp; &nbsp; &nbsp;";
                }
                print $lines[$i]->label;
                if ($showlineingray) {
                    print '</i>';
                } else {
                    print '</a>';
                }
                print "</td>\n";
                // Progress
                print '<td align="right">';
                print $lines[$i]->progress . ' %';
                print '</td>';
                // Time spent
                print '<td align="right">';
                if ($showlineingray) {
                    print '<i>';
                } else {
                    print '<a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $lines[$i]->id . '">';
                }
                if ($lines[$i]->duration) {
                    print ConvertSecondToTime($lines[$i]->duration, 'all');
                } else {
                    print '--:--';
                }
                if ($showlineingray) {
                    print '</i>';
                } else {
                    print '</a>';
                }
                print '</td>';
                print "</tr>\n";
                if (!$showlineingray) {
                    $inc++;
                }
                $level++;
                if ($lines[$i]->id) {
                    PLines($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId);
                }
                $level--;
                $total += $lines[$i]->duration;
            }
        } else {
            //$level--;
        }
    }
    if ($total > 0) {
        print '<tr class="liste_total"><td class="liste_total">' . $langs->trans("Total") . '</td>';
        print '<td></td>';
        print '<td></td>';
        print '<td align="right" nowrap="nowrap" class="liste_total">' . ConvertSecondToTime($total) . '</td></tr>';
    }
    return $inc;
}
예제 #4
0
파일: index.php 프로젝트: Albertopf/prueba
 //print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
 print '</td>';
 if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
     print '<td>';
     $code = dol_getIdFromCode($db, $obj->opp_status, 'c_lead_status', 'rowid', 'code');
     if ($code) {
         print $langs->trans("OppStatus" . $code);
     }
     print '</td>';
 }
 print '<td>';
 if (!empty($obj->taskid)) {
     $tasktmp->id = $obj->taskid;
     $tasktmp->ref = $obj->ref;
     $tasktmp->label = $obj->label;
     print $tasktmp->getNomUrl(1, 'withproject', 'task', 1, '<br>');
 } else {
     print $langs->trans("NoTasks");
 }
 print '</td>';
 print '<td align="center">' . dol_print_date($db->jdate($obj->dateo), 'day') . '</td>';
 print '<td align="center">' . dol_print_date($db->jdate($obj->datee), 'day') . '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->planned_workload, 'allhourmin');
 print '</a></td>';
 print '<td align="right">';
 print $obj->taskid > 0 ? $obj->progress . '%' : '';
 print '</td>';
 print '<td align="right"><a href="' . DOL_URL_ROOT . '/projet/tasks/time.php?id=' . $obj->taskid . '&withproject=1">';
 print convertSecondToTime($obj->timespent, 'allhourmin');
 print '</a></td>';
    /** Overloading the doActions function : replacing the parent's function with the one below 
     *  @param      parameters  meta datas of the hook (context, etc...) 
     *  @param      object             the object you want to process (an invoice if you are in invoice module, a propale in propale's module, etc...) 
     *  @param      action             current action (if set). Generally create or edit or null 
     *  @return       void 
     */
    function formObjectOptions($parameters, &$object, &$action, $hookmanager)
    {
        global $langs, $db, $conf;
        if ((in_array('ordercard', explode(':', $parameters['context'])) || in_array('propalcard', explode(':', $parameters['context']))) && !empty($conf->of->enabled) && !empty($object->id)) {
            ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
            $is_commande = in_array('ordercard', explode(':', $parameters['context']));
            if ($is_commande) {
                $res = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "assetOf \n\t        \t\tWHERE fk_commande = " . $object->id . " AND status IN ('VALID','OPEN','CLOSE')");
                $TOfId = array();
                while ($obj = $db->fetch_object($res)) {
                    $TOfId[] = $obj->rowid;
                }
                if (!empty($TOfId)) {
                    // l'of existe déjà et est valide
                    $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\t\t\tWHERE tex.fk_of IN (" . implode(',', $TOfId) . ")");
                    if ($obj = $db->fetch_object($res)) {
                        $t = strtotime($obj->date_estimated_end);
                        print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                    } else {
                        print 'Pas de tâche ordonnancée ou restant à ordonnancer';
                    }
                } else {
                    print '<a href="javascript:simulOrdo(' . $object->id . ')">Simuler l\'ordonnancement</a>';
                }
            } else {
                print '<a href="javascript:simulOrdo(' . $object->id . ')">Simuler l\'ordonnancement</a>';
            }
            ?>
			<script type="text/javascript">
				function simulOrdo(fk_object) {
					$('td[rel="date_fin_prod"]').html("Patientez svp...");
					$.ajax({
						url:"<?php 
            echo dol_buildpath('/scrumboard/script/interface.php', 1);
            ?>
"
						,data:{
							get:'task-ordo-simulation'
							,fk_object: fk_object
							,type_object : "<?php 
            echo $is_commande ? 'order' : 'propal';
            ?>
"
							
						}
					}).done(function(data) {
						$('td[rel="date_fin_prod"]').html(data+'<?php 
            echo addslashes(img_info('Temps calculé sur base automatique avec un lancement immédiat. Ne peut être qu\'indicatif. Non contractuel'));
            ?>
');
					});
					
				}
				
			</script>
			
			</td>
			</tr>
			<?php 
        } else {
            if (in_array('projectcard', explode(':', $parameters['context']))) {
                if ($object->id > 0) {
                    ?>
				<tr>
					<td>Fin de production prévisionnelle</td>
					<td rel="date_fin_prod">
				<?php 
                    $res = $db->query("SELECT MAX(date_estimated_end) as date_estimated_end \n\t\t\t\t\tFROM " . MAIN_DB_PREFIX . "projet_task t \n\t\t\t\t\tLEFT JOIN " . MAIN_DB_PREFIX . "projet_task_extrafields tex ON (tex.fk_object=t.rowid)\n\t\t\t\t\t\tWHERE t.fk_projet = " . $object->id);
                    if ($obj = $db->fetch_object($res)) {
                        $t = strtotime($obj->date_estimated_end);
                        if ($t != '-62169987208') {
                            print dol_print_date($t, 'day') . img_info('Temps actuel présent dans l\'ordonnancement. Attention, peut-être revu à tout moment');
                        } else {
                            print 'Pas de tâche ordonnancée';
                        }
                    } else {
                        print 'Pas de tâche ordonnancée';
                    }
                    ?>
				</td></tr>
				<?php 
                }
            } else {
                if (in_array('actioncard', explode(':', $parameters['context']))) {
                    $fk_task = 0;
                    if ($action != 'create') {
                        $object->fetchObjectLinked();
                        //var_dump($object->linkedObjectsIds['task']);
                        if (!empty($object->linkedObjectsIds['task'])) {
                            list($key, $fk_task) = each($object->linkedObjectsIds['task']);
                        }
                    }
                    if ($action == 'edit' || $action == 'create') {
                        ?>
				<script type="text/javascript">
					$('#projectid').after('<span rel="fk_task"></span>');
				
					$('#projectid').change(function() {
						
						var fk_project = $(this).val();
						
						$.ajax({
							url:"<?php 
                        echo dol_buildpath('/scrumboard/script/interface.php', 1);
                        ?>
"
							,data: {
								get:"select-task"
								,fk_task:<?php 
                        echo $fk_task;
                        ?>
								,fk_project : fk_project
							}
								
						}).done(function(data) {
							$('span[rel=fk_task]').html(data);	
						});
						
						
						
						
					});
					$('#projectid').change();
				</script>	
				<?php 
                    } else {
                        dol_include_once('/projet/class/task.class.php');
                        $task = new Task($db);
                        $task->fetch($fk_task);
                        if (!empty($task->id)) {
                            ?>
				<tr>
					<td><?php 
                            echo $langs->trans('Task');
                            ?>
</td>
					<td rel="fk_task">
					<?php 
                            echo $task->getNomUrl(1) . ' ' . $task->label;
                            ?>
					</td>
				</tr>
				<?php 
                        }
                    }
                }
            }
        }
        return 0;
    }