Qual: Use getNomUrl for project into list of timesheet.
This commit is contained in:
parent
4c0059266c
commit
5a0c66b9ad
@ -43,6 +43,7 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
|||||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||||
if (! $res) die("Include of main fails");
|
if (! $res) die("Include of main fails");
|
||||||
// Change this following line to use the correct relative path from htdocs
|
// Change this following line to use the correct relative path from htdocs
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/formcompany.class.php');
|
||||||
dol_include_once('/module/class/skeleton_class.class.php');
|
dol_include_once('/module/class/skeleton_class.class.php');
|
||||||
|
|
||||||
// Load traductions files requiredby by page
|
// Load traductions files requiredby by page
|
||||||
@ -60,6 +61,14 @@ if ($user->societe_id > 0)
|
|||||||
//accessforbidden();
|
//accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load object if id or ref is provided as parameter
|
||||||
|
$object=new Skeleton_Class($db);
|
||||||
|
if (($id || $ref) && $action != 'add')
|
||||||
|
{
|
||||||
|
$result=$object->fetch($id,$ref);
|
||||||
|
if ($result < 0) dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
@ -72,7 +81,6 @@ if ($action == 'add')
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$object=new Skeleton_Class($db);
|
|
||||||
/* object_prop_getpost_prop */
|
/* object_prop_getpost_prop */
|
||||||
$object->prop1=GETPOST("field1");
|
$object->prop1=GETPOST("field1");
|
||||||
$object->prop2=GETPOST("field2");
|
$object->prop2=GETPOST("field2");
|
||||||
@ -122,7 +130,7 @@ $form=new Form($db);
|
|||||||
|
|
||||||
// Put here content of your page
|
// Put here content of your page
|
||||||
|
|
||||||
// Example 1 : Adding jquery code
|
// Example : Adding jquery code
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
function init_myfunc()
|
function init_myfunc()
|
||||||
@ -138,13 +146,8 @@ jQuery(document).ready(function() {
|
|||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
// Example 2 : Adding links to objects
|
// Part to show a list
|
||||||
// The class must extends CommonObject class to have this method available
|
if ($action == 'list' || empty($id))
|
||||||
//$somethingshown=$object->showLinkedObjectBlock();
|
|
||||||
|
|
||||||
|
|
||||||
// Example 3 : List of data
|
|
||||||
if ($action == 'list')
|
|
||||||
{
|
{
|
||||||
$sql = "SELECT";
|
$sql = "SELECT";
|
||||||
$sql.= " t.rowid,";
|
$sql.= " t.rowid,";
|
||||||
@ -191,6 +194,69 @@ if ($action == 'list')
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Part to edit record
|
||||||
|
if ($id && $action == 'edit')
|
||||||
|
{
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<center><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"></center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Part to show record
|
||||||
|
if ($id && (empty($action) || $action == 'view'))
|
||||||
|
{
|
||||||
|
dol_fiche_head();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
print '<div class="tabsAction">'."\n";
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($user->rights->mymodule->write)
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->rights->mymodule->delete)
|
||||||
|
{
|
||||||
|
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span></div>'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans('Delete').'</a></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</div>'."\n";
|
||||||
|
|
||||||
|
|
||||||
|
// Example 2 : Adding links to objects
|
||||||
|
// The class must extends CommonObject class to have this method available
|
||||||
|
//$somethingshown=$object->showLinkedObjectBlock();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -741,7 +741,7 @@ class Project extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
|
||||||
* @param string $option Variant ('', 'nolink')
|
* @param string $option Variant ('', 'nolink')
|
||||||
* @param int $addlabel 0=Default, 1=Add label into string
|
* @param int $addlabel 0=Default, 1=Add label into string, >1=Add first chars into string
|
||||||
* @return string Chaine avec URL
|
* @return string Chaine avec URL
|
||||||
*/
|
*/
|
||||||
function getNomUrl($withpicto=0, $option='', $addlabel=0)
|
function getNomUrl($withpicto=0, $option='', $addlabel=0)
|
||||||
@ -773,7 +773,7 @@ class Project extends CommonObject
|
|||||||
|
|
||||||
if ($withpicto) $result.=($lien . img_object($label, $picto) . $lienfin);
|
if ($withpicto) $result.=($lien . img_object($label, $picto) . $lienfin);
|
||||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||||
if ($withpicto != 2) $result.=$lien . $this->ref . $lienfin . (($addlabel && $this->title) ? ' - ' . $this->title : '');
|
if ($withpicto != 2) $result.=$lien . $this->ref . $lienfin . (($addlabel && $this->title) ? ' - ' . dol_trunc($this->title, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@ print '</div></div></div>';
|
|||||||
// Tasks for all resources of all opened projects and time spent for each task/resource
|
// Tasks for all resources of all opened projects and time spent for each task/resource
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
|
|
||||||
$sql = "SELECT p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
|
$sql = "SELECT p.ref, p.title, p.rowid as projectid, t.label, t.rowid as taskid, u.rowid as userid, t.planned_workload, t.dateo, t.datee, SUM(tasktime.task_duration) as timespent";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
|
||||||
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
|
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
|
||||||
@ -216,7 +216,13 @@ if ( $resql )
|
|||||||
|
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td>'.$username.'</td>';
|
print '<td>'.$username.'</td>';
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$obj->projectid.'">'.$obj->title.'</a></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/fiche.php?id='.$obj->projectid.'">'.$obj->title.'</a>';
|
||||||
|
print '</td>';
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$obj->taskid.'&withproject=1">'.$obj->label.'</a></td>';
|
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$obj->taskid.'&withproject=1">'.$obj->label.'</a></td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($obj->dateo)).'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->dateo)).'</td>';
|
||||||
print '<td>'.dol_print_date($db->jdate($obj->datee)).'</td>';
|
print '<td>'.dol_print_date($db->jdate($obj->datee)).'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user