Qual: Uniformize user interface

This commit is contained in:
Laurent Destailleur 2011-06-13 13:07:10 +00:00
parent 490ca8b320
commit 2ffb4f2d02
18 changed files with 206 additions and 125 deletions

View File

@ -848,21 +848,17 @@ if ($socid > 0)
} }
} }
if ($user->rights->societe->contact->creer) /*if ($user->rights->societe->contact->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$objsoc->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$objsoc->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>';
} }*/
if(!empty($conf->global->MAIN_MODULE_CHRONODOCS) && $user->rights->chronodocs->entries->write)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/chronodocs/fiche.php?socid='.$objsoc->id.'&amp;action=create">'.$langs->trans("AddChronodoc").'</a>';
}
print '</div>'; print '</div>';
print "<br>\n"; print "<br>\n";
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{ {
print '<br>';
// List of contacts // List of contacts
show_contacts($conf,$langs,$db,$objsoc); show_contacts($conf,$langs,$db,$objsoc);
} }

View File

@ -32,6 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php");
$WIDTH=500; $WIDTH=500;
$HEIGHT=200; $HEIGHT=200;
$userid=GETPOST('userid');
$socid=GETPOST('socid');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {

View File

@ -309,7 +309,7 @@ if ($socid > 0)
} }
} }
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$societe->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'; //print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$societe->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>';
print '</div>'; print '</div>';
@ -318,6 +318,7 @@ if ($socid > 0)
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{ {
print '<br>';
// List of contacts // List of contacts
show_contacts($conf,$langs,$db,$societe); show_contacts($conf,$langs,$db,$societe);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
@ -20,9 +20,9 @@
/** /**
* \file htdocs/commande/stats/index.php * \file htdocs/commande/stats/index.php
* \ingroup commande * \ingroup commande
* \brief Page des stats commandes * \brief Page with customers or suppliers orders statistics
* \version $Id$ * \version $Id$
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
@ -34,15 +34,16 @@ $HEIGHT=200;
$mode='customer'; $mode='customer';
if (isset($_GET["mode"])) $mode=$_GET["mode"]; if (isset($_GET["mode"])) $mode=$_GET["mode"];
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden(); if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
if ($mode == 'supplier' && ! $user->rights->fournisseur->commande->lire) accessforbidden(); if ($mode == 'supplier' && ! $user->rights->fournisseur->commande->lire) accessforbidden();
$userid=GETPOST('userid');
$socid=GETPOST('socid');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$year = strftime("%Y", time()); $year = strftime("%Y", time());
@ -59,13 +60,13 @@ llxHeader();
if ($mode == 'customer') if ($mode == 'customer')
{ {
$title=$langs->trans("OrdersStatistics"); $title=$langs->trans("OrdersStatistics");
$dir=$conf->commande->dir_temp; $dir=$conf->commande->dir_temp;
} }
if ($mode == 'supplier') if ($mode == 'supplier')
{ {
$title=$langs->trans("OrdersStatisticsSuppliers"); $title=$langs->trans("OrdersStatisticsSuppliers");
$dir=$conf->fournisseur->dir_output.'/commande/temp'; $dir=$conf->fournisseur->dir_output.'/commande/temp';
} }
print_fiche_titre($title, $mesg); print_fiche_titre($title, $mesg);
@ -82,15 +83,15 @@ $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
$filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png'; $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
} }
else else
{ {
$filenamenb = $dir.'/ordersnbinyear-'.$year.'.png'; $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png';
if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png';
} }
$px = new DolGraph(); $px = new DolGraph();
@ -98,25 +99,25 @@ $mesg = $px->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px->SetData($data); $px->SetData($data);
$px->SetPrecisionY(0); $px->SetPrecisionY(0);
$i=$startyear; $i=$startyear;
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;
$i++; $i++;
} }
$px->SetLegend($legend); $px->SetLegend($legend);
$px->SetMaxValue($px->GetCeilMaxValue()); $px->SetMaxValue($px->GetCeilMaxValue());
$px->SetMinValue(min(0,$px->GetFloorMinValue())); $px->SetMinValue(min(0,$px->GetFloorMinValue()));
$px->SetWidth($WIDTH); $px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT); $px->SetHeight($HEIGHT);
$px->SetYLabel($langs->trans("NbOfOrder")); $px->SetYLabel($langs->trans("NbOfOrder"));
$px->SetShading(3); $px->SetShading(3);
$px->SetHorizTickIncrement(1); $px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0); $px->SetPrecisionY(0);
$px->mode='depth'; $px->mode='depth';
$px->SetTitle($langs->trans("NumberOfOrdersByMonth")); $px->SetTitle($langs->trans("NumberOfOrdersByMonth"));
$px->draw($filenamenb); $px->draw($filenamenb);
} }
// Build graphic amount of object // Build graphic amount of object
@ -126,41 +127,41 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
if (!$user->rights->societe->client->voir || $user->societe_id) if (!$user->rights->societe->client->voir || $user->societe_id)
{ {
$filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png'; $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
} }
else else
{ {
$filenameamount = $dir.'/ordersamountinyear-'.$year.'.png'; $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png';
if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png';
if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png';
} }
$px = new DolGraph(); $px = new DolGraph();
$mesg = $px->isGraphKo(); $mesg = $px->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px->SetData($data); $px->SetData($data);
$i=$startyear; $i=$startyear;
while ($i <= $endyear) while ($i <= $endyear)
{ {
$legend[]=$i; $legend[]=$i;
$i++; $i++;
} }
$px->SetLegend($legend); $px->SetLegend($legend);
$px->SetMaxValue($px->GetCeilMaxValue()); $px->SetMaxValue($px->GetCeilMaxValue());
$px->SetMinValue(min(0,$px->GetFloorMinValue())); $px->SetMinValue(min(0,$px->GetFloorMinValue()));
$px->SetWidth($WIDTH); $px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT); $px->SetHeight($HEIGHT);
$px->SetYLabel($langs->trans("AmountOfOrders")); $px->SetYLabel($langs->trans("AmountOfOrders"));
$px->SetShading(3); $px->SetShading(3);
$px->SetHorizTickIncrement(1); $px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0); $px->SetPrecisionY(0);
$px->mode='depth'; $px->mode='depth';
$px->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); $px->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
$px->draw($filenameamount); $px->draw($filenameamount);
} }
print '<table class="notopnoleftnopadd" width="100%"><tr>'; print '<table class="notopnoleftnopadd" width="100%"><tr>';
@ -180,24 +181,24 @@ print '</tr>';
$oldyear=0; $oldyear=0;
foreach ($data as $val) foreach ($data as $val)
{ {
$year = $val['year']; $year = $val['year'];
while ($year && $oldyear > $year+1) while ($year && $oldyear > $year+1)
{ // If we have empty year { // If we have empty year
$oldyear--; $oldyear--;
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">'; print '<tr height="24">';
print '<td align="center"><a href="month.php?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>'; print '<td align="center"><a href="month.php?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['avg'],'MT'),1).'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year; $oldyear=$year;
} }
print '</table>'; print '</table>';
@ -210,9 +211,9 @@ print '<td align="center" valign="top">';
print '<table class="border" width="100%"><tr valign="top"><td align="center">'; print '<table class="border" width="100%"><tr valign="top"><td align="center">';
if ($mesg) { print $mesg; } if ($mesg) { print $mesg; }
else { else {
print '<img src="'.$fileurlnb.'" title="'.$langs->trans("NbOfOrders").'" alt="'.$langs->trans("NbOfProposals").'">'; print '<img src="'.$fileurlnb.'" title="'.$langs->trans("NbOfOrders").'" alt="'.$langs->trans("NbOfProposals").'">';
print "<br>\n"; print "<br>\n";
print '<img src="'.$fileurlamount.'" title="'.$langs->trans("AmountTotal").'" alt="'.$langs->trans("AmountTotal").'">'; print '<img src="'.$fileurlamount.'" title="'.$langs->trans("AmountTotal").'" alt="'.$langs->trans("AmountTotal").'">';
} }
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -33,6 +33,8 @@ $langs->load("trips");
$WIDTH=500; $WIDTH=500;
$HEIGHT=200; $HEIGHT=200;
$userid=GETPOST('userid');
$socid=GETPOST('socid');
// Securite acces client // Securite acces client
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {

View File

@ -60,6 +60,7 @@ $socid=GETPOST('socid');
$action=GETPOST('action'); $action=GETPOST('action');
$confirm=GETPOST('confirm'); $confirm=GETPOST('confirm');
$lineid=GETPOST('lineid'); $lineid=GETPOST('lineid');
$userid=GETPOST('userid');
// Security check // Security check
$fieldid = isset($_GET["ref"])?'facnumber':'rowid'; $fieldid = isset($_GET["ref"])?'facnumber':'rowid';
@ -1098,10 +1099,7 @@ if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'
} }
/* // Modify line position (up)
* Ordonnancement des lignes
*/
if ($action == 'up' && $user->rights->facture->creer) if ($action == 'up' && $user->rights->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
@ -1123,7 +1121,7 @@ if ($action == 'up' && $user->rights->facture->creer)
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']);
exit; exit;
} }
// Modify line position (down)
if ($action == 'down' && $user->rights->facture->creer) if ($action == 'down' && $user->rights->facture->creer)
{ {
$object->fetch($id); $object->fetch($id);
@ -2926,20 +2924,18 @@ else
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='f.datef';
$limit = $conf->liste_limit;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$month =GETPOST('month','int'); $month =GETPOST('month','int');
$year =GETPOST('year','int'); $year =GETPOST('year','int');
$limit = $conf->liste_limit;
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='f.datef';
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
if ($page == -1) $page = 0 ;
$sql = 'SELECT '; $sql = 'SELECT ';
$sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,'; $sql.= ' f.rowid as facid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
@ -2955,6 +2951,11 @@ else
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= ' AND s.rowid = '.$socid; if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($userid)
{
if ($userid == -1) $sql.=' AND f.fk_user_author IS NULL';
else $sql.=' AND f.fk_user_author = '.$user->id;
}
if ($_GET['filtre']) if ($_GET['filtre'])
{ {
$filtrearr = explode(',', $_GET['filtre']); $filtrearr = explode(',', $_GET['filtre']);

View File

@ -160,6 +160,12 @@ class Facture extends CommonObject
dol_syslog("Facture::Create user=".$user->id); dol_syslog("Facture::Create user=".$user->id);
// Check parameters // Check parameters
if (empty($date) || empty($user->id))
{
$this->error="ErrorBadParameter";
dol_syslog("Facture::create Try to create an invoice with an empty parameter (user, date, ...)", LOG_ERR);
return -3;
}
$soc = new Societe($this->db); $soc = new Societe($this->db);
$result=$soc->fetch($this->socid); $result=$soc->fetch($this->socid);
if ($result < 0) if ($result < 0)

View File

@ -32,8 +32,9 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php');
$langs->load("bills"); $langs->load("bills");
// Security check // Security check
$facid = GETPOST("facid"); $facid =GETPOST("facid");
$socid = GETPOST("socid"); $socid =GETPOST("socid");
$userid=GETPOST('userid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture',$facid,''); $result = restrictedArea($user, 'facture',$facid,'');
@ -102,6 +103,11 @@ else
$sql.= " AND sc.fk_user = " .$user->id; $sql.= " AND sc.fk_user = " .$user->id;
} }
if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid; if ($socid > 0) $sql.= " AND f.fk_soc = ".$socid;
if ($userid)
{
if ($userid == -1) $sql.= " AND f.fk_user_author IS NULL";
else $sql.= " AND f.fk_user_author = ".$userid;
}
// Search criteria // Search criteria
if ($_REQUEST["search_ref"]) $sql .=" AND p.rowid=".$_REQUEST["search_ref"]; if ($_REQUEST["search_ref"]) $sql .=" AND p.rowid=".$_REQUEST["search_ref"];
if ($_REQUEST["search_account"]) $sql .=" AND b.fk_account=".$_REQUEST["search_account"]; if ($_REQUEST["search_account"]) $sql .=" AND b.fk_account=".$_REQUEST["search_account"];

View File

@ -179,7 +179,7 @@ else {
dol_print_error($db); dol_print_error($db);
} }
// On ajoute les paiements anciennes version, non lies par paiement_facture // On ajoute les paiements ancienne version, non lies par paiement_facture donc sans user
if ($modecompta != 'CREANCES-DETTES') if ($modecompta != 'CREANCES-DETTES')
{ {
$sql = "SELECT -1 as rowidx, '' as name, '' as firstname, sum(p.amount) as amount_ttc"; $sql = "SELECT -1 as rowidx, '' as name, '' as firstname, sum(p.amount) as amount_ttc";
@ -221,7 +221,7 @@ print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&amp;year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&amp;year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OrderStats"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"'); if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
@ -250,8 +250,9 @@ if (sizeof($amount))
foreach($arrayforsort as $key => $value) foreach($arrayforsort as $key => $value)
{ {
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr ".$bc[$var].">";
// Third party
$fullname=$name[$key]; $fullname=$name[$key];
if ($key >= 0) { if ($key >= 0) {
$linkname='<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$key.'">'.img_object($langs->trans("ShowUser"),'user').' '.$fullname.'</a>'; $linkname='<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$key.'">'.img_object($langs->trans("ShowUser"),'user').' '.$fullname.'</a>';
@ -260,16 +261,35 @@ if (sizeof($amount))
$linkname=$langs->trans("PaymentsNotLinkedToUser"); $linkname=$langs->trans("PaymentsNotLinkedToUser");
} }
print "<td>".$linkname."</td>\n"; print "<td>".$linkname."</td>\n";
print '<td align="right">'.price($amount[$key]).'</td>';
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : '&nbsp;').'</td>'; // Amount
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES')
{ {
if($key>0){ if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid='.$key.'">';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?id='.$key.'">'.img_picto($langs->trans("Show"),"stats").'</a></td>'; else print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?userid=-1">';
} else {
print '<td> &nbsp; </td>' ;
}
} }
else
{
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?userid='.$key.'">';
else print '<a href="#">';
}
print price($amount[$key]);
print '</td>';
// Percent
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : '&nbsp;').'</td>';
// Other stats
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
{
print '<td align="center">';
if ($conf->commande->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a>&nbsp;';
if ($conf->facture->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a>&nbsp;';
if ($conf->propal->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a>&nbsp;';
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }

View File

@ -227,6 +227,7 @@ print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"nom","",'&amp;year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"nom","",'&amp;year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&amp;year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder);
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
print "</tr>\n"; print "</tr>\n";
$var=true; $var=true;
@ -255,8 +256,9 @@ if (sizeof($amount))
foreach($arrayforsort as $key=>$value) foreach($arrayforsort as $key=>$value)
{ {
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr ".$bc[$var].">";
// Third party
$fullname=$name[$key]; $fullname=$name[$key];
if ($key > 0) { if ($key > 0) {
$linkname='<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$key.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$fullname.'</a>'; $linkname='<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$key.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$fullname.'</a>';
@ -265,19 +267,44 @@ if (sizeof($amount))
$linkname=$langs->trans("PaymentsNotLinkedToInvoice"); $linkname=$langs->trans("PaymentsNotLinkedToInvoice");
} }
print "<td>".$linkname."</td>\n"; print "<td>".$linkname."</td>\n";
// Amount
print '<td align="right">'; print '<td align="right">';
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid='.$key.'">'; if ($modecompta != 'CREANCES-DETTES')
else print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?orphelins=1">'; {
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?socid='.$key.'">';
else print '<a href="'.DOL_URL_ROOT.'/compta/paiement/liste.php?orphelins=1">';
}
else
{
if ($key > 0) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?socid='.$key.'">';
else print '<a href="#">';
}
print price($amount[$key]); print price($amount[$key]);
print '</a>'; print '</a>';
print '</td>'; print '</td>';
// Percent;
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>'; print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : '&nbsp;').'</td>';
// Other stats
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
{
print '<td align="center">';
if ($conf->commande->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a>&nbsp;';
if ($conf->facture->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a>&nbsp;';
if ($conf->propal->enabled && $key>0) print '&nbsp;<a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a>&nbsp;';
print '</td>';
}
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
// Total // Total
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td>&nbsp;</td></tr>'; print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td>&nbsp;</td>';
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '<td>&nbsp;</td>';
print '</tr>';
$db->free($result); $db->free($result);
} }

View File

@ -39,8 +39,9 @@ else {
$year_end=$year_start + ($nbofyear-1); $year_end=$year_start + ($nbofyear-1);
} }
$userid=GETPOST('userid');
$socid=GETPOST('socid');
// Security check // Security check
$socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:'';
if ($user->societe_id > 0) $socid = $user->societe_id; if ($user->societe_id > 0) $socid = $user->societe_id;
if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire)
accessforbidden(); accessforbidden();

View File

@ -379,16 +379,17 @@ if ( $societe->fetch($socid) )
} }
} }
if ($user->rights->societe->contact->creer) /*if ($user->rights->societe->contact->creer)
{ {
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&amp;action=create\">".$langs->trans("AddContact")."</a>"; print "<a class=\"butAction\" href=\"".DOL_URL_ROOT.'/contact/fiche.php?socid='.$socid."&amp;action=create\">".$langs->trans("AddContact")."</a>";
} }*/
print '</div>'; print '</div>';
print '<br>'; print '<br>';
if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB))
{ {
print '<br>';
// List of contacts // List of contacts
show_contacts($conf,$langs,$db,$societe); show_contacts($conf,$langs,$db,$societe);
} }

View File

@ -305,6 +305,7 @@ Option=Option
List=List List=List
FullList=Full list FullList=Full list
Statistics=Statistics Statistics=Statistics
OtherStatistics=Other statistics
Status=Status Status=Status
Ref=Ref. Ref=Ref.
RefSupplier=Ref. supplier RefSupplier=Ref. supplier

View File

@ -305,6 +305,7 @@ Option=Option
List=Liste List=Liste
FullList=Liste complète FullList=Liste complète
Statistics=Statistiques Statistics=Statistiques
OtherStatistics=Autres statistics
Status=État Status=État
Ref=Réf. Ref=Réf.
RefSupplier=Réf. fournisseur RefSupplier=Réf. fournisseur

View File

@ -337,8 +337,9 @@ function getFormeJuridiqueLabel($code)
* @param lang Object lang * @param lang Object lang
* @param db Database handler * @param db Database handler
* @param object Third party object * @param object Third party object
* @param backtopage Url to go once contact is created
*/ */
function show_projects($conf,$langs,$db,$object) function show_projects($conf,$langs,$db,$object,$backtopage='')
{ {
global $user; global $user;
@ -348,8 +349,14 @@ function show_projects($conf,$langs,$db,$object)
{ {
$langs->load("projects"); $langs->load("projects");
$buttoncreate='';
if ($conf->projet->enabled && $user->rights->projet->creer)
{
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
}
print "\n"; print "\n";
print_titre($langs->trans("ProjectsDedicatedToThisThirdParty")); print_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,'');
print "\n".'<table class="noborder" width=100%>'; print "\n".'<table class="noborder" width=100%>';
$sql = "SELECT p.rowid,p.title,p.ref,p.public, p.dateo as do, p.datee as de"; $sql = "SELECT p.rowid,p.title,p.ref,p.public, p.dateo as do, p.datee as de";
@ -426,8 +433,9 @@ function show_projects($conf,$langs,$db,$object)
* @param lang Object lang * @param lang Object lang
* @param db Database handler * @param db Database handler
* @param object Third party object * @param object Third party object
* @param backtopage Url to go once contact is created
*/ */
function show_contacts($conf,$langs,$db,$object) function show_contacts($conf,$langs,$db,$object,$backtopage='')
{ {
global $user; global $user;
global $bc; global $bc;
@ -441,8 +449,15 @@ function show_contacts($conf,$langs,$db,$object)
$user->fetch_clicktodial(); // lecture des infos de clicktodial $user->fetch_clicktodial(); // lecture des infos de clicktodial
} }
$buttoncreate='';
if ($user->rights->societe->contact->creer)
{
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n";
}
print "\n"; print "\n";
print_titre($langs->trans("ContactsForCompany")); print_fiche_titre($langs->trans("ContactsForCompany"),$buttoncreate,'');
print "\n".'<table class="noborder" width="100%">'."\n"; print "\n".'<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>'; print '<tr class="liste_titre"><td>'.$langs->trans("Name").'</td>';
@ -496,13 +511,13 @@ function show_contacts($conf,$langs,$db,$object)
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&amp;id='.$obj->rowid.'">'; print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?action=edit&amp;id='.$obj->rowid.'&amp;backtopage='.urlencode($backtopage).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
{ {
print '<td align="center"><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&backtopage=1&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'">'; print '<td align="center"><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&actioncode=AC_RDV&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtourl).'">';
print img_object($langs->trans("Rendez-Vous"),"action"); print img_object($langs->trans("Rendez-Vous"),"action");
print '</a></td>'; print '</a></td>';
} }

View File

@ -1838,15 +1838,16 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} }
if ($user->rights->societe->contact->creer) /*if ($user->rights->societe->contact->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'."\n"; print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'."\n";
} }
*/
if ($conf->projet->enabled && $user->rights->projet->creer) /*if ($conf->projet->enabled && $user->rights->projet->creer)
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>'."\n"; print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$soc->id.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
} }*/
if ($user->rights->societe->supprimer) if ($user->rights->societe->supprimer)
{ {
@ -1879,8 +1880,7 @@ else
$somethingshown=$formfile->show_documents('company',$soc->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$soc->default_lang); $somethingshown=$formfile->show_documents('company',$soc->id,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$soc->default_lang);
print '</td>'; print '</td>';
print '<td>'; print '<td></td>';
print '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
@ -1892,11 +1892,11 @@ else
// Contacts list // Contacts list
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{ {
$result=show_contacts($conf,$langs,$db,$soc); $result=show_contacts($conf,$langs,$db,$soc,$_SERVER["PHP_SELF"].'?socid='.$soc->id);
} }
// Projects list // Projects list
$result=show_projects($conf,$langs,$db,$soc); $result=show_projects($conf,$langs,$db,$soc,$_SERVER["PHP_SELF"].'?socid='.$soc->id);
} }
} }