diff --git a/htdocs/admin/fiscalyear.php b/htdocs/admin/fiscalyear.php
new file mode 100644
index 00000000000..7929fd5046f
--- /dev/null
+++ b/htdocs/admin/fiscalyear.php
@@ -0,0 +1,315 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/admin/fiscalyear.php
+ * \ingroup fiscal year
+ * \brief Setup page to configure fiscal year
+ */
+
+require '../main.inc.php';
+
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
+
+$action=GETPOST('action');
+
+$langs->load("admin");
+$langs->load("compta");
+
+if (! $user->admin) accessforbidden();
+
+$error=0;
+
+// List of statut
+static $tmpstatut2label=array(
+ '0'=>'OpenFiscalYear',
+ '1'=>'CloseFiscalYear'
+);
+$statut2label=array('');
+foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
+
+$mesg='';
+$errors=array();
+
+$object = new Fiscalyear($db);
+
+/*
+ * Actions
+ */
+
+// Add
+if ($action == 'add')
+{
+ if (! GETPOST('cancel','alpha'))
+ {
+ $error=0;
+
+ $object->label = GETPOST('label','alpha');
+ $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+ $object->statut = 0;
+
+ if (! $object->label)
+ {
+ $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'
';
+ $error++;
+ }
+ if (! $object->datestart)
+ {
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateStart")).'
';
+ $error++;
+ }
+ if (! $object->dateend)
+ {
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'
';
+ $error++;
+ }
+
+ if (! $error)
+ {
+ $id = $object->create();
+
+ if ($id > 0)
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ else
+ {
+ $mesg=$object->error;
+ $action='create';
+ }
+ }
+ else
+ {
+ $action='create';
+ }
+ }
+ else
+ {
+ header("Location: index.php");
+ exit;
+ }
+
+ if (! GETPOST('cancel','alpha'))
+ {
+ $error=0;
+
+ // Check values
+ $datestart = dol_mktime(12, 0, 0, $_POST['startmonth'], $_POST['startday'], $_POST['startyear']);
+ $dateend = dol_mktime(12, 0, 0, $_POST['endmonth'], $_POST['endday'], $_POST['endyear']);
+ $label = $_POST['label'];
+
+ if (empty($label))
+ {
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Label")).'
';
+ $error++;
+ //$action='create';
+ }
+ if (empty($datestart) || empty($dateend))
+ {
+ $mesgs[]=''.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'
';
+ $error++;
+ //$action='create';
+ }
+
+ if (! $error)
+ {
+ $this->db->begin();
+
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_fiscalyear";
+ $sql.= " (label, datestart, dateend, statut, entity)";
+ $sql.= " VALUES('".$label."',";
+ $sql.= " '".$datestart."',";
+ $sql.= " '".$dateend."',";
+ $sql.= " ' 0,";
+ $sql.= " ".$conf->entity."'";
+ $sql.=')';
+
+ dol_syslog(get_class($this)."::create_label sql=".$sql);
+ if ($this->db->query($sql))
+ {
+ return 1;
+ }
+ else
+ {
+ $this->error=$this->db->lasterror();
+ $this->errno=$this->db->lasterrno();
+ return -1;
+ }
+ }
+ }
+}
+
+// Rename field
+if ($action == 'update')
+{
+ if ($_POST["button"] != $langs->trans("Cancel"))
+ {
+ // Check values
+ if (! GETPOST('type'))
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
+ $action = 'create';
+ }
+ if (GETPOST('type')=='varchar' && $extrasize > $maxsizestring)
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg=$langs->trans("ErrorSizeTooLongForVarcharType",$maxsizestring);
+ $action = 'edit';
+ }
+ if (GETPOST('type')=='int' && $extrasize > $maxsizeint)
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg=$langs->trans("ErrorSizeTooLongForIntType",$maxsizeint);
+ $action = 'edit';
+ }
+
+ if (! $error)
+ {
+ if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
+ {
+ $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0));
+ if ($result > 0)
+ {
+ header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else
+ {
+ $error++;
+ $mesg=$extrafields->error;
+ }
+ }
+ else
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+ }
+ }
+ }
+}
+
+// Delete attribute
+if ($action == 'delete')
+{
+ if(isset($_GET["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_GET["attrname"]))
+ {
+ $result=$extrafields->delete($_GET["attrname"],$elementtype);
+ if ($result >= 0)
+ {
+ header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else $mesg=$extrafields->error;
+ }
+ else
+ {
+ $error++;
+ $langs->load("errors");
+ $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
+ }
+}
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+llxHeader('',$title);
+
+$title = $langs->trans('Accountancysetup');
+
+print_fiche_titre($langs->trans('Fiscalyear'));
+
+dol_htmloutput_errors($mesg);
+
+$sql = "SELECT f.rowid, f.label, f.datestart, f.dateend, f.statut, f.entity";
+$sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
+$sql.= " WHERE f.entity = ".$conf->entity;
+
+$result = $db->query($sql);
+
+$max=10;
+
+if ($result)
+{
+ $var=false;
+ $num = $db->num_rows($result);
+
+ $i = 0;
+
+ // Load attribute_label
+ print '';
+ print '';
+ print '| '.$langs->trans("Ref").' | ';
+ print ''.$langs->trans("Label").' | ';
+ print ''.$langs->trans("DateStart").' | ';
+ print ''.$langs->trans("DateEnd").' | ';
+ print ''.$langs->trans("Statut").' | ';
+ print '
';
+
+ if ($num)
+ {
+ $fiscalyearstatic=new Fiscalyear($db);
+
+ while ($i < $num && $i < $max)
+ {
+ $obj = $db->fetch_object($result);
+ $fiscalyearstatic->ref=$obj->rowid;
+ $fiscalyearstatic->id=$obj->rowid;
+ print '';
+ print '| '.img_object($langs->trans("ShowFiscalYear"),"technic").' '.$obj->rowid.' | ';
+ print ''.$obj->label.' | ';
+ print ''.dol_print_date($db->jdate($obj->datestart),'day').' | ';
+ print ''.dol_print_date($db->jdate($obj->dateend),'day').' | ';
+ print ''.$fiscalyearstatic->LibStatut($obj->statut,5).' | ';
+ print '
';
+ $var=!$var;
+ $i++;
+ }
+
+ }
+ else
+ {
+ print '| '.$langs->trans("None").' |
';
+ }
+
+ print '
';
+ print '';
+}
+else
+{
+ dol_print_error($db);
+}
+
+dol_fiche_end();
+
+// Buttons
+print '';
+
+llxFooter();
+$db->close();
\ No newline at end of file
diff --git a/htdocs/admin/fiscalyear_card.php b/htdocs/admin/fiscalyear_card.php
new file mode 100644
index 00000000000..d18fdbc3ec4
--- /dev/null
+++ b/htdocs/admin/fiscalyear_card.php
@@ -0,0 +1,325 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/admin/fiscalyear_card.php
+ * \brief Page to show a fiscal yeartrip
+ */
+
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+
+
+$langs->load("admin");
+$langs->load("compta");
+
+// Security check
+if (! $user->admin) accessforbidden();
+
+$error=0;
+
+$action = GETPOST('action','alpha');
+$confirm = GETPOST('confirm','alpha');
+$id = GETPOST('id','int');
+
+// List of statut
+static $tmpstatut2label=array(
+ '0'=>'OpenFiscalYear',
+ '1'=>'CloseFiscalYear'
+);
+$statut2label=array('');
+foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val);
+
+$mesg = '';
+
+$object = new Fiscalyear($db);
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
+
+if ($action == 'confirm_delete' && $confirm == "yes")
+{
+ $result=$object->delete($id);
+ if ($result >= 0)
+ {
+ header("Location: fiscalyear.php");
+ exit;
+ }
+ else
+ {
+ $mesg=$object->error;
+ }
+}
+
+else if ($action == 'add')
+{
+ if (! GETPOST('cancel','alpha'))
+ {
+ $error=0;
+
+ $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+ $object->label = GETPOST('label','alpha');
+ $object->statut = GETPOST('statut','int');;
+
+ /*
+ if (empty($object->datestart) && empty($object->dateend))
+ {
+ $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date"));
+ $error++;
+ }
+ */
+ if (empty($object->label))
+ {
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'
';
+ $error++;
+ }
+
+ if (! $error)
+ {
+ $id = $object->create($user);
+
+ if ($id > 0)
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ else
+ {
+ $mesg=$object->error;
+ $action='create';
+ }
+ }
+ else
+ {
+ $action='create';
+ }
+ }
+ else
+ {
+ header("Location: fiscalyear.php");
+ exit;
+ }
+}
+
+// Update record
+else if ($action == 'update')
+{
+ if (! GETPOST('cancel','alpha'))
+ {
+ $result = $object->fetch($id);
+
+ $object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+ $object->label = GETPOST('label','alpha');
+ $object->statut = GETPOST('statut','int');
+
+ $result = $object->update($user);
+
+ if ($result > 0)
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+ else
+ {
+ $mesg=$object->error;
+ }
+ }
+ else
+ {
+ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
+ exit;
+ }
+}
+
+/*
+ * View
+ */
+
+llxHeader();
+
+$form = new Form($db);
+
+/*
+ * Action create
+*/
+if ($action == 'create')
+{
+ print_fiche_titre($langs->trans("NewFiscalYear"));
+
+ dol_htmloutput_errors($mesg);
+
+ $datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
+ $dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
+
+ print '';
+
+ print '';
+ }
+ else
+ {
+ /*
+ * Confirm delete
+ */
+ if ($action == 'delete')
+ {
+ print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete");
+
+ }
+
+ print '';
+
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ // Ref
+ print '| '.$langs->trans("Ref").' | ';
+ print $object->rowid;
+ print ' | ';
+ print $linkback;
+ print ' |
';
+
+ // Label
+ print '| ';
+ print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
+ print ' | ';
+ print $form->editfieldval("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
+ print " |
";
+
+ // Date start
+ print '| ';
+ print $form->editfieldkey("Date",'datestart',$object->datestart,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
+ print ' | ';
+ print $form->editfieldval("Date",'datestart',$object->datestart,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
+ print ' |
';
+
+ // Date end
+ print '| ';
+ print $form->editfieldkey("Date",'dateend',$object->dateend,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
+ print ' | ';
+ print $form->editfieldval("Date",'dateend',$object->dateend,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
+ print ' |
';
+
+ // Statut
+ print '| '.$langs->trans("Status").' | '.$object->getLibStatut(4).' |
';
+
+ print "
";
+
+ print '';
+
+ /*
+ * Barre d'actions
+ */
+
+ print '';
+ }
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
+llxFooter();
+$db->close();
diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php
new file mode 100644
index 00000000000..3d48d47a082
--- /dev/null
+++ b/htdocs/core/class/fiscalyear.class.php
@@ -0,0 +1,272 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/class/fiscalyear.php
+ * \ingroup fiscal year
+ * \brief Page d'administration/configuration
+ */
+
+require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
+
+/**
+ * Class to manage fiscal year
+ */
+class Fiscalyear
+{
+ public $element='Fiscalyear';
+ public $table_element='accounting_fiscalyear';
+ public $table_element_line = '';
+ public $fk_element = '';
+ protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+
+ var $id;
+ var $rowid;
+
+ var $label;
+ var $datestart;
+ var $dateend;
+ var $statut; // 0=open, 1=closed
+ var $entity;
+
+ var $statuts=array();
+ var $statuts_short=array();
+
+ /**
+ * Constructor
+ *
+ * @param DoliDB $db Database handler
+ */
+ function __construct($db)
+ {
+ $this->db = $db;
+
+ $this->statuts_short = array(0 => 'Opened', 1 => 'Closed');
+ $this->statuts = array(0 => 'Opened', 1 => 'Closed');
+
+ return 1;
+ }
+
+ /**
+ * Create object in database
+ *
+ * @return int <0 if KO, >0 if OK
+ */
+ function create()
+ {
+ global $conf;
+
+ $this->db->begin();
+
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."accounting_fiscalyear (";
+ $sql.= " label";
+ $sql.= ", datestart";
+ $sql.= ", dateend";
+ $sql.= ", statut";
+ $sql.= ", entity";
+ $sql.= ") VALUES (";
+ $sql.= " '".$this->label;
+ $sql.= "', ".$this->db->idate($this->datestart);
+ $sql.= ", ".$this->db->idate($this->dateend);
+ $sql.= ", ".$this->statut;
+ $sql.= ", ".$conf->entity;
+ $sql.= ")";
+
+ dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ $error++; $this->errors[]="Error ".$this->db->lasterror();
+ }
+
+ if (! $error)
+ {
+ $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear");
+ }
+
+ // Commit or rollback
+ if ($error)
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+ else
+ {
+ $this->db->commit();
+ return $this->rowid;
+ }
+
+ dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."accounting_fiscalyear");
+
+ $result=$this->update($user);
+ if ($result > 0)
+ {
+ $this->db->commit();
+ return $this->rowid;
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ $this->db->rollback();
+ return $result;
+ }
+ }
+ else
+ {
+ $this->error=$this->db->error()." sql=".$sql;
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+ /**
+ * Update record
+ *
+ * @param User $user User making update
+ * @return int <0 if KO, >0 if OK
+ */
+ function update($user)
+ {
+ global $langs;
+
+ // Check parameters
+ if (empty($this->datestart) && empty($this->dateend))
+ {
+ $this->error='ErrorBadParameter';
+ return -1;
+ }
+
+ $this->db->begin();
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_fiscalyear ";
+ $sql .= " SET label = ".$this->label;
+ $sql .= " , datestart = '".$this->db->idate($this->datestart)."'";
+ $sql .= " , dateend = '".$this->db->idate($this->dateend)."'";
+ $sql .= " , statut = '".$this->statut."'";
+ $sql .= " WHERE rowid = ".$this->id;
+
+ dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
+ $result = $this->db->query($sql);
+ if ($result)
+ {
+ $this->db->commit();
+ return 1;
+ }
+ else
+ {
+ $this->error=$this->db->lasterror();
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+ /**
+ * Load an object from database
+ *
+ * @param int $id Id of record to load
+ * @return int <0 if KO, >0 if OK
+ */
+ function fetch($id)
+ {
+ $sql = "SELECT rowid, label, datestart, dateend, statut";
+ $sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear";
+ $sql.= " WHERE rowid = ".$id;
+
+ dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
+ $result = $this->db->query($sql);
+ if ( $result )
+ {
+ $obj = $this->db->fetch_object($result);
+
+ $this->id = $obj->rowid;
+ $this->ref = $obj->rowid;
+ $this->datestart = $this->db->jdate($obj->datestart);
+ $this->dateend = $this->db->jdate($obj->dateend);
+ $this->label = $obj->label;
+ $this->statut = $obj->statut;
+
+ return 1;
+ }
+ else
+ {
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+
+ /**
+ * Give a label from a status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
+ * @return string Label
+ */
+ function getLibStatut($mode=0)
+ {
+ return $this->LibStatut($this->statut,$mode);
+ }
+
+ /**
+ * Give a label from a status
+ *
+ * @param int $statut Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
+ * @return string Label
+ */
+ function LibStatut($statut,$mode=0)
+ {
+ global $langs;
+
+ if ($mode == 0)
+ {
+ return $langs->trans($this->statuts[$statut]);
+ }
+ if ($mode == 1)
+ {
+ return $langs->trans($this->statuts_short[$statut]);
+ }
+ if ($mode == 2)
+ {
+ if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]);
+ if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]);
+ }
+ if ($mode == 3)
+ {
+ if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
+ if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
+ }
+ if ($mode == 4)
+ {
+ if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
+ if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
+ }
+ if ($mode == 5)
+ {
+ if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
+ if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index f8e5828bbd1..b5e85d7830d 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -25,16 +25,17 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 5, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 104__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/boxes.php?leftmenu=setup', 'Boxes', 1, 'admin', '', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 105__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/menus.php?leftmenu=setup', 'Menus', 1, 'admin', '', '', 2, 3, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 106__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/delais.php?leftmenu=setup', 'Alerts', 1, 'admin', '', '', 2, 6, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/proxy.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 7, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 8, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 9, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 10, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 11, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'Dictionary', 1, 'admin', '', '', 2, 12, __ENTITY__);
-insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 13, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 5, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 106__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/delais.php?leftmenu=setup', 'Alerts', 1, 'admin', '', '', 2, 7, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 108__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/proxy.php?leftmenu=setup', 'Security', 1, 'admin', '', '', 2, 8, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 110__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/limits.php?leftmenu=setup', 'MenuLimits', 1, 'admin', '', '', 2, 9, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 107__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/pdf.php?leftmenu=setup', 'PDF', 1, 'admin', '', '', 2, 10, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 109__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/mails.php?leftmenu=setup', 'Emails', 1, 'admin', '', '', 2, 11, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 113__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/sms.php?leftmenu=setup', 'SMS', 1, 'admin', '', '', 2, 12, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 111__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/dict.php?leftmenu=setup', 'Dictionary', 1, 'admin', '', '', 2, 13, __ENTITY__);
+insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup"', __HANDLER__, 'left', 112__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/const.php?leftmenu=setup', 'OtherSetup', 1, 'admin', '', '', 2, 14, __ENTITY__);
-- Home - Sytem info
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__);
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index 35b3f78c5e7..29ad35214cd 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -501,6 +501,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/modules.php?mainmenu=home", $langs->trans("Modules").$warnpicto,1);
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
+ $newmenu->add("/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
if (! in_array($langs->defaultlang,array('en_US','en_GB','en_NZ','en_AU','fr_FR','fr_BE','es_ES','ca_ES')))
{
if (empty($leftmenu) || $leftmenu=="setup") $newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php
index f316d334928..a6063c84d18 100644
--- a/htdocs/core/menus/standard/empty.php
+++ b/htdocs/core/menus/standard/empty.php
@@ -115,6 +115,7 @@ class MenuManager
$this->menu->add("/admin/modules.php", $langs->trans("Modules"),1);
$this->menu->add("/admin/menus.php", $langs->trans("Menus"),1);
$this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
+ $this->menu->add("/admin/fiscalyear.php", $langs->trans("Fiscalyear"),1);
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
$this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1);
$this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
diff --git a/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql
new file mode 100644
index 00000000000..fe8563d7250
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_accounting_fiscalyear.sql
@@ -0,0 +1,27 @@
+-- ============================================================================
+-- Copyright (C) 2014 Alexandre Spangaro
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see .
+--
+-- ============================================================================
+
+create table llx_accounting_fiscalyear
+(
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ label varchar(128) NOT NULL,
+ datestart date,
+ dateend date,
+ statut tinyint DEFAULT 0 NOT NULL,
+ entity integer DEFAULT 1 NOT NULL -- multi company id
+)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index d22e27c1cbf..1f3cb7ed0c1 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1496,7 +1496,12 @@ TasksNumberingModules=Tasks numbering module
TaskModelModule=Tasks reports document model
##### ECM (GED) #####
ECMSetup = GED Setup
-ECMAutoTree = Automatic tree folder and document
-
+ECMAutoTree = Automatic tree folder and document
+##### Fiscal Year #####
+Fiscalyear=Fiscal years
+OpenFiscalYear=Open fiscal year
+CloseFiscalYear=Close fiscal year
+Opened=Opened
+Closed=Closed
Format=Format
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 059e3e4bac2..bc29d977ed2 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1497,6 +1497,11 @@ TaskModelModule=Modèles de document de rapport tâches
##### ECM (GED) #####
ECMSetup = Configuration du module GED
ECMAutoTree = L'arborescence automatique est disponible
-
+##### Fiscal Year #####
+Fiscalyear=Exercices fiscaux
+OpenFiscalYear=Exercice fiscal ouvert
+CloseFiscalYear=Exercice fiscal fermé
+Opened=Ouvert
+Closed=Fermé
Format=Format