Uniformize code and look and feel

This commit is contained in:
Laurent Destailleur 2016-10-17 18:18:06 +02:00
parent 434b3ef643
commit be917c34af
5 changed files with 198 additions and 71 deletions

View File

@ -727,19 +727,6 @@ else
// Status // Status
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->date_start?$object->date_start:-1,'projectstart',0,0,0,'',1,0,1);
print ' &nbsp; &nbsp; <input type="checkbox" name="reportdate" value="yes" ';
if ($comefromclone){print ' checked ';}
print '/> '. $langs->trans("ProjectReportDate");
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->date_end?$object->date_end:-1,'projectend',0,0,0,'',1,0,1);
print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
// Opportunity status // Opportunity status
@ -762,6 +749,19 @@ else
print '</tr>'; print '</tr>';
} }
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->date_start?$object->date_start:-1,'projectstart',0,0,0,'',1,0,1);
print ' &nbsp; &nbsp; <input type="checkbox" name="reportdate" value="yes" ';
if ($comefromclone){print ' checked ';}
print '/> '. $langs->trans("ProjectReportDate");
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->date_end?$object->date_end:-1,'projectend',0,0,0,'',1,0,1);
print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td>'; print '<tr><td>'.$langs->trans("Budget").'</td>';
print '<td><input size="5" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount,0,$langs,1,0):'')).'"></td>'; print '<td><input size="5" type="text" name="budget_amount" value="'.(isset($_POST['budget_amount'])?GETPOST('budget_amount'):(strcmp($object->budget_amount,'')?price($object->budget_amount,0,$langs,1,0):'')).'"></td>';
@ -799,48 +799,63 @@ else
} }
else else
{ {
print '<table class="border" width="100%">'; // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
// Ref $morehtmlref='<div class="refidno">';
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>'; // Title
$morehtmlref.=$object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Ref
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td></tr>'; print '</td></tr>';
*/
// Label // Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; //print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Third party // Third party
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; /*
print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td>';
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project'); if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
else print'&nbsp;'; else print'&nbsp;';
print '</td></tr>'; print '</td></tr>';
*/
// Visibility // Visibility
print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject'); if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; //print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print dol_print_date($object->date_start,'day');
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_end,'day');
print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
@ -861,31 +876,53 @@ else
print '</td></tr>'; print '</td></tr>';
} }
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print dol_print_date($object->date_start,'day');
print '</td></tr>';
// Date end
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_end,'day');
print '</td></tr>';
// Budget // Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency); if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,1,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description // Description
print '<td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->description); print nl2br($object->description);
print '</td></tr>'; print '</td></tr>';
// Categories // Categories
if($conf->categorie->enabled) { if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'project',1); print $form->showCategories($object->id,'project',1);
print "</td></tr>"; print "</td></tr>";
} }
// Other options
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
}
print '</table>'; print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
} }
dol_fiche_end(); dol_fiche_end();

View File

@ -37,6 +37,7 @@ class Project extends CommonObject
public $table_element_line = 'projet_task'; public $table_element_line = 'projet_task';
public $fk_element = 'fk_projet'; public $fk_element = 'fk_projet';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'projectpub';
/** /**
* {@inheritdoc} * {@inheritdoc}

View File

@ -33,6 +33,7 @@ class Task extends CommonObject
{ {
public $element='project_task'; //!< Id that identify managed objects public $element='project_task'; //!< Id that identify managed objects
public $table_element='projet_task'; //!< Name of table without prefix where object is stored public $table_element='projet_task'; //!< Name of table without prefix where object is stored
public $picto = 'task';
var $fk_task_parent; var $fk_task_parent;
var $label; var $label;

View File

@ -149,13 +149,37 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
/* // Project card
* Projet synthese pour rappel
*/
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Title
$morehtmlref.=$object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
/*
// Ref // Ref
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
@ -176,15 +200,32 @@ if ($id > 0 || ! empty($ref))
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1);
else print '&nbsp;'; else print '&nbsp;';
print '</td></tr>'; print '</td></tr>';
*/
// Visibility // Visibility
print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject'); if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Status if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; {
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent,'')) print price($object->opp_percent,'',$langs,1,0).' %';
print '</td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
print '</td></tr>';
}
// Date start // Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
@ -196,28 +237,47 @@ if ($id > 0 || ! empty($ref))
print dol_print_date($object->date_end,'day'); print dol_print_date($object->date_end,'day');
print '</td></tr>'; print '</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) // Budget
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency);
print '</td></tr>';
}
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>'; print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency);
print '</td></tr>'; print '</td></tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print "</table>"; print "</table>";
print '</div>'; print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print nl2br($object->description);
print '</td></tr>';
// Categories
if($conf->categorie->enabled) {
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id,'project',1);
print "</td></tr>";
}
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end();
print '<br>';
// Contacts lines (modules that overwrite templates must declare this into descriptor) // Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));

View File

@ -76,6 +76,7 @@ llxHeader("",$title,$help_url);
$object = new Project($db); $object = new Project($db);
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty();
$object->info($id); $object->info($id);
$head = project_prepare_head($object); $head = project_prepare_head($object);
@ -83,11 +84,38 @@ $head = project_prepare_head($object);
dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); dol_fiche_head($head, 'agenda', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
print '<table width="100%"><tr><td>'; // Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">';
// Title
$morehtmlref.=$object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
{
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref.='</div>';
// Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
dol_print_object_info($object, 1); dol_print_object_info($object, 1);
print '</td></tr></table>'; print '</div>';
print '<div class="clearboth"></div>';
dol_fiche_end(); dol_fiche_end();