Fix length of month too large

More complete template
This commit is contained in:
Laurent Destailleur 2017-12-08 16:15:41 +01:00
parent 56b5eab2e4
commit 95cb5025a2
28 changed files with 223 additions and 162 deletions

View File

@ -79,9 +79,10 @@ class AdherentStats extends Stats
* Return the number of proposition by month for a given year
*
* @param int $year Year
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -93,7 +94,7 @@ class AdherentStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getNbByMonth($year, $sql);
return $this->_getNbByMonth($year, $sql, $format);
}
/**
@ -116,12 +117,13 @@ class AdherentStats extends Stats
}
/**
* Return the number of subscriptions by month for a given year
* Return the number of subscriptions by month for a given year
*
* @param int $year Year
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of amount each month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
global $user;
@ -133,7 +135,7 @@ class AdherentStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
return $this->_getAmountByMonth($year, $sql);
return $this->_getAmountByMonth($year, $sql, $format);
}
/**

View File

@ -69,7 +69,8 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
$s=$mysoc->country_id.':'.$mysoc->country_code.':'.$mysoc->country_label;
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_COUNTRY", $s,'chaine',0,'',$conf->entity);
module_require_by_country($mysoc->country_code);
activateModulesRequiredByCountry($mysoc->country_code);
}
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom",'nohtml'),'chaine',0,'',$conf->entity);

View File

@ -3,7 +3,7 @@ LOG INALTERABLE
## Fonctionnalité
Ce module tace, en temps réel, certains évènements métiers dans une log non reversible (que vous ne pouvez pas modifier une fois enregistré) de type blockchain.
Ce module trace, en temps réel, certains évènements métiers dans une log inaltérable (que vous ne pouvez pas modifier une fois enregistrés) de type blockchain.
Ce module est requis pour la compatibilité avec les exigences légales de certains pays (comme la France avec la loi Fincance 2016 - Norme NF535).
@ -15,9 +15,9 @@ Ce module est requis pour la compatibilité avec les exigences légales de certa
Remarque: Le type des événements tracés est probablement plus large que la plupart des exigences légales mais permet d'être prêt pour d'éventuel élargissement
de ces exigences.
Vous pouvez aussi lire et recherche au sein de la log dédiée.
Vous pouvez aussi lire et faire des recherches au sein de la log inaltérable.
Tous les enregistrements de la logs inaltérable sont liés avec le précédent dnas une Blockchain, et leur contenu fait parti de la signature inclue dans le lien,
aussi, une fois le module activé et le premier enregistrement réalisé, il ne sera plus possible d'effacer ni modifié un enregistrement dans la log
inaltérable sans corrompre la chaine. Dès lors qu'un enregistrement est invalide, tous les suivants seront également considérés invalides.
Tous les enregistrements de la logs inaltérable sont liés avec le précédent dans une Blockchain, et leur contenu fait parti de la signature inclue dans ce lien,
aussi, une fois le module activé et le premier enregistrement réalisé, il ne sera plus possible d'effacer ni modifier un enregistrement dans la log
inaltérable sans corrompre toute la chaine. Dès lors qu'un enregistrement est invalide, tous les suivants pourront également être considérés invalides par votre administration.

View File

@ -168,10 +168,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
{
$actioncode='';
//$actioncode='';
$search_title='';
$datestart='';
$dateend='';
$status='';
$search_array_options=array();
}

View File

@ -64,27 +64,27 @@ class PropaleStats extends Stats
if ($mode == 'customer')
{
$object=new Propal($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
$this->field_date='p.datep';
$this->field='total_ht';
$this->field_line='total_ht';
$this->where.= " p.fk_statut > 0";
}
if ($mode == 'supplier')
{
$object=new SupplierProposal($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
$this->field_date='p.date_valid';
$this->field='total_ht';
$this->field_line='total_ht';
$this->where.= " p.fk_statut > 0"; // Validated, accepted, refused and closed
}
}
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
$this->where.= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -100,9 +100,10 @@ class PropaleStats extends Stats
* Return propals number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -114,7 +115,7 @@ class PropaleStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
return $res;
}
@ -141,10 +142,11 @@ class PropaleStats extends Stats
/**
* Return the propals amount by month for a year
*
* @param int $year Year to scan
* @return array Array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format)
{
global $user;
@ -156,7 +158,7 @@ class PropaleStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
return $res;
}

View File

@ -60,8 +60,8 @@ class CommandeStats extends Stats
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->cachefilesuffix = $mode;
if ($mode == 'customer')
{
$object=new Commande($this->db);
@ -82,7 +82,7 @@ class CommandeStats extends Stats
}
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where.= ' AND c.entity IN ('.getEntity('commande').')';
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($this->socid)
{
@ -95,9 +95,10 @@ class CommandeStats extends Stats
* Return orders number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -109,7 +110,7 @@ class CommandeStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
return $res;
}
@ -136,10 +137,11 @@ class CommandeStats extends Stats
/**
* Return the orders amount by month for a year
*
* @param int $year Year to scan
* @return array Array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
global $user;
@ -151,7 +153,7 @@ class CommandeStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
return $res;
}
@ -217,6 +219,6 @@ class CommandeStats extends Stats
return $this->_getAllByProduct($sql);
}
}

View File

@ -91,9 +91,10 @@ class DeplacementStats extends Stats
* Renvoie le nombre de facture par mois pour une annee donnee
*
* @param string $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
$sql = "SELECT MONTH(dated) as dm, count(*)";
$sql.= " FROM ".$this->from;
@ -102,7 +103,7 @@ class DeplacementStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}
@ -112,9 +113,10 @@ class DeplacementStats extends Stats
* Renvoie le montant de facture par mois pour une annee donnee
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
$sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from;
@ -123,7 +125,7 @@ class DeplacementStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}

View File

@ -93,9 +93,10 @@ class FactureStats extends Stats
* Return orders number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -107,7 +108,7 @@ class FactureStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}
@ -136,10 +137,11 @@ class FactureStats extends Stats
/**
* Return the invoices amount by month for a year
*
* @param int $year Year to scan
* @return array Array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
global $user;
@ -151,7 +153,7 @@ class FactureStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}

View File

@ -124,7 +124,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$endyear.'.png';
@ -164,7 +164,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$endyear.'.png';

View File

@ -123,7 +123,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesnbinyear-'.$year.'.png';
@ -163,7 +163,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=invoicesamountinyear-'.$year.'.png';

View File

@ -126,7 +126,7 @@ class box_graph_orders_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@ -164,7 +164,7 @@ class box_graph_orders_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';

View File

@ -125,7 +125,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersnbinyear-'.$endyear.'.png';
@ -163,7 +163,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&amp;file=ordersamountinyear-'.$endyear.'.png';

View File

@ -123,7 +123,7 @@ class box_graph_propales_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($shownb)
{
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data1 = $stats->getNbByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
$filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
@ -162,7 +162,7 @@ class box_graph_propales_permonth extends ModeleBoxes
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
if ($showtot)
{
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)));
$data2 = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,(GETPOST('action','aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0));
$datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
//$datatype2 = array('lines','bars');

View File

@ -39,9 +39,10 @@ abstract class Stats
* @param int $endyear Start year
* @param int $startyear End year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonthWithPrevYear($endyear,$startyear,$cachedelay=0)
function getNbByMonthWithPrevYear($endyear, $startyear, $cachedelay=0, $format=0)
{
global $conf,$user,$langs;
@ -76,7 +77,6 @@ abstract class Stats
dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it.");
}
}
// Load file into $data
if ($foundintocache) // Cache file found and is not too old
{
@ -88,7 +88,7 @@ abstract class Stats
$year=$startyear;
while ($year <= $endyear)
{
$datay[$year] = $this->getNbByMonth($year);
$datay[$year] = $this->getNbByMonth($year, $format);
$year++;
}
@ -133,9 +133,10 @@ abstract class Stats
* @param int $endyear Start year
* @param int $startyear End year
* @param int $cachedelay Delay we accept for cache file (0=No read, no save of cache, -1=No read but save)
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getAmountByMonthWithPrevYear($endyear,$startyear,$cachedelay=0)
function getAmountByMonthWithPrevYear($endyear, $startyear, $cachedelay=0, $format=0)
{
global $conf,$user,$langs;
@ -182,7 +183,7 @@ abstract class Stats
$year=$startyear;
while($year <= $endyear)
{
$datay[$year] = $this->getAmountByMonth($year);
$datay[$year] = $this->getAmountByMonth($year, $format);
$year++;
}
@ -409,11 +410,13 @@ abstract class Stats
*
* @param int $year Year
* @param string $sql SQL
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month
*/
function _getNbByMonth($year, $sql, $format=0)
{
global $langs;
$result=array();
$res=array();
@ -446,8 +449,11 @@ abstract class Stats
for ($i = 1 ; $i < 13 ; $i++)
{
$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
$month=dol_substr($month,0,3);
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
elseif ($format == 1) $month=$i;
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
$data[$i-1] = array($month, $res[$i]);
}
@ -460,11 +466,13 @@ abstract class Stats
*
* @param int $year Year
* @param string $sql SQL
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array
*/
function _getAmountByMonth($year, $sql, $format=0)
{
global $langs;
$result=array();
$res=array();
@ -495,8 +503,11 @@ abstract class Stats
for ($i = 1 ; $i < 13 ; $i++)
{
$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
$month=dol_substr($month,0,3);
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
elseif ($format == 1) $month=$i;
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
$data[$i-1] = array($month, $res[$i]);
}
@ -508,11 +519,13 @@ abstract class Stats
*
* @param int $year Year
* @param string $sql SQL
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is a number
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array
*/
function _getAverageByMonth($year, $sql, $format=0)
{
global $langs;
$result=array();
$res=array();
@ -542,8 +555,11 @@ abstract class Stats
for ($i = 1 ; $i < 13 ; $i++)
{
$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
$month=dol_substr($month,0,3);
if ($format == 0) $month=$langs->transnoentitiesnoconv('MonthShort'.sprintf("%02d", $i));
elseif ($format == 1) $month=$i;
elseif ($format == 2) $month=$langs->transnoentitiesnoconv('MonthVeryShort'.sprintf("%02d", $i));
//$month=dol_print_date(dol_mktime(12,0,0,$i,1,$year),($format?"%m":"%b"));
//$month=dol_substr($month,0,3);
$data[$i-1] = array($month, $res[$i]);
}

View File

@ -1133,17 +1133,17 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
}
/**
* Activate external modules for country if neccessary
* Activate external modules mandatroy when country is country_code
*
* @param string $country_code CountryCode
* @return int 1
*/
function module_require_by_country($country_code)
function activateModulesRequiredByCountry($country_code)
{
global $db, $conf, $langs;
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
@ -1156,12 +1156,12 @@ function module_require_by_country($country_code)
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
include_once $dir.$file;
$objMod = new $modName($db);
if ($objMod->numero > 0)
{
$j = $objMod->numero;
@ -1170,28 +1170,26 @@ function module_require_by_country($country_code)
{
$j = 1000 + $i;
}
$modulequalified=1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if(!empty($conf->global->$const_name)) $modulequalified=0; // already activated
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->automatic_activation) && is_array($objMod->automatic_activation) && isset($objMod->automatic_activation[$country_code]))
{
activateModule($modName);
setEventMessage($objMod->automatic_activation[$country_code],'warnings');
}
}
else dol_syslog("Module ".get_class($objMod)." not qualified");
}
@ -1204,7 +1202,7 @@ function module_require_by_country($country_code)
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
}
}
return 1;
}

View File

@ -71,13 +71,23 @@ class modBlockedLog extends DolibarrModules
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->langfiles = array('blockedlog');
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_unactivation = array('FR'=>'BlockedLogAreRequiredByYourCountryLegislation');
$this->automatic_activation = array('FR'=>'BlockedLogActivatedBecauseRequiredByYourCountryLegislation');
// Currently, activation is not automatic because only companies (in France) making invoices to non business customers must
// enable this module.
// It is automatic only if $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY is on.
if (! empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY))
{
$this->automatic_activation = array('FR'=>'BlockedLogActivatedBecauseRequiredByYourCountryLegislation');
}
$this->always_enabled = !empty($conf->blockedlog->enabled) && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY));
// Constants
//-----------
$this->const = array();
// New pages on tabs
// -----------------
@ -90,25 +100,22 @@ class modBlockedLog extends DolibarrModules
// Main menu entries
//------------------
$this->menu = array();
$this->always_enabled = !empty($conf->blockedlog->enabled) && !empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) && in_array($mysoc->country_code, explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY));
}
/**
* Check if module was already used before unactivation linked to warnings_unactivation property
* Check if module was already used before unactivation linked to warnings_unactivation property
*/
function alreadyUsed() {
$res = $this->db->query("SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."blockedlog");
if($res!==false) {
$obj = $this->db->fetch_object($res);
return ($obj->nb > 0);
}
return false;
}
/**
* Function called when module is disabled.
* The remove function removes tabs, constants, boxes, permissions and menus from Dolibarr database.
@ -118,27 +125,27 @@ class modBlockedLog extends DolibarrModules
* @return int 1 if OK, 0 if KO
*/
function remove($options = '') {
global $user;
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
$object=new stdClass;
$object->id = 1;
$object->element = 'module';
$object->ref = 'module';
$object->date = time();
$b=new BlockedLog($this->db);
$b->setObjectData($object, 'MODULE_RESET', -1);
$res = $b->create($user);
if($res<=0) {
$this->error = $b->error;
return $res;
}
return $this->_remove(array(), $options);
}
}

View File

@ -50,7 +50,6 @@ class modUser extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des utilisateurs (requis)";
$this->always_enabled = true; // Can't be disabled
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
@ -69,6 +68,7 @@ class modUser extends DolibarrModules
$this->depends = array();
$this->requiredby = array();
$this->langfiles = array("main","users","companies","members",'salaries');
$this->always_enabled = true; // Can't be disabled
// Constants
$this->const = array();
@ -204,13 +204,13 @@ class modUser extends DolibarrModules
$this->rights[$r][4] = 'user';
$this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
//--------
$r=0;
@ -230,7 +230,7 @@ class modUser extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' WHERE u.entity IN ('.getEntity('user').')';
// Imports
//--------
$r=0;
@ -266,7 +266,7 @@ class modUser extends DolibarrModules
$this->import_regex_array[$r]=array('u.employee'=>'^[0|1]','u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
$this->import_examplevalues_array[$r]=array('u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00");
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
}

View File

@ -42,7 +42,7 @@ class DonationStats extends Stats
var $from;
var $field;
var $where;
/**
* Constructor
@ -55,13 +55,13 @@ class DonationStats extends Stats
function __construct($db, $socid, $mode, $userid=0)
{
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->cachefilesuffix = $mode;
$object=new Don($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as d";
//$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
@ -77,9 +77,10 @@ class DonationStats extends Stats
* Return shipment number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -90,7 +91,7 @@ class DonationStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
return $res;
}

View File

@ -42,7 +42,7 @@ class ExpeditionStats extends Stats
var $from;
var $field;
var $where;
/**
* Constructor
@ -55,13 +55,13 @@ class ExpeditionStats extends Stats
function __construct($db, $socid, $mode, $userid=0)
{
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->cachefilesuffix = $mode;
$object=new Expedition($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
//$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
@ -82,9 +82,10 @@ class ExpeditionStats extends Stats
* Return shipment number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -96,7 +97,7 @@ class ExpeditionStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
return $res;
}

View File

@ -60,9 +60,9 @@ class ExpenseReportStats extends Stats
$this->field='total_ht';
//$this->where = " e.fk_statut > 0";
//$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have.
//$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have.
$this->where.= ' e.entity IN ('.getEntity('expensereport').')';
//$this->where.= " AND entity = ".$conf->entity;
if ($this->socid)
{
@ -100,10 +100,11 @@ class ExpenseReportStats extends Stats
/**
* Renvoie le nombre de facture par mois pour une annee donnee
*
* @param string $year Year to scan
* @return array Array of values
* @param string $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
$sql = "SELECT MONTH(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').") as dm, count(*)";
$sql.= " FROM ".$this->from;
@ -112,7 +113,7 @@ class ExpenseReportStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}
@ -122,9 +123,10 @@ class ExpenseReportStats extends Stats
* Renvoie le montant de facture par mois pour une annee donnee
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
$sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from;
@ -133,7 +135,7 @@ class ExpenseReportStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
//var_dump($res);print '<br>';
return $res;
}

View File

@ -59,8 +59,8 @@ class FichinterStats extends Stats
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->cachefilesuffix = $mode;
$this->where.= " c.entity = ".$conf->entity;
if ($mode == 'customer')
{
@ -83,9 +83,10 @@ class FichinterStats extends Stats
* Return intervention number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with number by month
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -97,7 +98,7 @@ class FichinterStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getNbByMonth($year, $sql);
$res=$this->_getNbByMonth($year, $sql, $format);
return $res;
}
@ -124,10 +125,11 @@ class FichinterStats extends Stats
/**
* Return the intervention amount by month for a year
*
* @param int $year Year to scan
* @return array Array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
global $user;
@ -139,7 +141,7 @@ class FichinterStats extends Stats
$sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC');
$res=$this->_getAmountByMonth($year, $sql);
$res=$this->_getAmountByMonth($year, $sql, $format);
return $res;
}
@ -205,6 +207,6 @@ class FichinterStats extends Stats
return $this->_getAllByProduct($sql);
}
}

View File

@ -1,6 +1,6 @@
BlockedLog=Non Reversible Logs
BlockedLog=Unalterable Logs
Field=Field
BlockedLogDesc=This module tracks some events into a non reversible log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
BlockedLogDesc=This module tracks some events into an unalterable log (that you can't modify once recorded) into a block chain, in real time. This module provides compatibility with requirements of laws of some countries (like France with the law Fincance 2016 - Norme NF535).
Fingerprints=Archived events and fingerprints
FingerprintsDesc=Archived business events and fingerprints
CompanyInitialKey=Company initial key (hash of genesis block)
@ -27,6 +27,6 @@ logDOC_PREVIEW=Preview of a validated document in order to print or download
logDOC_DOWNLOAD=Download of a validated document in order to print or send
DataOfArchivedEvent=Full datas of archived event
ImpossibleToReloadObject=Object (type %s, id %s) removed
BlockedLogAreRequiredByYourCountryLegislation=Unalterable logs are required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of non-legal software as it can not be validated by a tax audit.
BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of non-legal software as it can not be validated by a tax audit.
BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit.
BlockedLogDisableNotAllowedForCountry=Disable not allowed for this countries

View File

@ -548,6 +548,18 @@ MonthShort09=Sep
MonthShort10=Oct
MonthShort11=Nov
MonthShort12=Dec
MonthVeryShort01=J
MonthVeryShort02=F
MonthVeryShort03=M
MonthVeryShort04=A
MonthVeryShort05=M
MonthVeryShort06=J
MonthVeryShort07=J
MonthVeryShort08=A
MonthVeryShort09=S
MonthVeryShort10=O
MonthVeryShort11=N
MonthVeryShort12=D
AttachedFiles=Attached files and documents
JoinMainDoc=Join main document
DateFormatYYYYMM=YYYY-MM

View File

@ -110,11 +110,13 @@ class modMyModule extends DolibarrModules
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
$this->requiredby = array(); // List of module ids to disable if this one is disabled
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
$this->langfiles = array("mymodule@mymodule");
$this->phpmin = array(5,3); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(4,0); // Minimum version of Dolibarr required by module
$this->langfiles = array("mymodule@mymodule");
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
//$this->automatic_activation = array('FR'=>'MyModuleWasAutomaticallyActivatedBecauseOfYourCountryChoice');
//$this->always_enabled = true; // If true, can't be disabled
// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)

View File

@ -163,10 +163,11 @@ class ProjectStats extends Stats
/**
* Return Project number by month for a year
*
* @param int $year scan
* @return array of values
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -182,7 +183,7 @@ class ProjectStats extends Stats
$this->yearmonth=0;
$res = $this->_getNbByMonth($year, $sql);
$res = $this->_getNbByMonth($year, $sql, $format);
// var_dump($res);print '<br>';
return $res;
}
@ -190,10 +191,11 @@ class ProjectStats extends Stats
/**
* Return the Project amount by month for a year
*
* @param int $year scan
* @return array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getAmountByMonth($year)
function getAmountByMonth($year, $format=0)
{
global $user;
@ -208,7 +210,7 @@ class ProjectStats extends Stats
$sql .= $this->db->order('dm', 'DESC');
$this->yearmonth=0;
$res = $this->_getAmountByMonth($year, $sql);
$res = $this->_getAmountByMonth($year, $sql, $format);
// var_dump($res);print '<br>';
return $res;
}
@ -421,10 +423,11 @@ class ProjectStats extends Stats
/**
* Return the Project transformation rate by month for a year
*
* @param int $year scan
* @return array with amount by month
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array with amount by month
*/
function getTransformRateByMonth($year)
function getTransformRateByMonth($year, $format=0)
{
global $user;
@ -438,7 +441,7 @@ class ProjectStats extends Stats
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$res_total = $this->_getNbByMonth($year, $sql);
$res_total = $this->_getNbByMonth($year, $sql, $format);
$this->status=6;
@ -453,7 +456,7 @@ class ProjectStats extends Stats
$this->status=0;
$this->yearmonth=0;
$res_only_wined = $this->_getNbByMonth($year, $sql);
$res_only_wined = $this->_getNbByMonth($year, $sql, $format);
$res=array();

View File

@ -158,10 +158,11 @@ class TaskStats extends Stats
/**
* Return Task number by month for a year
*
* @param int $year scan
* @return array of values
* @param int $year Year to scan
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of values
*/
function getNbByMonth($year)
function getNbByMonth($year, $format=0)
{
global $user;
@ -177,7 +178,7 @@ class TaskStats extends Stats
$this->yearmonth=0;
$res = $this->_getNbByMonth($year, $sql);
$res = $this->_getNbByMonth($year, $sql, $format);
// var_dump($res);print '<br>';
return $res;
}

View File

@ -1104,6 +1104,10 @@ div.blockvmenuend, div.blockvmenubookmarks {
div.vmenu, td.vmenu {
padding-right: 10px !important;
}
.blockvmenu .menu_titre {
margin-top: 4px;
margin-bottom: 3px;
}
/* Try responsive even not on smartphone
#id-container {
@ -1798,7 +1802,7 @@ div.login_block {
position: absolute;
text-align: <?php print $right; ?>;
<?php print $right; ?>: 0;
top: 0;
top: <?php print $disableimages?'4px':'0'; ?>;
font-weight: bold;
max-width: <?php echo $maxwidthloginblock; ?>px;
<?php if (GETPOST('optioncss','aZ09') == 'print') { ?>

View File

@ -3093,7 +3093,7 @@ span.dashboardlineko {
border-bottom-width: 1px;
}
.boxtablenobottom {
border-bottom-width: 0 !important;
/* border-bottom-width: 0 !important; */
}
.boxtable .fichehalfright, .boxtable .fichehalfleft {
min-width: 300px;