New: Add a dedicated third party page

This commit is contained in:
Laurent Destailleur 2010-11-16 23:49:25 +00:00
parent e751b5ed57
commit da09e5c9eb
8 changed files with 244 additions and 9 deletions

View File

@ -13,7 +13,7 @@ delete from llx_menu where menu_handler=__HANDLER__;
-- table llx_menu
--
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 1, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->compta->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire', '', 2, 6, __ENTITY__);

View File

@ -13,7 +13,7 @@ delete from llx_menu where menu_handler=__HANDLER__;
-- table llx_menu
--
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('1', 1__+MAX_llx_menu__, __HANDLER__, 'top', 'home', '', 0, '/index.php?mainmenu=home&leftmenu=', 'Home', -1, '', '', '', 2, 1, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled || $conf->fournisseur->enabled', 2__+MAX_llx_menu__, __HANDLER__, 'top', 'companies', '', 0, '/societe/index.php?mainmenu=companies&leftmenu=', 'ThirdParties', -1, 'companies', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->product->enabled || $conf->service->enabled', 3__+MAX_llx_menu__, __HANDLER__, 'top', 'products', '', 0, '/product/index.php?mainmenu=products&leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire||$user->rights->service->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->compta->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->deplacement->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire', '', 2, 6, __ENTITY__);

View File

@ -87,10 +87,10 @@ function print_eldy_menu($db,$atarget,$type_user)
|| ($conf->fournisseur->enabled && $user->rights->fournisseur->lire))
{
print_start_menu_entry($idsel);
print '<a class="tmenuimage" href="'.DOL_URL_ROOT.'/index.php?mainmenu=companies&amp;leftmenu="'.($atarget?" target=$atarget":"").'>';
print '<a class="tmenuimage" href="'.DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&amp;leftmenu="'.($atarget?" target=$atarget":"").'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'/index.php?mainmenu=companies&amp;leftmenu="'.($atarget?" target=$atarget":"").'>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&amp;leftmenu="'.($atarget?" target=$atarget":"").'>';
print_text_menu_entry($langs->trans("ThirdParties"));
print '</a>';
print_end_menu_entry();

View File

@ -493,7 +493,7 @@ foreach($dashboardlines as $key => $board)
{
print '<td rowspan="'.$rowspan.'" width="80" style="border-left: 1px solid #DDDDDD" align="center">';
$text='';
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate");
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
$options='height="64px"';
if ($rowspan <= 2) $options='height="24"'; // Weather logo is smaller if dashboard has few elements
else if ($rowspan <= 3) $options='height="48"'; // Weather logo is smaller if dashboard has few elements

View File

@ -294,6 +294,9 @@ YouMustCreateContactFirst=You must create emails contacts for third party first
ListSuppliersShort=List of suppliers
ListProspectsShort=List of prospects
ListCustomersShort=List of customers
ThirdPartiesArea=Third parties area
LastModifiedThirdParties=Last %s modified third parties
UniqueThirdParties=Total of unique third parties
# Monkey
MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.

View File

@ -301,7 +301,9 @@ YouMustCreateContactFirst=Vous devez créer des contacts avec emails sur le tier
ListSuppliersShort=Liste fournisseurs
ListProspectsShort=Liste prospects
ListCustomersShort=Liste clients
ThirdPartiesArea=Espace Tiers
LastModifiedThirdParties=Les %s derniers tiers modifiés
UniqueThirdParties=Total de tiers uniques
# Monkey
MonkeyNumRefModelDesc=Renvoie le numéro sous la forme %syymm-nnnn pour les codes clients et %syymm-nnnn pour les codes fournisseurs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0.

View File

@ -0,0 +1,214 @@
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/societe/index.php
* \ingroup societe
* \brief Home page for third parties area
* \version $Id$
*/
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php');
// Security check
$result=restrictedArea($user,'societe',0,'','','','');
$thirdparty_static = new Societe($db);
$langs->load("companies");
/*
* View
*/
$transAreaType = $langs->trans("ThirdPartiesArea");
$helpurl='EN:Module_ThirdParty|FR:Module_Tiers|ES:M&oacute;dulo_Tierceros';
llxHeader("",$langs->trans("ThirdParties"),$helpurl);
print_fiche_titre($transAreaType);
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="30%" class="notopnoleft">';
/*
* Zone recherche tiers
*/
$rowspan=2;
print '<form method="post" action="'.DOL_URL_ROOT.'/societe/societe.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="3">'.$langs->trans("Search").'</td></tr>';
print "<tr $bc[0]><td>";
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="14" name="search_nom_only"></td>';
print '<td rowspan="'.$rowspan.'"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print "<tr $bc[0]><td>";
print $langs->trans("Other").':</td><td><input class="flat" type="text" size="14" name="search_all"></td>';
//print '<td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td>';
print '</tr>';
print "</table></form><br>";
/*
* Nombre de tiers
*/
$third = array();
$total=0;
$sql = "SELECT s.rowid, s.client, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.entity = ".$conf->entity;
$result = $db->query($sql);
if ($result)
{
while ($objp = $db->fetch_object($result))
{
if ($objp->client == 1 || $objp->client == 3) $third['customer']++;
if ($objp->client == 2 || $objp->client == 3) $third['prospect']++;
if ($objp->fournisseur) $third['supplier']++;
$total++;
}
}
else dol_print_error($db);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
if ($conf->societe->enabled)
{
$statProducts = "<tr $bc[0]>";
$statProducts.= '<td><a href="'.DOL_URL_ROOT.'/comm/prospect/prospects.php">'.$langs->trans("Prospects").'</a></td><td align="right">'.round($third['prospect']).'</td>';
$statProducts.= "</tr>";
$statProducts.= "<tr $bc[1]>";
$statProducts.= '<td><a href="'.DOL_URL_ROOT.'/comm/clients.php">'.$langs->trans("Customers").'</a></td><td align="right">'.round($third['customer']).'</td>';
$statProducts.= "</tr>";
}
if ($conf->fournisseur->enabled)
{
$statServices = "<tr $bc[0]>";
$statServices.= '<td><a href="'.DOL_URL_ROOT.'/fourn/liste.php">'.$langs->trans("Suppliers").'</a></td><td align="right">'.round($third['supplier']).'</td>';
$statServices.= "</tr>";
}
print $statProducts;
print $statServices;
print '<tr class="liste_total"><td>'.$langs->trans("UniqueThirdParties").'</td><td align="right">';
print $total;
print '</td></tr>';
print '</table>';
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
/*
* Last third parties modified
*/
$max=15;
$sql = "SELECT s.rowid, s.nom, s.client, s.fournisseur,";
$sql.= " s.tms as datem";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE s.entity = ".$conf->entity;
$sql.= " AND (";
if (! empty($conf->societe->enabled)) $sql.=" s.client in (1,2,3)";
if (! empty($conf->fournisseur->enabled)) $sql.=" OR s.fournisseur in (1)";
$sql.= ")";
$sql.= $db->order("s.tms","DESC");
$sql.= $db->plimit($max,0);
//print $sql;
$result = $db->query($sql) ;
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
if ($num > 0)
{
$transRecordedType = $langs->trans("LastModifiedThirdParties",$max);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$transRecordedType.'</td></tr>';
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
// Name
print '<td nowrap="nowrap">';
$thirdparty_static->id=$objp->rowid;
$thirdparty_static->nom=$objp->nom;
$thirdparty_static->client=$objp->client;
$thirdparty_static->fournisseur=$objp->fournisseur;
$thirdparty_static->datem=$db->jdate($objp->datem);
print $thirdparty_static->getNomUrl(1,'',16);
print "</td>\n";
// Type
print '<td align="center">';
if ($thirdparty_static->client==1 || $thirdparty_static->client==3)
{
print "<a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$thirdparty_static->id."\">".$langs->trans("Customer")."</a>\n";
}
if ($thirdparty_static->client == 3) print " / ";
if ($thirdparty_static->client==2 || $thirdparty_static->client==3)
{
print "<a href=\"".DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$thirdparty_static->id."\">".$langs->trans("Prospect")."</a>\n";
}
if ($thirdparty_static->fournisseur)
{
if ($thirdparty_static->client) print " / ";
print '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$thirdparty_static->id.'">'.$langs->trans("Supplier").'</a>';
}
print '</td>';
// Last modified date
print '<td align="right">';
print dol_print_date($thirdparty_static->datem,'day');
print "</td>";
// print '<td align="right" nowrap="nowrap">';
// print $product_static->LibStatut($objp->tobuy,5,1);
// print "</td>";
print "</tr>\n";
$i++;
}
$db->free();
print "</table>";
}
}
else
{
dol_print_error($db);
}
print '</td></tr></table>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -37,6 +37,8 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe','','');
$search_nom=trim(isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"]);
$search_nom_only=trim(isset($_GET["search_nom_only"])?$_GET["search_nom_only"]:$_POST["search_nom_only"]);
$search_all=trim(isset($_GET["search_all"])?$_GET["search_all"]:$_POST["search_all"]);
$search_ville=trim(isset($_GET["search_ville"])?$_GET["search_ville"]:$_POST["search_ville"]);
$socname=trim(isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]);
$search_idprof1=trim($_REQUEST['search_idprof1']);
@ -171,7 +173,19 @@ if (! $user->rights->societe->lire || ! $user->rights->fournisseur->lire)
{
if (! $user->rights->fournisseur->lire) $sql.=" AND s.fournisseur != 1";
}
if ($search_nom_only)
{
$sql.= " AND s.nom LIKE '%".addslashes($search_nom_only)."%'";
}
if ($search_all)
{
$sql.= " AND (";
$sql.= "s.nom LIKE '%".addslashes($search_all)."%'";
$sql.= " OR s.code_client LIKE '%".addslashes($search_all)."%'";
$sql.= " OR s.email like '%".addslashes($search_all)."%'";
$sql.= " OR s.url like '%".addslashes($search_all)."%'";
$sql.= ")";
}
if ($search_nom)
{
$sql.= " AND (";
@ -202,6 +216,7 @@ if ($search_idprof4)
{
$sql .= " AND s.idprof4 LIKE '%".addslashes($search_idprof4)."%'";
}
//print $sql;
// Count total nb of records
$nbtotalofrecords = 0;
@ -260,6 +275,7 @@ if ($resql)
print '<td class="liste_titre">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only;
print '<input class="flat" type="text" name="search_nom" value="'.$search_nom.'">';
print '</td><td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ville" value="'.$search_ville.'">';
@ -319,8 +335,8 @@ if ($resql)
if ($obj->client) print " / ";
print '<a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
}
print '</td></tr>'."\n";
print '</td>';
print '</tr>'."\n";
$i++;
}