diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index b5cc46a3d0d..89aad6e2d0d 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -79,6 +79,7 @@ $object = new Fiscalyear($db);
$max = 100;
$form = new Form($db);
+$fiscalyearstatic = new Fiscalyear($db);
$title = $langs->trans('AccountingPeriods');
$helpurl = "";
@@ -132,13 +133,15 @@ if ($result)
print '';
if ($num) {
- $fiscalyearstatic = new Fiscalyear($db);
-
while ($i < $num && $i < $max) {
$obj = $db->fetch_object($result);
+
$fiscalyearstatic->id = $obj->rowid;
+
print '
';
- print '| '.img_object($langs->trans("ShowFiscalYear"), "technic").' '.$obj->rowid.' | ';
+ print '';
+ print $fiscalyearstatic->getNomUrl(1);
+ print ' | ';
print ''.$obj->label.' | ';
print ''.dol_print_date($db->jdate($obj->date_start), 'day').' | ';
print ''.dol_print_date($db->jdate($obj->date_end), 'day').' | ';
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
index 0686b68115a..c0216f16a19 100644
--- a/htdocs/core/class/fiscalyear.class.php
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -35,6 +35,8 @@ class Fiscalyear extends CommonObject
*/
public $element = 'fiscalyear';
+ public $picto = 'technic';
+
/**
* @var string Name of table without prefix where object is stored
*/
@@ -97,6 +99,7 @@ class Fiscalyear extends CommonObject
public $statuts = array();
public $statuts_short = array();
+
/**
* Constructor
*
@@ -267,6 +270,78 @@ class Fiscalyear extends CommonObject
}
}
+ /**
+ * Return clicable link of object (with eventually picto)
+ *
+ * @param int $withpicto Add picto into link
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
+ */
+ public function getNomUrl($withpicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
+ {
+ global $conf, $langs, $user;
+
+ if (empty($this->ref)) $this->ref = $this->id;
+
+ if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
+
+ $result = '';
+
+ $url = DOL_URL_ROOT.'/accountancy/admin/fiscalyear_card.php?id='.$this->id;
+
+ if (!$user->rights->accounting->fiscalyear->write)
+ $option = 'nolink';
+
+ if ($option !== 'nolink')
+ {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
+ if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
+ }
+
+ if ($short) return $url;
+
+ $label = '';
+
+ if ($user->rights->accounting->fiscalyear->write) {
+ $label = ''.$langs->trans("FiscalPeriod").'';
+ $label .= '
'.$langs->trans('Ref').': '.$this->id;
+ if (isset($this->statut)) {
+ $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5);
+ }
+ }
+
+ $linkclose = '';
+ if (empty($notooltip) && $user->rights->accounting->fiscalyear->write)
+ {
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+ {
+ $label = $langs->trans("FiscalYear");
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip"';
+ }
+
+ $linkstart = '';
+ $linkend = '';
+
+ if ($option === 'nolink') {
+ $linkstart = '';
+ $linkend = '';
+ }
+
+ $result .= $linkstart;
+ if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ if ($withpicto != 2) $result .= $this->ref;
+ $result .= $linkend;
+
+ return $result;
+ }
+
/**
* Give a label from a status
*