Fix: strict mode avenue
This commit is contained in:
parent
5a57070f6f
commit
94b7aed116
@ -33,9 +33,8 @@ $langs->load("propal");
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$socid='';
|
||||
if ($_GET["socid"]) { $socid=$_GET["socid"]; }
|
||||
if ($user->societe_id > 0)
|
||||
$socid=GETPOST('socid','int');
|
||||
if (isset($user->societe_id) && $user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->societe_id;
|
||||
@ -193,7 +192,7 @@ if ($conf->propal->enabled)
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@ -270,7 +269,7 @@ if ($resql)
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
@ -285,10 +284,12 @@ else dol_print_error($db);
|
||||
/*
|
||||
* Opened proposals
|
||||
*/
|
||||
if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
$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.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
@ -339,7 +340,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
|
||||
@ -244,20 +244,22 @@ if ($result)
|
||||
$i = 0;
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
$moreforfilter='';
|
||||
|
||||
// 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.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||
$moreforfilter.=' ';
|
||||
}
|
||||
// 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.=$form->select_dolusers($search_user,'search_user',1);
|
||||
}
|
||||
if ($moreforfilter)
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" colspan="9">';
|
||||
@ -306,11 +308,13 @@ if ($result)
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
$subtotal=0;
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$now = time();
|
||||
$now = dol_now();
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">';
|
||||
@ -394,8 +398,8 @@ if ($result)
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$total = $total + $objp->total_ht;
|
||||
$subtotal = $subtotal + $objp->total_ht;
|
||||
$total += $objp->total_ht;
|
||||
$subtotal += $objp->total_ht;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -56,7 +56,7 @@ $langs->load("propal");
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
|
||||
print_fiche_titre($langs->trans("ProposalsStatistics"));
|
||||
|
||||
$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]);
|
||||
}
|
||||
|
||||
$fileurl_avg='';
|
||||
if (! isset($mode)) $mode=''; // TODO $mode not defined ?
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
@ -211,11 +213,12 @@ if (! count($arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
|
||||
$h=0;
|
||||
$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][2] = 'byyear';
|
||||
$h++;
|
||||
|
||||
$object=(object) array(); // TODO $object not defined ?
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats');
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
@ -261,7 +264,7 @@ $oldyear=0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
print $avg;
|
||||
//print $avg; // TODO $avg not defined ?
|
||||
while ($oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -176,7 +177,8 @@ abstract class Stats
|
||||
*/
|
||||
function _getNbByMonth($year, $sql)
|
||||
{
|
||||
$result = array();
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
dol_syslog(get_class($this)."::_getNbByMonth sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -200,7 +202,7 @@ abstract class Stats
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$res[$i] = $result[$i] + 0;
|
||||
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||
}
|
||||
|
||||
$data = array();
|
||||
@ -225,7 +227,8 @@ abstract class Stats
|
||||
*/
|
||||
function _getAmountByMonth($year, $sql)
|
||||
{
|
||||
$result = array();
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
dol_syslog(get_class($this)."::_getAmountByMonth sql=".$sql);
|
||||
|
||||
@ -247,7 +250,7 @@ abstract class Stats
|
||||
|
||||
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();
|
||||
@ -271,7 +274,8 @@ abstract class Stats
|
||||
*/
|
||||
function _getAverageByMonth($year, $sql)
|
||||
{
|
||||
$result = array();
|
||||
$result=array();
|
||||
$res=array();
|
||||
|
||||
dol_syslog(get_class($this)."::_getAverageByMonth sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
@ -292,7 +296,7 @@ abstract class Stats
|
||||
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$res[$i] = $result[$i] + 0;
|
||||
$res[$i] = (isset($result[$i])?$result[$i]:0);
|
||||
}
|
||||
|
||||
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 ($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
|
||||
// TODO $stcomm is not defined !
|
||||
/*
|
||||
if (dol_strlen($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
|
||||
// Insert sale filter
|
||||
if ($search_sale)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user