Fix: strict mode avenue
This commit is contained in:
parent
5a57070f6f
commit
94b7aed116
@ -33,9 +33,8 @@ $langs->load("propal");
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid='';
|
$socid=GETPOST('socid','int');
|
||||||
if ($_GET["socid"]) { $socid=$_GET["socid"]; }
|
if (isset($user->societe_id) && $user->societe_id > 0)
|
||||||
if ($user->societe_id > 0)
|
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
@ -285,10 +284,12 @@ else dol_print_error($db);
|
|||||||
/*
|
/*
|
||||||
* Opened proposals
|
* Opened proposals
|
||||||
*/
|
*/
|
||||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||||
{
|
{
|
||||||
$langs->load("propal");
|
$langs->load("propal");
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
|
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as propalid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||||
|
|||||||
@ -244,20 +244,22 @@ if ($result)
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
if ($user->rights->societe->client->voir || $socid) // TODO same of the second !!
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||||
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||||
$moreforfilter.=' ';
|
$moreforfilter.=' ';
|
||||||
}
|
}
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
if ($user->rights->societe->client->voir || $socid) // TODO same of the first !!
|
||||||
{
|
{
|
||||||
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
||||||
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
|
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
|
||||||
}
|
}
|
||||||
if ($moreforfilter)
|
if (! empty($moreforfilter))
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre" colspan="9">';
|
print '<td class="liste_titre" colspan="9">';
|
||||||
@ -306,11 +308,13 @@ if ($result)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
$total=0;
|
||||||
|
$subtotal=0;
|
||||||
|
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($result);
|
$objp = $db->fetch_object($result);
|
||||||
$now = time();
|
$now = dol_now();
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td nowrap="nowrap">';
|
print '<td nowrap="nowrap">';
|
||||||
@ -394,8 +398,8 @@ if ($result)
|
|||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$total = $total + $objp->total_ht;
|
$total += $objp->total_ht;
|
||||||
$subtotal = $subtotal + $objp->total_ht;
|
$subtotal += $objp->total_ht;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -56,7 +56,7 @@ $langs->load("propal");
|
|||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
|
print_fiche_titre($langs->trans("ProposalsStatistics"));
|
||||||
|
|
||||||
$dir=$conf->propal->dir_temp;
|
$dir=$conf->propal->dir_temp;
|
||||||
|
|
||||||
@ -159,6 +159,8 @@ for ($i = 1 ; $i < 13 ; $i++)
|
|||||||
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fileurl_avg='';
|
||||||
|
if (! isset($mode)) $mode=''; // TODO $mode not defined ?
|
||||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||||
{
|
{
|
||||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||||
@ -211,11 +213,12 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
|||||||
|
|
||||||
$h=0;
|
$h=0;
|
||||||
$head = array();
|
$head = array();
|
||||||
$head[$h][0] = DOL_URL_ROOT . '/commande/stats/index.php';
|
$head[$h][0] = DOL_URL_ROOT . '/comm/propal/stats/index.php';
|
||||||
$head[$h][1] = $langs->trans("ByMonthYear");
|
$head[$h][1] = $langs->trans("ByMonthYear");
|
||||||
$head[$h][2] = 'byyear';
|
$head[$h][2] = 'byyear';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
$object=(object) array(); // TODO $object not defined ?
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats');
|
||||||
|
|
||||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||||
@ -261,7 +264,7 @@ $oldyear=0;
|
|||||||
foreach ($data as $val)
|
foreach ($data as $val)
|
||||||
{
|
{
|
||||||
$year = $val['year'];
|
$year = $val['year'];
|
||||||
print $avg;
|
//print $avg; // TODO $avg not defined ?
|
||||||
while ($oldyear > $year+1)
|
while ($oldyear > $year+1)
|
||||||
{ // If we have empty year
|
{ // If we have empty year
|
||||||
$oldyear--;
|
$oldyear--;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -176,7 +177,8 @@ abstract class Stats
|
|||||||
*/
|
*/
|
||||||
function _getNbByMonth($year, $sql)
|
function _getNbByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result=array();
|
||||||
|
$res=array();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::_getNbByMonth sql=".$sql);
|
dol_syslog(get_class($this)."::_getNbByMonth sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -200,7 +202,7 @@ abstract class Stats
|
|||||||
|
|
||||||
for ($i = 1 ; $i < 13 ; $i++)
|
for ($i = 1 ; $i < 13 ; $i++)
|
||||||
{
|
{
|
||||||
$res[$i] = $result[$i] + 0;
|
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -225,7 +227,8 @@ abstract class Stats
|
|||||||
*/
|
*/
|
||||||
function _getAmountByMonth($year, $sql)
|
function _getAmountByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result=array();
|
||||||
|
$res=array();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::_getAmountByMonth sql=".$sql);
|
dol_syslog(get_class($this)."::_getAmountByMonth sql=".$sql);
|
||||||
|
|
||||||
@ -247,7 +250,7 @@ abstract class Stats
|
|||||||
|
|
||||||
for ($i = 1 ; $i < 13 ; $i++)
|
for ($i = 1 ; $i < 13 ; $i++)
|
||||||
{
|
{
|
||||||
$res[$i] = (int) round($result[$i]) + 0;
|
$res[$i] = (int) round((isset($result[$i])?$result[$i]:0));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
@ -271,7 +274,8 @@ abstract class Stats
|
|||||||
*/
|
*/
|
||||||
function _getAverageByMonth($year, $sql)
|
function _getAverageByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
$result = array();
|
$result=array();
|
||||||
|
$res=array();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::_getAverageByMonth sql=".$sql);
|
dol_syslog(get_class($this)."::_getAverageByMonth sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
@ -292,7 +296,7 @@ abstract class Stats
|
|||||||
|
|
||||||
for ($i = 1 ; $i < 13 ; $i++)
|
for ($i = 1 ; $i < 13 ; $i++)
|
||||||
{
|
{
|
||||||
$res[$i] = $result[$i] + 0;
|
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
|
|||||||
@ -180,10 +180,13 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = s
|
|||||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||||
if ($search_categ) $sql.= " AND s.rowid = cs.fk_societe"; // Join for the needed table to filter by categ
|
if ($search_categ) $sql.= " AND s.rowid = cs.fk_societe"; // Join for the needed table to filter by categ
|
||||||
|
// TODO $stcomm is not defined !
|
||||||
|
/*
|
||||||
if (dol_strlen($stcomm))
|
if (dol_strlen($stcomm))
|
||||||
{
|
{
|
||||||
$sql.= " AND s.fk_stcomm=".$stcomm;
|
$sql.= " AND s.fk_stcomm=".$stcomm;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible
|
||||||
// Insert sale filter
|
// Insert sale filter
|
||||||
if ($search_sale)
|
if ($search_sale)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user