diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php
index 7b625066390..fecd48637ed 100644
--- a/dev/skeletons/skeleton_page.php
+++ b/dev/skeletons/skeleton_page.php
@@ -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) die("Include of main fails");
// 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');
// Load traductions files requiredby by page
@@ -60,6 +61,14 @@ if ($user->societe_id > 0)
//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;
- $object=new Skeleton_Class($db);
/* object_prop_getpost_prop */
$object->prop1=GETPOST("field1");
$object->prop2=GETPOST("field2");
@@ -122,7 +130,7 @@ $form=new Form($db);
// Put here content of your page
-// Example 1 : Adding jquery code
+// Example : Adding jquery code
print '';
-// Example 2 : Adding links to objects
-// The class must extends CommonObject class to have this method available
-//$somethingshown=$object->showLinkedObjectBlock();
-
-
-// Example 3 : List of data
-if ($action == 'list')
+// Part to show a list
+if ($action == 'list' || empty($id))
{
$sql = "SELECT";
$sql.= " t.rowid,";
@@ -191,6 +194,69 @@ if ($action == 'list')
+// Part to edit record
+if ($id && $action == 'edit')
+{
+ dol_fiche_head();
+
+ print '
';
+
+ dol_fiche_end();
+}
+
+
+
+// Part to show record
+if ($id && (empty($action) || $action == 'view'))
+{
+ dol_fiche_head();
+
+
+
+ dol_fiche_end();
+
+
+ // Buttons
+ print ''."\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 '
'."\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 '
'.$langs->trans('Delete').'
'."\n";
+ }
+ else
+ {
+ print '
'."\n";
+ }
+ }
+ }
+ print '
'."\n";
+
+
+ // Example 2 : Adding links to objects
+ // The class must extends CommonObject class to have this method available
+ //$somethingshown=$object->showLinkedObjectBlock();
+
+}
+
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 7b7441ba570..100dd4dfb51 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -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 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
*/
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 && $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;
}
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index 7ea2a0af1e9..9622f4fa480 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -156,7 +156,7 @@ print '';
// Tasks for all resources of all opened projects and time spent for each task/resource
print '';
-$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.= " 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";
@@ -216,7 +216,13 @@ if ( $resql )
print "
";
print '| '.$username.' | ';
- print ''.$obj->title.' | ';
+ print '';
+ $projectstatic->id=$obj->projectid;
+ $projectstatic->ref=$obj->ref;
+ $projectstatic->title=$obj->title;
+ print $projectstatic->getNomUrl(1,'',16);
+ //print ''.$obj->title.'';
+ print ' | ';
print ''.$obj->label.' | ';
print ''.dol_print_date($db->jdate($obj->dateo)).' | ';
print ''.dol_print_date($db->jdate($obj->datee)).' | ';