Fiscal year - 1st step

This commit is contained in:
aspangaro
2014-05-28 05:34:10 +02:00
parent 349d6177d1
commit dce9c2bc76
9 changed files with 964 additions and 12 deletions

315
htdocs/admin/fiscalyear.php Normal file
View File

@@ -0,0 +1,315 @@
<?php
/* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>';
$error++;
}
if (! $object->datestart)
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateStart")).'</div>';
$error++;
}
if (! $object->dateend)
{
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")).'</div>';
$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[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Label")).'</div>';
$error++;
//$action='create';
}
if (empty($datestart) || empty($dateend))
{
$mesgs[]='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("Date")).'</div>';
$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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("DateStart").'</td>';
print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td>'.$langs->trans("Statut").'</td>';
print '</tr>';
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 '<tr '.$bc[$var].'>';
print '<td><a href="fiscalyear_card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowFiscalYear"),"technic").' '.$obj->rowid.'</a></td>';
print '<td align="left">'.$obj->label.'</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->datestart),'day').'</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->dateend),'day').'</td>';
print '<td>'.$fiscalyearstatic->LibStatut($obj->statut,5).'</td>';
print '</tr>';
$var=!$var;
$i++;
}
}
else
{
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
print '</form>';
}
else
{
dol_print_error($db);
}
dol_fiche_end();
// Buttons
print '<div class="tabsAction">';
print '<a class="butAction" href="fiscalyear_card.php?action=create">'.$langs->trans("NewFiscalYear").'</a>';
print '</div>';
llxFooter();
$db->close();

View File

@@ -0,0 +1,325 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")).'</div>';
$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 '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<table class="border" width="100%">';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>';
// Date start
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($datestart?$datestart:-1,'','','','','add',1,1);
print '</td></tr>';
// Date end
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($dateend?$dateend:-1,'','','','','add',1,1);
print '</td></tr>';
// Statut
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("Statut").'</td><td class="valeur">'.$form->selectarray('statut',$statut2label,GETPOST('statut')).'</td>';
print '</tr>';
print '</table>';
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> &nbsp; &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center';
print '</form>';
}
else if ($id)
{
$result = $object->fetch($id);
if ($result > 0)
{
dol_htmloutput_mesg($mesg);
if ($action == 'edit')
{
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<table class="border" width="100%">';
// Ref
print "<tr>";
print '<td width="20%">'.$langs->trans("Ref").'</td><td>';
print $object->rowid;
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
print '<input name="label" class="flat" size="32" value="'.$object->label.'">';
print '</td></tr>';
// Date start
print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->datestart,'','','','','update');
print '</td></tr>';
// Date end
print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->dateend,'','','','','update');
print '</td></tr>';
print '</table>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; ';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '</center>';
print '</form>';
print '</div>';
}
else
{
/*
* Confirm delete
*/
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete");
}
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/fiscalyear.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
print $object->rowid;
print '</td><td width="25%">';
print $linkback;
print '</td></tr>';
// Label
print '<tr><td valign="top">';
print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
print '</td><td colspan="2">';
print $form->editfieldval("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
print "</td></tr>";
// Date start
print '<tr><td>';
print $form->editfieldkey("Date",'datestart',$object->datestart,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td><td colspan="2">';
print $form->editfieldval("Date",'datestart',$object->datestart,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td></tr>';
// Date end
print '<tr><td>';
print $form->editfieldkey("Date",'dateend',$object->dateend,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td><td colspan="2">';
print $form->editfieldval("Date",'dateend',$object->dateend,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td></tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatut(4).'</td></tr>';
print "</table><br>";
print '</div>';
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
print '</div>';
}
}
else
{
dol_print_error($db);
}
}
llxFooter();
$db->close();

View File

@@ -0,0 +1,272 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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');
}
}
}

View File

@@ -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__);

View File

@@ -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);

View File

@@ -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);

View File

@@ -0,0 +1,27 @@
-- ============================================================================
-- Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
--
-- 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 <http://www.gnu.org/licenses/>.
--
-- ============================================================================
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;

View File

@@ -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

View File

@@ -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