2006-05-06 21:06:40 +02:00
< ? php
2015-05-23 18:52:31 +02:00
/* Copyright ( C ) 2006 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2006 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2007 Patrick Raguin < patrick . raguin @ gmail . com >
* Copyright ( C ) 2010 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
* Copyright ( C ) 2013 - 2014 Florian Henry < florian . henry @ open - concept . pro >
* Copyright ( C ) 2013 - 2014 Juanjo Menent < jmenent @ 2 byte . es >
* Copyright ( C ) 2013 Christophe Battarel < contact @ altairis . fr >
2015-07-15 20:30:33 +02:00
* Copyright ( C ) 2013 Alexandre Spangaro < aspangaro . dolibarr @ gmail . com >
2015-01-25 01:20:58 +01:00
* Copyright ( C ) 2015 Frederic France < frederic . france @ free . fr >
2015-05-23 18:52:31 +02:00
* Copyright ( C ) 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2017-09-18 18:49:31 +02:00
* Copyright ( C ) 2017 Rui Strecht < rui . strecht @ aliartalentos . com >
2018-04-20 10:38:16 +02:00
* Copyright ( C ) 2018 Ferran Marcet < fmarcet @ 2 byte . es >
2013-11-24 21:28:15 +01:00
*
2006-04-09 00:47:51 +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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2006-04-09 00:47:51 +02:00
* ( 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:24:38 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2006-04-09 00:47:51 +02:00
* or see http :// www . gnu . org /
*/
/**
2011-10-24 11:25:54 +02:00
* \file htdocs / core / lib / company . lib . php
2008-08-06 16:50:06 +02:00
* \brief Ensemble de fonctions de base pour le module societe
* \ingroup societe
2008-07-29 21:20:33 +02:00
*/
2006-04-09 00:47:51 +02:00
2008-08-06 16:50:06 +02:00
/**
2009-03-12 02:44:02 +01:00
* Return array of tabs to used on pages for third parties cards .
2008-08-06 16:50:06 +02:00
*
2015-02-10 11:38:13 +01:00
* @ param Societe $object Object company shown
2011-09-28 14:13:48 +02:00
* @ return array Array of tabs
2008-08-06 16:50:06 +02:00
*/
2015-02-10 11:38:13 +01:00
function societe_prepare_head ( Societe $object )
2006-05-06 21:06:40 +02:00
{
2014-10-12 12:22:45 +02:00
global $db , $langs , $conf , $user ;
2010-08-21 17:30:17 +02:00
$h = 0 ;
$head = array ();
2017-03-20 20:58:43 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/card.php?socid=' . $object -> id ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Card " );
2010-11-05 09:28:49 +01:00
$head [ $h ][ 2 ] = 'card' ;
2010-08-21 17:30:17 +02:00
$h ++ ;
2018-07-17 13:48:08 +02:00
if ( empty ( $conf -> global -> MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES ))
{
if ( empty ( $conf -> global -> MAIN_DISABLE_CONTACTS_TAB ))
2017-09-27 20:07:01 +02:00
{
2018-07-17 13:48:08 +02:00
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$nbContact = 0 ; // TODO
2017-09-27 20:07:01 +02:00
2018-07-17 13:48:08 +02:00
$sql = " SELECT COUNT(p.rowid) as nb " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " socpeople as p " ;
$sql .= " WHERE p.fk_soc = " . $object -> id ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$obj = $db -> fetch_object ( $resql );
if ( $obj ) $nbContact = $obj -> nb ;
}
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/contact.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( 'ContactsAddresses' );
if ( $nbContact > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbContact . '</span>' ;
$head [ $h ][ 2 ] = 'contact' ;
$h ++ ;
}
}
else
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/societecontact.php?socid=' . $object -> id ;
$nbContact = count ( $object -> liste_contact ( - 1 , 'internal' )) + count ( $object -> liste_contact ( - 1 , 'external' ));
$head [ $h ][ 1 ] = $langs -> trans ( " ContactsAddresses " );
if ( $nbContact > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbContact . '</span>' ;
$head [ $h ][ 2 ] = 'contact' ;
$h ++ ;
2017-09-27 19:56:03 +02:00
}
2013-04-13 21:18:41 +02:00
if ( $object -> client == 1 || $object -> client == 2 || $object -> client == 3 )
2011-01-19 12:26:55 +01:00
{
2014-09-18 21:18:25 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/comm/card.php?socid=' . $object -> id ;
2013-05-14 10:51:09 +02:00
$head [ $h ][ 1 ] = '' ;
2013-05-02 17:41:10 +02:00
if ( empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS ) && ( $object -> client == 2 || $object -> client == 3 )) $head [ $h ][ 1 ] .= $langs -> trans ( " Prospect " );
2018-08-14 20:51:24 +02:00
if ( empty ( $conf -> global -> SOCIETE_DISABLE_PROSPECTS ) && empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS ) && $object -> client == 3 ) $head [ $h ][ 1 ] .= ' | ' ;
2013-04-13 21:18:41 +02:00
if ( empty ( $conf -> global -> SOCIETE_DISABLE_CUSTOMERS ) && ( $object -> client == 1 || $object -> client == 3 )) $head [ $h ][ 1 ] .= $langs -> trans ( " Customer " );
2011-01-19 12:26:55 +01:00
$head [ $h ][ 2 ] = 'customer' ;
$h ++ ;
2015-10-13 13:06:32 +02:00
2016-04-17 15:05:54 +02:00
if ( ! empty ( $conf -> global -> PRODUIT_CUSTOMER_PRICES ))
{
$langs -> load ( " products " );
// price
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/price.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " CustomerPrices " );
$head [ $h ][ 2 ] = 'price' ;
$h ++ ;
}
}
2013-04-13 21:18:41 +02:00
if ( ! empty ( $conf -> fournisseur -> enabled ) && $object -> fournisseur && ! empty ( $user -> rights -> fournisseur -> lire ))
2010-08-21 17:30:17 +02:00
{
2014-09-18 21:18:25 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/card.php?socid=' . $object -> id ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Supplier " );
$head [ $h ][ 2 ] = 'supplier' ;
$h ++ ;
}
2013-10-23 13:38:18 +02:00
2015-10-24 16:09:26 +02:00
if ( ! empty ( $conf -> projet -> enabled ) && ( ! empty ( $user -> rights -> projet -> lire ) ))
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/project.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Projects " );
2016-07-11 10:37:43 +02:00
$nbNote = 0 ;
$sql = " SELECT COUNT(n.rowid) as nb " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as n " ;
$sql .= " WHERE fk_soc = " . $object -> id ;
2018-11-08 18:45:02 +01:00
$sql .= " AND entity IN ( " . getEntity ( 'project' ) . " ) " ;
2016-07-11 10:37:43 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
$nbNote = $obj -> nb ;
$i ++ ;
}
}
else {
dol_print_error ( $db );
}
if ( $nbNote > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbNote . '</span>' ;
2015-10-24 16:09:26 +02:00
$head [ $h ][ 2 ] = 'project' ;
$h ++ ;
}
2011-01-25 00:35:21 +01:00
2015-05-31 02:05:39 +02:00
// Tab to link resources
2015-09-26 13:22:05 +02:00
if ( ! empty ( $conf -> resource -> enabled ) && ! empty ( $conf -> global -> RESOURCE_ON_THIRDPARTIES ))
2015-05-31 02:05:39 +02:00
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/resource/element_resource.php?element=societe&element_id=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Resources " );
$head [ $h ][ 2 ] = 'resources' ;
$h ++ ;
}
2017-10-22 15:28:03 +02:00
if ( ! empty ( $conf -> global -> ACCOUNTING_ENABLE_LETTERING ))
2017-09-26 13:02:29 +02:00
{
2017-10-22 15:28:03 +02:00
// Tab to accountancy
if ( ! empty ( $conf -> accounting -> enabled ) && $object -> client > 0 )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/accountancy/bookkeeping/thirdparty_lettrage.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " TabAccountingCustomer " );
$head [ $h ][ 2 ] = 'accounting' ;
$h ++ ;
}
2017-09-26 13:02:29 +02:00
2017-10-22 15:28:03 +02:00
// Tab to accountancy
if ( ! empty ( $conf -> accounting -> enabled ) && $object -> fournisseur > 0 )
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/accountancy/bookkeeping/thirdparty_lettrage_supplier.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " TabAccountingSupplier " );
$head [ $h ][ 2 ] = 'accounting_supplier' ;
$h ++ ;
}
2017-09-26 13:02:29 +02:00
}
2016-10-02 16:12:40 +02:00
// Related items
2018-03-22 16:39:47 +01:00
if ( ! empty ( $conf -> commande -> enabled ) || ! empty ( $conf -> propal -> enabled ) || ! empty ( $conf -> facture -> enabled ) || ! empty ( $conf -> ficheinter -> enabled ) || ! empty ( $conf -> fournisseur -> enabled ))
2016-10-02 16:12:40 +02:00
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/consumption.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $langs -> trans ( " Referers " );
$head [ $h ][ 2 ] = 'consumption' ;
$h ++ ;
}
2018-03-07 15:05:49 +01:00
// Bank accounts
2016-10-02 16:12:40 +02:00
if ( empty ( $conf -> global -> SOCIETE_DISABLE_BANKACCOUNT ))
{
2018-03-13 17:47:43 +01:00
$nbBankAccount = 0 ;
$foundonexternalonlinesystem = 0 ;
2018-03-07 15:05:49 +01:00
$langs -> load ( " banks " );
$title = $langs -> trans ( " BankAccounts " );
if ( ! empty ( $conf -> stripe -> enabled ))
{
$langs -> load ( " stripe " );
$title = $langs -> trans ( " BankAccountsAndGateways " );
2018-03-13 17:47:43 +01:00
$servicestatus = 0 ;
if ( ! empty ( $conf -> global -> STRIPE_LIVE ) && ! GETPOST ( 'forcesandbox' , 'alpha' )) $servicestatus = 1 ;
include_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php' ;
$societeaccount = new SocieteAccount ( $db );
$stripecu = $societeaccount -> getCustomerAccount ( $object -> id , 'stripe' , $servicestatus ); // Get thirdparty cu_...
if ( $stripecu ) $foundonexternalonlinesystem ++ ;
2018-03-07 15:05:49 +01:00
}
2016-12-11 13:21:21 +01:00
2016-10-02 16:12:40 +02:00
$sql = " SELECT COUNT(n.rowid) as nb " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " societe_rib as n " ;
$sql .= " WHERE fk_soc = " . $object -> id ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
$nbBankAccount = $obj -> nb ;
$i ++ ;
}
}
else {
dol_print_error ( $db );
}
2018-03-13 17:32:49 +01:00
//if (! empty($conf->stripe->enabled) && $nbBankAccount > 0) $nbBankAccount = '...'; // No way to know exact number
2018-03-13 17:47:43 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/paymentmodes.php?socid=' . $object -> id ;
$head [ $h ][ 1 ] = $title ;
if ( $foundonexternalonlinesystem ) $head [ $h ][ 1 ] .= ' <span class="badge">...</span>' ;
elseif ( $nbBankAccount > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbBankAccount . '</span>' ;
2016-10-02 16:12:40 +02:00
$head [ $h ][ 2 ] = 'rib' ;
$h ++ ;
}
2017-06-26 10:09:22 +02:00
2018-03-06 13:26:40 +01:00
if ( ! empty ( $conf -> website -> enabled ) && ( ! empty ( $conf -> global -> WEBSITE_USE_WEBSITE_ACCOUNTS )) && ( ! empty ( $user -> rights -> societe -> lire )))
2017-10-21 12:26:14 +02:00
{
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/website.php?id=' . $object -> id ;
2017-11-03 15:56:16 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " WebSiteAccounts " );
2017-10-21 12:26:14 +02:00
$nbNote = 0 ;
$sql = " SELECT COUNT(n.rowid) as nb " ;
2018-07-05 02:31:49 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe_account as n " ;
$sql .= " WHERE fk_soc = " . $object -> id . ' AND fk_website > 0' ;
2017-10-21 12:26:14 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
$nbNote = $obj -> nb ;
$i ++ ;
}
}
else {
dol_print_error ( $db );
}
if ( $nbNote > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbNote . '</span>' ;
$head [ $h ][ 2 ] = 'website' ;
$h ++ ;
}
2016-10-02 16:12:40 +02:00
// Show more tabs from modules
2011-01-25 00:35:21 +01:00
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'thirdparty' );
2010-08-21 17:30:17 +02:00
if ( $user -> societe_id == 0 )
{
2013-07-20 09:07:10 +02:00
// Notifications
if ( ! empty ( $conf -> notification -> enabled ))
{
2014-10-12 12:22:45 +02:00
$nbNote = 0 ;
2014-10-17 15:01:56 +02:00
$sql = " SELECT COUNT(n.rowid) as nb " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " notify_def as n " ;
$sql .= " WHERE fk_soc = " . $object -> id ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
$nbNote = $obj -> nb ;
$i ++ ;
}
}
else {
dol_print_error ( $db );
}
2014-10-16 20:55:13 +02:00
2014-09-18 21:18:25 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/notify/card.php?socid=' . $object -> id ;
2013-07-20 09:07:10 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notifications " );
2014-10-19 19:57:42 +02:00
if ( $nbNote > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbNote . '</span>' ;
2013-07-20 09:07:10 +02:00
$head [ $h ][ 2 ] = 'notify' ;
$h ++ ;
}
2013-10-23 13:38:18 +02:00
2013-07-20 09:07:10 +02:00
// Notes
2013-07-16 01:09:19 +02:00
$nbNote = 0 ;
if ( ! empty ( $object -> note_private )) $nbNote ++ ;
if ( ! empty ( $object -> note_public )) $nbNote ++ ;
2013-04-09 17:18:07 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/note.php?id=' . $object -> id ;
2016-05-30 01:30:28 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notes " );
2014-10-19 19:57:42 +02:00
if ( $nbNote > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . $nbNote . '</span>' ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 2 ] = 'note' ;
$h ++ ;
2011-12-21 18:56:44 +01:00
2011-12-20 11:47:35 +01:00
// Attached files
2013-07-16 18:45:40 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2016-01-23 17:19:34 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php' ;
2017-02-28 21:33:18 +01:00
$upload_dir = $conf -> societe -> multidir_output [ $object -> entity ] . " / " . $object -> id ;
2017-04-12 11:30:33 +02:00
$nbFiles = count ( dol_dir_list ( $upload_dir , 'files' , 0 , '' , '(\.meta|_preview.*\.png)$' ));
2016-01-23 17:19:34 +01:00
$nbLinks = Link :: count ( $db , $object -> element , $object -> id );
2017-06-26 10:09:22 +02:00
2010-12-29 11:08:45 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/document.php?socid=' . $object -> id ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Documents " );
2016-01-23 17:23:00 +01:00
if (( $nbFiles + $nbLinks ) > 0 ) $head [ $h ][ 1 ] .= ' <span class="badge">' . ( $nbFiles + $nbLinks ) . '</span>' ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 2 ] = 'document' ;
$h ++ ;
2011-01-23 23:39:48 +01:00
}
2016-04-08 14:28:49 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/agenda.php?socid=' . $object -> id ;
2016-10-02 21:31:32 +02:00
$head [ $h ][ 1 ] .= $langs -> trans ( " Events " );
2016-04-08 14:28:49 +02:00
if ( ! empty ( $conf -> agenda -> enabled ) && ( ! empty ( $user -> rights -> agenda -> myactions -> read ) || ! empty ( $user -> rights -> agenda -> allactions -> read ) ))
{
2016-05-17 02:16:28 +02:00
$head [ $h ][ 1 ] .= '/' ;
2016-10-02 21:31:32 +02:00
$head [ $h ][ 1 ] .= $langs -> trans ( " Agenda " );
2016-04-08 14:28:49 +02:00
}
$head [ $h ][ 2 ] = 'agenda' ;
$h ++ ;
2017-06-26 10:09:22 +02:00
2011-12-21 18:56:44 +01:00
// Log
2016-04-08 14:28:49 +02:00
/* $head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/info.php?socid=' . $object -> id ;
2011-12-21 18:56:44 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Info " );
$head [ $h ][ 2 ] = 'info' ;
2016-04-08 14:28:49 +02:00
$h ++ ; */
2011-12-21 18:56:44 +01:00
2011-01-25 00:59:37 +01:00
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'thirdparty' , 'remove' );
2010-08-21 17:30:17 +02:00
return $head ;
2008-02-25 17:30:43 +01:00
}
2006-04-09 00:47:51 +02:00
2008-02-25 17:30:43 +01:00
2008-08-06 16:50:06 +02:00
/**
2009-03-12 02:44:02 +01:00
* Return array of tabs to used on page
2008-08-06 16:50:06 +02:00
*
2011-09-28 14:13:48 +02:00
* @ param Object $object Object for tabs
2012-01-04 21:23:50 +01:00
* @ return array Array of tabs
2008-08-06 16:50:06 +02:00
*/
2010-12-29 11:08:45 +01:00
function societe_prepare_head2 ( $object )
2008-02-25 17:30:43 +01:00
{
2010-08-21 17:30:17 +02:00
global $langs , $conf , $user ;
$h = 0 ;
$head = array ();
2017-03-20 20:58:43 +01:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/card.php?socid=' . $object -> id ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " Card " );
$head [ $h ][ 2 ] = 'company' ;
$h ++ ;
2010-12-29 11:08:45 +01:00
$head [ $h ][ 0 ] = 'commerciaux.php?socid=' . $object -> id ;
2010-08-21 17:30:17 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " SalesRepresentative " );
$head [ $h ][ 2 ] = 'salesrepresentative' ;
$h ++ ;
return $head ;
2006-05-06 21:06:40 +02:00
}
2008-01-11 11:25:26 +01:00
2011-06-22 18:24:20 +02:00
/**
2011-09-28 14:13:48 +02:00
* Return array head with list of tabs to view object informations .
*
* @ return array head array with tabs
2011-06-22 18:24:20 +02:00
*/
2014-12-04 13:20:56 +01:00
function societe_admin_prepare_head ()
2011-06-22 18:24:20 +02:00
{
global $langs , $conf , $user ;
$h = 0 ;
$head = array ();
2011-09-28 14:13:48 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/admin/societe.php' ;
2013-03-24 07:11:44 +01:00
$head [ $h ][ 1 ] = $langs -> trans ( " Miscellaneous " );
2011-06-22 18:24:20 +02:00
$head [ $h ][ 2 ] = 'general' ;
$h ++ ;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
2014-12-04 13:20:56 +01:00
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'company_admin' );
2011-08-24 14:18:56 +02:00
2011-09-28 14:13:48 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/admin/societe_extrafields.php' ;
2012-09-14 12:15:55 +02:00
$head [ $h ][ 1 ] = $langs -> trans ( " ExtraFieldsThirdParties " );
2011-08-17 21:43:18 +02:00
$head [ $h ][ 2 ] = 'attributes' ;
$h ++ ;
2011-08-24 14:18:56 +02:00
2012-09-17 01:39:30 +02:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/admin/contact_extrafields.php' ;
$head [ $h ][ 1 ] = $langs -> trans ( " ExtraFieldsContacts " );
$head [ $h ][ 2 ] = 'attributes_contacts' ;
$h ++ ;
2012-09-14 12:15:55 +02:00
2014-12-04 13:20:56 +01:00
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'company_admin' , 'remove' );
2011-06-22 18:24:20 +02:00
return $head ;
}
2008-01-11 11:25:26 +01:00
/**
2013-06-27 16:02:52 +02:00
* Return country label , code or id from an id , code or label
2011-08-24 20:05:58 +02:00
*
2013-06-27 16:02:52 +02:00
* @ param int $searchkey Id or code of country to search
2017-11-03 13:25:49 +01:00
* @ param string $withcode '0' = Return label ,
2011-09-28 14:13:48 +02:00
* '1' = Return code + label ,
* '2' = Return code from id ,
* '3' = Return id from code ,
* 'all' = Return array ( 'id' => , 'code' => , 'label' => )
* @ param DoliDB $dbtouse Database handler ( using in global way may fail because of conflicts with some autoload features )
* @ param Translate $outputlangs Langs object for output translation
2013-06-27 16:02:52 +02:00
* @ param int $entconv 0 = Return value without entities and not converted to output charset , 1 = Ready for html output
* @ param int $searchlabel Label of country to search ( warning : searching on label is not reliable )
2018-06-25 17:01:37 +02:00
* @ return mixed Integer with country id or String with country code or translated country name or Array ( 'id' , 'code' , 'label' ) or 'NotDefined'
2008-07-29 21:20:33 +02:00
*/
2017-11-03 13:25:49 +01:00
function getCountry ( $searchkey , $withcode = '' , $dbtouse = 0 , $outputlangs = '' , $entconv = 1 , $searchlabel = '' )
2008-01-11 11:25:26 +01:00
{
2010-08-21 17:30:17 +02:00
global $db , $langs ;
2016-08-31 19:48:15 +02:00
$result = '' ;
2017-06-26 10:09:22 +02:00
2012-08-08 14:07:04 +02:00
// Check parameters
2013-06-27 16:02:52 +02:00
if ( empty ( $searchkey ) && empty ( $searchlabel ))
2012-08-08 14:07:04 +02:00
{
if ( $withcode === 'all' ) return array ( 'id' => '' , 'code' => '' , 'label' => '' );
else return '' ;
}
2010-09-04 20:04:47 +02:00
if ( ! is_object ( $dbtouse )) $dbtouse = $db ;
2010-12-02 00:15:39 +01:00
if ( ! is_object ( $outputlangs )) $outputlangs = $langs ;
2010-09-04 20:04:47 +02:00
2014-08-10 13:37:39 +02:00
$sql = " SELECT rowid, code, label FROM " . MAIN_DB_PREFIX . " c_country " ;
2013-06-27 16:02:52 +02:00
if ( is_numeric ( $searchkey )) $sql .= " WHERE rowid= " . $searchkey ;
elseif ( ! empty ( $searchkey )) $sql .= " WHERE code=' " . $db -> escape ( $searchkey ) . " ' " ;
2014-08-10 13:37:39 +02:00
else $sql .= " WHERE label=' " . $db -> escape ( $searchlabel ) . " ' " ;
2010-08-21 17:30:17 +02:00
2010-09-04 20:04:47 +02:00
$resql = $dbtouse -> query ( $sql );
2010-08-21 17:30:17 +02:00
if ( $resql )
{
2010-09-04 20:04:47 +02:00
$obj = $dbtouse -> fetch_object ( $resql );
2010-08-21 17:30:17 +02:00
if ( $obj )
{
2014-08-10 13:37:39 +02:00
$label = (( ! empty ( $obj -> label ) && $obj -> label != '-' ) ? $obj -> label : '' );
2010-12-02 00:15:39 +01:00
if ( is_object ( $outputlangs ))
2010-08-21 17:30:17 +02:00
{
2010-12-02 00:15:39 +01:00
$outputlangs -> load ( " dict " );
if ( $entconv ) $label = ( $obj -> code && ( $outputlangs -> trans ( " Country " . $obj -> code ) != " Country " . $obj -> code )) ? $outputlangs -> trans ( " Country " . $obj -> code ) : $label ;
else $label = ( $obj -> code && ( $outputlangs -> transnoentitiesnoconv ( " Country " . $obj -> code ) != " Country " . $obj -> code )) ? $outputlangs -> transnoentitiesnoconv ( " Country " . $obj -> code ) : $label ;
2010-08-21 17:30:17 +02:00
}
2016-08-31 19:48:15 +02:00
if ( $withcode == 1 ) $result = $label ? " $obj->code - $label " : " $obj->code " ;
else if ( $withcode == 2 ) $result = $obj -> code ;
else if ( $withcode == 3 ) $result = $obj -> rowid ;
else if ( $withcode === 'all' ) $result = array ( 'id' => $obj -> rowid , 'code' => $obj -> code , 'label' => $label );
else $result = $label ;
2010-08-21 17:30:17 +02:00
}
else
{
2016-08-31 19:48:15 +02:00
$result = 'NotDefined' ;
2010-08-21 17:30:17 +02:00
}
2013-06-27 16:02:52 +02:00
$dbtouse -> free ( $resql );
2016-08-31 19:48:15 +02:00
return $result ;
2010-08-21 17:30:17 +02:00
}
2010-09-04 20:04:47 +02:00
else dol_print_error ( $dbtouse , '' );
2012-08-08 14:07:04 +02:00
return 'Error' ;
2010-06-19 00:54:16 +02:00
}
/**
2013-10-23 13:38:18 +02:00
* Return state translated from an id . Return value is always utf8 encoded and without entities .
2011-08-24 20:05:58 +02:00
*
2017-09-20 13:45:18 +02:00
* @ param int $id id of state ( province / departement )
2013-10-23 13:38:18 +02:00
* @ param int $withcode '0' = Return label ,
* '1' = Return string code + label ,
* '2' = Return code ,
* 'all' = return array ( 'id' => , 'code' => , 'label' => )
* @ param DoliDB $dbtouse Database handler ( using in global way may fail because of conflicts with some autoload features )
2017-09-20 13:45:18 +02:00
* @ param int $withregion '0' = Ignores region ,
* '1' = Add region name / code / id as needed to output ,
* @ param Translate $outputlangs Langs object for output translation , not fully implemented yet
* @ param int $entconv 0 = Return value without entities and not converted to output charset , 1 = Ready for html output
* @ return mixed String with state code or state name or Array ( 'id' , 'code' , 'label' ) / Array ( 'id' , 'code' , 'label' , 'region_code' , 'region' )
2010-06-19 00:54:16 +02:00
*/
2018-03-14 10:48:56 +01:00
function getState ( $id , $withcode = '' , $dbtouse = 0 , $withregion = 0 , $outputlangs = '' , $entconv = 1 )
2010-06-19 00:54:16 +02:00
{
2010-08-21 17:30:17 +02:00
global $db , $langs ;
2010-09-04 20:04:47 +02:00
if ( ! is_object ( $dbtouse )) $dbtouse = $db ;
2017-09-20 13:06:35 +02:00
$sql = " SELECT d.rowid as id, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.code_region as region_code, r.nom as region_name FROM " ;
2017-09-18 17:48:13 +02:00
$sql .= " " . MAIN_DB_PREFIX . " c_departements as d, " . MAIN_DB_PREFIX . " c_regions as r, " . MAIN_DB_PREFIX . " c_country as c " ;
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and d.rowid= " . $id ;
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1 " ;
$sql .= " ORDER BY c.code, d.code_departement " ;
2010-08-21 17:30:17 +02:00
2014-06-12 11:31:53 +02:00
dol_syslog ( " Company.lib::getState " , LOG_DEBUG );
2010-09-04 20:04:47 +02:00
$resql = $dbtouse -> query ( $sql );
2010-08-21 17:30:17 +02:00
if ( $resql )
{
2010-09-04 20:04:47 +02:00
$obj = $dbtouse -> fetch_object ( $resql );
2010-08-21 17:30:17 +02:00
if ( $obj )
{
2017-09-20 13:06:35 +02:00
$label = (( ! empty ( $obj -> name ) && $obj -> name != '-' ) ? $obj -> name : '' );
if ( is_object ( $outputlangs ))
{
$outputlangs -> load ( " dict " );
if ( $entconv ) $label = ( $obj -> code && ( $outputlangs -> trans ( " State " . $obj -> code ) != " State " . $obj -> code )) ? $outputlangs -> trans ( " State " . $obj -> code ) : $label ;
else $label = ( $obj -> code && ( $outputlangs -> transnoentitiesnoconv ( " State " . $obj -> code ) != " State " . $obj -> code )) ? $outputlangs -> transnoentitiesnoconv ( " State " . $obj -> code ) : $label ;
}
if ( $withcode == 1 ) {
if ( $withregion == 1 ) {
2017-09-18 17:48:13 +02:00
return $label = $obj -> region_name . ' - ' . $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
}
else {
return $label = $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
}
}
2017-09-20 13:06:35 +02:00
else if ( $withcode == 2 ) {
if ( $withregion == 1 ) {
2017-09-18 17:48:13 +02:00
return $label = $obj -> region_name . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
}
else {
return $label = ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
}
}
2017-09-20 13:06:35 +02:00
else if ( $withcode === 'all' ) {
if ( $withregion == 1 ) {
return array ( 'id' => $obj -> id , 'code' => $obj -> code , 'label' => $label , 'region_code' => $obj -> region_code , 'region' => $obj -> region_name );
}
else {
return array ( 'id' => $obj -> id , 'code' => $obj -> code , 'label' => $label );
}
}
else {
2018-02-07 17:06:58 +01:00
if ( $withregion == 1 ) {
return $label = $obj -> region_name . ' - ' . $label ;
}
else {
return $label ;
}
2017-09-20 13:06:35 +02:00
}
2010-08-21 17:30:17 +02:00
}
else
{
2015-06-07 03:39:43 +02:00
return $langs -> transnoentitiesnoconv ( " NotDefined " );
2010-08-21 17:30:17 +02:00
}
}
2010-09-04 20:04:47 +02:00
else dol_print_error ( $dbtouse , '' );
2008-01-11 11:25:26 +01:00
}
2009-10-30 12:41:11 +01:00
/**
2017-06-26 10:09:22 +02:00
* Return label of currency or code + label
2011-08-24 20:05:58 +02:00
*
2017-06-26 10:09:22 +02:00
* @ param string $code_iso Code iso of currency
* @ param int $withcode '1' = show code + label
* @ param Translate $outputlangs Output language
* @ return string Label translated of currency
2009-10-30 12:41:11 +01:00
*/
2017-06-26 10:09:22 +02:00
function currency_name ( $code_iso , $withcode = '' , $outputlangs = null )
2009-10-30 12:41:11 +01:00
{
2010-08-21 17:30:17 +02:00
global $langs , $db ;
2017-06-26 10:09:22 +02:00
if ( empty ( $outputlangs )) $outputlangs = $langs ;
2017-06-27 12:33:29 +02:00
$outputlangs -> load ( " dict " );
2017-06-26 10:09:22 +02:00
// If there is a translation, we can send immediatly the label
if ( $outputlangs -> trans ( " Currency " . $code_iso ) != " Currency " . $code_iso )
2010-08-21 17:30:17 +02:00
{
2017-06-26 10:09:22 +02:00
return ( $withcode ? $code_iso . ' - ' : '' ) . $outputlangs -> trans ( " Currency " . $code_iso );
2010-08-21 17:30:17 +02:00
}
2017-06-26 10:09:22 +02:00
// If no translation, we read table to get label by default
2010-08-21 17:30:17 +02:00
$sql = " SELECT label FROM " . MAIN_DB_PREFIX . " c_currencies " ;
$sql .= " WHERE code_iso=' " . $code_iso . " ' " ;
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
if ( $num )
{
$obj = $db -> fetch_object ( $resql );
$label = ( $obj -> label != '-' ? $obj -> label : '' );
if ( $withcode ) return ( $label == $code_iso ) ? " $code_iso " : " $code_iso - $label " ;
else return $label ;
}
else
{
return $code_iso ;
}
}
2017-06-26 10:09:22 +02:00
return 'ErrorWhenReadingCurrencyLabel' ;
2009-10-30 12:41:11 +01:00
}
2008-01-11 11:25:26 +01:00
2008-01-11 18:16:46 +01:00
/**
2011-07-04 10:00:52 +02:00
* Retourne le nom traduit de la forme juridique
2011-08-24 20:05:58 +02:00
*
2011-09-28 14:13:48 +02:00
* @ param string $code Code de la forme juridique
* @ return string Nom traduit du pays
2008-01-11 18:16:46 +01:00
*/
function getFormeJuridiqueLabel ( $code )
{
2010-08-21 17:30:17 +02:00
global $db , $langs ;
if ( ! $code ) return '' ;
$sql = " SELECT libelle FROM " . MAIN_DB_PREFIX . " c_forme_juridique " ;
$sql .= " WHERE code=' $code ' " ;
2014-06-12 11:31:53 +02:00
dol_syslog ( " Company.lib::getFormeJuridiqueLabel " , LOG_DEBUG );
2010-08-21 17:30:17 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$num = $db -> num_rows ( $resql );
if ( $num )
{
$obj = $db -> fetch_object ( $resql );
$label = ( $obj -> libelle != '-' ? $obj -> libelle : '' );
return $label ;
}
else
{
return $langs -> trans ( " NotDefined " );
}
}
2008-01-11 18:16:46 +01:00
}
2018-04-09 14:25:02 +02:00
2017-04-30 03:18:49 +02:00
/**
2018-04-09 14:25:02 +02:00
* Return list of countries that are inside the EEC ( European Economic Community )
2017-04-30 03:18:49 +02:00
* TODO Add a field into country dictionary .
2017-06-26 10:09:22 +02:00
*
2018-04-09 14:25:02 +02:00
* @ return array Array of countries code in EEC
*/
function getCountriesInEEC ()
{
// List of all country codes that are in europe for european vat rules
// List found on http://ec.europa.eu/taxation_customs/common/faq/faq_1179_en.htm#9
$country_code_in_EEC = array (
'AT' , // Austria
'BE' , // Belgium
'BG' , // Bulgaria
'CY' , // Cyprus
'CZ' , // Czech republic
'DE' , // Germany
'DK' , // Danemark
'EE' , // Estonia
'ES' , // Spain
'FI' , // Finland
'FR' , // France
'GB' , // United Kingdom
'GR' , // Greece
'HR' , // Croatia
'NL' , // Holland
'HU' , // Hungary
'IE' , // Ireland
'IM' , // Isle of Man - Included in UK
'IT' , // Italy
'LT' , // Lithuania
'LU' , // Luxembourg
'LV' , // Latvia
'MC' , // Monaco - Included in France
'MT' , // Malta
//'NO', // Norway
'PL' , // Poland
'PT' , // Portugal
'RO' , // Romania
'SE' , // Sweden
'SK' , // Slovakia
'SI' , // Slovenia
'UK' , // United Kingdom
//'CH', // Switzerland - No. Swizerland in not in EEC
);
return $country_code_in_EEC ;
}
/**
* Return if a country of an object is inside the EEC ( European Economic Community )
*
2017-04-30 03:18:49 +02:00
* @ param Object $object Object
* @ return boolean true = country inside EEC , false = country outside EEC
*/
function isInEEC ( $object )
{
2017-12-15 22:14:28 +01:00
if ( empty ( $object -> country_code )) return false ;
2018-04-09 14:25:02 +02:00
$country_code_in_EEC = getCountriesInEEC ();
2017-04-30 03:18:49 +02:00
//print "dd".$this->country_code;
return in_array ( $object -> country_code , $country_code_in_EEC );
}
2008-01-11 18:16:46 +01:00
2010-05-23 12:20:35 +02:00
/**
2011-05-25 15:27:07 +02:00
* Show html area for list of projects
2011-08-24 20:05:58 +02:00
*
2012-02-04 14:39:47 +01:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
* @ param Object $object Third party object
* @ param string $backtopage Url to go once contact is created
2015-10-24 16:09:26 +02:00
* @ param int $nocreatelink 1 = Hide create project link
2017-12-04 20:17:07 +01:00
* @ param string $morehtmlright More html on right of title
2012-02-04 14:39:47 +01:00
* @ return void
2010-05-23 12:20:35 +02:00
*/
2017-12-04 20:17:07 +01:00
function show_projects ( $conf , $langs , $db , $object , $backtopage = '' , $nocreatelink = 0 , $morehtmlright = '' )
2010-05-23 12:20:35 +02:00
{
2010-08-21 17:30:17 +02:00
global $user ;
$i = - 1 ;
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> projet -> enabled ) && $user -> rights -> projet -> lire )
2010-08-21 17:30:17 +02:00
{
$langs -> load ( " projects " );
2018-04-15 17:37:49 +02:00
$newcardbutton = '' ;
2015-10-24 16:09:26 +02:00
if ( ! empty ( $conf -> projet -> enabled ) && $user -> rights -> projet -> creer && empty ( $nocreatelink ))
2011-06-13 15:07:10 +02:00
{
2018-06-13 22:57:41 +02:00
$newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $object -> id . '&action=create&backtopage=' . urlencode ( $backtopage ) . '"><span class="valignmiddle">' . $langs -> trans ( " AddProject " ) . '</span>' ;
2018-04-18 03:26:15 +02:00
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>' ;
$newcardbutton .= '</a>' ;
2011-06-13 15:07:10 +02:00
}
2010-08-21 17:30:17 +02:00
print " \n " ;
2018-04-15 17:37:49 +02:00
print load_fiche_titre ( $langs -> trans ( " ProjectsDedicatedToThisThirdParty " ), $newcardbutton . $morehtmlright , '' );
2017-03-11 00:07:14 +01:00
print '<div class="div-table-responsive">' ;
2010-08-21 17:30:17 +02:00
print " \n " . '<table class="noborder" width=100%>' ;
2018-11-08 11:25:29 +01:00
$sql = " SELECT p.rowid as id, p.entity, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount " ;
2017-03-11 00:43:06 +01:00
$sql .= " , cls.code as opp_status_code " ;
2010-08-21 17:30:17 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as p " ;
2017-03-11 00:43:06 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_lead_status as cls on p.fk_opp_status = cls.rowid " ;
2010-12-29 11:08:45 +01:00
$sql .= " WHERE p.fk_soc = " . $object -> id ;
2018-11-08 11:25:29 +01:00
$sql .= " AND p.entity IN ( " . getEntity ( 'project' ) . " ) " ;
2010-08-21 17:30:17 +02:00
$sql .= " ORDER BY p.dateo DESC " ;
$result = $db -> query ( $sql );
if ( $result )
{
$num = $db -> num_rows ( $result );
print '<tr class="liste_titre">' ;
2017-03-11 00:43:06 +01:00
print '<td>' . $langs -> trans ( " Ref " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Name " ) . '</td>' ;
print '<td class="center">' . $langs -> trans ( " DateStart " ) . '</td>' ;
print '<td class="center">' . $langs -> trans ( " DateEnd " ) . '</td>' ;
print '<td class="right">' . $langs -> trans ( " OpportunityAmountShort " ) . '</td>' ;
print '<td class="center">' . $langs -> trans ( " OpportunityStatusShort " ) . '</td>' ;
print '<td class="right">' . $langs -> trans ( " OpportunityProbabilityShort " ) . '</td>' ;
print '<td class="right">' . $langs -> trans ( " Status " ) . '</td>' ;
2010-08-21 17:30:17 +02:00
print '</tr>' ;
if ( $num > 0 )
{
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
2010-08-21 17:30:17 +02:00
2015-03-25 14:31:04 +01:00
$projecttmp = new Project ( $db );
2010-08-21 17:30:17 +02:00
$i = 0 ;
2017-09-16 00:49:46 +02:00
2010-08-21 17:30:17 +02:00
while ( $i < $num )
{
$obj = $db -> fetch_object ( $result );
2015-03-25 14:31:04 +01:00
$projecttmp -> fetch ( $obj -> id );
2010-08-21 17:30:17 +02:00
// To verify role of users
2015-03-25 14:31:04 +01:00
$userAccess = $projecttmp -> restrictedProjectArea ( $user );
2010-08-21 17:30:17 +02:00
if ( $user -> rights -> projet -> lire && $userAccess > 0 )
{
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2010-08-21 17:30:17 +02:00
// Ref
2015-03-25 14:31:04 +01:00
print '<td><a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $projecttmp -> id . '">' . img_object ( $langs -> trans ( " ShowProject " ),( $obj -> public ? 'projectpub' : 'project' )) . " " . $obj -> ref . '</a></td>' ;
2010-08-21 17:30:17 +02:00
// Label
print '<td>' . $obj -> title . '</td>' ;
// Date start
2017-03-11 00:43:06 +01:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> do ), " day " ) . '</td>' ;
2010-08-21 17:30:17 +02:00
// Date end
2017-03-11 00:43:06 +01:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> de ), " day " ) . '</td>' ;
// Opp amount
print '<td class="right">' ;
if ( $obj -> opp_status_code )
{
print price ( $obj -> opp_amount , 1 , '' , 1 , - 1 , - 1 , '' );
}
print '</td>' ;
// Opp status
print '<td align="center">' ;
2018-11-08 20:05:01 +01:00
if ( $obj -> opp_status_code ) print $langs -> trans ( " OppStatus " . $obj -> opp_status_code );
2017-03-11 00:43:06 +01:00
print '</td>' ;
// Opp percent
print '<td align="right">' ;
if ( $obj -> opp_percent ) print price ( $obj -> opp_percent , 1 , '' , 1 , 0 ) . '%' ;
2017-06-26 10:09:22 +02:00
print '</td>' ;
2015-03-25 14:31:04 +01:00
// Status
print '<td align="right">' . $projecttmp -> getLibStatut ( 5 ) . '</td>' ;
2010-08-21 17:30:17 +02:00
print '</tr>' ;
}
$i ++ ;
}
}
else
2014-10-16 20:55:13 +02:00
{
2017-04-14 13:02:29 +02:00
print '<tr class="oddeven"><td colspan="5" class="opacitymedium">' . $langs -> trans ( " None " ) . '</td></tr>' ;
2010-08-21 17:30:17 +02:00
}
$db -> free ( $result );
}
else
{
dol_print_error ( $db );
}
print " </table> " ;
2017-03-11 00:07:14 +01:00
print '</div>' ;
2017-06-26 10:09:22 +02:00
2010-08-21 17:30:17 +02:00
print " <br> \n " ;
}
return $i ;
2010-05-23 12:20:35 +02:00
}
2008-07-27 23:22:44 +02:00
/**
2011-05-25 15:27:07 +02:00
* Show html area for list of contacts
2011-12-21 18:56:44 +01:00
*
2011-11-22 14:00:03 +01:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
2015-02-10 11:38:13 +01:00
* @ param Societe $object Third party object
2011-11-22 14:00:03 +01:00
* @ param string $backtopage Url to go once contact is created
2012-02-04 14:39:47 +01:00
* @ return void
2008-07-27 23:22:44 +02:00
*/
2011-06-13 15:07:10 +02:00
function show_contacts ( $conf , $langs , $db , $object , $backtopage = '' )
2008-07-27 23:22:44 +02:00
{
2018-03-06 13:26:40 +01:00
global $user , $conf , $extrafields , $hookmanager ;
global $contextpage ;
2010-08-21 17:30:17 +02:00
2018-03-06 13:26:40 +01:00
$form = new Form ( $db );
2013-12-14 20:58:03 +01:00
2018-04-05 11:34:26 +02:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2013-11-13 17:02:30 +01:00
$sortfield = GETPOST ( " sortfield " , 'alpha' );
$sortorder = GETPOST ( " sortorder " , 'alpha' );
2017-05-21 02:43:51 +02:00
$page = GETPOST ( 'page' , 'int' );
2013-11-13 17:02:30 +01:00
$search_status = GETPOST ( " search_status " , 'int' );
if ( $search_status == '' ) $search_status = 1 ; // always display activ customer first
$search_name = GETPOST ( " search_name " , 'alpha' );
2014-12-30 21:04:02 +01:00
$search_addressphone = GETPOST ( " search_addressphone " , 'alpha' );
2013-12-14 20:58:03 +01:00
2013-11-13 17:02:30 +01:00
if ( ! $sortorder ) $sortorder = " ASC " ;
2018-03-06 13:26:40 +01:00
if ( ! $sortfield ) $sortfield = " t.lastname " ;
2013-12-14 20:58:03 +01:00
2018-03-06 13:26:40 +01:00
if ( ! empty ( $conf -> clicktodial -> enabled ))
2017-09-16 00:49:46 +02:00
{
2018-03-06 13:26:40 +01:00
$user -> fetch_clicktodial (); // lecture des infos de clicktodial du user
2017-09-16 00:49:46 +02:00
}
2010-08-21 17:30:17 +02:00
$contactstatic = new Contact ( $db );
2018-03-06 13:26:40 +01:00
$extralabels = $extrafields -> fetch_name_optionals_label ( $contactstatic -> table_element );
$contactstatic -> fields = array (
'name' => array ( 'type' => 'varchar(128)' , 'label' => 'Name' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 1 , 'index' => 1 , 'position' => 10 , 'searchall' => 1 ),
'poste' => array ( 'type' => 'varchar(128)' , 'label' => 'PostOfFunction' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 1 , 'index' => 1 , 'position' => 20 ),
'address' => array ( 'type' => 'varchar(128)' , 'label' => 'Address' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 1 , 'index' => 1 , 'position' => 30 ),
'statut' => array ( 'type' => 'integer' , 'label' => 'Status' , 'enabled' => 1 , 'visible' => 1 , 'notnull' => 1 , 'default' => 0 , 'index' => 1 , 'position' => 40 , 'arrayofkeyval' => array ( 0 => $contactstatic -> LibStatut ( 0 , 1 ), 1 => $contactstatic -> LibStatut ( 1 , 1 ))),
);
// Definition of fields for list
$arrayfields = array (
't.rowid' => array ( 'label' => " TechnicalID " , 'checked' => ( $conf -> global -> MAIN_SHOW_TECHNICAL_ID ? 1 : 0 ), 'enabled' => ( $conf -> global -> MAIN_SHOW_TECHNICAL_ID ? 1 : 0 ), 'position' => 1 ),
't.name' => array ( 'label' => " Name " , 'checked' => 1 , 'position' => 10 ),
't.poste' => array ( 'label' => " PostOrFunction " , 'checked' => 1 , 'position' => 20 ),
't.address' => array ( 'label' => ( empty ( $conf -> dol_optimize_smallscreen ) ? $langs -> trans ( " Address " ) . ' / ' . $langs -> trans ( " Phone " ) . ' / ' . $langs -> trans ( " Email " ) : $langs -> trans ( " Address " )), 'checked' => 1 , 'position' => 30 ),
't.statut' => array ( 'label' => " Status " , 'checked' => 1 , 'position' => 40 , 'align' => 'center' ),
);
// Extra fields
if ( is_array ( $extrafields -> attributes [ $contactstatic -> table_element ][ 'label' ]) && count ( $extrafields -> attributes [ $contactstatic -> table_element ][ 'label' ]))
{
foreach ( $extrafields -> attributes [ $contactstatic -> table_element ][ 'label' ] as $key => $val )
{
2018-05-27 15:04:12 +02:00
if ( ! empty ( $extrafields -> attributes [ $contactstatic -> table_element ][ 'list' ][ $key ])) {
$arrayfields [ " ef. " . $key ] = array (
'label' => $extrafields -> attributes [ $contactstatic -> table_element ][ 'label' ][ $key ],
'checked' => (( $extrafields -> attributes [ $contactstatic -> table_element ][ 'list' ][ $key ] < 0 ) ? 0 : 1 ),
'position' => $extrafields -> attributes [ $contactstatic -> table_element ][ 'pos' ][ $key ],
'enabled' => ( abs ( $extrafields -> attributes [ $contactstatic -> table_element ][ 'list' ][ $key ]) != 3 && $extrafields -> attributes [ $contactstatic -> table_element ][ 'perms' ][ $key ]));
}
2018-03-06 13:26:40 +01:00
}
}
// Initialize array of search criterias
$search = array ();
foreach ( $contactstatic -> fields as $key => $val )
2010-08-21 17:30:17 +02:00
{
2018-03-06 13:26:40 +01:00
if ( GETPOST ( 'search_' . $key , 'alpha' )) $search [ $key ] = GETPOST ( 'search_' . $key , 'alpha' );
2010-08-21 17:30:17 +02:00
}
2018-04-05 11:34:26 +02:00
$search_array_options = $extrafields -> getOptionalsFromPost ( $extralabels , '' , 'search_' );
2018-03-06 13:26:40 +01:00
// Purge search criteria
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) // All tests are required to be compatible with all browsers
{
$search_status = '' ;
$search_name = '' ;
$search_addressphone = '' ;
$search_array_options = array ();
foreach ( $contactstatic -> fields as $key => $val )
{
$search [ $key ] = '' ;
}
$toselect = '' ;
}
$contactstatic -> fields = dol_sort_array ( $contactstatic -> fields , 'position' );
$arrayfields = dol_sort_array ( $arrayfields , 'position' );
2018-04-15 17:37:49 +02:00
$newcardbutton = '' ;
2011-06-13 15:07:10 +02:00
if ( $user -> rights -> societe -> contact -> creer )
{
2012-03-14 15:04:55 +01:00
$addcontact = ( ! empty ( $conf -> global -> SOCIETE_ADDRESSES_MANAGEMENT ) ? $langs -> trans ( " AddContact " ) : $langs -> trans ( " AddContactAddress " ));
2018-06-13 22:57:41 +02:00
$newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $object -> id . '&action=create&backtopage=' . urlencode ( $backtopage ) . '"><span class="valignmiddle">' . $addcontact . '</span>' ;
2018-04-18 03:26:15 +02:00
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>' ;
$newcardbutton .= '</a>' ;
2011-06-13 15:07:10 +02:00
}
2010-08-21 17:30:17 +02:00
print " \n " ;
2012-03-19 22:06:28 +01:00
2012-03-14 15:04:55 +01:00
$title = ( ! empty ( $conf -> global -> SOCIETE_ADDRESSES_MANAGEMENT ) ? $langs -> trans ( " ContactsForCompany " ) : $langs -> trans ( " ContactsAddressesForCompany " ));
2018-04-15 17:37:49 +02:00
print load_fiche_titre ( $title , $newcardbutton , '' );
2011-06-13 15:07:10 +02:00
2017-12-04 20:17:07 +01:00
print '<form method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '" name="formfilter">' ;
2018-03-06 13:26:40 +01:00
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">' ;
2014-01-05 15:46:39 +01:00
print '<input type="hidden" name="socid" value="' . $object -> id . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
2017-05-21 02:43:51 +02:00
print '<input type="hidden" name="page" value="' . $page . '">' ;
2017-06-26 10:09:22 +02:00
2018-03-06 13:26:40 +01:00
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
$selectedfields = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage ); // This also change content of $arrayfields
//if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
2017-09-16 00:49:46 +02:00
2018-03-06 13:26:40 +01:00
print '<div class="div-table-responsive">' ; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print " \n " . '<table class="tagtable liste">' . " \n " ;
2013-12-14 20:58:03 +01:00
2018-04-05 11:34:26 +02:00
$param = " socid= " . urlencode ( $object -> id );
if ( $search_status != '' ) $param .= '&search_status=' . urlencode ( $search_status );
if ( $search_name != '' ) $param .= '&search_name=' . urlencode ( $search_name );
if ( $optioncss != '' ) $param .= '&optioncss=' . urlencode ( $optioncss );
// Add $param from extra fields
2018-04-17 14:34:17 +02:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
2018-04-05 11:34:26 +02:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php' ;
2013-12-14 20:58:03 +01:00
2018-03-06 13:26:40 +01:00
$sql = " SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo, " ;
$sql .= " t.civility as civility_id, t.address, t.zip, t.town " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " socpeople as t " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " socpeople_extrafields as ef on (t.rowid = ef.fk_object) " ;
$sql .= " WHERE t.fk_soc = " . $object -> id ;
if ( $search_status != '' && $search_status != '-1' ) $sql .= " AND t.statut = " . $db -> escape ( $search_status );
2018-04-05 11:34:26 +02:00
if ( $search_name ) $sql .= natural_search ( array ( 't.lastname' , 't.firstname' ), $search_name );
// Add where from extra fields
2018-04-17 14:34:17 +02:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
2018-04-05 11:34:26 +02:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php' ;
2018-03-06 13:26:40 +01:00
if ( $sortfield == " t.name " ) $sql .= " ORDER BY t.lastname $sortorder , t.firstname $sortorder " ;
else $sql .= " ORDER BY $sortfield $sortorder " ;
2010-08-21 17:30:17 +02:00
2014-06-13 01:34:39 +02:00
dol_syslog ( 'core/lib/company.lib.php :: show_contacts' , LOG_DEBUG );
2010-08-21 17:30:17 +02:00
$result = $db -> query ( $sql );
2015-06-14 17:38:28 +02:00
if ( ! $result ) dol_print_error ( $db );
2010-08-21 17:30:17 +02:00
$num = $db -> num_rows ( $result );
2018-03-06 13:26:40 +01:00
// Fields title search
// --------------------------------------------------------------------
2017-09-16 00:49:46 +02:00
print '<tr class="liste_titre">' ;
2018-03-06 13:26:40 +01:00
foreach ( $contactstatic -> fields as $key => $val )
{
$align = '' ;
if ( in_array ( $val [ 'type' ], array ( 'date' , 'datetime' , 'timestamp' ))) $align .= ( $align ? ' ' : '' ) . 'center' ;
if ( in_array ( $val [ 'type' ], array ( 'timestamp' ))) $align .= ( $align ? ' ' : '' ) . 'nowrap' ;
if ( $key == 'status' || $key == 'statut' ) $align .= ( $align ? ' ' : '' ) . 'center' ;
if ( ! empty ( $arrayfields [ 't.' . $key ][ 'checked' ]))
{
print '<td class="liste_titre' . ( $align ? ' ' . $align : '' ) . '">' ;
if ( in_array ( $key , array ( 'lastname' , 'name' ))) print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . dol_escape_htmltag ( $search [ $key ]) . '">' ;
elseif ( in_array ( $key , array ( 'statut' ))) print $form -> selectarray ( 'search_status' , array ( '-1' => '' , '0' => $contactstatic -> LibStatut ( 0 , 1 ), '1' => $contactstatic -> LibStatut ( 1 , 1 )), $search_status );
print '</td>' ;
}
}
// Extra fields
2018-04-17 14:34:17 +02:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
2018-03-06 13:26:40 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php' ;
// Fields from hook
$parameters = array ( 'arrayfields' => $arrayfields );
$reshook = $hookmanager -> executeHooks ( 'printFieldListOption' , $parameters , $contactstatic ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
// Action column
print '<td class="liste_titre" align="right">' ;
$searchpicto = $form -> showFilterButtons ();
print $searchpicto ;
print '</td>' ;
print '</tr>' . " \n " ;
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">' ;
foreach ( $contactstatic -> fields as $key => $val )
{
$align = '' ;
if ( in_array ( $val [ 'type' ], array ( 'date' , 'datetime' , 'timestamp' ))) $align .= ( $align ? ' ' : '' ) . 'center' ;
if ( in_array ( $val [ 'type' ], array ( 'timestamp' ))) $align .= ( $align ? ' ' : '' ) . 'nowrap' ;
if ( $key == 'status' || $key == 'statut' ) $align .= ( $align ? ' ' : '' ) . 'center' ;
if ( ! empty ( $arrayfields [ 't.' . $key ][ 'checked' ])) print getTitleFieldOfList ( $arrayfields [ 't.' . $key ][ 'label' ], 0 , $_SERVER [ 'PHP_SELF' ], 't.' . $key , '' , $param , ( $align ? 'class="' . $align . '"' : '' ), $sortfield , $sortorder , $align . ' ' ) . " \n " ;
}
// Extra fields
2018-04-17 14:34:17 +02:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
2018-03-06 13:26:40 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php' ;
// Hook fields
2018-04-20 10:38:16 +02:00
$parameters = array ( 'arrayfields' => $arrayfields , 'param' => $param , 'sortfield' => $sortfield , 'sortorder' => $sortorder );
2018-03-06 13:26:40 +01:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters , $object ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
print getTitleFieldOfList ( $selectedfields , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , 'align="center"' , $sortfield , $sortorder , 'maxwidthsearch ' ) . " \n " ;
print '</tr>' . " \n " ;
$i = - 1 ;
2017-06-26 10:09:22 +02:00
2017-09-16 00:49:46 +02:00
if ( $num || ( GETPOST ( 'button_search' ) || GETPOST ( 'button_search.x' ) || GETPOST ( 'button_search_x' )))
{
2018-03-06 13:26:40 +01:00
$i = 0 ;
2010-08-21 17:30:17 +02:00
while ( $i < $num )
{
$obj = $db -> fetch_object ( $result );
2017-06-26 10:09:22 +02:00
2010-08-21 17:30:17 +02:00
$contactstatic -> id = $obj -> rowid ;
2015-10-10 01:51:12 +02:00
$contactstatic -> ref = $obj -> ref ;
2013-11-13 17:26:29 +01:00
$contactstatic -> statut = $obj -> statut ;
2013-02-24 14:46:00 +01:00
$contactstatic -> lastname = $obj -> lastname ;
2010-08-21 17:30:17 +02:00
$contactstatic -> firstname = $obj -> firstname ;
2014-05-05 00:23:09 +02:00
$contactstatic -> civility_id = $obj -> civility_id ;
2016-08-06 00:04:24 +02:00
$contactstatic -> civility_code = $obj -> civility_id ;
2015-06-14 17:38:28 +02:00
$contactstatic -> poste = $obj -> poste ;
$contactstatic -> address = $obj -> address ;
$contactstatic -> zip = $obj -> zip ;
$contactstatic -> town = $obj -> town ;
$contactstatic -> phone_pro = $obj -> phone_pro ;
$contactstatic -> phone_mobile = $obj -> phone_mobile ;
$contactstatic -> phone_perso = $obj -> phone_perso ;
$contactstatic -> email = $obj -> email ;
2015-10-10 01:51:12 +02:00
$contactstatic -> web = $obj -> web ;
$contactstatic -> skype = $obj -> skype ;
2016-08-06 00:04:24 +02:00
$contactstatic -> photo = $obj -> photo ;
2015-10-10 01:51:12 +02:00
2015-10-11 12:27:04 +02:00
$country_code = getCountry ( $obj -> country_id , 2 );
2015-10-10 01:51:12 +02:00
$contactstatic -> country_code = $country_code ;
2016-08-06 00:04:24 +02:00
$contactstatic -> setGenderFromCivility ();
2018-03-06 13:26:40 +01:00
$contactstatic -> fetch_optionals ();
if ( is_array ( $contactstatic -> array_options ))
{
foreach ( $contactstatic -> array_options as $key => $val )
{
$obj -> $key = $val ;
}
}
2017-06-26 10:09:22 +02:00
2018-01-09 14:29:01 +01:00
print '<tr class="oddeven">' ;
2015-10-10 01:51:12 +02:00
2018-03-06 13:26:40 +01:00
// ID
if ( ! empty ( $arrayfields [ 't.rowid' ][ 'checked' ]))
{
print '<td>' ;
print $contactstatic -> id ;
print '</td>' ;
}
2017-03-24 17:32:38 +01:00
// Photo - Name
2018-03-06 13:26:40 +01:00
if ( ! empty ( $arrayfields [ 't.name' ][ 'checked' ]))
{
print '<td>' ;
print $form -> showphoto ( 'contact' , $contactstatic , 0 , 0 , 0 , 'photorefnoborder valignmiddle marginrightonly' , 'small' , 1 , 0 , 1 );
print $contactstatic -> getNomUrl ( 0 , '' , 0 , '&backtopage=' . urlencode ( $backtopage ));
print '</td>' ;
}
2017-06-26 10:09:22 +02:00
2016-08-06 00:04:24 +02:00
// Job position
2018-03-06 13:26:40 +01:00
if ( ! empty ( $arrayfields [ 't.poste' ][ 'checked' ]))
{
print '<td>' ;
if ( $obj -> poste ) print $obj -> poste ;
print '</td>' ;
}
2010-08-21 17:30:17 +02:00
2017-03-24 17:32:38 +01:00
// Address - Phone - Email
2018-03-06 13:26:40 +01:00
if ( ! empty ( $arrayfields [ 't.address' ][ 'checked' ]))
{
print '<td>' ;
print $contactstatic -> getBannerAddress ( 'contact' , $object );
print '</td>' ;
}
2013-09-15 18:33:20 +02:00
2014-12-30 21:04:02 +01:00
// Status
2018-03-06 13:26:40 +01:00
if ( ! empty ( $arrayfields [ 't.statut' ][ 'checked' ]))
{
print '<td align="center">' . $contactstatic -> getLibStatut ( 5 ) . '</td>' ;
}
// Extra fields
2018-04-17 14:34:17 +02:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
2018-03-06 13:26:40 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php' ;
2014-12-30 21:04:02 +01:00
2018-03-06 13:26:40 +01:00
// Actions
print '<td align="right">' ;
// Add to agenda
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> agenda -> enabled ) && $user -> rights -> agenda -> myactions -> create )
2010-08-21 17:30:17 +02:00
{
2014-09-18 21:18:25 +02:00
print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&actioncode=&contactid=' . $obj -> rowid . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2012-11-14 00:59:52 +01:00
print img_object ( $langs -> trans ( " Event " ), " action " );
2018-03-06 13:26:40 +01:00
print '</a> ' ;
2010-08-21 17:30:17 +02:00
}
2014-01-26 19:27:42 +01:00
2014-01-06 17:14:13 +01:00
// Edit
2011-06-13 15:44:50 +02:00
if ( $user -> rights -> societe -> contact -> creer )
{
2018-04-05 11:34:26 +02:00
print '<a href="' . DOL_URL_ROOT . '/contact/card.php?action=edit&id=' . $obj -> rowid . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2011-06-13 15:44:50 +02:00
print img_edit ();
2018-03-06 13:26:40 +01:00
print '</a>' ;
2011-06-13 15:44:50 +02:00
}
2018-03-06 13:26:40 +01:00
print '</td>' ;
2013-10-23 13:38:18 +02:00
2010-08-21 17:30:17 +02:00
print " </tr> \n " ;
$i ++ ;
}
}
else
2014-02-19 11:08:43 +01:00
{
2018-03-06 13:26:40 +01:00
$colspan = 1 ;
foreach ( $arrayfields as $key => $val ) { if ( ! empty ( $val [ 'checked' ])) $colspan ++ ; }
print '<tr><td colspan="' . $colspan . '" class="opacitymedium">' . $langs -> trans ( " None " ) . '</td></tr>' ;
2010-08-21 17:30:17 +02:00
}
print " \n </table> \n " ;
2017-09-16 00:49:46 +02:00
print '</div>' ;
2010-08-21 17:30:17 +02:00
2014-01-05 15:46:39 +01:00
print '</form>' . " \n " ;
2010-08-21 17:30:17 +02:00
return $i ;
2008-07-27 23:22:44 +02:00
}
2012-07-02 19:30:37 +02:00
/**
* Show html area for list of addresses
*
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
2015-02-10 11:38:13 +01:00
* @ param Societe $object Third party object
2012-07-02 19:30:37 +02:00
* @ param string $backtopage Url to go once address is created
* @ return void
*/
function show_addresses ( $conf , $langs , $db , $object , $backtopage = '' )
{
global $user ;
2012-03-19 22:06:28 +01:00
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/societe/class/address.class.php' ;
2012-07-02 19:30:37 +02:00
2012-03-14 12:14:28 +01:00
$addressstatic = new Address ( $db );
2012-07-02 19:30:37 +02:00
$num = $addressstatic -> fetch_lines ( $object -> id );
2018-04-15 17:37:49 +02:00
$newcardbutton = '' ;
2012-07-02 19:30:37 +02:00
if ( $user -> rights -> societe -> creer )
{
2018-06-13 22:57:41 +02:00
$newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/comm/address.php?socid=' . $object -> id . '&action=create&backtopage=' . urlencode ( $backtopage ) . '"><span class="valignmiddle">' . $langs -> trans ( " AddAddress " ) . '</span>' ;
2018-04-18 03:26:15 +02:00
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>' ;
$newcardbutton .= '</a>' ;
2012-07-02 19:30:37 +02:00
}
print " \n " ;
2018-04-15 17:37:49 +02:00
print load_fiche_titre ( $langs -> trans ( " AddressesForCompany " ), $newcardbutton , '' );
2012-07-02 19:30:37 +02:00
print " \n " . '<table class="noborder" width="100%">' . " \n " ;
print '<tr class="liste_titre"><td>' . $langs -> trans ( " Label " ) . '</td>' ;
2012-03-14 12:14:28 +01:00
print '<td>' . $langs -> trans ( " CompanyName " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Town " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Country " ) . '</td>' ;
2012-12-29 02:51:35 +01:00
print '<td>' . $langs -> trans ( " Phone " ) . '</td>' ;
2012-07-02 19:30:37 +02:00
print '<td>' . $langs -> trans ( " Fax " ) . '</td>' ;
print " <td> </td> " ;
print " </tr> " ;
if ( $num > 0 )
{
foreach ( $addressstatic -> lines as $address )
{
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2012-07-02 19:30:37 +02:00
2012-03-14 12:14:28 +01:00
print '<td>' ;
2012-03-14 19:17:04 +01:00
$addressstatic -> id = $address -> id ;
2012-07-02 19:30:37 +02:00
$addressstatic -> label = $address -> label ;
print $addressstatic -> getNomUrl ( 1 );
print '</td>' ;
2012-03-14 12:14:28 +01:00
print '<td>' . $address -> name . '</td>' ;
2012-03-19 22:06:28 +01:00
2012-03-14 12:14:28 +01:00
print '<td>' . $address -> town . '</td>' ;
2012-03-19 22:06:28 +01:00
2012-03-14 18:25:05 +01:00
$img = picto_from_langcode ( $address -> country_code );
2012-07-02 19:30:37 +02:00
print '<td>' . ( $img ? $img . ' ' : '' ) . $address -> country . '</td>' ;
// Lien click to dial
print '<td>' ;
print dol_print_phone ( $address -> phone , $address -> country_code , $address -> id , $object -> id , 'AC_TEL' );
print '</td>' ;
print '<td>' ;
print dol_print_phone ( $address -> fax , $address -> country_code , $address -> id , $object -> id , 'AC_FAX' );
print '</td>' ;
if ( $user -> rights -> societe -> creer )
{
print '<td align="right">' ;
print '<a href="' . DOL_URL_ROOT . '/comm/address.php?action=edit&id=' . $address -> id . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
print img_edit ();
print '</a></td>' ;
}
print " </tr> \n " ;
}
}
else
{
2017-04-14 11:22:48 +02:00
//print '<tr class="oddeven">';
2012-07-02 19:30:37 +02:00
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
//print "</tr>\n";
}
print " \n </table> \n " ;
print " <br> \n " ;
return $num ;
2012-03-14 12:14:28 +01:00
}
2008-07-27 23:22:44 +02:00
2008-01-11 11:25:26 +01:00
/**
2011-04-10 23:30:11 +02:00
* Show html area with actions to do
2012-02-04 14:39:47 +01:00
*
2015-10-24 16:09:26 +02:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Object db
2016-10-17 17:52:58 +02:00
* @ param Adherent | Societe $filterobj Object third party or member
2015-10-24 16:09:26 +02:00
* @ param Contact $objcon Object contact
* @ param int $noprint Return string but does not output it
2016-09-08 10:26:38 +02:00
* @ param int $actioncode Filter on actioncode
2015-10-24 16:09:26 +02:00
* @ return mixed Return html part or void if noprint is 1
2008-07-29 21:20:33 +02:00
*/
2016-10-17 17:52:58 +02:00
function show_actions_todo ( $conf , $langs , $db , $filterobj , $objcon = '' , $noprint = 0 , $actioncode = '' )
2008-01-08 09:30:05 +01:00
{
2018-03-06 13:26:40 +01:00
global $user , $conf ;
2010-08-21 17:30:17 +02:00
2016-10-17 17:52:58 +02:00
$out = show_actions_done ( $conf , $langs , $db , $filterobj , $objcon , 1 , $actioncode , 'todo' );
2011-04-11 09:35:15 +02:00
if ( $noprint ) return $out ;
else print $out ;
2008-01-08 09:30:05 +01:00
}
2008-01-11 11:25:26 +01:00
/**
2016-10-30 12:39:51 +01:00
* Show html area with actions ( done or not , ignore the name of function )
2011-12-21 18:56:44 +01:00
*
2016-09-11 13:38:15 +02:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Object db
2017-11-26 20:21:01 +01:00
* @ param mixed $filterobj Object Adherent | Societe | Project | Product | CommandeFournisseur
2016-09-11 13:38:15 +02:00
* @ param Contact $objcon Object contact
* @ param int $noprint Return string but does not output it
* @ param string $actioncode Filter on actioncode
2017-03-30 11:25:28 +02:00
* @ param string $donetodo Filter on event 'done' or 'todo' or '' = nofilter ( all ) .
2016-10-18 00:02:18 +02:00
* @ param array $filters Filter on other fields
2016-10-30 12:39:51 +01:00
* @ param string $sortfield Sort field
* @ param string $sortorder Sort order
2016-09-11 13:38:15 +02:00
* @ return mixed Return html part or void if noprint is 1
* TODO change function to be able to list event linked to an object .
2008-07-29 21:20:33 +02:00
*/
2017-01-02 12:39:12 +01:00
function show_actions_done ( $conf , $langs , $db , $filterobj , $objcon = '' , $noprint = 0 , $actioncode = '' , $donetodo = 'done' , $filters = array (), $sortfield = 'a.datep,a.id' , $sortorder = 'DESC' )
2008-01-08 09:30:05 +01:00
{
2018-03-06 13:26:40 +01:00
global $user , $conf ;
2016-10-17 17:52:58 +02:00
global $form ;
2010-08-21 17:30:17 +02:00
2016-10-30 12:39:51 +01:00
global $param ;
2017-06-26 10:09:22 +02:00
2018-10-04 09:42:11 +02:00
dol_include_once ( '/comm/action/class/actioncomm.class.php' );
2012-02-13 01:43:35 +01:00
// Check parameters
2017-08-25 13:50:45 +02:00
if ( ! is_object ( $filterobj ) && ! is_object ( $objcon )) dol_print_error ( '' , 'BadParameter' );
2012-02-13 01:43:35 +01:00
2011-04-11 09:35:15 +02:00
$out = '' ;
2010-08-21 17:30:17 +02:00
$histo = array ();
$numaction = 0 ;
2012-12-27 15:43:52 +01:00
$now = dol_now ( 'tzuser' );
2010-08-21 17:30:17 +02:00
2012-09-15 10:01:35 +02:00
if ( ! empty ( $conf -> agenda -> enabled ))
2010-08-21 17:30:17 +02:00
{
// Recherche histo sur actioncomm
$sql = " SELECT a.id, a.label, " ;
$sql .= " a.datep as dp, " ;
$sql .= " a.datep2 as dp2, " ;
$sql .= " a.note, a.percent, " ;
2011-06-04 15:12:44 +02:00
$sql .= " a.fk_element, a.elementtype, " ;
2010-08-21 17:30:17 +02:00
$sql .= " a.fk_user_author, a.fk_contact, " ;
2016-10-30 12:39:51 +01:00
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto, " ;
2017-03-30 15:39:50 +02:00
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname " ;
2017-08-25 13:50:45 +02:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Societe' ) $sql .= " , sp.lastname, sp.firstname " ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) $sql .= " , m.lastname, m.firstname " ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) $sql .= " , o.ref " ;
2017-11-26 20:21:01 +01:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) $sql .= " , o.ref " ;
2018-03-06 13:26:40 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm as a " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " user as u on u.rowid = a.fk_user_action " ;
2015-04-27 11:46:08 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_actioncomm as c ON a.fk_action = c.id " ;
2017-08-25 13:50:45 +02:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Societe' ) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " socpeople as sp ON a.fk_contact = sp.rowid " ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) $sql .= " , " . MAIN_DB_PREFIX . " adherent as m " ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) $sql .= " , " . MAIN_DB_PREFIX . " commande_fournisseur as o " ;
2017-11-26 20:21:01 +01:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) $sql .= " , " . MAIN_DB_PREFIX . " product as o " ;
2018-03-06 13:26:40 +01:00
$sql .= " WHERE a.entity IN ( " . getEntity ( 'agenda' ) . " ) " ;
2017-08-25 13:50:45 +02:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Societe' && $filterobj -> id ) $sql .= " AND a.fk_soc = " . $filterobj -> id ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Project' && $filterobj -> id ) $sql .= " AND a.fk_project = " . $filterobj -> id ;
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' )
2016-12-26 18:21:18 +01:00
{
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member' " ;
if ( $filterobj -> id ) $sql .= " AND a.fk_element = " . $filterobj -> id ;
}
2017-08-25 13:50:45 +02:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' )
2016-12-26 18:21:18 +01:00
{
2017-11-26 20:21:01 +01:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier' " ;
if ( $filterobj -> id ) $sql .= " AND a.fk_element = " . $filterobj -> id ;
}
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' )
{
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product' " ;
if ( $filterobj -> id ) $sql .= " AND a.fk_element = " . $filterobj -> id ;
2016-12-26 18:21:18 +01:00
}
2018-10-04 09:42:11 +02:00
//TODO check how ot work with new table actioncomm_resources and multiple contact affectation
2010-08-21 17:30:17 +02:00
if ( is_object ( $objcon ) && $objcon -> id ) $sql .= " AND a.fk_contact = " . $objcon -> id ;
2016-11-08 12:58:07 +01:00
// Condition on actioncode
if ( ! empty ( $actioncode ))
{
if ( empty ( $conf -> global -> AGENDA_USE_EVENT_TYPE ))
{
if ( $actioncode == 'AC_NON_AUTO' ) $sql .= " AND c.type != 'systemauto' " ;
elseif ( $actioncode == 'AC_ALL_AUTO' ) $sql .= " AND c.type = 'systemauto' " ;
2017-06-26 10:09:22 +02:00
else
2016-11-08 12:58:07 +01:00
{
if ( $actioncode == 'AC_OTH' ) $sql .= " AND c.type != 'systemauto' " ;
if ( $actioncode == 'AC_OTH_AUTO' ) $sql .= " AND c.type = 'systemauto' " ;
}
}
else
{
if ( $actioncode == 'AC_NON_AUTO' ) $sql .= " AND c.type != 'systemauto' " ;
elseif ( $actioncode == 'AC_ALL_AUTO' ) $sql .= " AND c.type = 'systemauto' " ;
else $sql .= " AND c.code = ' " . $db -> escape ( $actioncode ) . " ' " ;
}
}
2016-10-17 17:52:58 +02:00
if ( $donetodo == 'todo' ) $sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > ' " . $db -> idate ( $now ) . " ')) " ;
if ( $donetodo == 'done' ) $sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= ' " . $db -> idate ( $now ) . " ')) " ;
2016-10-18 00:02:18 +02:00
if ( is_array ( $filters ) && $filters [ 'search_agenda_label' ]) $sql .= natural_search ( 'a.label' , $filters [ 'search_agenda_label' ]);
2016-10-30 12:39:51 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2014-06-12 11:31:53 +02:00
dol_syslog ( " company.lib::show_actions_done " , LOG_DEBUG );
2010-08-21 17:30:17 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$i = 0 ;
$num = $db -> num_rows ( $resql );
2017-09-16 00:49:46 +02:00
2010-08-21 17:30:17 +02:00
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
2017-06-26 10:09:22 +02:00
2018-10-04 09:42:11 +02:00
$contactaction = new ActionComm ( $db );
$contactaction -> id = $obj -> id ;
$result = $contactaction -> fetchResources ();
if ( $result < 0 ) {
dol_print_error ( $db );
2018-10-04 09:45:12 +02:00
setEventMessage ( " company.lib::show_actions_done Error fetch ressource " , 'errors' );
2018-10-04 09:42:11 +02:00
}
2016-10-17 17:52:58 +02:00
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '' ;
if (( $obj -> percent >= 0 and $obj -> percent < 100 ) || ( $obj -> percent == - 1 && $obj -> datep > $now )) $tododone = 'todo' ;
2012-07-10 22:10:12 +02:00
$histo [ $numaction ] = array (
2016-10-17 17:52:58 +02:00
'type' => 'action' ,
'tododone' => $tododone ,
'id' => $obj -> id ,
'datestart' => $db -> jdate ( $obj -> dp ),
'dateend' => $db -> jdate ( $obj -> dp2 ),
'note' => $obj -> label ,
'percent' => $obj -> percent ,
2017-06-26 10:09:22 +02:00
2016-10-30 12:39:51 +01:00
'userid' => $obj -> user_id ,
2017-03-30 15:39:50 +02:00
'login' => $obj -> user_login ,
'userfirstname' => $obj -> user_firstname ,
'userlastname' => $obj -> user_lastname ,
'userphoto' => $obj -> user_photo ,
'contact_id' => $obj -> fk_contact ,
2018-10-04 09:42:11 +02:00
'socpeopleassigned' => $contactaction -> socpeopleassigned ,
2016-10-17 17:52:58 +02:00
'lastname' => $obj -> lastname ,
'firstname' => $obj -> firstname ,
'fk_element' => $obj -> fk_element ,
2016-10-30 12:39:51 +01:00
'elementtype' => $obj -> elementtype ,
// Type of event
'acode' => $obj -> acode ,
'alabel' => $obj -> alabel ,
'libelle' => $obj -> alabel , // deprecated
'apicto' => $obj -> apicto
2012-07-10 22:10:12 +02:00
);
2017-06-26 10:09:22 +02:00
2010-08-21 17:30:17 +02:00
$numaction ++ ;
$i ++ ;
}
}
else
{
dol_print_error ( $db );
}
}
2017-09-16 00:49:46 +02:00
// Add also event from emailings. TODO This should be replaced by an automatic event ? May be it's too much for very large emailing.
2012-07-10 22:10:12 +02:00
if ( ! empty ( $conf -> mailing -> enabled ) && ! empty ( $objcon -> email ))
2010-08-21 17:30:17 +02:00
{
$langs -> load ( " mails " );
$sql = " SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage, " ;
$sql .= " 'AC_EMAILING' as acode, " ;
2017-03-30 15:39:50 +02:00
$sql .= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname " ; // User that valid action
2010-08-21 17:30:17 +02:00
$sql .= " FROM " . MAIN_DB_PREFIX . " mailing as m, " . MAIN_DB_PREFIX . " mailing_cibles as mc, " . MAIN_DB_PREFIX . " user as u " ;
2011-02-24 19:22:24 +01:00
$sql .= " WHERE mc.email = ' " . $db -> escape ( $objcon -> email ) . " ' " ; // Search is done on email.
2010-08-21 17:30:17 +02:00
$sql .= " AND mc.statut = 1 " ;
$sql .= " AND u.rowid = m.fk_user_valid " ;
$sql .= " AND mc.fk_mailing=m.rowid " ;
$sql .= " ORDER BY mc.date_envoi DESC, m.rowid DESC " ;
2014-06-12 11:31:53 +02:00
dol_syslog ( " company.lib::show_actions_done " , LOG_DEBUG );
2010-08-21 17:30:17 +02:00
$resql = $db -> query ( $sql );
if ( $resql )
{
$i = 0 ;
$num = $db -> num_rows ( $resql );
2017-09-16 00:49:46 +02:00
2010-08-21 17:30:17 +02:00
while ( $i < $num )
{
$obj = $db -> fetch_object ( $resql );
2012-07-10 22:10:12 +02:00
$histo [ $numaction ] = array (
'type' => 'mailing' ,
2016-10-17 17:52:58 +02:00
'tododone' => 'done' ,
2012-07-10 22:10:12 +02:00
'id' => $obj -> id ,
2014-09-28 16:12:38 +02:00
'datestart' => $db -> jdate ( $obj -> da ),
'dateend' => $db -> jdate ( $obj -> da ),
2012-07-10 22:10:12 +02:00
'note' => $obj -> note ,
'percent' => $obj -> percentage ,
'acode' => $obj -> acode ,
2017-06-26 10:09:22 +02:00
2017-03-30 15:39:50 +02:00
'userid' => $obj -> user_id ,
'login' => $obj -> user_login ,
'userfirstname' => $obj -> user_firstname ,
'userlastname' => $obj -> user_lastname ,
'userphoto' => $obj -> user_photo
2012-07-10 22:10:12 +02:00
);
2010-08-21 17:30:17 +02:00
$numaction ++ ;
$i ++ ;
}
2011-11-22 14:00:03 +01:00
$db -> free ( $resql );
2010-08-21 17:30:17 +02:00
}
else
{
dol_print_error ( $db );
}
}
2012-09-15 11:21:22 +02:00
if ( ! empty ( $conf -> agenda -> enabled ) || ( ! empty ( $conf -> mailing -> enabled ) && ! empty ( $objcon -> email )))
2010-08-21 17:30:17 +02:00
{
2016-11-14 02:25:59 +01:00
$delay_warning = $conf -> global -> MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60 ;
2017-06-26 10:09:22 +02:00
2018-09-03 11:59:19 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php' ;
2016-12-26 18:21:18 +01:00
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
2018-09-03 11:59:19 +02:00
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2016-10-30 12:39:51 +01:00
2018-09-03 11:59:19 +02:00
$formactions = new FormActions ( $db );
2017-06-26 10:09:22 +02:00
2018-09-03 11:59:19 +02:00
$actionstatic = new ActionComm ( $db );
2010-08-21 17:30:17 +02:00
$userstatic = new User ( $db );
$contactstatic = new Contact ( $db );
2011-06-06 20:13:10 +02:00
2016-12-26 18:21:18 +01:00
// TODO mutualize/uniformize
2010-08-21 17:30:17 +02:00
$propalstatic = new Propal ( $db );
$orderstatic = new Commande ( $db );
2016-12-26 18:21:18 +01:00
$supplierorderstatic = new CommandeFournisseur ( $db );
2010-08-21 17:30:17 +02:00
$facturestatic = new Facture ( $db );
2016-10-17 17:52:58 +02:00
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
2017-08-25 13:50:45 +02:00
if ( $objcon && get_class ( $objcon ) == 'Contact' && $filterobj && get_class ( $filterobj ) == 'Societe' )
2016-12-19 16:22:41 +01:00
{
$out .= '<input type="hidden" name="id" value="' . $objcon -> id . '" />' ;
}
else
{
$out .= '<input type="hidden" name="id" value="' . $filterobj -> id . '" />' ;
}
2017-08-25 13:50:45 +02:00
if ( $filterobj && get_class ( $filterobj ) == 'Societe' ) $out .= '<input type="hidden" name="socid" value="' . $filterobj -> id . '" />' ;
2017-06-26 10:09:22 +02:00
2011-04-11 09:35:15 +02:00
$out .= " \n " ;
2017-06-26 10:09:22 +02:00
2017-03-02 01:26:15 +01:00
$out .= '<div class="div-table-responsive-no-min">' ;
2011-04-11 09:35:15 +02:00
$out .= '<table class="noborder" width="100%">' ;
2017-03-30 15:39:50 +02:00
$out .= '<tr class="liste_titre">' ;
if ( $donetodo )
{
$out .= '<td class="liste_titre"></td>' ;
}
$out .= '<td class="liste_titre"></td>' ;
$out .= '<td class="liste_titre"></td>' ;
$out .= '<td class="liste_titre">' ;
$out .= $formactions -> select_type_actions ( $actioncode , " actioncode " , '' , empty ( $conf -> global -> AGENDA_USE_EVENT_TYPE ) ? 1 :- 1 , 0 , 0 , 1 );
$out .= '</td>' ;
2017-10-04 12:58:13 +02:00
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth100onsmartphone" name="search_agenda_label" value="' . $filters [ 'search_agenda_label' ] . '"></td>' ;
$out .= '<td class="liste_titre"></td>' ;
2017-03-30 15:39:50 +02:00
$out .= '<td class="liste_titre"></td>' ;
$out .= '<td class="liste_titre"></td>' ;
$out .= '<td class="liste_titre"></td>' ;
// Action column
$out .= '<td class="liste_titre" align="middle">' ;
2017-05-14 21:06:33 +02:00
$searchpicto = $form -> showFilterAndCheckAddButtons ( $massactionbutton ? 1 : 0 , 'checkforselect' , 1 );
$out .= $searchpicto ;
2017-03-30 15:39:50 +02:00
$out .= '</td>' ;
$out .= '</tr>' ;
2017-06-26 10:09:22 +02:00
2011-04-11 09:35:15 +02:00
$out .= '<tr class="liste_titre">' ;
2016-10-17 17:52:58 +02:00
if ( $donetodo )
{
2017-03-30 15:39:50 +02:00
$tmp = '' ;
2017-11-16 12:18:25 +01:00
if ( get_class ( $filterobj ) == 'Societe' ) $tmp .= '<a href="' . DOL_URL_ROOT . '/comm/action/list.php?socid=' . $filterobj -> id . '&status=done">' ;
2017-03-30 15:39:50 +02:00
$tmp .= ( $donetodo != 'done' ? $langs -> trans ( " ActionsToDoShort " ) : '' );
$tmp .= ( $donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '' );
$tmp .= ( $donetodo != 'todo' ? $langs -> trans ( " ActionsDoneShort " ) : '' );
2017-03-30 11:25:28 +02:00
//$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
2017-03-30 15:39:50 +02:00
if ( get_class ( $filterobj ) == 'Societe' ) $tmp .= '</a>' ;
$out .= getTitleFieldOfList ( $tmp );
2015-07-21 10:24:54 +02:00
}
2017-03-30 15:39:50 +02:00
$out .= getTitleFieldOfList ( $langs -> trans ( " Ref " ), 0 , $_SERVER [ " PHP_SELF " ], 'a.id' , '' , $param , '' , $sortfield , $sortorder );
$out .= getTitleFieldOfList ( $langs -> trans ( " Owner " ));
2017-10-04 12:58:13 +02:00
$out .= getTitleFieldOfList ( $langs -> trans ( " Type " ));
2017-03-30 15:39:50 +02:00
$out .= getTitleFieldOfList ( $langs -> trans ( " Label " ), 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder );
$out .= getTitleFieldOfList ( $langs -> trans ( " Date " ), 0 , $_SERVER [ " PHP_SELF " ], 'a.datep,a.id' , '' , $param , 'align="center"' , $sortfield , $sortorder );
$out .= getTitleFieldOfList ( '' );
2018-10-04 09:42:11 +02:00
$out .= getTitleFieldOfList ( $langs -> trans ( " ActionOnContact " ), 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder );
2016-10-30 12:39:51 +01:00
$out .= getTitleFieldOfList ( $langs -> trans ( " Status " ), 0 , $_SERVER [ " PHP_SELF " ], 'a.percent' , '' , $param , 'align="center"' , $sortfield , $sortorder );
2017-03-30 15:39:50 +02:00
$out .= getTitleFieldOfList ( '' , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder , 'maxwidthsearch ' );
2016-10-17 17:52:58 +02:00
$out .= '</tr>' ;
2017-06-26 10:09:22 +02:00
2018-03-22 10:46:42 +01:00
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/cactioncomm.class.php' ;
$caction = new CActionComm ( $db );
$arraylist = $caction -> liste_array ( 1 , 'code' , '' , ( empty ( $conf -> global -> AGENDA_USE_EVENT_TYPE ) ? 1 : 0 ), '' , 1 );
2010-08-21 17:30:17 +02:00
foreach ( $histo as $key => $value )
{
2016-10-30 12:39:51 +01:00
$actionstatic -> fetch ( $histo [ $key ][ 'id' ]); // TODO Do we need this, we already have a lot of data of line into $histo
2016-10-17 17:52:58 +02:00
2018-03-22 10:46:42 +01:00
$actionstatic -> type_picto = $histo [ $key ][ 'apicto' ];
$actionstatic -> type_code = $histo [ $key ][ 'acode' ];
2017-09-16 00:49:46 +02:00
$out .= '<tr class="oddeven">' ;
2017-06-26 10:09:22 +02:00
2016-10-30 12:39:51 +01:00
// Done or todo
2016-10-17 17:52:58 +02:00
if ( $donetodo )
2014-09-28 16:12:38 +02:00
{
2016-10-17 17:52:58 +02:00
$out .= '<td class="nowrap">' ;
$out .= '</td>' ;
2014-09-28 16:12:38 +02:00
}
2017-06-26 10:09:22 +02:00
2016-10-17 17:52:58 +02:00
// Ref
$out .= '<td class="nowrap">' ;
$out .= $actionstatic -> getNomUrl ( 1 , - 1 );
$out .= '</td>' ;
2017-06-26 10:09:22 +02:00
2017-03-30 15:39:50 +02:00
// Author of event
$out .= '<td>' ;
//$userstatic->id=$histo[$key]['userid'];
//$userstatic->login=$histo[$key]['login'];
//$out.=$userstatic->getLoginUrl(1);
2018-03-06 13:26:40 +01:00
if ( $histo [ $key ][ 'userid' ] > 0 )
{
$userstatic -> fetch ( $histo [ $key ][ 'userid' ]);
$out .= $userstatic -> getNomUrl ( - 1 );
}
2017-03-30 15:39:50 +02:00
$out .= '</td>' ;
2017-06-26 10:09:22 +02:00
2017-10-04 12:58:13 +02:00
// Type
$out .= '<td>' ;
if ( ! empty ( $conf -> global -> AGENDA_USE_EVENT_TYPE ))
{
2018-03-22 10:46:42 +01:00
if ( $actionstatic -> type_picto ) print img_picto ( '' , $actionstatic -> type_picto );
2017-10-04 12:58:13 +02:00
else {
2018-03-22 10:46:42 +01:00
if ( $actionstatic -> type_code == 'AC_RDV' ) $out .= img_picto ( '' , 'object_group' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
elseif ( $actionstatic -> type_code == 'AC_TEL' ) $out .= img_picto ( '' , 'object_phoning' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
elseif ( $actionstatic -> type_code == 'AC_FAX' ) $out .= img_picto ( '' , 'object_phoning_fax' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
elseif ( $actionstatic -> type_code == 'AC_EMAIL' ) $out .= img_picto ( '' , 'object_email' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
elseif ( $actionstatic -> type_code == 'AC_INT' ) $out .= img_picto ( '' , 'object_intervention' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
elseif ( ! preg_match ( '/_AUTO/' , $actionstatic -> type_code )) $out .= img_picto ( '' , 'object_action' , '' , false , 0 , 0 , '' , 'paddingright' ) . ' ' ;
2017-10-04 12:58:13 +02:00
}
}
2018-03-22 10:46:42 +01:00
$labeltype = $actionstatic -> type_code ;
if ( empty ( $conf -> global -> AGENDA_USE_EVENT_TYPE ) && empty ( $arraylist [ $labeltype ])) $labeltype = 'AC_OTH' ;
if ( ! empty ( $arraylist [ $labeltype ])) $labeltype = $arraylist [ $labeltype ];
$out .= dol_trunc ( $labeltype , 28 );
2017-10-04 12:58:13 +02:00
$out .= '</td>' ;
2016-10-17 17:52:58 +02:00
// Title
2011-06-06 20:13:10 +02:00
$out .= '<td>' ;
2012-07-10 22:10:12 +02:00
if ( isset ( $histo [ $key ][ 'type' ]) && $histo [ $key ][ 'type' ] == 'action' )
2010-08-21 17:30:17 +02:00
{
2011-06-06 20:13:10 +02:00
$transcode = $langs -> trans ( " Action " . $histo [ $key ][ 'acode' ]);
2016-10-30 12:39:51 +01:00
$libelle = ( $transcode != " Action " . $histo [ $key ][ 'acode' ] ? $transcode : $histo [ $key ][ 'alabel' ]);
2011-06-06 20:13:10 +02:00
//$actionstatic->libelle=$libelle;
2016-10-17 17:52:58 +02:00
$libelle = $histo [ $key ][ 'note' ];
2010-08-21 17:30:17 +02:00
$actionstatic -> id = $histo [ $key ][ 'id' ];
2016-10-17 17:52:58 +02:00
$out .= dol_trunc ( $libelle , 120 );
2010-08-21 17:30:17 +02:00
}
2012-07-10 22:10:12 +02:00
if ( isset ( $histo [ $key ][ 'type' ]) && $histo [ $key ][ 'type' ] == 'mailing' )
2010-08-21 17:30:17 +02:00
{
2014-09-18 21:18:25 +02:00
$out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo [ $key ][ 'id' ] . '">' . img_object ( $langs -> trans ( " ShowEMailing " ), " email " ) . ' ' ;
2010-08-21 17:30:17 +02:00
$transcode = $langs -> trans ( " Action " . $histo [ $key ][ 'acode' ]);
$libelle = ( $transcode != " Action " . $histo [ $key ][ 'acode' ] ? $transcode : 'Send mass mailing' );
2015-06-30 16:10:03 +02:00
$out .= dol_trunc ( $libelle , 120 );
2010-08-21 17:30:17 +02:00
}
2011-04-11 09:35:15 +02:00
$out .= '</td>' ;
2017-03-30 15:39:50 +02:00
2016-10-17 17:52:58 +02:00
// Date
2017-03-30 15:39:50 +02:00
$out .= '<td class="center nowrap">' ;
2016-10-17 17:52:58 +02:00
$out .= dol_print_date ( $histo [ $key ][ 'datestart' ], 'dayhour' );
if ( $histo [ $key ][ 'dateend' ] && $histo [ $key ][ 'dateend' ] != $histo [ $key ][ 'datestart' ])
{
$tmpa = dol_getdate ( $histo [ $key ][ 'datestart' ], true );
$tmpb = dol_getdate ( $histo [ $key ][ 'dateend' ], true );
if ( $tmpa [ 'mday' ] == $tmpb [ 'mday' ] && $tmpa [ 'mon' ] == $tmpb [ 'mon' ] && $tmpa [ 'year' ] == $tmpb [ 'year' ]) $out .= '-' . dol_print_date ( $histo [ $key ][ 'dateend' ], 'hour' );
else $out .= '-' . dol_print_date ( $histo [ $key ][ 'dateend' ], 'dayhour' );
}
2016-11-14 02:25:59 +01:00
$late = 0 ;
2017-12-10 08:12:49 +01:00
if ( $histo [ $key ][ 'percent' ] == 0 && $histo [ $key ][ 'datestart' ] && $histo [ $key ][ 'datestart' ] < ( $now - $delay_warning )) $late = 1 ;
if ( $histo [ $key ][ 'percent' ] == 0 && ! $histo [ $key ][ 'datestart' ] && $histo [ $key ][ 'dateend' ] && $histo [ $key ][ 'datestart' ] < ( $now - $delay_warning )) $late = 1 ;
if ( $histo [ $key ][ 'percent' ] > 0 && $histo [ $key ][ 'percent' ] < 100 && $histo [ $key ][ 'dateend' ] && $histo [ $key ][ 'dateend' ] < ( $now - $delay_warning )) $late = 1 ;
if ( $histo [ $key ][ 'percent' ] > 0 && $histo [ $key ][ 'percent' ] < 100 && ! $histo [ $key ][ 'dateend' ] && $histo [ $key ][ 'datestart' ] && $histo [ $key ][ 'datestart' ] < ( $now - $delay_warning )) $late = 1 ;
2016-11-14 02:25:59 +01:00
if ( $late ) $out .= img_warning ( $langs -> trans ( " Late " )) . ' ' ;
2016-10-17 17:52:58 +02:00
$out .= " </td> \n " ;
2017-06-26 10:09:22 +02:00
2011-06-06 20:13:10 +02:00
// Title of event
//$out.='<td>'.dol_trunc($histo[$key]['note'], 40).'</td>';
2010-08-21 17:30:17 +02:00
// Objet lie
2016-12-26 18:21:18 +01:00
// TODO mutualize/uniformize
2011-04-11 09:35:15 +02:00
$out .= '<td>' ;
2014-09-28 16:12:38 +02:00
//var_dump($histo[$key]['elementtype']);
2012-07-10 22:10:12 +02:00
if ( isset ( $histo [ $key ][ 'elementtype' ]))
2010-08-21 17:30:17 +02:00
{
2012-07-10 22:10:12 +02:00
if ( $histo [ $key ][ 'elementtype' ] == 'propal' && ! empty ( $conf -> propal -> enabled ))
{
2015-01-25 01:20:58 +01:00
//$propalstatic->ref=$langs->trans("ProposalShort");
//$propalstatic->id=$histo[$key]['fk_element'];
if ( $propalstatic -> fetch ( $histo [ $key ][ 'fk_element' ]) > 0 ) {
$propalstatic -> type = $histo [ $key ][ 'ftype' ];
$out .= $propalstatic -> getNomUrl ( 1 );
} else {
2018-03-22 10:46:42 +01:00
//$out.= '<span class="opacitymedium">'.$langs->trans("ProposalDeleted").'</span>';
2015-01-25 01:20:58 +01:00
}
}
2014-09-28 16:12:38 +02:00
elseif (( $histo [ $key ][ 'elementtype' ] == 'order' || $histo [ $key ][ 'elementtype' ] == 'commande' ) && ! empty ( $conf -> commande -> enabled ))
2012-07-10 22:10:12 +02:00
{
2015-01-25 01:20:58 +01:00
//$orderstatic->ref=$langs->trans("Order");
//$orderstatic->id=$histo[$key]['fk_element'];
if ( $orderstatic -> fetch ( $histo [ $key ][ 'fk_element' ]) > 0 ) {
$orderstatic -> type = $histo [ $key ][ 'ftype' ];
$out .= $orderstatic -> getNomUrl ( 1 );
} else {
2018-03-22 10:46:42 +01:00
//$out.= '<span class="opacitymedium">'.$langs->trans("OrderDeleted").'<span>';
2015-01-25 01:20:58 +01:00
}
}
2014-09-28 16:12:38 +02:00
elseif (( $histo [ $key ][ 'elementtype' ] == 'invoice' || $histo [ $key ][ 'elementtype' ] == 'facture' ) && ! empty ( $conf -> facture -> enabled ))
2012-07-10 22:10:12 +02:00
{
2015-01-25 01:20:58 +01:00
//$facturestatic->ref=$langs->trans("Invoice");
//$facturestatic->id=$histo[$key]['fk_element'];
if ( $facturestatic -> fetch ( $histo [ $key ][ 'fk_element' ]) > 0 ) {
$facturestatic -> type = $histo [ $key ][ 'ftype' ];
$out .= $facturestatic -> getNomUrl ( 1 , 'compta' );
} else {
2018-03-22 10:46:42 +01:00
//$out.= '<span class="opacitymedium">'.$langs->trans("InvoiceDeleted").'</span>';
2015-01-25 01:20:58 +01:00
}
2012-07-10 22:10:12 +02:00
}
else $out .= ' ' ;
2010-08-21 17:30:17 +02:00
}
2011-04-11 09:35:15 +02:00
else $out .= ' ' ;
$out .= '</td>' ;
2010-08-21 17:30:17 +02:00
// Contact pour cette action
2018-04-24 10:02:26 +02:00
if ( empty ( $objcon -> id ) && isset ( $histo [ $key ][ 'contact_id' ]) && $histo [ $key ][ 'contact_id' ] > 0 )
2010-08-21 17:30:17 +02:00
{
2013-02-24 14:46:00 +01:00
$contactstatic -> lastname = $histo [ $key ][ 'lastname' ];
2010-08-21 17:30:17 +02:00
$contactstatic -> firstname = $histo [ $key ][ 'firstname' ];
$contactstatic -> id = $histo [ $key ][ 'contact_id' ];
2011-04-11 09:35:15 +02:00
$out .= '<td width="120">' . $contactstatic -> getNomUrl ( 1 , '' , 10 ) . '</td>' ;
2018-10-04 09:45:12 +02:00
} elseif ( isset ( $histo [ $key ][ 'socpeopleassigned' ]) && is_array ( $histo [ $key ][ 'socpeopleassigned' ]) && count ( $histo [ $key ][ 'socpeopleassigned' ]) > 0 ) {
$out .= '<td>' ;
foreach ( $histo [ $key ][ 'socpeopleassigned' ] as $cid => $Tab ) {
$contact = new Contact ( $db );
$result = $contact -> fetch ( $cid );
if ( $result < 0 )
dol_print_error ( $db , $contact -> error );
if ( $result > 0 ) {
$out .= $contact -> getNomUrl ( 1 );
2018-10-04 09:47:04 +02:00
if ( isset ( $histo [ $key ][ 'acode' ]) && $histo [ $key ][ 'acode' ] == 'AC_TEL' ) {
2018-10-04 09:45:12 +02:00
if ( ! empty ( $contact -> phone_pro ))
$out .= '(' . dol_print_phone ( $contact -> phone_pro ) . ')' ;
}
$out .= '<div class="paddingright"></div>' ;
}
}
$out .= '</td>' ;
}
2018-10-04 09:42:11 +02:00
else {
$out .= '<td> </td>' ;
2010-08-21 17:30:17 +02:00
}
2017-03-30 15:39:50 +02:00
// Status
2017-09-16 00:49:46 +02:00
$out .= '<td class="nowrap" align="center">' . $actionstatic -> LibStatut ( $histo [ $key ][ 'percent' ], 3 , 0 , $histo [ $key ][ 'datestart' ]) . '</td>' ;
2010-08-21 17:30:17 +02:00
2016-10-17 17:52:58 +02:00
// Actions
$out .= '<td></td>' ;
2017-06-26 10:09:22 +02:00
2011-04-11 09:35:15 +02:00
$out .= " </tr> \n " ;
2010-08-21 17:30:17 +02:00
$i ++ ;
}
2011-04-11 09:35:15 +02:00
$out .= " </table> \n " ;
2017-03-02 01:26:15 +01:00
$out .= " </div> \n " ;
2010-08-21 17:30:17 +02:00
}
2008-08-06 16:50:06 +02:00
2016-10-17 17:52:58 +02:00
$out .= '</form>' ;
2017-06-26 10:09:22 +02:00
2011-04-11 09:35:15 +02:00
if ( $noprint ) return $out ;
else print $out ;
2008-07-29 21:20:33 +02:00
}
2011-03-22 20:31:29 +01:00
/**
* Show html area for list of subsidiaries
2012-02-04 14:39:47 +01:00
*
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
* @ param Societe $object Third party object
* @ return void
2011-03-22 20:31:29 +01:00
*/
function show_subsidiaries ( $conf , $langs , $db , $object )
{
global $user ;
$i =- 1 ;
2018-06-20 22:02:36 +02:00
$sql = " SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas " ;
2011-03-22 20:31:29 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe as s " ;
$sql .= " WHERE s.parent = " . $object -> id ;
2017-05-30 18:50:54 +02:00
$sql .= " AND s.entity IN ( " . getEntity ( 'societe' ) . " ) " ;
2011-03-22 20:31:29 +01:00
$sql .= " ORDER BY s.nom " ;
$result = $db -> query ( $sql );
$num = $db -> num_rows ( $result );
if ( $num )
{
$socstatic = new Societe ( $db );
2011-04-10 23:30:11 +02:00
2016-12-05 13:45:57 +01:00
print load_fiche_titre ( $langs -> trans ( " Subsidiaries " ), '' , '' );
2011-03-22 20:31:29 +01:00
print " \n " . '<table class="noborder" width="100%">' . " \n " ;
print '<tr class="liste_titre"><td>' . $langs -> trans ( " Company " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Address " ) . '</td><td>' . $langs -> trans ( " Zip " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Town " ) . '</td><td>' . $langs -> trans ( " CustomerCode " ) . '</td>' ;
print " <td> </td> " ;
print " </tr> " ;
$i = 0 ;
while ( $i < $num )
{
$obj = $db -> fetch_object ( $result );
$socstatic -> id = $obj -> rowid ;
$socstatic -> name = $obj -> name ;
2018-06-20 22:02:36 +02:00
$socstatic -> name_alias = $obj -> name_alias ;
$socstatic -> email = $obj -> email ;
$socstatic -> code_client = $obj -> code_client ;
$socstatic -> code_fournisseur = $obj -> code_client ;
$socstatic -> code_compta = $obj -> code_compta ;
$socstatic -> code_compta_fournisseur = $obj -> code_compta_fournisseur ;
$socstatic -> email = $obj -> email ;
2011-03-22 20:31:29 +01:00
$socstatic -> canvas = $obj -> canvas ;
2018-06-20 22:02:36 +02:00
$socstatic -> client = $obj -> client ;
$socstatic -> fournisseur = $obj -> fournisseur ;
print '<tr class="oddeven">' ;
print '<td>' ;
2011-03-22 20:31:29 +01:00
print $socstatic -> getNomUrl ( 1 );
print '</td>' ;
print '<td>' . $obj -> address . '</td>' ;
print '<td>' . $obj -> zip . '</td>' ;
print '<td>' . $obj -> town . '</td>' ;
print '<td>' . $obj -> code_client . '</td>' ;
print '<td align="center">' ;
2017-03-20 20:58:43 +01:00
print '<a href="' . DOL_URL_ROOT . '/societe/card.php?socid=' . $obj -> rowid . '&action=edit">' ;
2011-03-22 20:31:29 +01:00
print img_edit ();
print '</a></td>' ;
print " </tr> \n " ;
$i ++ ;
}
print " \n </table> \n " ;
}
print " <br> \n " ;
return $i ;
}
2018-03-06 13:26:40 +01:00