2004-10-20 23:06:45 +02:00
< ? php
2011-10-24 18:56:00 +02:00
/* Copyright ( C ) 2001 - 2004 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2012-02-19 15:40:13 +01:00
* Copyright ( C ) 2004 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2012-02-01 11:36:16 +01:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis @ dolibarr . fr >
2012-06-10 11:10:18 +02:00
* Copyright ( C ) 2011 - 2012 Juanjo Menent < jmenent @ 2 byte . es >
2002-04-29 21:47:03 +02:00
*
* 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
2011-08-01 01:19:04 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2002-04-29 19:53:37 +02:00
*/
2005-01-03 20:21:51 +01:00
/**
2008-11-19 19:19:51 +01:00
* \file htdocs / index . php
2008-12-07 16:55:40 +01:00
* \brief Dolibarr home page
2008-11-16 19:55:00 +01:00
*/
2005-01-03 20:21:51 +01:00
2009-05-16 09:01:34 +02:00
define ( 'NOCSRFCHECK' , 1 ); // This is login page. We must be able to go on it from another web site.
2009-05-16 08:31:59 +02:00
2012-08-22 23:24:21 +02:00
require './main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2002-04-29 19:53:37 +02:00
2005-02-27 17:45:59 +01:00
2008-12-07 16:55:40 +01:00
// If not defined, we select menu "home"
2005-04-09 00:03:42 +02:00
if ( ! isset ( $_GET [ " mainmenu " ])) $_GET [ " mainmenu " ] = " home " ;
2012-03-19 14:06:21 +01:00
$action = GETPOST ( 'action' );
2005-01-03 20:21:51 +01:00
2006-11-01 16:15:14 +01:00
2011-12-06 23:38:54 +01:00
include_once ( DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php' );
$hookmanager = new HookManager ( $db );
2012-03-02 14:51:16 +01:00
$hookmanager -> initHooks ( array ( 'index' ));
2011-12-06 23:38:54 +01:00
2011-02-19 18:21:29 +01:00
2008-12-07 16:55:40 +01:00
/*
* Actions
*/
2006-11-01 16:15:14 +01:00
2011-02-19 18:21:29 +01:00
// Check if company name is defined (first install)
if ( ! isset ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ) || empty ( $conf -> global -> MAIN_INFO_SOCIETE_NOM ))
{
header ( " Location: " . DOL_URL_ROOT . " /admin/company.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete " );
exit ;
}
2006-11-01 16:15:14 +01:00
2010-02-28 05:32:18 +01:00
2006-11-01 16:15:14 +01:00
/*
2008-12-07 16:55:40 +01:00
* View
2008-11-16 19:55:00 +01:00
*/
2005-01-03 20:21:51 +01:00
2011-08-15 19:43:40 +02:00
// If smartphone mode, we do not show main page, we show only menu
2012-02-29 20:58:05 +01:00
if ( preg_match ( '/^smartphone/' , $conf -> smart_menu ) && ! empty ( $conf -> browser -> phone ))
2011-02-16 20:59:16 +01:00
{
2011-07-08 17:35:08 +02:00
$limitmenuto = GETPOST ( 'limitmenuto' ) ? GETPOST ( 'limitmenuto' ) : 0 ;
$limitmenuto = 1 ; // A virer
2011-02-19 18:21:29 +01:00
2011-02-18 10:50:45 +01:00
// Load the smartphone menu manager
2011-10-24 14:11:49 +02:00
$result =@ include_once ( DOL_DOCUMENT_ROOT . " /core/menus/smartphone/ " . $conf -> smart_menu );
2011-02-18 10:50:45 +01:00
if ( ! $result ) // If failed to include, we try with standard
{
2011-07-08 17:35:08 +02:00
$conf -> smart_menu = 'smartphone_backoffice.php' ;
2011-10-24 14:11:49 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /core/menus/smartphone/ " . $conf -> smart_menu );
2011-02-18 10:50:45 +01:00
}
$menusmart = new MenuSmart ( $db );
include_once ( DOL_DOCUMENT_ROOT . '/theme/phones/smartphone/tpl/menu.tpl.php' );
2011-02-16 20:59:16 +01:00
exit ;
}
2002-04-29 19:53:37 +02:00
llxHeader ();
2003-02-11 14:24:02 +01:00
2005-08-12 00:57:29 +02:00
print_fiche_titre ( $langs -> trans ( " HomeArea " ));
2008-06-14 12:39:00 +02:00
if ( ! empty ( $conf -> global -> MAIN_MOTD ))
2004-07-26 16:38:34 +02:00
{
2011-07-08 17:35:08 +02:00
$conf -> global -> MAIN_MOTD = preg_replace ( '/<br(\s[\sa-zA-Z_="]*)?\/?>/i' , '<br>' , $conf -> global -> MAIN_MOTD );
if ( ! empty ( $conf -> global -> MAIN_MOTD ))
{
print " \n <!-- Start of welcome text --> \n " ;
print '<table width="100%" class="notopnoleftnoright"><tr><td>' ;
print dol_htmlentitiesbr ( $conf -> global -> MAIN_MOTD );
print '</td></tr></table><br>' ;
print " \n <!-- End of welcome text --> \n " ;
}
2004-07-26 16:38:34 +02:00
}
2005-08-12 00:57:29 +02:00
2011-08-18 00:13:26 +02:00
print '<div class="fichecenter"><div class="fichethirdleft">' ;
2005-08-12 00:57:29 +02:00
/*
2008-12-07 16:55:40 +01:00
* Informations area
2005-08-12 00:57:29 +02:00
*/
2005-09-06 15:56:40 +02:00
2005-08-12 00:57:29 +02:00
print '<table class="noborder" width="100%">' ;
2011-11-03 01:59:13 +01:00
print '<tr class="liste_titre"><th class="liste_titre" colspan="2">' . $langs -> trans ( " Informations " ) . '</th></tr>' ;
2005-08-12 00:57:29 +02:00
print '<tr ' . $bc [ false ] . '>' ;
2011-05-21 17:25:00 +02:00
print '<td nowrap="nowrap">' . $langs -> trans ( " User " ) . '</td><td>' . $user -> getNomUrl ( 0 ) . '</td></tr>' ;
2005-08-12 00:57:29 +02:00
print '<tr ' . $bc [ true ] . '>' ;
2011-05-21 17:25:00 +02:00
print '<td nowrap="nowrap">' . $langs -> trans ( " PreviousConnexion " ) . '</td><td>' ;
2012-06-27 01:40:25 +02:00
if ( $user -> datepreviouslogin ) print dol_print_date ( $user -> datepreviouslogin , " dayhour " , 'tzuser' );
2005-08-12 00:57:29 +02:00
else print $langs -> trans ( " Unknown " );
print '</td>' ;
2005-09-06 15:56:40 +02:00
print " </tr> \n " ;
print " </table> \n " ;
2005-08-12 00:57:29 +02:00
2005-08-12 23:45:18 +02:00
/*
2010-02-16 23:26:44 +01:00
* Dashboard Dolibarr states ( statistics )
2009-08-23 02:15:30 +02:00
* Hidden for external users
2005-08-12 23:45:18 +02:00
*/
2005-12-02 14:33:20 +01:00
$langs -> load ( " commercial " );
2007-07-08 18:30:51 +02:00
$langs -> load ( " bills " );
2010-12-01 22:28:08 +01:00
$langs -> load ( " orders " );
2005-08-24 18:36:07 +02:00
if ( $user -> societe_id == 0 )
2005-08-12 23:45:18 +02:00
{
2011-07-08 17:35:08 +02:00
print '<br>' ;
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
2011-11-03 01:59:13 +01:00
print '<th class="liste_titre" colspan="2">' . $langs -> trans ( " DolibarrStateBoard " ) . '</th>' ;
print '<th class="liste_titre" align="right"> </th>' ;
2011-07-08 17:35:08 +02:00
print '</tr>' ;
$var = true ;
// Condition to be checked for each display line dashboard
$conditions = array (
! empty ( $conf -> societe -> enabled ) && $user -> rights -> societe -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS_STATS ),
! empty ( $conf -> societe -> enabled ) && $user -> rights -> societe -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS_STATS ),
! empty ( $conf -> fournisseur -> enabled ) && $user -> rights -> fournisseur -> lire && empty ( $conf -> global -> SOCIETE_DISABLE_SUPPLIERS_STATS ),
! empty ( $conf -> adherent -> enabled ) && $user -> rights -> adherent -> lire ,
! empty ( $conf -> product -> enabled ) && $user -> rights -> produit -> lire ,
! empty ( $conf -> service -> enabled ) && $user -> rights -> service -> lire ,
! empty ( $conf -> propal -> enabled ) && $user -> rights -> propale -> lire ,
! empty ( $conf -> commande -> enabled ) && $user -> rights -> commande -> lire ,
! empty ( $conf -> facture -> enabled ) && $user -> rights -> facture -> lire ,
! empty ( $conf -> societe -> enabled ) && $user -> rights -> contrat -> activer );
// Class file containing the method load_state_board for each line
$includes = array ( DOL_DOCUMENT_ROOT . " /societe/class/client.class.php " ,
DOL_DOCUMENT_ROOT . " /comm/prospect/class/prospect.class.php " ,
DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.class.php " ,
DOL_DOCUMENT_ROOT . " /adherents/class/adherent.class.php " ,
DOL_DOCUMENT_ROOT . " /product/class/product.class.php " ,
DOL_DOCUMENT_ROOT . " /product/class/service.class.php " ,
DOL_DOCUMENT_ROOT . " /comm/propal/class/propal.class.php " ,
DOL_DOCUMENT_ROOT . " /commande/class/commande.class.php " ,
DOL_DOCUMENT_ROOT . " /compta/facture/class/facture.class.php " ,
DOL_DOCUMENT_ROOT . " /contrat/class/contrat.class.php " );
// Name class containing the method load_state_board for each line
$classes = array ( 'Client' ,
2007-01-03 02:50:29 +01:00
'Prospect' ,
2005-08-24 18:36:07 +02:00
'Fournisseur' ,
'Adherent' ,
'Product' ,
'Service' ,
2007-05-05 00:37:06 +02:00
'Propal' ,
'Commande' ,
'Facture' ,
2008-10-07 01:21:00 +02:00
'Contrat' );
2011-07-08 17:35:08 +02:00
// Cle array returned by the method load_state_board for each line
$keys = array ( 'customers' ,
2005-08-24 18:36:07 +02:00
'prospects' ,
'suppliers' ,
'members' ,
'products' ,
'services' ,
2007-05-05 00:37:06 +02:00
'proposals' ,
'orders' ,
'invoices' ,
2008-10-07 01:21:00 +02:00
'Contracts' );
2011-07-08 17:35:08 +02:00
// Dashboard Icon lines
$icons = array ( 'company' ,
2005-08-24 18:36:07 +02:00
'company' ,
'company' ,
'user' ,
'product' ,
'service' ,
2007-05-05 00:37:06 +02:00
'propal' ,
'order' ,
'bill' ,
2008-10-07 01:21:00 +02:00
'order' );
2011-07-08 17:35:08 +02:00
// Translation keyword
$titres = array ( " Customers " ,
2008-04-28 00:33:56 +02:00
" Prospects " ,
" Suppliers " ,
" Members " ,
" Products " ,
" Services " ,
" CommercialProposals " ,
" CustomersOrders " ,
" BillsCustomers " ,
2008-10-07 01:21:00 +02:00
" Contracts " );
2011-07-08 17:35:08 +02:00
// Dashboard Link lines
2011-08-21 15:07:10 +02:00
$links = array ( DOL_URL_ROOT . '/comm/list.php' ,
2011-08-21 15:12:47 +02:00
DOL_URL_ROOT . '/comm/prospect/list.php' ,
2011-07-08 17:35:08 +02:00
DOL_URL_ROOT . '/fourn/liste.php' ,
2012-04-20 12:45:14 +02:00
DOL_URL_ROOT . '/adherents/liste.php?statut=1&mainmenu=members' ,
DOL_URL_ROOT . '/product/liste.php?type=0&mainmenu=products' ,
DOL_URL_ROOT . '/product/liste.php?type=1&mainmenu=products' ,
2012-06-09 19:16:31 +02:00
DOL_URL_ROOT . '/comm/propal/list.php?mainmenu=commercial' ,
2011-07-08 17:35:08 +02:00
DOL_URL_ROOT . '/commande/liste.php?mainmenu=commercial' ,
2012-06-09 19:16:31 +02:00
DOL_URL_ROOT . '/compta/facture/list.php?mainmenu=accountancy' ,
2011-07-08 17:35:08 +02:00
DOL_URL_ROOT . '/contrat/liste.php' );
// Translation lang files
$langfile = array ( " bills " ,
2008-04-28 00:33:56 +02:00
" prospects " ,
" suppliers " ,
" members " ,
" products " ,
" produts " ,
" propal " ,
" orders " ,
" bills " ,
2008-10-07 01:21:00 +02:00
" Contracts " );
2009-01-21 14:06:34 +01:00
2011-07-08 17:35:08 +02:00
// Loop and displays each line of table
foreach ( $keys as $key => $val )
{
if ( $conditions [ $key ])
{
$classe = $classes [ $key ];
// Search in cache if load_state_board is already realized
if ( ! isset ( $boardloaded [ $classe ]) || ! is_object ( $boardloaded [ $classe ]))
{
include_once ( $includes [ $key ]);
$board = new $classe ( $db );
$board -> load_state_board ( $user );
$boardloaded [ $classe ] = $board ;
}
else $board = $boardloaded [ $classe ];
$var =! $var ;
if ( $langfile [ $key ]) $langs -> load ( $langfile [ $key ]);
$title = $langs -> trans ( $titres [ $key ]);
print '<tr ' . $bc [ $var ] . '><td width="16">' . img_object ( $title , $icons [ $key ]) . '</td>' ;
print '<td>' . $title . '</td>' ;
print '<td align="right"><a href="' . $links [ $key ] . '">' . $board -> nb [ $val ] . '</a></td>' ;
print '</tr>' ;
}
}
2011-12-06 23:38:54 +01:00
$object = ( object ) array ();
$parameters = array ();
$action = '' ;
$reshook = $hookmanager -> executeHooks ( 'addStatisticLine' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2011-07-08 17:35:08 +02:00
print '</table>' ;
2005-08-12 23:45:18 +02:00
}
2011-08-15 19:43:40 +02:00
2011-08-18 00:13:26 +02:00
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">' ;
2005-08-12 00:57:29 +02:00
/*
2010-11-13 17:59:53 +01:00
* Dolibarr Working Board with weather
2005-08-12 00:57:29 +02:00
*/
2010-12-01 22:28:08 +01:00
$showweather = empty ( $conf -> global -> MAIN_DISABLE_METEO ) ? 1 : 0 ;
2010-11-13 17:59:53 +01:00
$rowspan = 0 ;
$dashboardlines = array ();
2007-10-05 20:37:34 +02:00
print '<table class="noborder" width="100%">' ;
print '<tr class="liste_titre">' ;
2011-11-03 01:59:13 +01:00
print '<th class="liste_titre"colspan="2">' . $langs -> trans ( " DolibarrWorkBoard " ) . '</th>' ;
print '<th class="liste_titre"align="right">' . $langs -> trans ( " Number " ) . '</th>' ;
print '<th class="liste_titre"align="right">' . $langs -> trans ( " Late " ) . '</th>' ;
print '<th class="liste_titre"> </th>' ;
print '<th class="liste_titre"width="20"> </th>' ;
if ( $showweather ) print '<th class="liste_titre" width="80"> </th>' ;
2007-10-05 20:37:34 +02:00
print '</tr>' ;
2008-05-07 02:43:41 +02:00
2007-10-05 20:37:34 +02:00
//
2010-02-16 23:26:44 +01:00
// Do not include sections without management permission
2007-10-05 20:37:34 +02:00
//
2010-11-13 17:59:53 +01:00
// Number of actions to do (late)
2008-05-18 18:11:54 +02:00
if ( $conf -> agenda -> enabled && $user -> rights -> agenda -> myactions -> read )
2007-10-05 20:37:34 +02:00
{
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /comm/action/class/actioncomm.class.php " );
$board = new ActionComm ( $db );
$board -> load_board ( $user );
$board -> warning_delay = $conf -> actions -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " ActionsToDo " );
$board -> url = DOL_URL_ROOT . '/comm/action/listactions.php?status=todo&mainmenu=agenda' ;
2011-05-21 17:25:00 +02:00
$board -> img = img_object ( $langs -> trans ( " Actions " ), " action " );
2010-11-13 17:59:53 +01:00
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-09-05 10:54:52 +02:00
2010-11-13 17:59:53 +01:00
// Number of customer orders a deal
2007-10-05 20:37:34 +02:00
if ( $conf -> commande -> enabled && $user -> rights -> commande -> lire )
2005-08-12 00:57:29 +02:00
{
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /commande/class/commande.class.php " );
$board = new Commande ( $db );
$board -> load_board ( $user );
2010-11-13 18:37:22 +01:00
$board -> warning_delay = $conf -> commande -> client -> warning_delay / 60 / 60 / 24 ;
2010-11-13 17:59:53 +01:00
$board -> label = $langs -> trans ( " OrdersToProcess " );
$board -> url = DOL_URL_ROOT . '/commande/liste.php?viewstatut=-2' ;
$board -> img = img_object ( $langs -> trans ( " Orders " ), " order " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 18:37:22 +01:00
// Number of suppliers orders a deal
if ( $conf -> fournisseur -> enabled && $user -> rights -> fournisseur -> commande -> lire )
{
include_once ( DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.commande.class.php " );
$board = new CommandeFournisseur ( $db );
$board -> load_board ( $user );
$board -> warning_delay = $conf -> commande -> fournisseur -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " SuppliersOrdersToProcess " );
$board -> url = DOL_URL_ROOT . '/fourn/commande/index.php' ;
$board -> img = img_object ( $langs -> trans ( " Orders " ), " order " );
$rowspan ++ ;
$dashboardlines [] = $board ;
}
2010-11-13 17:59:53 +01:00
// Number of commercial proposals opened (expired)
2007-10-05 20:37:34 +02:00
if ( $conf -> propal -> enabled && $user -> rights -> propale -> lire )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " propal " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /comm/propal/class/propal.class.php " );
$board = new Propal ( $db );
$board -> load_board ( $user , " opened " );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> propal -> cloture -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " PropalsToClose " );
2012-06-10 11:10:18 +02:00
$board -> url = DOL_URL_ROOT . '/comm/propal/list.php?viewstatut=1' ;
2010-11-13 17:59:53 +01:00
$board -> img = img_object ( $langs -> trans ( " Propals " ), " propal " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of commercial proposals CLOSED signed (billed)
2007-10-05 20:37:34 +02:00
if ( $conf -> propal -> enabled && $user -> rights -> propale -> lire )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " propal " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /comm/propal/class/propal.class.php " );
$board = new Propal ( $db );
$board -> load_board ( $user , " signed " );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> propal -> facturation -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " PropalsToBill " );
2012-06-10 11:10:18 +02:00
$board -> url = DOL_URL_ROOT . '/comm/propal/list.php?viewstatut=2' ;
2010-11-13 17:59:53 +01:00
$board -> img = img_object ( $langs -> trans ( " Propals " ), " propal " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of services enabled (delayed)
2007-10-05 20:37:34 +02:00
if ( $conf -> contrat -> enabled && $user -> rights -> contrat -> lire )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " contracts " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /contrat/class/contrat.class.php " );
$board = new Contrat ( $db );
$board -> load_board ( $user , " inactives " );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> contrat -> services -> inactifs -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " BoardNotActivatedServices " );
$board -> url = DOL_URL_ROOT . '/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=0' ;
$board -> img = img_object ( $langs -> trans ( " Contract " ), " contract " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-09-13 11:29:50 +02:00
2010-02-16 23:26:44 +01:00
// Number of active services (expired)
2007-10-05 20:37:34 +02:00
if ( $conf -> contrat -> enabled && $user -> rights -> contrat -> lire )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " contracts " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /contrat/class/contrat.class.php " );
$board = new Contrat ( $db );
$board -> load_board ( $user , " expired " );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> contrat -> services -> expires -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " BoardRunningServices " );
$board -> url = DOL_URL_ROOT . '/contrat/services.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired' ;
$board -> img = img_object ( $langs -> trans ( " Contract " ), " contract " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2010-11-13 17:59:53 +01:00
// Number of invoices customers (has paid)
2007-10-05 20:37:34 +02:00
if ( $conf -> facture -> enabled && $user -> rights -> facture -> lire )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " bills " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /compta/facture/class/facture.class.php " );
$board = new Facture ( $db );
$board -> load_board ( $user );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> facture -> client -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " CustomerBillsUnpaid " );
$board -> url = DOL_URL_ROOT . '/compta/facture/impayees.php' ;
$board -> img = img_object ( $langs -> trans ( " Bills " ), " bill " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 18:37:22 +01:00
// Number of supplier invoices (has paid)
if ( $conf -> fournisseur -> enabled && $conf -> facture -> enabled && $user -> rights -> facture -> lire )
{
$langs -> load ( " bills " );
include_once ( DOL_DOCUMENT_ROOT . " /fourn/class/fournisseur.facture.class.php " );
$board = new FactureFournisseur ( $db );
$board -> load_board ( $user );
$board -> warning_delay = $conf -> facture -> fournisseur -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " SupplierBillsToPay " );
$board -> url = DOL_URL_ROOT . '/fourn/facture/index.php?filtre=paye:0' ;
$board -> img = img_object ( $langs -> trans ( " Bills " ), " bill " );
$rowspan ++ ;
$dashboardlines [] = $board ;
}
2010-11-13 17:59:53 +01:00
// Number of transactions to conciliate
2007-10-05 20:37:34 +02:00
if ( $conf -> banque -> enabled && $user -> rights -> banque -> lire && ! $user -> societe_id )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " banks " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /compta/bank/class/account.class.php " );
$board = new Account ( $db );
$found = $board -> load_board ( $user );
2011-02-03 23:29:09 +01:00
if ( $found > 0 )
{
2011-07-08 17:35:08 +02:00
$board -> warning_delay = $conf -> bank -> rappro -> warning_delay / 60 / 60 / 24 ;
2011-02-03 23:29:09 +01:00
$board -> label = $langs -> trans ( " TransactionsToConciliate " );
$board -> url = DOL_URL_ROOT . '/compta/bank/index.php?leftmenu=bank&mainmenu=bank' ;
$board -> img = img_object ( $langs -> trans ( " TransactionsToConciliate " ), " payment " );
$rowspan ++ ;
$dashboardlines [] = $board ;
}
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of cheque to send
2007-10-05 20:37:34 +02:00
if ( $conf -> banque -> enabled && $user -> rights -> banque -> lire && ! $user -> societe_id )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " banks " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /compta/paiement/cheque/class/remisecheque.class.php " );
$board = new RemiseCheque ( $db );
$board -> load_board ( $user );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> bank -> cheque -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " BankChecksToReceipt " );
$board -> url = DOL_URL_ROOT . '/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=accountancy' ;
$board -> img = img_object ( $langs -> trans ( " BankChecksToReceipt " ), " payment " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2007-10-05 20:37:34 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Number of foundation members
2007-10-05 20:37:34 +02:00
if ( $conf -> adherent -> enabled && $user -> rights -> adherent -> lire && ! $user -> societe_id )
{
2011-07-08 17:35:08 +02:00
$langs -> load ( " members " );
2008-11-16 19:55:00 +01:00
2011-07-08 17:35:08 +02:00
include_once ( DOL_DOCUMENT_ROOT . " /adherents/class/adherent.class.php " );
$board = new Adherent ( $db );
$board -> load_board ( $user );
2010-11-13 17:59:53 +01:00
$board -> warning_delay = $conf -> adherent -> cotisation -> warning_delay / 60 / 60 / 24 ;
$board -> label = $langs -> trans ( " MembersWithSubscriptionToReceive " );
$board -> url = DOL_URL_ROOT . '/adherents/liste.php?mainmenu=members&statut=1' ;
$board -> img = img_object ( $langs -> trans ( " Members " ), " user " );
$rowspan ++ ;
$dashboardlines [] = $board ;
2005-09-13 11:29:50 +02:00
}
2005-08-12 00:57:29 +02:00
2010-11-13 17:59:53 +01:00
// Calculate total nb of late
$totallate = 0 ;
foreach ( $dashboardlines as $key => $board )
{
if ( $board -> nbtodolate > 0 ) $totallate += $board -> nbtodolate ;
}
2007-10-05 20:37:34 +02:00
2010-11-13 17:59:53 +01:00
// Show dashboard
$var = true ;
foreach ( $dashboardlines as $key => $board )
2008-03-31 00:25:39 +02:00
{
2010-11-13 17:59:53 +01:00
$var =! $var ;
print '<tr ' . $bc [ $var ] . '><td width="16">' . $board -> img . '</td><td>' . $board -> label . '</td>' ;
print '<td align="right"><a href="' . $board -> url . '">' . $board -> nbtodo . '</a></td>' ;
print '<td align="right">' ;
print '<a href="' . $board -> url . '">' ;
print $board -> nbtodolate ;
print '</a></td>' ;
print '<td align="left">' ;
if ( $board -> nbtodolate > 0 ) print img_picto ( $langs -> trans ( " NActionsLate " , $board -> nbtodolate ), " warning " );
else print ' ' ;
print '</td>' ;
print '<td nowrap="nowrap" align="right">' ;
print ' (>' . ceil ( $board -> warning_delay ) . ' ' . $langs -> trans ( " days " ) . ')' ;
print '</td>' ;
if ( $showweather )
{
2012-02-19 15:40:13 +01:00
print '<td class="nohover" rowspan="' . $rowspan . '" width="80" style="border-left: 1px solid #DDDDDD" align="center">' ;
2010-11-13 17:59:53 +01:00
$text = '' ;
2010-11-17 00:49:25 +01:00
if ( $totallate > 0 ) $text = $langs -> transnoentitiesnoconv ( " WarningYouHaveAtLeastOneTaskLate " ) . ' (' . $langs -> transnoentitiesnoconv ( " NActionsLate " , $totallate ) . ')' ;
2010-11-13 17:59:53 +01:00
$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
print showWeather ( $totallate , $text , $options );
//print showWeather(0,'');
//print showWeather(40,$text);
print '</td>' ;
$showweather = 0 ;
}
print '</tr>' ;
print " \n " ;
2008-03-31 00:25:39 +02:00
}
2010-11-13 17:59:53 +01:00
print '</table>' ; // End table array
2011-08-18 00:13:26 +02:00
print '</div></div></div><div class="fichecenter"><br>' ;
2010-11-13 17:59:53 +01:00
2002-04-29 19:53:37 +02:00
2005-01-03 20:21:51 +01:00
2003-02-13 17:58:48 +01:00
/*
2008-12-07 16:55:40 +01:00
* Show boxes
2003-02-13 17:58:48 +01:00
*/
2008-12-07 16:55:40 +01:00
2012-03-19 15:51:55 +01:00
FormOther :: printBoxesArea ( $user , " 0 " );
2005-08-12 00:57:29 +02:00
2005-02-27 17:45:59 +01:00
2011-08-18 00:13:26 +02:00
print '</div>' ;
2009-08-24 21:29:52 +02:00
/*
* Show security warnings
*/
// Security warning repertoire install existe (si utilisateur admin)
if ( $user -> admin && empty ( $conf -> global -> MAIN_REMOVE_INSTALL_WARNING ))
{
2011-07-08 17:35:08 +02:00
$message = '' ;
2011-08-04 14:07:29 +02:00
// Check if install lock file is present
$lockfile = DOL_DATA_ROOT . '/install.lock' ;
if ( ! empty ( $lockfile ) && ! file_exists ( $lockfile ) && is_dir ( DOL_DOCUMENT_ROOT . " /install " ))
2011-07-08 17:35:08 +02:00
{
2011-10-29 23:52:05 +02:00
$langs -> load ( " errors " );
2011-07-08 17:35:08 +02:00
//if (! empty($message)) $message.='<br>';
2012-03-16 11:23:53 +01:00
$message .= info_admin ( $langs -> trans ( " WarningLockFileDoesNotExists " , DOL_DATA_ROOT ) . ' ' . $langs -> trans ( " WarningUntilDirRemoved " , DOL_DOCUMENT_ROOT . " /install " ));
2011-07-08 17:35:08 +02:00
}
// Conf files must be in read only mode
2011-07-30 12:23:24 +02:00
if ( is_writable ( $conffile ))
2011-07-08 17:35:08 +02:00
{
$langs -> load ( " errors " );
2011-10-29 23:52:05 +02:00
//$langs->load("other");
2011-07-08 17:35:08 +02:00
//if (! empty($message)) $message.='<br>';
$message .= info_admin ( $langs -> transnoentities ( " WarningConfFileMustBeReadOnly " ) . ' ' . $langs -> trans ( " WarningUntilDirRemoved " , DOL_DOCUMENT_ROOT . " /install " ));
}
if ( $message )
{
print $message ;
//$message.='<br>';
//print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install"));
}
2009-08-24 21:29:52 +02:00
}
2011-12-12 01:39:55 +01:00
llxFooter ();
2009-08-24 21:29:52 +02:00
2003-02-13 17:58:48 +01:00
$db -> close ();
2002-04-29 19:53:37 +02:00
2010-11-13 17:59:53 +01:00
/**
* Show weather logo . Logo to show depends on $totallate and values for
* $conf -> global -> MAIN_METEO_OFFSET
* $conf -> global -> MAIN_METEO_GAP
2011-07-08 17:35:08 +02:00
*
* @ param int $totallate Nb of element late
* @ param string $text Text to show on logo
* @ param string $options More parameters on img tag
* @ return string Return img tag of weather
2010-11-13 17:59:53 +01:00
*/
function showWeather ( $totallate , $text , $options )
{
global $conf ;
$out = '' ;
$offset = 0 ;
$cursor = 10 ; // By default
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
//if (! empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP;
$level0 = $offset ; if ( ! empty ( $conf -> global -> MAIN_METEO_LEVEL0 )) $level0 = $conf -> global -> MAIN_METEO_LEVEL0 ;
$level1 = $offset + 1 * $cursor ; if ( ! empty ( $conf -> global -> MAIN_METEO_LEVEL1 )) $level1 = $conf -> global -> MAIN_METEO_LEVEL1 ;
$level2 = $offset + 2 * $cursor ; if ( ! empty ( $conf -> global -> MAIN_METEO_LEVEL2 )) $level2 = $conf -> global -> MAIN_METEO_LEVEL2 ;
$level3 = $offset + 3 * $cursor ; if ( ! empty ( $conf -> global -> MAIN_METEO_LEVEL3 )) $level3 = $conf -> global -> MAIN_METEO_LEVEL3 ;
if ( $totallate <= $level0 ) $out .= img_picto_common ( $text , 'weather/weather-clear.png' , $options );
if ( $totallate > $level0 && $totallate <= $level1 ) $out .= img_picto_common ( $text , 'weather/weather-few-clouds.png' , $options );
if ( $totallate > $level1 && $totallate <= $level2 ) $out .= img_picto_common ( $text , 'weather/weather-clouds.png' , $options );
if ( $totallate > $level2 && $totallate <= $level3 ) $out .= img_picto_common ( $text , 'weather/weather-many-clouds.png' , $options );
if ( $totallate > $level3 ) $out .= img_picto_common ( $text , 'weather/weather-storm.png' , $options );
return $out ;
}
2007-08-01 09:41:53 +02:00
?>