2006-05-06 19:06:40 +00:00
< ? php
2015-05-23 16:52:31 +00: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 >
2018-10-27 12:43:12 +00:00
* Copyright ( C ) 2010 - 2012 Regis Houssin < regis . houssin @ inodbox . com >
2015-05-23 16:52:31 +00:00
* 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 >
2019-01-28 20:39:22 +00:00
* Copyright ( C ) 2013 - 2018 Alexandre Spangaro < aspangaro @ open - dsi . fr >
2026-02-01 18:07:15 +00:00
* Copyright ( C ) 2015 - 2026 Frédéric France < frederic . france @ free . fr >
2015-05-23 16:52:31 +00:00
* Copyright ( C ) 2015 Raphaël Doursenaud < rdoursenaud @ gpcsolutions . fr >
2018-10-16 20:27:34 +00:00
* Copyright ( C ) 2017 Rui Strecht < rui . strecht @ aliartalentos . com >
2024-10-13 18:31:23 +00:00
* Copyright ( C ) 2018 - 2024 Ferran Marcet < fmarcet @ 2 byte . es >
2026-02-01 17:09:39 +00:00
* Copyright ( C ) 2024 - 2026 MDW < mdeweerd @ users . noreply . github . com >
2013-11-24 20:28:15 +00:00
*
2006-04-08 22:47:51 +00: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 14:36:08 +00:00
* the Free Software Foundation ; either version 3 of the License , or
2006-04-08 22:47:51 +00: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
2019-09-23 19:55:30 +00:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
* or see https :// www . gnu . org /
2006-04-08 22:47:51 +00:00
*/
/**
2011-10-24 09:25:54 +00:00
* \file htdocs / core / lib / company . lib . php
2024-01-13 18:48:20 +00:00
* \brief Ensemble de functions de base pour le module societe
2008-08-06 14:50:06 +00:00
* \ingroup societe
2008-07-29 19:20:33 +00:00
*/
2006-04-08 22:47:51 +00:00
2008-08-06 14:50:06 +00:00
/**
2009-03-12 01:44:02 +00:00
* Return array of tabs to used on pages for third parties cards .
2008-08-06 14:50:06 +00:00
*
2015-02-10 10:38:13 +00:00
* @ param Societe $object Object company shown
2026-04-07 01:25:42 +00:00
* @ param string $subtabs Parameter for choosing subtab , currently used for either conferenceorbooth or attendee
2024-10-13 23:59:44 +00:00
* @ return array < array { 0 : string , 1 : string , 2 : string } > Array of tabs to show
2008-08-06 14:50:06 +00:00
*/
2026-04-07 01:25:42 +00:00
function societe_prepare_head ( Societe $object , $subtabs = '' )
2006-05-06 19:06:40 +00:00
{
2026-04-07 01:25:42 +00:00
dol_syslog ( 'Company::societe_prepare_head' , LOG_DEBUG );
2020-09-07 08:18:17 +00:00
global $db , $langs , $conf , $user ;
2022-04-05 12:36:09 +00:00
global $hookmanager ;
2020-09-07 08:18:17 +00:00
$h = 0 ;
$head = array ();
2025-08-04 11:12:22 +00:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/societe/card.php?socid=' . $object -> id ;
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " ThirdParty " );
$head [ $h ][ 2 ] = 'card' ;
$h ++ ;
2021-02-20 17:21:10 +00:00
2024-04-08 10:13:38 +00:00
if ( ! getDolGlobalString ( 'MAIN_DISABLE_CONTACTS_TAB' ) && $user -> hasRight ( 'societe' , 'contact' , 'lire' )) {
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$nbContact = 0 ;
// Enable caching of thirdrparty count Contacts
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_contacts_thirdparty_' . $object -> id ;
2024-04-08 10:13:38 +00:00
$dataretrieved = dol_getcache ( $cachekey );
2021-02-20 17:21:10 +00:00
2024-04-08 10:13:38 +00:00
if ( ! is_null ( $dataretrieved )) {
$nbContact = $dataretrieved ;
} else {
$sql = " SELECT COUNT(p.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " socpeople as p " ;
2024-04-08 10:13:38 +00:00
// Add table from hooks
$parameters = array ( 'contacttab' => true );
$reshook = $hookmanager -> executeHooks ( 'printFieldListFrom' , $parameters , $object ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2025-08-04 11:12:22 +00:00
$sql .= " WHERE p.fk_soc = " . (( int ) $object -> id );
$sql .= " AND p.entity IN ( " . getEntity ( $object -> element ) . " ) " ;
2024-04-08 10:13:38 +00:00
// Add where from hooks
2024-05-30 11:37:17 +00:00
$parameters = array ( 'contacttab' => true );
2024-04-08 10:13:38 +00:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters , $object ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
$nbContact = $obj -> nb ;
2018-07-17 11:48:08 +00:00
}
2021-02-20 17:21:10 +00:00
2024-04-08 10:13:38 +00:00
dol_setcache ( $cachekey , $nbContact , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
2018-07-17 11:48:08 +00:00
}
2024-04-08 10:13:38 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/contact.php' , [ 'socid' => $object -> id ]);
2024-04-08 10:13:38 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( 'ContactsAddresses' );
if ( $nbContact > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>' ;
2018-07-17 11:48:08 +00:00
}
2024-04-08 10:13:38 +00:00
$head [ $h ][ 2 ] = 'contact' ;
$h ++ ;
}
if ( getDolGlobalString ( 'MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES' )) {
2024-04-17 11:10:09 +00:00
// Some features may be unstable with this option, like permissions rules, import contact, ...
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/societecontact.php' , [ 'socid' => $object -> id ]);
2019-01-27 10:55:16 +00:00
$nbContact = count ( $object -> liste_contact ( - 1 , 'internal' )) + count ( $object -> liste_contact ( - 1 , 'external' ));
2024-04-08 10:13:38 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " ContactsAddressesExt " );
2021-02-20 14:41:57 +00:00
if ( $nbContact > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2024-04-08 10:13:38 +00:00
$head [ $h ][ 2 ] = 'contactext' ;
2018-07-17 11:48:08 +00:00
$h ++ ;
2017-09-27 17:56:03 +00:00
}
2020-10-27 23:34:59 +00:00
if ( $object -> client == 1 || $object -> client == 2 || $object -> client == 3 ) {
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/comm/card.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = '' ;
2023-11-27 10:39:32 +00:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' ) && ( $object -> client == 2 || $object -> client == 3 )) {
2021-02-20 14:41:57 +00:00
$head [ $h ][ 1 ] .= $langs -> trans ( " Prospect " );
}
2023-11-27 10:39:32 +00:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' ) && ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' ) && $object -> client == 3 ) {
2021-02-20 14:41:57 +00:00
$head [ $h ][ 1 ] .= ' | ' ;
}
2023-11-27 10:39:32 +00:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' ) && ( $object -> client == 1 || $object -> client == 3 )) {
2021-02-20 14:41:57 +00:00
$head [ $h ][ 1 ] .= $langs -> trans ( " Customer " );
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'customer' ;
$h ++ ;
2024-09-25 21:18:16 +00:00
if ( getDolGlobalString ( 'PRODUIT_CUSTOMER_PRICES' ) || getDolGlobalString ( 'PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES' )) {
2020-09-07 08:18:17 +00:00
$langs -> load ( " products " );
// price
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/price.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " CustomerPrices " );
$head [ $h ][ 2 ] = 'price' ;
$h ++ ;
}
}
$supplier_module_enabled = 0 ;
2023-04-18 14:15:13 +00:00
if ( isModEnabled ( 'supplier_proposal' ) || isModEnabled ( " supplier_order " ) || isModEnabled ( " supplier_invoice " )) {
2021-02-20 14:41:57 +00:00
$supplier_module_enabled = 1 ;
}
2023-10-15 13:32:35 +00:00
if ( $supplier_module_enabled == 1 && $object -> fournisseur && $user -> hasRight ( 'fournisseur' , 'lire' )) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 0 ] = DOL_URL_ROOT . '/fourn/card.php?socid=' . $object -> id ;
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Supplier " );
$head [ $h ][ 2 ] = 'supplier' ;
$h ++ ;
}
2024-12-18 08:19:48 +00:00
if ( isModEnabled ( 'accounting' ) && getDolGlobalString ( 'ACCOUNTING_ENABLE_TABONTHIRDPARTY' ) && ( $user -> hasRight ( 'accounting' , 'mouvements' , 'lire' ))) {
2024-12-18 22:21:34 +00:00
// link to customer account by default
if ( ! empty ( $object -> code_compta_client )) {
$subledger_start_account = $subledger_end_account = $object -> code_compta_client ;
2024-12-18 21:17:12 +00:00
$mode = 'customer' ;
2024-12-18 22:21:34 +00:00
} elseif ( ! empty ( $object -> code_compta_fournisseur )) {
$subledger_start_account = $subledger_end_account = $object -> code_compta_fournisseur ;
2024-12-18 21:17:12 +00:00
$mode = 'supplier' ;
2024-12-18 22:21:34 +00:00
} else {
$subledger_start_account = $subledger_end_account = '' ;
2024-12-18 21:17:12 +00:00
$mode = 'customer' ;
2024-12-18 22:21:34 +00:00
}
2024-12-18 08:19:48 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php' , [ 'socid' => $object -> id , 'mode' => $mode , 'type' => 'sub' , 'search_accountancy_code_start' => $subledger_start_account , 'search_accountancy_code_end' => $subledger_end_account ]);
2024-12-18 08:19:48 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Accounting " );
$head [ $h ][ 2 ] = 'accounting' ;
$h ++ ;
}
2023-10-15 13:32:35 +00:00
if ( isModEnabled ( 'project' ) && ( $user -> hasRight ( 'projet' , 'lire' ))) {
2026-04-07 01:25:42 +00:00
dol_syslog ( 'Company::societe_prepare_head::isModEnabled::project' , LOG_DEBUG );
2021-02-20 21:03:11 +00:00
$nbProject = 0 ;
2021-02-21 08:50:58 +00:00
// Enable caching of thirdrparty count projects
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_projects_thirdparty_' . $object -> id ;
2021-02-20 21:03:11 +00:00
$dataretrieved = dol_getcache ( $cachekey );
if ( ! is_null ( $dataretrieved )) {
$nbProject = $dataretrieved ;
2020-09-07 08:18:17 +00:00
} else {
2021-02-20 21:03:11 +00:00
$sql = " SELECT COUNT(n.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as n " ;
$sql .= " WHERE fk_soc = " . (( int ) $object -> id );
$sql .= " AND entity IN ( " . getEntity ( 'project' ) . " ) " ;
2021-02-20 21:03:11 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
$nbProject = $obj -> nb ;
} else {
dol_print_error ( $db );
}
dol_setcache ( $cachekey , $nbProject , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
2020-09-07 08:18:17 +00:00
}
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/project.php' , [ 'socid' => $object -> id ]);
2021-02-20 14:41:57 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Projects " );
2021-02-20 21:03:11 +00:00
if ( $nbProject > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbProject . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'project' ;
$h ++ ;
}
2011-01-24 23:35:21 +00:00
2020-09-07 08:18:17 +00:00
// Tab to link resources
2023-11-27 10:39:32 +00:00
if ( isModEnabled ( 'resource' ) && getDolGlobalString ( 'RESOURCE_ON_THIRDPARTIES' )) {
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/resource/element_resource.php' , [ 'element' => 'societe' , 'element_id' => $object -> id ]);
2015-05-31 00:05:39 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Resources " );
$head [ $h ][ 2 ] = 'resources' ;
$h ++ ;
}
2016-10-02 14:12:40 +00:00
// Related items
2024-02-27 14:30:37 +00:00
if (( isModEnabled ( 'order' ) || isModEnabled ( 'propal' ) || isModEnabled ( 'invoice' ) || isModEnabled ( 'intervention' ) || isModEnabled ( " supplier_proposal " ) || isModEnabled ( " supplier_order " ) || isModEnabled ( " supplier_invoice " ))
2025-08-04 11:12:22 +00:00
&& ! getDolGlobalString ( 'THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB' )
) {
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/consumption.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Referers " );
$head [ $h ][ 2 ] = 'consumption' ;
$h ++ ;
}
// Bank accounts
2023-09-04 17:35:33 +00:00
if ( ! getDolGlobalInt ( 'SOCIETE_DISABLE_BANKACCOUNT' )) {
2020-09-07 08:18:17 +00:00
$nbBankAccount = 0 ;
2019-11-13 18:35:02 +00:00
$foundonexternalonlinesystem = 0 ;
2022-02-13 18:26:16 +00:00
$langs -> load ( " bills " );
2018-03-07 14:05:49 +00:00
2022-02-02 17:04:11 +00:00
$title = $langs -> trans ( " PaymentModes " );
2019-05-21 11:27:45 +00:00
2024-11-04 11:32:13 +00:00
$servicestatus = 0 ;
2022-06-09 20:10:51 +00:00
if ( isModEnabled ( 'stripe' )) {
2025-07-10 17:47:58 +00:00
if ( getDolGlobalString ( 'STRIPE_LIVE' ) /* && !GETPOST('forcesandbox', 'alpha')*/ ) {
2021-02-20 14:41:57 +00:00
$servicestatus = 1 ;
}
2018-03-13 16:47:43 +00:00
2025-08-04 11:12:22 +00:00
include_once DOL_DOCUMENT_ROOT . '/societe/class/societeaccount.class.php' ;
2018-03-13 16:47:43 +00:00
$societeaccount = new SocieteAccount ( $db );
2019-11-13 18:35:02 +00:00
$stripecu = $societeaccount -> getCustomerAccount ( $object -> id , 'stripe' , $servicestatus ); // Get thirdparty cu_...
2021-02-20 14:41:57 +00:00
if ( $stripecu ) {
$foundonexternalonlinesystem ++ ;
}
2018-03-07 14:05:49 +00:00
}
2016-12-11 12:21:21 +00:00
2020-09-07 08:18:17 +00:00
$sql = " SELECT COUNT(n.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe_rib as n " ;
$sql .= " WHERE n.fk_soc = " . (( int ) $object -> id );
2022-06-09 20:10:51 +00:00
if ( ! isModEnabled ( 'stripe' )) {
2025-10-31 23:35:50 +00:00
$sql .= " AND (n.stripe_card_ref IS NULL OR n.stripe_card_ref ='') " ;
2020-02-05 11:49:56 +00:00
} else {
2025-08-04 11:12:22 +00:00
$sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = " . (( int ) $servicestatus ) . " )) " ;
2020-02-05 11:49:56 +00:00
}
2020-02-04 18:33:20 +00:00
2020-09-07 08:18:17 +00:00
$resql = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2021-02-20 14:41:57 +00:00
$obj = $db -> fetch_object ( $resql );
$nbBankAccount = $obj -> nb ;
2020-09-07 08:18:17 +00:00
} else {
dol_print_error ( $db );
}
2022-06-09 20:10:51 +00:00
//if (isModEnabled('stripe') && $nbBankAccount > 0) $nbBankAccount = '...'; // No way to know exact number
2020-09-07 08:18:17 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/paymentmodes.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $title ;
2021-02-20 14:41:57 +00:00
if ( $foundonexternalonlinesystem ) {
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">...</span>' ;
} elseif ( $nbBankAccount > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbBankAccount . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'rib' ;
$h ++ ;
}
2024-01-30 12:22:53 +00:00
if (( isModEnabled ( 'website' ) || isModEnabled ( 'webportal' )) && $user -> hasRight ( 'societe' , 'lire' )) {
2026-04-07 01:25:42 +00:00
dol_syslog ( 'Company::societe_prepare_head::isModEnabled::website' , LOG_DEBUG );
2023-08-18 15:37:41 +00:00
$site_filter_list = array ();
if ( isModEnabled ( 'website' )) {
$site_filter_list [] = 'dolibarr_website' ;
}
if ( isModEnabled ( 'webportal' )) {
$site_filter_list [] = 'dolibarr_portal' ;
}
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/website.php' , [ 'id' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " WebSiteAccounts " );
$nbNote = 0 ;
$sql = " SELECT COUNT(n.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe_account as n " ;
$sql .= " WHERE fk_soc = " . (( int ) $object -> id );
$sql .= " AND entity IN ( " . getEntity ( 'thirdpartyaccount' ) . " ) " ;
2023-08-18 15:37:41 +00:00
if ( ! empty ( $site_filter_list )) {
2025-08-04 11:12:22 +00:00
$sql .= " AND n.site IN ( " . $db -> sanitize ( " ' " . implode ( " ',' " , $site_filter_list ) . " ' " , 1 ) . " ) " ;
2023-08-18 15:37:41 +00:00
}
2020-09-07 08:18:17 +00:00
$resql = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2021-02-20 14:41:57 +00:00
$obj = $db -> fetch_object ( $resql );
$nbNote = $obj -> nb ;
2020-09-07 08:18:17 +00:00
} else {
dol_print_error ( $db );
}
2021-02-20 14:41:57 +00:00
if ( $nbNote > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'website' ;
$h ++ ;
}
2017-10-21 10:26:14 +00:00
2022-05-10 14:19:00 +00:00
if ( getDolGlobalString ( 'PARTNERSHIP_IS_MANAGED_FOR' , 'thirdparty' ) == 'thirdparty' ) {
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'partnership' , 'read' )) {
2021-11-29 00:04:32 +00:00
$langs -> load ( " partnership " );
2021-08-23 13:00:29 +00:00
$nbPartnership = is_array ( $object -> partnerships ) ? count ( $object -> partnerships ) : 0 ;
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/partnership/partnership_list.php' , [ 'socid' => $object -> id ]);
2022-10-29 07:39:12 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Partnerships " );
$nbNote = 0 ;
$sql = " SELECT COUNT(n.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " partnership as n " ;
$sql .= " WHERE fk_soc = " . (( int ) $object -> id );
$sql .= " AND entity IN ( " . getEntity ( 'partnership' ) . " ) " ;
2022-10-29 07:39:12 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
$nbNote = $obj -> nb ;
} else {
dol_print_error ( $db );
}
if ( $nbNote > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' ;
2022-10-29 07:39:12 +00:00
}
$head [ $h ][ 2 ] = 'partnerships' ;
2021-08-23 13:00:29 +00:00
if ( $nbPartnership > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbPartnership . '</span>' ;
2021-08-23 13:00:29 +00:00
}
$h ++ ;
}
}
2024-06-15 16:55:17 +00:00
// Notifications
if ( isModEnabled ( 'ticket' ) && $user -> hasRight ( " ticket " , " read " )) {
2026-04-07 01:25:42 +00:00
dol_syslog ( 'Company::societe_prepare_head::isModEnabled::ticket' , LOG_DEBUG );
2024-06-15 16:55:17 +00:00
//$langs->load('ticket');
$nbTicket = 0 ;
// Enable caching of thirdparty count notifications
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_ticket_thirdparty_' . $object -> id ;
2024-06-15 16:55:17 +00:00
$nbticketretreived = dol_getcache ( $cachekey );
if ( ! is_null ( $nbticketretreived )) {
$nbTicket = $nbticketretreived ;
} else {
// List of notifications enabled for contacts of the third party
$sql = " SELECT COUNT(t.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " ticket as t " ;
$sql .= " WHERE t.fk_soc = " . (( int ) $object -> id );
2024-06-15 16:55:17 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
$nbTicket = $obj -> nb ;
} else {
dol_print_error ( $db );
}
dol_setcache ( $cachekey , $nbTicket , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
}
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/ticket/list.php' , [ 'socid' => $object -> id ]);
2024-06-15 16:55:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Tickets " );
if ( $nbTicket > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbTicket . '</span>' ;
2024-06-15 16:55:17 +00:00
}
$head [ $h ][ 2 ] = 'ticket' ;
$h ++ ;
}
2026-04-07 01:25:42 +00:00
if ( isModEnabled ( 'eventorganization' ) && isModEnabled ( 'project' ) && ( $user -> hasRight ( 'projet' , 'lire' ))) {
dol_syslog ( 'Company::societe_prepare_head::isModEnabled::eventorganization' , LOG_DEBUG );
$langs -> load ( 'eventorganization' );
if ( $subtabs == 'attendees' ) {
$url_for_list = '/eventorganization/conferenceorboothattendee_list.php' ;
} else {
// this seems to be the default elsewhere, so let's keep that
$url_for_list = '/eventorganization/conferenceorbooth_list.php' ;
}
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . $url_for_list , [ 'thirdpartyid' => $object -> id , 'withthirdparty' => 1 ]);
$head [ $h ][ 1 ] = $langs -> trans ( " EventOrganization " );
// Enable caching of conf or booth count
$nbConfOrBooth = 0 ;
$nbAttendees = 0 ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_conferenceorbooth_thirdparty_' . $object -> id ;
$dataretrieved = dol_getcache ( $cachekey );
if ( ! is_null ( $dataretrieved )) {
$nbConfOrBooth = $dataretrieved ;
} else {
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorbooth.class.php' ;
$conforbooth = new ConferenceOrBooth ( $db );
$result = $conforbooth -> fetchAll ( '' , '' , 0 , 0 , '(t.fk_soc:=:' . (( int ) $object -> id ) . " ) " );
//,
if ( ! is_array ( $result ) && $result < 0 ) {
setEventMessages ( $conforbooth -> error , $conforbooth -> errors , 'errors' );
} else {
$nbConfOrBooth = count ( $result );
}
dol_setcache ( $cachekey , $nbConfOrBooth , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
}
$cachekey = 'count_attendees_thirdparty_' . $object -> id ;
$dataretrieved = dol_getcache ( $cachekey );
if ( ! is_null ( $dataretrieved )) {
$nbAttendees = $dataretrieved ;
} else {
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php' ;
$conforboothattendee = new ConferenceOrBoothAttendee ( $db );
$result = $conforboothattendee -> fetchAll ( '' , '' , 0 , 0 , '(t.fk_soc:=:' . (( int ) $object -> id ) . ')' );
if ( ! is_array ( $result ) && $result < 0 ) {
setEventMessages ( $conforboothattendee -> error , $conforboothattendee -> errors , 'errors' );
} else {
$nbAttendees = count ( $result );
}
dol_setcache ( $cachekey , $nbAttendees , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
}
if ( $nbConfOrBooth > 0 || $nbAttendees > 0 ) {
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' ;
$head [ $h ][ 1 ] .= '<span title="' . dol_escape_htmltag ( $langs -> trans ( " ConferenceOrBooth " )) . '">' . $nbConfOrBooth . '</span>' ;
$head [ $h ][ 1 ] .= ' + ' ;
$head [ $h ][ 1 ] .= '<span title="' . dol_escape_htmltag ( $langs -> trans ( " Attendees " )) . '">' . $nbAttendees . '</span>' ;
$head [ $h ][ 1 ] .= '</span>' ;
}
// why are the head eventorganisation with s and the module is eventorganization with z?
$head [ $h ][ 2 ] = 'eventorganization' ;
$h ++ ;
}
2024-06-15 16:55:17 +00:00
2016-10-02 14:12:40 +00:00
// Show more tabs from modules
2020-09-07 08:18:17 +00: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
2022-09-15 14:55:52 +00:00
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'thirdparty' , 'add' , 'core' );
2020-09-07 08:18:17 +00:00
2020-10-27 23:34:59 +00:00
if ( $user -> socid == 0 ) {
2020-09-07 08:18:17 +00:00
// Notifications
2022-06-09 20:10:51 +00:00
if ( isModEnabled ( 'notification' )) {
2024-03-03 16:07:58 +00:00
$langs -> load ( 'mails' );
2021-02-20 14:41:57 +00:00
$nbNotif = 0 ;
2021-11-02 03:50:29 +00:00
// Enable caching of thirdparty count notifications
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_notifications_thirdparty_' . $object -> id ;
2021-02-20 16:12:06 +00:00
$dataretrieved = dol_getcache ( $cachekey );
2021-02-20 17:21:10 +00:00
if ( ! is_null ( $dataretrieved )) {
$nbNotif = $dataretrieved ;
2021-02-20 16:12:06 +00:00
} else {
2024-03-19 14:34:47 +00:00
// List of notifications enabled for contacts of the third party
2021-02-20 14:41:57 +00:00
$sql = " SELECT COUNT(n.rowid) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " c_action_trigger as a, " ;
$sql .= " " . MAIN_DB_PREFIX . " notify_def as n, " ;
$sql .= " " . MAIN_DB_PREFIX . " socpeople as c " ;
2024-03-18 21:28:10 +00:00
$sql .= " WHERE a.rowid = n.fk_action " ;
2024-03-19 14:34:47 +00:00
$sql .= " AND c.rowid = n.fk_contact " ;
2025-08-04 11:12:22 +00:00
$sql .= " AND c.fk_soc = " . (( int ) $object -> id );
2021-02-20 14:41:57 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $resql );
2021-02-20 14:41:57 +00:00
$nbNotif = $obj -> nb ;
} else {
dol_print_error ( $db );
}
2021-02-20 19:48:59 +00:00
dol_setcache ( $cachekey , $nbNotif , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
2020-09-07 08:18:17 +00:00
}
2021-02-20 17:21:10 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/notify/card.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notifications " );
2021-02-20 14:41:57 +00:00
if ( $nbNotif > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbNotif . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'notify' ;
$h ++ ;
}
2013-10-23 11:38:18 +00:00
2013-07-20 07:07:10 +00:00
// Notes
2020-09-07 08:18:17 +00:00
$nbNote = 0 ;
2021-02-20 14:52:45 +00:00
if ( ! empty ( $object -> note_private )) {
$nbNote ++ ;
}
if ( ! empty ( $object -> note_public )) {
$nbNote ++ ;
}
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/note.php' , [ 'id' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Notes " );
2021-02-20 14:41:57 +00:00
if ( $nbNote > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'note' ;
$h ++ ;
2021-02-21 08:50:58 +00:00
// Attached files and Links
$totalAttached = 0 ;
// Enable caching of thirdrparty count attached files and links
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_attached_thirdparty_' . $object -> id ;
2021-02-21 08:50:58 +00:00
$dataretrieved = dol_getcache ( $cachekey );
if ( ! is_null ( $dataretrieved )) {
$totalAttached = $dataretrieved ;
} else {
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php' ;
2025-09-07 23:48:52 +00:00
$upload_dir = $conf -> societe -> multidir_output [ $object -> entity ? ? $conf -> entity ] . " / " . $object -> id ;
2021-02-21 08:50:58 +00:00
$nbFiles = count ( dol_dir_list ( $upload_dir , 'files' , 0 , '' , '(\.meta|_preview.*\.png)$' ));
$nbLinks = Link :: count ( $db , $object -> element , $object -> id );
$totalAttached = $nbFiles + $nbLinks ;
dol_setcache ( $cachekey , $totalAttached , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
}
2020-09-07 08:18:17 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/document.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Documents " );
2021-02-21 08:50:58 +00:00
if (( $totalAttached ) > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . ( $totalAttached ) . '</span>' ;
2021-02-20 14:41:57 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'document' ;
$h ++ ;
}
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/messaging.php' , [ 'socid' => $object -> id ]);
2020-12-29 16:48:52 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Events " );
2024-03-07 19:16:48 +00:00
if ( isModEnabled ( 'agenda' ) && ( $user -> hasRight ( 'agenda' , 'myactions' , 'read' ) || $user -> hasRight ( 'agenda' , 'allactions' , 'read' ))) {
2026-04-07 01:25:42 +00:00
dol_syslog ( 'Company::societe_prepare_head::isModEnabled::agenda' , LOG_DEBUG );
2021-02-20 17:21:10 +00:00
$nbEvent = 0 ;
2023-02-20 00:12:15 +00:00
// Enable caching of thirdparty count actioncomm
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php' ;
$cachekey = 'count_events_thirdparty_' . $object -> id ;
2021-02-20 16:12:06 +00:00
$dataretrieved = dol_getcache ( $cachekey );
2021-02-20 17:21:10 +00:00
if ( ! is_null ( $dataretrieved )) {
$nbEvent = $dataretrieved ;
2021-02-20 16:12:06 +00:00
} else {
2021-02-19 22:16:56 +00:00
$sql = " SELECT COUNT(id) as nb " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm " ;
$sql .= " WHERE fk_soc = " . (( int ) $object -> id );
$sql .= " AND entity IN ( " . getEntity ( 'agenda' ) . " ) " ;
2021-02-19 22:16:56 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
$nbEvent = $obj -> nb ;
} else {
2025-08-04 11:12:22 +00:00
dol_syslog ( 'Failed to count actioncomm ' . $db -> lasterror (), LOG_ERR );
2021-02-19 22:16:56 +00:00
}
2021-02-20 19:48:59 +00:00
dol_setcache ( $cachekey , $nbEvent , 120 ); // If setting cache fails, this is not a problem, so we do not test result.
2021-02-17 21:14:21 +00:00
}
2021-02-20 17:21:10 +00:00
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] .= '/' ;
$head [ $h ][ 1 ] .= $langs -> trans ( " Agenda " );
2021-02-17 21:16:07 +00:00
if ( $nbEvent > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>' ;
2021-02-17 21:14:21 +00:00
}
2020-09-07 08:18:17 +00:00
}
$head [ $h ][ 2 ] = 'agenda' ;
$h ++ ;
2022-09-15 14:55:52 +00:00
// 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
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'thirdparty' , 'add' , 'external' );
2011-12-21 17:56:44 +00:00
2020-09-07 08:18:17 +00:00
complete_head_from_modules ( $conf , $langs , $object , $head , $h , 'thirdparty' , 'remove' );
2011-01-24 23:59:37 +00:00
2020-09-07 08:18:17 +00:00
return $head ;
2008-02-25 16:30:43 +00:00
}
2006-04-08 22:47:51 +00:00
2008-02-25 16:30:43 +00:00
2008-08-06 14:50:06 +00:00
/**
2009-03-12 01:44:02 +00:00
* Return array of tabs to used on page
2008-08-06 14:50:06 +00:00
*
2011-09-28 12:13:48 +00:00
* @ param Object $object Object for tabs
2024-10-13 23:59:44 +00:00
* @ return array < array { 0 : string , 1 : string , 2 : string } > Array of tabs to show
2008-08-06 14:50:06 +00:00
*/
2010-12-29 10:08:45 +00:00
function societe_prepare_head2 ( $object )
2008-02-25 16:30:43 +00:00
{
2023-10-09 11:23:22 +00:00
global $langs ;
2020-09-07 08:18:17 +00:00
$h = 0 ;
$head = array ();
2010-08-21 15:30:17 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/card.php' , [ 'socid' => $object -> id ]);
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " ThirdParty " );
$head [ $h ][ 2 ] = 'company' ;
$h ++ ;
2010-08-21 15:30:17 +00:00
2025-08-04 11:12:22 +00:00
$head [ $h ][ 0 ] = 'commerciaux.php?socid=' . $object -> id ;
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " SalesRepresentative " );
$head [ $h ][ 2 ] = 'salesrepresentative' ;
$h ++ ;
2010-08-21 15:30:17 +00:00
2020-09-07 08:18:17 +00:00
return $head ;
2006-05-06 19:06:40 +00:00
}
2008-01-11 10:25:26 +00:00
2011-06-22 16:24:20 +00:00
/**
2024-01-13 18:48:20 +00:00
* Return array head with list of tabs to view object information .
2011-09-28 12:13:48 +00:00
*
2024-10-13 23:59:44 +00:00
* @ return array < array { 0 : string , 1 : string , 2 : string } > Array of tabs to show
2011-06-22 16:24:20 +00:00
*/
2014-12-04 12:20:56 +00:00
function societe_admin_prepare_head ()
2011-06-22 16:24:20 +00:00
{
2026-06-13 23:09:51 +00:00
global $langs , $conf , $extrafields ;
2022-10-13 18:28:16 +00:00
$extrafields -> fetch_name_optionals_label ( 'societe' );
$extrafields -> fetch_name_optionals_label ( 'socpeople' );
2011-06-22 16:24:20 +00:00
2020-09-07 08:18:17 +00:00
$h = 0 ;
$head = array ();
2011-06-22 16:24:20 +00:00
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/admin/societe.php' );
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " Miscellaneous " );
$head [ $h ][ 2 ] = 'general' ;
$h ++ ;
2011-06-22 16:24:20 +00:00
2020-09-07 08:18:17 +00:00
// 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
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'company_admin' );
2011-08-24 12:18:56 +00:00
2026-08-12 03:18:53 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/admin/extrafields.php' , array ( 'elementtype' => 'societe' ));
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " ExtraFieldsThirdParties " );
2022-10-13 18:28:16 +00:00
$nbExtrafields = $extrafields -> attributes [ 'societe' ][ 'count' ];
if ( $nbExtrafields > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>' ;
2022-10-13 18:28:16 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'attributes' ;
$h ++ ;
2011-08-24 12:18:56 +00:00
2026-08-12 03:18:53 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/admin/extrafields.php' , array ( 'elementtype' => 'socpeople' ));
2020-09-07 08:18:17 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " ExtraFieldsContacts " );
2022-10-13 18:28:16 +00:00
$nbExtrafields = $extrafields -> attributes [ 'socpeople' ][ 'count' ];
if ( $nbExtrafields > 0 ) {
2025-08-04 11:12:22 +00:00
$head [ $h ][ 1 ] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>' ;
2022-10-13 18:28:16 +00:00
}
2020-09-07 08:18:17 +00:00
$head [ $h ][ 2 ] = 'attributes_contacts' ;
$h ++ ;
2012-09-14 10:15:55 +00:00
2025-09-23 21:13:42 +00:00
if ( getDolGlobalString ( 'MAIN_FEATURES_LEVEL' ) >= 1 ) {
2026-02-01 18:07:15 +00:00
$head [ $h ][ 0 ] = dolBuildUrl ( DOL_URL_ROOT . '/societe/admin/public_interface.php' );
2025-09-23 21:13:42 +00:00
$head [ $h ][ 1 ] = $langs -> trans ( " PublicUrl " );
$head [ $h ][ 2 ] = 'publicurl' ;
$h ++ ;
}
2020-09-07 08:18:17 +00:00
complete_head_from_modules ( $conf , $langs , null , $head , $h , 'company_admin' , 'remove' );
2011-06-22 16:24:20 +00:00
2020-09-07 08:18:17 +00:00
return $head ;
2011-06-22 16:24:20 +00:00
}
2008-01-11 10:25:26 +00:00
/**
2013-06-27 14:02:52 +00:00
* Return country label , code or id from an id , code or label
2011-08-24 18:05:58 +00:00
*
2024-01-02 20:02:25 +00:00
* @ param int | string $searchkey Id or code of country to search
2024-09-30 08:05:24 +00:00
* @ param '' | '0' | '1' | '2' | '3' | 'all' $withcode '' or '0' = Return label ,
* '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
2025-03-11 00:43:54 +00:00
* @ param int < 0 , 1 > $entconv 0 = Return value without entities and not converted to output charset , 1 = Ready for html output
2024-03-07 20:39:29 +00:00
* @ param string $searchlabel Label of country to search ( warning : searching on label is not reliable )
2024-03-13 20:46:14 +00:00
* @ return int | string | array { id : int , code : string , label : string } Integer with country id or String with country code or translated country name or Array ( 'id' , 'code' , 'label' ) or 'NotDefined'
2008-07-29 19:20:33 +00:00
*/
2024-03-04 19:14:52 +00:00
function getCountry ( $searchkey , $withcode = '' , $dbtouse = null , $outputlangs = null , $entconv = 1 , $searchlabel = '' )
2008-01-11 10:25:26 +00:00
{
2020-09-07 08:18:17 +00:00
global $db , $langs ;
$result = '' ;
// Check parameters
2020-10-27 23:34:59 +00:00
if ( empty ( $searchkey ) && empty ( $searchlabel )) {
2021-02-20 16:12:06 +00:00
if ( $withcode === 'all' ) {
2024-03-15 15:40:04 +00:00
return array ( 'id' => 0 , 'code' => '' , 'label' => '' );
2021-02-20 16:12:06 +00:00
} else {
return '' ;
}
}
if ( ! is_object ( $dbtouse )) {
$dbtouse = $db ;
}
if ( ! is_object ( $outputlangs )) {
$outputlangs = $langs ;
2020-09-07 08:18:17 +00:00
}
2025-08-04 11:12:22 +00:00
$sql = " SELECT rowid, code, label FROM " . MAIN_DB_PREFIX . " c_country " ;
2021-02-20 16:12:06 +00:00
if ( is_numeric ( $searchkey )) {
2025-08-04 11:12:22 +00:00
$sql .= " WHERE rowid = " . (( int ) $searchkey );
2021-02-20 16:12:06 +00:00
} elseif ( ! empty ( $searchkey )) {
2025-08-04 11:12:22 +00:00
$sql .= " WHERE code = ' " . $db -> escape ( $searchkey ) . " ' " ;
2021-02-20 16:12:06 +00:00
} else {
2025-08-04 11:12:22 +00:00
$sql .= " WHERE label = ' " . $db -> escape ( $searchlabel ) . " ' " ;
2021-02-20 16:12:06 +00:00
}
2020-09-07 08:18:17 +00:00
$resql = $dbtouse -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$obj = $dbtouse -> fetch_object ( $resql );
2020-10-27 23:34:59 +00:00
if ( $obj ) {
2020-09-07 08:18:17 +00:00
$label = (( ! empty ( $obj -> label ) && $obj -> label != '-' ) ? $obj -> label : '' );
2020-10-27 23:34:59 +00:00
if ( is_object ( $outputlangs )) {
2020-09-07 08:18:17 +00:00
$outputlangs -> load ( " dict " );
2021-02-23 21:03:23 +00:00
if ( $entconv ) {
2025-08-04 11:12:22 +00:00
$label = ( $obj -> code && ( $outputlangs -> trans ( " Country " . $obj -> code ) != " Country " . $obj -> code )) ? $outputlangs -> trans ( " Country " . $obj -> code ) : $label ;
2021-02-23 21:03:23 +00:00
} else {
2025-08-04 11:12:22 +00:00
$label = ( $obj -> code && ( $outputlangs -> transnoentitiesnoconv ( " Country " . $obj -> code ) != " Country " . $obj -> code )) ? $outputlangs -> transnoentitiesnoconv ( " Country " . $obj -> code ) : $label ;
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
}
2024-09-06 11:44:29 +00:00
if ( $withcode == '1' ) {
2021-02-20 16:12:06 +00:00
$result = $label ? " $obj->code - $label " : " $obj->code " ;
2024-09-06 11:44:29 +00:00
} elseif ( $withcode == '2' ) {
2021-02-20 16:12:06 +00:00
$result = $obj -> code ;
2024-09-06 11:44:29 +00:00
} elseif ( $withcode == '3' ) {
2021-02-20 16:12:06 +00:00
$result = $obj -> rowid ;
} elseif ( $withcode === 'all' ) {
2024-03-07 19:16:48 +00:00
$result = array ( 'id' => $obj -> rowid , 'code' => $obj -> code , 'label' => $label );
2021-02-20 16:12:06 +00:00
} else {
$result = $label ;
}
2020-09-07 08:18:17 +00:00
} else {
$result = 'NotDefined' ;
}
$dbtouse -> free ( $resql );
return $result ;
2021-02-20 14:52:45 +00:00
} else {
dol_print_error ( $dbtouse , '' );
}
2020-09-07 08:18:17 +00:00
return 'Error' ;
2010-06-18 22:54:16 +00:00
}
/**
2013-10-23 11:38:18 +00:00
* Return state translated from an id . Return value is always utf8 encoded and without entities .
2011-08-24 18:05:58 +00:00
*
2017-09-20 11:45:18 +00:00
* @ param int $id id of state ( province / departement )
2024-05-02 17:33:51 +00:00
* @ param '0' | '1' | '2' | 'all' $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 )
* @ param int < 0 , 1 > $withregion '0' = Ignores region ,
2017-09-20 11:45:18 +00:00
* '1' = Add region name / code / id as needed to output ,
2025-03-11 00:43:54 +00:00
* @ param ? Translate $outputlangs Langs object for output translation , not fully implemented yet
2024-05-02 17:33:51 +00:00
* @ param int < 0 , 1 > $entconv 0 = Return value without entities and not converted to output charset , 1 = Ready for html output
* @ return string | array { id : int , code : string , label : string } | array { id : int , code : string , label : string , region_code : string , region : string } String with state code or state name or Array ( 'id' , 'code' , 'label' ) / Array ( 'id' , 'code' , 'label' , 'region_code' , 'region' )
2010-06-18 22:54:16 +00:00
*/
2024-05-02 17:33:51 +00:00
function getState ( $id , $withcode = '0' , $dbtouse = null , $withregion = 0 , $outputlangs = null , $entconv = 1 )
2010-06-18 22:54:16 +00:00
{
2020-09-07 08:18:17 +00:00
global $db , $langs ;
2021-02-20 16:12:06 +00:00
if ( ! is_object ( $dbtouse )) {
$dbtouse = $db ;
}
2020-09-07 08:18:17 +00: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 " ;
2025-08-04 11:12:22 +00: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= " . (( int ) $id );
2020-09-07 08:18:17 +00:00
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1 " ;
$sql .= " ORDER BY c.code, d.code_departement " ;
dol_syslog ( " Company.lib::getState " , LOG_DEBUG );
$resql = $dbtouse -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$obj = $dbtouse -> fetch_object ( $resql );
2020-10-27 23:34:59 +00:00
if ( $obj ) {
2020-09-07 08:18:17 +00:00
$label = (( ! empty ( $obj -> name ) && $obj -> name != '-' ) ? $obj -> name : '' );
2020-10-27 23:34:59 +00:00
if ( is_object ( $outputlangs )) {
2020-09-07 08:18:17 +00:00
$outputlangs -> load ( " dict " );
2021-02-23 21:03:23 +00:00
if ( $entconv ) {
2025-08-04 11:12:22 +00:00
$label = ( $obj -> code && ( $outputlangs -> trans ( " State " . $obj -> code ) != " State " . $obj -> code )) ? $outputlangs -> trans ( " State " . $obj -> code ) : $label ;
2021-02-23 21:03:23 +00:00
} else {
2025-08-04 11:12:22 +00:00
$label = ( $obj -> code && ( $outputlangs -> transnoentitiesnoconv ( " State " . $obj -> code ) != " State " . $obj -> code )) ? $outputlangs -> transnoentitiesnoconv ( " State " . $obj -> code ) : $label ;
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
}
if ( $withcode == 1 ) {
if ( $withregion == 1 ) {
2025-08-04 11:12:22 +00:00
return $label = $obj -> region_name . ' - ' . $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2020-09-07 08:18:17 +00:00
} else {
2025-08-04 11:12:22 +00:00
return $label = $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2020-09-07 08:18:17 +00:00
}
} elseif ( $withcode == 2 ) {
if ( $withregion == 1 ) {
2025-08-04 11:12:22 +00:00
return $label = $obj -> region_name . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2020-09-07 08:18:17 +00:00
} else {
return $label = ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
}
} elseif ( $withcode === 'all' ) {
if ( $withregion == 1 ) {
2024-03-07 19:16:48 +00:00
return array ( 'id' => $obj -> id , 'code' => $obj -> code , 'label' => $label , 'region_code' => $obj -> region_code , 'region' => $obj -> region_name );
2020-09-07 08:18:17 +00:00
} else {
2024-03-07 19:16:48 +00:00
return array ( 'id' => $obj -> id , 'code' => $obj -> code , 'label' => $label );
2020-09-07 08:18:17 +00:00
}
} else {
if ( $withregion == 1 ) {
2025-08-04 11:12:22 +00:00
return $label = $obj -> region_name . ' - ' . $label ;
2020-09-07 08:18:17 +00:00
} else {
return $label ;
}
}
} else {
return $langs -> transnoentitiesnoconv ( " NotDefined " );
}
2021-02-23 21:03:23 +00:00
} else {
dol_print_error ( $dbtouse , '' );
}
2023-01-03 16:34:51 +00:00
return '' ;
2008-01-11 10:25:26 +00:00
}
2009-10-30 11:41:11 +00:00
/**
2017-06-26 08:09:22 +00:00
* Return label of currency or code + label
2011-08-24 18:05:58 +00:00
*
2025-03-11 00:43:54 +00:00
* @ param string $code_iso Code iso of currency
* @ param int < 0 , 1 > $withcode '1' = show code + label
* @ param ? Translate $outputlangs Output language
* @ return string Label translated of currency
2009-10-30 11:41:11 +00:00
*/
2024-02-29 15:59:32 +00:00
function currency_name ( $code_iso , $withcode = 0 , $outputlangs = null )
2009-10-30 11:41:11 +00:00
{
2020-09-07 08:18:17 +00:00
global $langs , $db ;
2021-02-20 16:12:06 +00:00
if ( empty ( $outputlangs )) {
$outputlangs = $langs ;
}
2020-09-07 08:18:17 +00:00
$outputlangs -> load ( " dict " );
2024-01-13 18:48:20 +00:00
// If there is a translation, we can send immediately the label
2025-08-04 11:12:22 +00:00
if ( $outputlangs -> trans ( " Currency " . $code_iso ) != " Currency " . $code_iso ) {
return ( $withcode ? $code_iso . ' - ' : '' ) . $outputlangs -> trans ( " Currency " . $code_iso );
2020-09-07 08:18:17 +00:00
}
// If no translation, we read table to get label by default
2025-08-04 11:12:22 +00:00
$sql = " SELECT label FROM " . MAIN_DB_PREFIX . " c_currencies " ;
$sql .= " WHERE code_iso=' " . $db -> escape ( $code_iso ) . " ' " ;
2020-09-07 08:18:17 +00:00
$resql = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$num = $db -> num_rows ( $resql );
2020-10-27 23:34:59 +00:00
if ( $num ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $resql );
$label = ( $obj -> label != '-' ? $obj -> label : '' );
2021-02-20 16:12:06 +00:00
if ( $withcode ) {
return ( $label == $code_iso ) ? " $code_iso " : " $code_iso - $label " ;
} else {
return $label ;
}
2020-09-07 08:18:17 +00:00
} else {
return $code_iso ;
}
}
return 'ErrorWhenReadingCurrencyLabel' ;
2009-10-30 11:41:11 +00:00
}
2008-01-11 10:25:26 +00:00
2008-01-11 17:16:46 +00:00
/**
2024-05-09 12:55:50 +00:00
* Return the name translated of juridical status .
* This method include a cache .
2011-08-24 18:05:58 +00:00
*
2023-03-19 09:43:27 +00:00
* @ param string $code Code of juridical status
* @ return string Value of the juridical status
2008-01-11 17:16:46 +00:00
*/
function getFormeJuridiqueLabel ( $code )
{
2024-05-09 12:55:50 +00:00
global $conf , $db , $langs ;
2020-09-07 08:18:17 +00:00
2021-02-23 21:03:23 +00:00
if ( ! $code ) {
return '' ;
}
2020-09-07 08:18:17 +00:00
2025-08-04 11:12:22 +00:00
if ( ! empty ( $conf -> cache [ " legalform_ " . $langs -> defaultlang . '_' . $code ])) {
return $conf -> cache [ " legalform_ " . $langs -> defaultlang . '_' . $code ];
2024-05-09 12:55:50 +00:00
}
2025-08-04 11:12:22 +00:00
$sql = " SELECT libelle as label FROM " . MAIN_DB_PREFIX . " c_forme_juridique " ;
$sql .= " WHERE code = ' " . $db -> escape ( $code ) . " ' " ;
2020-09-07 08:18:17 +00:00
dol_syslog ( " Company.lib::getFormeJuridiqueLabel " , LOG_DEBUG );
2023-03-19 09:43:27 +00:00
2020-09-07 08:18:17 +00:00
$resql = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$num = $db -> num_rows ( $resql );
2020-10-27 23:34:59 +00:00
if ( $num ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $resql );
2023-03-19 09:43:27 +00:00
2023-08-05 23:14:36 +00:00
$label = ( $obj -> label != '-' ? $obj -> label : '' );
2023-03-19 09:43:27 +00:00
2025-08-04 11:12:22 +00:00
$conf -> cache [ " legalform_ " . $langs -> defaultlang . '_' . $code ] = $label ;
2024-05-09 12:55:50 +00:00
2023-03-19 09:43:27 +00:00
return $langs -> trans ( $label );
2020-09-07 08:18:17 +00:00
} else {
return $langs -> trans ( " NotDefined " );
}
2023-03-19 09:43:27 +00:00
} else {
2025-08-04 11:12:22 +00:00
return 'Error ' . $db -> lasterror ();
2020-09-07 08:18:17 +00:00
}
2008-01-11 17:16:46 +00:00
}
2018-04-09 12:25:02 +00:00
2017-04-30 01:18:49 +00:00
/**
2018-04-09 12:25:02 +00:00
* Return list of countries that are inside the EEC ( European Economic Community )
2019-12-16 21:30:16 +00:00
* Note : Try to keep this function as a " memory only " function for performance reasons .
2017-06-26 08:09:22 +00:00
*
2025-02-21 17:15:50 +00:00
* @ return string [] Array of country codes in EEC
2018-04-09 12:25:02 +00:00
*/
function getCountriesInEEC ()
{
// List of all country codes that are in europe for european vat rules
2021-10-03 03:49:54 +00:00
// List found on https://ec.europa.eu/taxation_customs/territorial-status-eu-countries-and-certain-territories_en
2021-03-02 14:24:55 +00:00
global $conf , $db ;
$country_code_in_EEC = array ();
2018-04-09 12:25:02 +00:00
2021-06-21 09:23:53 +00:00
if ( ! empty ( $conf -> cache [ 'country_code_in_EEC' ])) {
2021-03-02 15:21:43 +00:00
// Use of cache to reduce number of database requests
$country_code_in_EEC = $conf -> cache [ 'country_code_in_EEC' ];
2021-03-02 14:24:55 +00:00
} else {
2025-08-04 11:12:22 +00:00
$sql = " SELECT cc.code FROM " . MAIN_DB_PREFIX . " c_country as cc " ;
2021-03-02 15:03:14 +00:00
$sql .= " WHERE cc.eec = 1 " ;
2019-06-20 10:32:14 +00:00
2021-03-02 15:03:14 +00:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num ) {
$objp = $db -> fetch_object ( $resql );
$country_code_in_EEC [] = $objp -> code ;
$i ++ ;
}
} else {
dol_print_error ( $db );
}
2021-03-02 15:21:43 +00:00
$conf -> cache [ 'country_code_in_EEC' ] = $country_code_in_EEC ;
2021-03-02 14:24:55 +00:00
}
2018-04-09 12:25:02 +00:00
return $country_code_in_EEC ;
}
/**
* Return if a country of an object is inside the EEC ( European Economic Community )
*
2017-04-30 01:18:49 +00:00
* @ param Object $object Object
* @ return boolean true = country inside EEC , false = country outside EEC
*/
function isInEEC ( $object )
{
2021-02-23 21:03:23 +00:00
if ( empty ( $object -> country_code )) {
return false ;
}
2017-12-15 21:14:28 +00:00
2021-05-03 09:00:41 +00:00
$country_code_in_EEC = getCountriesInEEC (); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
2018-04-09 12:25:02 +00:00
2021-03-02 22:55:41 +00:00
//print "dd".$object->country_code;
2020-09-07 08:18:17 +00:00
return in_array ( $object -> country_code , $country_code_in_EEC );
2017-04-30 01:18:49 +00:00
}
2008-01-11 17:16:46 +00:00
2025-02-14 19:54:03 +00:00
/**
* Return list of countries that are inside the SEPA zone ( Single Euro Payment Area )
* Note : Try to keep this function as a " memory only " function for performance reasons .
*
2025-02-21 17:15:50 +00:00
* @ return string [] Array of country codes in SEPA
2025-02-14 19:54:03 +00:00
*/
function getCountriesInSEPA ()
{
2025-02-14 20:10:42 +00:00
// List of all country codes that are in Europe agreement for bank transferts
2025-02-14 19:54:03 +00:00
// List found on https://www.ecb.europa.eu/paym/integration/retail/sepa/html/index.en.html
global $conf , $db ;
$country_code_in_SEPA = array ();
if ( ! empty ( $conf -> cache [ 'country_code_in_SEPA' ])) {
// Use of cache to reduce number of database requests
$country_code_in_SEPA = $conf -> cache [ 'country_code_in_SEPA' ];
} else {
2025-08-04 11:12:22 +00:00
$sql = " SELECT cc.code FROM " . MAIN_DB_PREFIX . " c_country as cc " ;
2025-02-14 19:54:03 +00:00
$sql .= " WHERE cc.sepa = 1 " ;
$resql = $db -> query ( $sql );
if ( $resql ) {
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num ) {
$objp = $db -> fetch_object ( $resql );
$country_code_in_SEPA [] = $objp -> code ;
$i ++ ;
}
} else {
dol_print_error ( $db );
}
$conf -> cache [ 'country_code_in_SEPA' ] = $country_code_in_SEPA ;
}
return $country_code_in_SEPA ;
}
/**
* Return if a country of an object is inside the SEPA zone ( Single Euro Payment Area )
*
* @ param Object $object Object
* @ return boolean true = ccountry inside SEPA , false = country outside SEPA
*/
function isInSEPA ( $object )
{
if ( empty ( $object -> country_code )) {
return false ;
}
$country_code_in_SEPA = getCountriesInSEPA (); // This make a database call but there is a cache done into $conf->cache['country_code_in_SEPA']
//print "dd".$object->country_code;
return in_array ( $object -> country_code , $country_code_in_SEPA );
}
2010-05-23 10:20:35 +00:00
/**
2011-05-25 13:27:07 +00:00
* Show html area for list of projects
2011-08-24 18:05:58 +00:00
*
2026-01-11 15:17:12 +00:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
* @ param Societe $object Third party object
* @ param string $backtopage Url to go once contact is created
* @ param int < 0 , 1 > $nocreatelink 1 = Hide create project link
* @ param string $morehtmlright More html on right of title
* @ param string $massactionbutton Mass action button
2019-02-13 21:43:12 +00:00
* @ return int
2010-05-23 10:20:35 +00:00
*/
2026-01-11 15:17:12 +00:00
function show_projects ( $conf , $langs , $db , $object , $backtopage = '' , $nocreatelink = 0 , $morehtmlright = '' , $massactionbutton = '' )
2010-05-23 10:20:35 +00:00
{
2026-04-23 15:41:15 +00:00
global $conf , $user , $action , $hookmanager , $form ;
2026-01-11 15:17:12 +00:00
global $massaction , $arrayofselected , $arrayofmassactions ;
2020-09-07 08:18:17 +00:00
$i = - 1 ;
2022-12-09 13:27:43 +00:00
if ( isModEnabled ( 'project' ) && $user -> hasRight ( 'projet' , 'lire' )) {
2020-09-07 08:18:17 +00:00
$langs -> load ( " projects " );
$newcardbutton = '' ;
2025-09-19 21:38:52 +00:00
if ( $user -> hasRight ( 'projet' , 'creer' ) && empty ( $nocreatelink )) {
2025-08-04 11:12:22 +00:00
$newcardbutton .= dolGetButtonTitle ( $langs -> trans ( 'AddProject' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/projet/card.php?socid=' . $object -> id . '&action=create&backtopage=' . urlencode ( $backtopage ));
2020-09-07 08:18:17 +00:00
}
print " \n " ;
2026-03-10 18:27:59 +00:00
print load_fiche_titre ( $langs -> trans ( " ProjectsDedicatedToThisThirdParty " ), $newcardbutton . $morehtmlright , 'project' , 0 , '' , '' , $massactionbutton );
2022-07-12 17:17:44 +00:00
2025-08-04 11:12:22 +00:00
print '<div class="div-table-responsive">' . " \n " ;
2022-07-12 17:17:44 +00:00
print '<table class="noborder centpercent">' ;
2020-09-07 08:18:17 +00:00
2024-02-15 13:08:08 +00: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_modification, p.budget_amount " ;
2020-09-07 08:18:17 +00:00
$sql .= " , cls.code as opp_status_code " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as p " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_lead_status as cls on p.fk_opp_status = cls.rowid " ;
$sql .= " WHERE p.fk_soc = " . (( int ) $object -> id );
$sql .= " AND p.entity IN ( " . getEntity ( 'project' ) . " ) " ;
2020-09-07 08:18:17 +00:00
$sql .= " ORDER BY p.dateo DESC " ;
$result = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $result ) {
2020-09-07 08:18:17 +00:00
$num = $db -> num_rows ( $result );
print '<tr class="liste_titre">' ;
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-11-10 17:49:20 +00:00
print '<td class="center">' ;
2024-09-05 12:25:14 +00:00
$selectedfields = ( is_array ( $arrayofmassactions ) && count ( $arrayofmassactions ) ? $form -> showCheckAddButtons ( 'checkforselect' , 1 ) : '' );
2023-11-10 17:49:20 +00:00
print $selectedfields ;
print '</td>' ;
}
2025-08-04 11:12:22 +00: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>' ;
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-11-10 17:49:20 +00:00
print '<td class="center">' ;
2024-04-12 12:44:54 +00:00
$selectedfields = ( is_array ( $arrayofmassactions ) && count ( $arrayofmassactions ) ? $form -> showCheckAddButtons ( 'checkforselect' , 1 ) : '' );
2023-11-10 17:49:20 +00:00
print $selectedfields ;
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
print '</tr>' ;
2020-10-27 23:34:59 +00:00
if ( $num > 0 ) {
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
2020-09-07 08:18:17 +00:00
$projecttmp = new Project ( $db );
$i = 0 ;
2020-10-27 23:34:59 +00:00
while ( $i < $num ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $result );
$projecttmp -> fetch ( $obj -> id );
// To verify role of users
$userAccess = $projecttmp -> restrictedProjectArea ( $user );
2023-10-15 13:32:35 +00:00
if ( $user -> hasRight ( 'projet' , 'lire' ) && $userAccess > 0 ) {
2020-09-07 08:18:17 +00:00
print '<tr class="oddeven">' ;
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-11-10 17:49:20 +00:00
print '<td class="nowrap center actioncolumn">' ;
if ( $massactionbutton || $massaction ) {
$selected = 0 ;
if ( in_array ( $obj -> id , $arrayofselected )) {
$selected = 1 ;
}
2025-08-04 11:12:22 +00:00
print '<input id="cb' . $obj -> id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj -> id . '"' . ( $selected ? ' checked="checked"' : '' ) . '>' ;
2023-11-10 17:49:20 +00:00
}
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
// Ref
2022-07-12 15:42:20 +00:00
print '<td class="nowraponall">' ;
2025-08-04 11:12:22 +00:00
print $projecttmp -> getNomUrl ( 1 , '' , 0 , '' , '-' , 0 , 1 , '' , 'project:' . $_SERVER [ " PHP_SELF " ] . '?socid=__SOCID__' );
2020-09-07 08:18:17 +00:00
print '</td>' ;
// Label
2026-03-25 00:21:40 +00:00
print '<td title="' . dol_escape_htmltag ( $obj -> title ) . '"><div class="twolinesmax-normallineheight minwidth200onall">' . dol_escape_htmltag ( $obj -> title ) . '</div></td>' ;
2020-09-07 08:18:17 +00:00
// Date start
2025-08-04 11:12:22 +00:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> do ), " day " ) . '</td>' ;
2020-09-07 08:18:17 +00:00
// Date end
2025-08-04 11:12:22 +00:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> de ), " day " ) . '</td>' ;
2020-09-07 08:18:17 +00:00
// Opp amount
print '<td class="right">' ;
2020-10-27 23:34:59 +00:00
if ( $obj -> opp_status_code ) {
2025-08-04 11:12:22 +00:00
print '<span class="amount">' . price ( $obj -> opp_amount , 1 , '' , 1 , - 1 , - 1 , '' ) . '</span>' ;
2020-09-07 08:18:17 +00:00
}
print '</td>' ;
// Opp status
print '<td class="center">' ;
2021-02-23 21:03:23 +00:00
if ( $obj -> opp_status_code ) {
2025-08-04 11:12:22 +00:00
print $langs -> trans ( " OppStatus " . $obj -> opp_status_code );
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
print '</td>' ;
// Opp percent
print '<td class="right">' ;
2021-02-23 21:03:23 +00:00
if ( $obj -> opp_percent ) {
2025-08-04 11:12:22 +00:00
print price ( $obj -> opp_percent , 1 , '' , 1 , 0 ) . '%' ;
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
print '</td>' ;
// Status
2025-08-04 11:12:22 +00:00
print '<td class="right">' . $projecttmp -> getLibStatut ( 5 ) . '</td>' ;
2020-09-07 08:18:17 +00:00
2023-09-22 12:06:11 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-11-10 17:49:20 +00:00
print '<td class="nowrap center actioncolumn">' ;
2023-09-22 12:06:11 +00:00
if ( $massactionbutton || $massaction ) {
$selected = 0 ;
if ( in_array ( $obj -> id , $arrayofselected )) {
$selected = 1 ;
}
2025-08-04 11:12:22 +00:00
print '<input id="cb' . $obj -> id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj -> id . '"' . ( $selected ? ' checked="checked"' : '' ) . '>' ;
2023-09-22 12:06:11 +00:00
}
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
print '</tr>' ;
}
$i ++ ;
}
} else {
2025-08-04 11:12:22 +00:00
print '<tr class="oddeven"><td colspan="9"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2020-09-07 08:18:17 +00:00
}
$db -> free ( $result );
} else {
dol_print_error ( $db );
}
2022-07-12 17:17:44 +00:00
2024-03-14 09:02:23 +00:00
//projects linked to that thirdpart because of a people of that company is linked to a project
if ( getDolGlobalString ( 'PROJECT_DISPLAY_LINKED_BY_CONTACT' )) {
print " \n " ;
print load_fiche_titre ( $langs -> trans ( " ProjectsLinkedToThisThirdParty " ), '' , '' );
2025-08-04 11:12:22 +00:00
print '<div class="div-table-responsive">' . " \n " ;
2024-03-14 09:02:23 +00:00
print '<table class="noborder centpercent">' ;
$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 " ;
$sql .= " , cls.code as opp_status_code " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " projet as p " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_lead_status as cls on p.fk_opp_status = cls.rowid " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " element_contact as ec on p.rowid = ec.element_id " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " socpeople as sc on ec.fk_socpeople = sc.rowid " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_type_contact as tc on ec.fk_c_type_contact = tc.rowid " ;
$sql .= " WHERE sc.fk_soc = " . (( int ) $object -> id );
$sql .= " AND p.entity IN ( " . getEntity ( 'project' ) . " ) " ;
2024-10-13 18:31:23 +00:00
$sql .= " AND tc.element = 'project' AND tc.source = 'external' " ;
2024-03-14 09:02:23 +00:00
$sql .= " ORDER BY p.dateo DESC " ;
$result = $db -> query ( $sql );
if ( $result ) {
$num = $db -> num_rows ( $result );
print '<tr class="liste_titre">' ;
2025-08-04 11:12:22 +00: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>' ;
2024-03-14 09:02:23 +00:00
print '</tr>' ;
if ( $num > 0 ) {
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php' ;
2024-03-14 09:02:23 +00:00
$projecttmp = new Project ( $db );
$i = 0 ;
while ( $i < $num ) {
$obj = $db -> fetch_object ( $result );
$projecttmp -> fetch ( $obj -> id );
// To verify role of users
$userAccess = $projecttmp -> restrictedProjectArea ( $user );
2025-09-19 21:38:52 +00:00
if ( $userAccess > 0 ) {
2024-03-14 09:02:23 +00:00
print '<tr class="oddeven">' ;
// Ref
print '<td class="nowraponall">' ;
2025-08-04 11:12:22 +00:00
print $projecttmp -> getNomUrl ( 1 , '' , 0 , '' , '-' , 0 , 1 , '' , 'project:' . $_SERVER [ " PHP_SELF " ] . '?socid=__SOCID__' );
2024-03-14 09:02:23 +00:00
print '</td>' ;
// Label
2026-03-25 00:21:40 +00:00
print '<td title="' . dol_escape_htmltag ( $obj -> title ) . '"><div class="twolinesmax-normallineheight minwidth200onall">' . dol_escape_htmltag ( $obj -> title ) . '</div></td>' ;
2024-03-14 09:02:23 +00:00
// Date start
2025-08-04 11:12:22 +00:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> do ), " day " ) . '</td>' ;
2024-03-14 09:02:23 +00:00
// Date end
2025-08-04 11:12:22 +00:00
print '<td class="center">' . dol_print_date ( $db -> jdate ( $obj -> de ), " day " ) . '</td>' ;
2024-03-14 09:02:23 +00:00
// Opp amount
print '<td class="right">' ;
if ( $obj -> opp_status_code ) {
2025-08-04 11:12:22 +00:00
print '<span class="amount">' . price ( $obj -> opp_amount , 1 , '' , 1 , - 1 , - 1 , '' ) . '</span>' ;
2024-03-14 09:02:23 +00:00
}
print '</td>' ;
// Opp status
print '<td class="center">' ;
if ( $obj -> opp_status_code ) {
2025-08-04 11:12:22 +00:00
print $langs -> trans ( " OppStatus " . $obj -> opp_status_code );
2024-03-14 09:02:23 +00:00
}
print '</td>' ;
// Opp percent
print '<td class="right">' ;
if ( $obj -> opp_percent ) {
2025-08-04 11:12:22 +00:00
print price ( $obj -> opp_percent , 1 , '' , 1 , 0 ) . '%' ;
2024-03-14 09:02:23 +00:00
}
print '</td>' ;
// Status
2025-08-04 11:12:22 +00:00
print '<td class="right">' . $projecttmp -> getLibStatut ( 5 ) . '</td>' ;
2024-03-14 09:02:23 +00:00
print '</tr>' ;
}
$i ++ ;
}
} else {
2025-08-04 11:12:22 +00:00
print '<tr class="oddeven"><td colspan="8"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2024-03-14 09:02:23 +00:00
}
$db -> free ( $result );
} else {
dol_print_error ( $db );
}
}
2024-03-07 19:16:48 +00:00
$parameters = array ( 'sql' => $sql , 'function' => 'show_projects' );
2022-07-12 17:17:44 +00:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListFooter' , $parameters , $object , $action ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2020-09-07 08:18:17 +00:00
print " </table> " ;
print '</div>' ;
print " <br> \n " ;
}
return $i ;
2010-05-23 10:20:35 +00:00
}
2008-07-27 21:22:44 +00:00
/**
2011-05-25 13:27:07 +00:00
* Show html area for list of contacts
2011-12-21 17:56:44 +00:00
*
2022-07-18 09:51:28 +00:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
* @ param Societe $object Third party object
* @ param string $backtopage Url to go once contact is created
2025-03-11 00:43:54 +00:00
* @ param int < 0 , 1 > $showuserlogin 1 = Show also user login if it exists
2019-02-13 21:43:12 +00:00
* @ return int
2008-07-27 21:22:44 +00:00
*/
2022-07-18 09:51:28 +00:00
function show_contacts ( $conf , $langs , $db , $object , $backtopage = '' , $showuserlogin = 0 )
2008-07-27 21:22:44 +00:00
{
2025-11-18 20:25:02 +00:00
global $user , $extrafields , $hookmanager ;
2018-03-06 12:26:40 +00:00
global $contextpage ;
2010-08-21 15:30:17 +00:00
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php' ;
2019-09-03 15:04:42 +00:00
$formcompany = new FormCompany ( $db );
2020-09-07 08:18:17 +00:00
$form = new Form ( $db );
2013-12-14 19:58:03 +00:00
2020-09-07 08:18:17 +00:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2022-01-13 10:09:37 +00:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2024-03-01 00:52:40 +00:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOSTINT ( 'pageplusone' ) - 1 ) : GETPOSTINT ( " page " );
2019-10-01 09:23:38 +00:00
2024-03-08 16:52:34 +00:00
$search_status = GETPOST ( " search_status " , " intcomma " );
2021-02-23 21:03:23 +00:00
if ( $search_status == '' ) {
$search_status = 1 ; // always display active customer first
}
2019-10-01 09:23:38 +00:00
2024-04-19 11:34:48 +00:00
$search_rowid = GETPOST ( " search_rowid " , " intcomma " );
2020-09-07 08:18:17 +00:00
$search_name = GETPOST ( " search_name " , 'alpha' );
$search_address = GETPOST ( " search_address " , 'alpha' );
$search_poste = GETPOST ( " search_poste " , 'alpha' );
2022-10-17 08:27:57 +00:00
$search_note_private = GETPOST ( 'search_note_private' , 'alphanohtml' );
2019-11-13 18:35:02 +00:00
$search_roles = GETPOST ( " search_roles " , 'array' );
2023-01-17 11:16:03 +00:00
$search_birthday_dtstart = GETPOST ( " search_birthday_dtstart " , 'alpha' );
$search_birthday_dtend = GETPOST ( " search_birthday_dtend " , 'alpha' );
2019-09-25 16:24:36 +00:00
2023-01-17 11:16:03 +00:00
if ( $search_birthday_dtstart != '' || $search_birthday_dtend != '' ) {
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$search_birthday_dtstart = dol_mktime ( 0 , 0 , 0 , GETPOSTINT ( 'search_birthday_dtstartmonth' ), GETPOSTINT ( 'search_birthday_dtstartday' ), GETPOSTINT ( 'search_birthday_dtstartyear' ));
$search_birthday_dtend = dol_mktime ( 23 , 59 , 59 , GETPOSTINT ( 'search_birthday_dtendmonth' ), GETPOSTINT ( 'search_birthday_dtendday' ), GETPOSTINT ( 'search_birthday_dtendyear' ));
2023-01-17 11:16:03 +00:00
}
2020-09-07 08:18:17 +00:00
$socialnetworks = getArrayOfSocialNetworks ();
$searchAddressPhoneDBFields = array (
//Address
't.address' ,
't.zip' ,
't.town' ,
//Phone
't.phone' ,
't.phone_perso' ,
't.phone_mobile' ,
//Fax
't.fax' ,
//E-mail
't.email' ,
);
2021-05-03 18:22:36 +00:00
//Social media
2021-04-30 08:12:24 +00:00
// foreach ($socialnetworks as $key => $value) {
// if ($value['active']) {
// $searchAddressPhoneDBFields['t.'.$key] = "t.socialnetworks->'$.".$key."'";
// }
// }
2020-09-07 08:18:17 +00:00
2021-02-23 21:03:23 +00:00
if ( ! $sortorder ) {
$sortorder = " ASC " ;
}
if ( ! $sortfield ) {
$sortfield = " t.lastname " ;
}
2020-09-07 08:18:17 +00:00
2022-09-25 21:06:42 +00:00
if ( isModEnabled ( 'clicktodial' )) {
2020-09-07 08:18:17 +00:00
$user -> fetch_clicktodial (); // lecture des infos de clicktodial du user
}
$contactstatic = new Contact ( $db );
$extrafields -> fetch_name_optionals_label ( $contactstatic -> table_element );
$contactstatic -> fields = array (
2025-03-11 00:43:54 +00:00
'rowid' => array ( 'type' => 'integer' , 'label' => " TechnicalID " , 'enabled' => ( getDolGlobalString ( 'MAIN_SHOW_TECHNICAL_ID' ) ? '1' : '0' ), 'visible' => ( getDolGlobalString ( 'MAIN_SHOW_TECHNICAL_ID' ) ? 1 : 0 ), 'position' => 1 ),
'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' => 'PostOrFunction' , 'enabled' => '1' , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 2 , 'index' => 1 , 'position' => 20 ),
'address' => array ( 'type' => 'varchar(128)' , 'label' => 'Address' , 'enabled' => '1' , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 3 , 'index' => 1 , 'position' => 30 ),
'note_private' => array ( 'type' => 'html' , 'label' => 'NotePrivate' , 'enabled' => ( string ) (( int ) ! getDolGlobalBool ( 'MAIN_LIST_HIDE_PRIVATE_NOTES' )), 'visible' => 3 , 'position' => 35 ),
'role' => array ( 'type' => 'checkbox' , 'label' => 'Role' , 'enabled' => '1' , 'visible' => 1 , 'notnull' => 1 , 'showoncombobox' => 4 , 'index' => 1 , 'position' => 40 ),
'birthday' => array ( 'type' => 'date' , 'label' => 'Birthday' , 'enabled' => '1' , 'visible' => - 1 , 'notnull' => 0 , 'position' => 45 ),
'statut' => array ( 'type' => 'integer' , 'label' => 'Status' , 'enabled' => '1' , 'visible' => 1 , 'notnull' => 1 , 'default' => '0' , 'index' => 1 , 'position' => 50 , 'arrayofkeyval' => array ( 0 => $contactstatic -> LibStatut ( 0 , 1 ), 1 => $contactstatic -> LibStatut ( 1 , 1 ))),
2020-09-07 08:18:17 +00:00
);
// Definition of fields for list
$arrayfields = array (
2025-03-11 00:43:54 +00:00
't.rowid' => array ( 'label' => " TechnicalID " , 'checked' => ( getDolGlobalString ( 'MAIN_SHOW_TECHNICAL_ID' ) ? '1' : '0' ), 'enabled' => ( getDolGlobalString ( '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 ),
2025-08-04 11:12:22 +00:00
'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 ),
2025-03-11 00:43:54 +00:00
't.note_private' => array ( 'label' => 'NotePrivate' , 'checked' => '0' , 'position' => 35 ),
'sc.role' => array ( 'label' => " ContactByDefaultFor " , 'checked' => '1' , 'position' => 40 ),
't.birthday' => array ( 'label' => " Birthday " , 'checked' => '0' , 'position' => 45 ),
't.statut' => array ( 'label' => " Status " , 'checked' => '1' , 'position' => 50 , 'class' => 'center' ),
'u.user' => array ( 'label' => " DolibarrLogin " , 'checked' => '1' , 'position' => 50 , 'class' => 'center' ),
2020-09-07 08:18:17 +00:00
);
// Extra fields
2025-03-18 13:55:37 +00:00
$extrafieldsobjectkey = $contactstatic -> table_element ;
$extrafieldsobjectprefix = 'ef.' ;
$extrafieldspositionoffset = 1000 ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php' ;
2020-09-07 08:18:17 +00:00
2024-01-13 18:48:20 +00:00
// Initialize array of search criteria
2020-09-07 08:18:17 +00:00
$search = array ();
2020-10-27 23:34:59 +00:00
foreach ( $arrayfields as $key => $val ) {
2025-08-04 11:12:22 +00:00
$queryName = 'search_' . substr ( $key , 2 );
2020-09-07 08:18:17 +00:00
if ( GETPOST ( $queryName , 'alpha' )) {
$search [ substr ( $key , 2 )] = GETPOST ( $queryName , 'alpha' );
}
}
$search_array_options = $extrafields -> getOptionalsFromPost ( $contactstatic -> table_element , '' , 'search_' );
// Purge search criteria
2020-10-27 23:34:59 +00:00
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
2022-09-15 15:25:00 +00:00
$search_rowid = '' ;
2020-09-07 08:18:17 +00:00
$search_status = '' ;
2021-02-20 14:52:45 +00:00
$search_name = '' ;
$search_roles = array ();
2020-09-07 08:18:17 +00:00
$search_address = '' ;
$search_poste = '' ;
2022-10-17 08:27:57 +00:00
$search_note_private = '' ;
2023-01-17 11:16:03 +00:00
$search_birthday_dtstart = '' ;
$search_birthday_dtend = '' ;
2020-09-07 08:18:17 +00:00
$search = array ();
$search_array_options = array ();
2020-10-27 23:34:59 +00:00
foreach ( $contactstatic -> fields as $key => $val ) {
2021-02-23 21:03:23 +00:00
$search [ $key ] = '' ;
}
2020-09-07 08:18:17 +00:00
}
2018-03-06 12:26:40 +00:00
2020-09-07 08:18:17 +00:00
$contactstatic -> fields = dol_sort_array ( $contactstatic -> fields , 'position' );
$arrayfields = dol_sort_array ( $arrayfields , 'position' );
2018-03-06 12:26:40 +00:00
2020-09-07 08:18:17 +00:00
$newcardbutton = '' ;
2025-03-12 19:41:39 +00:00
$parameters = array ( 'socid' => $object -> id );
$reshook = $hookmanager -> executeHooks ( 'printNewCardButton' , $parameters , $object );
if ( empty ( $reshook )) {
if ( $user -> hasRight ( 'societe' , 'contact' , 'creer' )) {
$addcontact = ( getDolGlobalString ( 'SOCIETE_ADDRESSES_MANAGEMENT' ) ? $langs -> trans ( " AddContact " ) : $langs -> trans ( " AddContactAddress " ));
2025-08-04 11:12:22 +00:00
$newcardbutton .= dolGetButtonTitle ( $addcontact , '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/contact/card.php?socid=' . $object -> id . '&action=create&backtopage=' . urlencode ( $backtopage ));
2025-03-12 19:41:39 +00:00
}
} else {
$newcardbutton = $hookmanager -> resPrint ;
2020-09-07 08:18:17 +00:00
}
2011-06-13 13:07:10 +00:00
2020-09-07 08:18:17 +00:00
print " \n " ;
2012-03-19 21:06:28 +00:00
2023-11-27 10:39:32 +00:00
$title = ( getDolGlobalString ( 'SOCIETE_ADDRESSES_MANAGEMENT' ) ? $langs -> trans ( " ContactsForCompany " ) : $langs -> trans ( " ContactsAddressesForCompany " ));
2024-10-24 17:36:10 +00:00
print load_fiche_titre ( $title , $newcardbutton , 'contact' );
2011-06-13 13:07:10 +00:00
2025-08-04 11:12:22 +00:00
print '<form method="POST" id="searchFormList" action="' . $_SERVER [ " PHP_SELF " ] . '" name="formfilter">' ;
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2020-09-07 08:18:17 +00:00
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">' ;
2025-08-04 11:12:22 +00: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 . '">' ;
print '<input type="hidden" name="page" value="' . $page . '">' ;
2017-06-26 08:09:22 +00:00
2023-05-31 12:02:05 +00:00
$arrayofmassactions = array ();
$mode = 'view' ;
2020-09-07 08:18:17 +00:00
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
2026-04-23 15:41:15 +00:00
$htmlofselectarray = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage , $conf -> main_checkbox_left_column ); // This also change content of $arrayfields with user setup
2024-04-30 07:45:28 +00:00
$selectedfields = ( $mode != 'kanban' ? $htmlofselectarray : '' );
2023-05-31 12:02:05 +00:00
$selectedfields .= ( count ( $arrayofmassactions ) ? $form -> showCheckAddButtons ( 'checkforselect' , 1 ) : '' );
2017-09-15 22:49:46 +00:00
2024-01-13 18:48:20 +00:00
print '<div class="div-table-responsive">' ; // You can use div-table-responsive-no-min if you don't need reserved height for your table
2025-08-04 11:12:22 +00:00
print " \n " . '<table class="tagtable liste noborder">' . " \n " ;
2020-09-07 08:18:17 +00:00
2025-08-04 11:12:22 +00:00
$param = " socid= " . urlencode (( string ) ( $object -> id ));
2022-09-15 15:25:00 +00:00
if ( $search_rowid != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_rowid=' . urlencode (( string ) ( $search_rowid ));
2022-09-15 15:25:00 +00:00
}
2021-02-23 21:03:23 +00:00
if ( $search_status != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_status=' . urlencode (( string ) ( $search_status ));
2021-02-23 21:03:23 +00:00
}
if ( count ( $search_roles ) > 0 ) {
$param .= implode ( '&search_roles[]=' , $search_roles );
}
if ( $search_name != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_name=' . urlencode ( $search_name );
2021-02-23 21:03:23 +00:00
}
if ( $search_poste != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_poste=' . urlencode ( $search_poste );
2021-02-23 21:03:23 +00:00
}
if ( $search_address != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_address=' . urlencode ( $search_address );
2021-02-23 21:03:23 +00:00
}
2022-10-17 08:27:57 +00:00
if ( $search_note_private != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_note_private=' . urlencode ( $search_note_private );
2022-10-17 08:27:57 +00:00
}
2023-02-21 15:14:14 +00:00
if ( $search_birthday_dtstart != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_birthday_dtstart=' . urlencode (( string ) $search_birthday_dtstart );
2023-02-21 15:14:14 +00:00
}
if ( $search_birthday_dtend != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&search_birthday_dtend=' . urlencode (( string ) $search_birthday_dtend );
2023-01-17 11:16:03 +00:00
}
2021-02-23 21:03:23 +00:00
if ( $optioncss != '' ) {
2025-08-04 11:12:22 +00:00
$param .= '&optioncss=' . urlencode ( $optioncss );
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
// Add $param from extra fields
$extrafieldsobjectkey = $contactstatic -> table_element ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php' ;
2020-09-07 08:18:17 +00:00
2023-02-06 18:28:11 +00:00
$sql = " SELECT t.rowid, t.entity, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, " ;
$sql .= " t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.socialnetworks, t.statut, t.photo, t.fk_soc, " ;
$sql .= " t.civility as civility_id, t.address, t.zip, t.town, t.birthday, " ;
$sql .= " t.note_private " ;
2025-08-04 11:12:22 +00:00
$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 = " . (( int ) $object -> id );
$sql .= " AND t.entity IN ( " . getEntity ( 'socpeople' ) . " ) " ;
$sql .= " AND ((t.fk_user_creat = " . (( int ) $user -> id ) . " AND t.priv = 1) OR t.priv = 0) " ;
2022-09-15 15:25:00 +00:00
if ( $search_rowid ) {
2022-09-15 15:43:33 +00:00
$sql .= natural_search ( 't.rowid' , $search_rowid );
2022-09-15 15:25:00 +00:00
}
2021-02-23 21:03:23 +00:00
if ( $search_status != '' && $search_status != '-1' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND t.statut = " . (( int ) $search_status );
2021-02-23 21:03:23 +00:00
}
if ( $search_name ) {
$sql .= natural_search ( array ( 't.lastname' , 't.firstname' ), $search_name );
}
if ( $search_poste ) {
$sql .= natural_search ( 't.poste' , $search_poste );
}
2020-09-07 08:18:17 +00:00
if ( $search_address ) {
2019-10-07 22:07:27 +00:00
$sql .= natural_search ( $searchAddressPhoneDBFields , $search_address );
}
2022-10-17 08:27:57 +00:00
if ( $search_note_private ) {
$sql .= natural_search ( 't.note_private' , $search_note_private );
}
2023-01-17 11:16:03 +00:00
if ( $search_birthday_dtstart != '' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND t.birthday >= ' " . $db -> idate ( $search_birthday_dtstart ) . " ' " ;
2023-01-17 11:16:03 +00:00
}
if ( $search_birthday_dtend != '' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND t.birthday <= ' " . $db -> idate ( $search_birthday_dtend ) . " ' " ;
2023-01-17 11:16:03 +00:00
}
2019-11-13 18:35:02 +00:00
if ( count ( $search_roles ) > 0 ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND t.rowid IN (SELECT sc.fk_socpeople FROM " . MAIN_DB_PREFIX . " societe_contacts as sc WHERE sc.fk_c_type_contact IN ( " . $db -> sanitize ( implode ( ',' , $search_roles )) . " )) " ;
2019-09-02 12:47:32 +00:00
}
2020-09-07 08:18:17 +00:00
// Add where from extra fields
$extrafieldsobjectkey = $contactstatic -> table_element ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php' ;
2022-03-22 09:46:26 +00:00
// Add where from hooks
$parameters = array ( 'socid' => $object -> id );
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters , $object ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2021-02-23 21:03:23 +00:00
if ( $sortfield == " t.name " ) {
$sql .= " ORDER BY t.lastname $sortorder , t.firstname $sortorder " ;
} else {
$sql .= " ORDER BY $sortfield $sortorder " ;
}
2020-09-07 08:18:17 +00:00
dol_syslog ( 'core/lib/company.lib.php :: show_contacts' , LOG_DEBUG );
$result = $db -> query ( $sql );
2021-02-23 21:03:23 +00:00
if ( ! $result ) {
dol_print_error ( $db );
}
2020-09-07 08:18:17 +00:00
$num = $db -> num_rows ( $result );
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre">' ;
2023-05-31 12:02:05 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2024-12-18 08:19:48 +00:00
print '<td class="liste_titre right">' ;
2023-05-31 12:02:05 +00:00
print $form -> showFilterButtons ();
print '</td>' ;
}
2020-10-27 23:34:59 +00:00
foreach ( $contactstatic -> fields as $key => $val ) {
2020-09-07 08:18:17 +00:00
$align = '' ;
2021-02-23 21:03:23 +00:00
if ( in_array ( $val [ 'type' ], array ( 'date' , 'datetime' , 'timestamp' ))) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'center' ;
2021-02-23 21:03:23 +00:00
}
if ( in_array ( $val [ 'type' ], array ( 'timestamp' ))) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'nowrap' ;
2021-02-23 21:03:23 +00:00
}
if ( $key == 'status' || $key == 'statut' ) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'center' ;
2021-02-23 21:03:23 +00:00
}
2025-08-04 11:12:22 +00:00
if ( ! empty ( $arrayfields [ 't.' . $key ][ 'checked' ]) || ! empty ( $arrayfields [ 'sc.' . $key ][ 'checked' ])) {
print '<td class="liste_titre' . ( $align ? ' ' . $align : '' ) . '">' ;
2020-09-07 08:18:17 +00:00
if ( in_array ( $key , array ( 'statut' ))) {
2024-03-07 19:16:48 +00:00
print $form -> selectarray ( 'search_status' , array ( '-1' => '' , '0' => $contactstatic -> LibStatut ( 0 , 1 ), '1' => $contactstatic -> LibStatut ( 1 , 1 )), $search_status , 0 , 0 , 0 , '' , 0 , 0 , 0 , '' , 'onrightofpage' );
2020-09-07 08:18:17 +00:00
} elseif ( in_array ( $key , array ( 'role' ))) {
2022-07-18 09:51:28 +00:00
print $formcompany -> showRoles ( " search_roles " , $contactstatic , 'edit' , $search_roles , 'minwidth200 maxwidth300' );
2023-01-17 11:16:03 +00:00
} elseif ( in_array ( $key , array ( 'birthday' ))) {
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_birthday_dtstart ? $search_birthday_dtstart : '' , " search_birthday_dtstart " , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'From' ));
print '</div>' ;
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_birthday_dtend ? $search_birthday_dtend : '' , " search_birthday_dtend " , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'to' ));
print '</div>' ;
2020-09-07 08:18:17 +00:00
} else {
2025-08-04 11:12:22 +00:00
print '<input type="text" class="flat maxwidth75" name="search_' . $key . '" value="' . ( ! empty ( $search [ $key ]) ? dol_escape_htmltag ( $search [ $key ]) : '' ) . '">' ;
2020-09-07 08:18:17 +00:00
}
print '</td>' ;
}
}
2022-07-18 09:51:28 +00:00
if ( $showuserlogin ) {
2022-09-15 15:48:17 +00:00
print '<td class="liste_titre"></td>' ;
2022-07-18 09:51:28 +00:00
}
2020-09-07 08:18:17 +00:00
// Extra fields
$extrafieldsobjectkey = $contactstatic -> table_element ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php' ;
2020-09-07 08:18:17 +00:00
// Fields from hook
2024-03-07 19:16:48 +00:00
$parameters = array ( 'arrayfields' => $arrayfields );
2020-09-07 08:18:17 +00:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListOption' , $parameters , $contactstatic ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2024-12-18 08:19:48 +00:00
print '<td class="liste_titre right">' ;
2023-05-31 12:02:05 +00:00
print $form -> showFilterButtons ();
print '</td>' ;
}
2025-08-04 11:12:22 +00:00
print '</tr>' . " \n " ;
2020-09-07 08:18:17 +00:00
// Fields title label
// --------------------------------------------------------------------
print '<tr class="liste_titre">' ;
2023-05-31 12:02:05 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2025-08-04 11:12:22 +00:00
print getTitleFieldOfList ( $selectedfields , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , $sortfield , $sortorder , 'maxwidthsearch center ' ) . " \n " ;
2023-05-31 12:02:05 +00:00
}
2020-10-27 23:34:59 +00:00
foreach ( $contactstatic -> fields as $key => $val ) {
2020-09-07 08:18:17 +00:00
$align = '' ;
2021-02-23 21:03:23 +00:00
if ( in_array ( $val [ 'type' ], array ( 'date' , 'datetime' , 'timestamp' ))) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'center' ;
2021-02-23 21:03:23 +00:00
}
if ( in_array ( $val [ 'type' ], array ( 'timestamp' ))) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'nowrap' ;
2021-02-23 21:03:23 +00:00
}
if ( $key == 'status' || $key == 'statut' ) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'center' ;
2021-02-23 21:03:23 +00:00
}
2025-08-04 11:12:22 +00:00
if ( ! empty ( $arrayfields [ 't.' . $key ][ 'checked' ])) {
print getTitleFieldOfList ( $val [ 'label' ], 0 , $_SERVER [ 'PHP_SELF' ], 't.' . $key , '' , $param , ( $align ? 'class="' . $align . '"' : '' ), $sortfield , $sortorder , $align . ' ' ) . " \n " ;
2021-02-23 21:03:23 +00:00
}
if ( $key == 'role' ) {
2025-08-04 11:12:22 +00:00
$align .= ( $align ? ' ' : '' ) . 'left' ;
2021-02-23 21:03:23 +00:00
}
2025-08-04 11:12:22 +00:00
if ( ! empty ( $arrayfields [ 'sc.' . $key ][ 'checked' ])) {
print getTitleFieldOfList ( $arrayfields [ 'sc.' . $key ][ 'label' ], 0 , $_SERVER [ 'PHP_SELF' ], '' , '' , $param , ( $align ? 'class="' . $align . '"' : '' ), $sortfield , $sortorder , $align . ' ' ) . " \n " ;
2020-09-07 08:18:17 +00:00
}
}
2022-07-18 09:51:28 +00:00
if ( $showuserlogin ) {
2025-08-04 11:12:22 +00:00
print '<th class="wrapcolumntitle liste_titre">' . $langs -> trans ( " DolibarrLogin " ) . '</th>' ;
2022-07-18 09:51:28 +00:00
}
2020-09-07 08:18:17 +00:00
// Extra fields
$extrafieldsobjectkey = $contactstatic -> table_element ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php' ;
2020-09-07 08:18:17 +00:00
// Hook fields
2024-03-07 19:16:48 +00:00
$parameters = array ( 'arrayfields' => $arrayfields , 'param' => $param , 'sortfield' => $sortfield , 'sortorder' => $sortorder );
2020-09-07 08:18:17 +00:00
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters , $object ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2023-05-31 12:02:05 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2025-08-04 11:12:22 +00:00
print getTitleFieldOfList ( $selectedfields , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , '' , '' , $sortfield , $sortorder , 'maxwidthsearch center ' ) . " \n " ;
2023-05-31 12:02:05 +00:00
}
2025-08-04 11:12:22 +00:00
print '</tr>' . " \n " ;
2018-03-06 12:26:40 +00:00
2020-09-07 08:18:17 +00:00
$i = - 1 ;
2017-06-26 08:09:22 +00:00
2020-10-27 23:34:59 +00:00
if ( $num || ( GETPOST ( 'button_search' ) || GETPOST ( 'button_search.x' ) || GETPOST ( 'button_search_x' ))) {
2020-09-07 08:18:17 +00:00
$i = 0 ;
2020-10-27 23:34:59 +00:00
while ( $i < $num ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $result );
$contactstatic -> id = $obj -> rowid ;
2021-03-17 21:16:54 +00:00
$contactstatic -> ref = $obj -> rowid ;
2025-08-15 15:31:44 +00:00
$contactstatic -> status = $obj -> statut ;
2020-09-07 08:18:17 +00:00
$contactstatic -> statut = $obj -> statut ;
$contactstatic -> lastname = $obj -> lastname ;
$contactstatic -> firstname = $obj -> firstname ;
$contactstatic -> civility_id = $obj -> civility_id ;
$contactstatic -> civility_code = $obj -> civility_id ;
$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 ;
$contactstatic -> socialnetworks = $obj -> socialnetworks ;
$contactstatic -> photo = $obj -> photo ;
2023-02-06 15:35:53 +00:00
$contactstatic -> fk_soc = $obj -> fk_soc ;
2022-12-02 10:00:52 +00:00
$contactstatic -> entity = $obj -> entity ;
2020-09-07 08:18:17 +00:00
2024-09-06 11:44:29 +00:00
$country_code = getCountry ( $obj -> country_id , '2' );
2020-09-07 08:18:17 +00:00
$contactstatic -> country_code = $country_code ;
$contactstatic -> setGenderFromCivility ();
$contactstatic -> fetch_optionals ();
$resultRole = $contactstatic -> fetchRoles ();
if ( $resultRole < 0 ) {
setEventMessages ( null , $contactstatic -> errors , 'errors' );
}
2020-10-27 23:34:59 +00:00
if ( is_array ( $contactstatic -> array_options )) {
foreach ( $contactstatic -> array_options as $key => $val ) {
2020-09-07 08:18:17 +00:00
$obj -> $key = $val ;
}
}
print '<tr class="oddeven">' ;
2023-05-31 12:02:05 +00:00
// Actions
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-05-31 12:02:05 +00:00
print '<td class="nowrap center">' ;
// Add to agenda
2024-03-07 19:16:48 +00:00
if ( isModEnabled ( 'agenda' ) && $user -> hasRight ( 'agenda' , 'myactions' , 'create' )) {
2025-08-04 11:12:22 +00:00
print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&actioncode=&contactid=' . $obj -> rowid . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2023-05-31 12:02:05 +00:00
print img_object ( $langs -> trans ( " Event " ), " action " );
print '</a> ' ;
}
// Edit
if ( $user -> hasRight ( 'societe' , 'contact' , 'creer' )) {
2025-08-04 11:12:22 +00:00
print '<a class="editfielda paddingleft" href="' . DOL_URL_ROOT . '/contact/card.php?action=edit&token=' . newToken () . '&id=' . $obj -> rowid . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2023-05-31 12:02:05 +00:00
print img_edit ();
print '</a>' ;
}
2024-03-14 10:58:23 +00:00
// Delete
if ( $user -> hasRight ( 'societe' , 'contact' , 'delete' )) {
2025-08-04 11:12:22 +00:00
print '<a class="marginleftonly right" href="' . DOL_URL_ROOT . '/societe/contact.php?action=delete&token=' . newToken () . '&id=' . $obj -> rowid . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2024-03-14 10:58:23 +00:00
print img_delete ();
print '</a>' ;
}
2023-05-31 12:02:05 +00:00
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
// ID
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 't.rowid' ][ 'checked' ])) {
2020-09-07 08:18:17 +00:00
print '<td>' ;
print $contactstatic -> id ;
print '</td>' ;
}
2018-03-06 12:26:40 +00:00
2017-03-24 16:32:38 +00:00
// Photo - Name
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 't.name' ][ 'checked' ])) {
2023-04-18 14:40:38 +00:00
print '<td class="tdoverflowmax150">' ;
2025-07-01 14:22:21 +00:00
print $form -> showphoto ( 'contact' , $contactstatic , 0 , 0 , 0 , 'photorefnoborder valignmiddle marginrightonly' , 'small' , 1 , 0 , 'user' );
2025-08-04 11:12:22 +00:00
print $contactstatic -> getNomUrl ( 0 , '' , 0 , '&backtopage=' . urlencode ( $backtopage ));
2018-03-06 12:26:40 +00:00
print '</td>' ;
2020-09-07 08:18:17 +00:00
}
2017-06-26 08:09:22 +00:00
2016-08-05 22:04:24 +00:00
// Job position
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 't.poste' ][ 'checked' ])) {
2025-08-04 11:12:22 +00:00
print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag ( $obj -> poste ) . '">' ;
2021-02-23 21:03:23 +00:00
if ( $obj -> poste ) {
2023-04-18 14:40:38 +00:00
print dol_escape_htmltag ( $obj -> poste );
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
print '</td>' ;
}
// Address - Phone - Email
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 't.address' ][ 'checked' ])) {
2023-04-18 14:40:38 +00:00
$addresstoshow = $contactstatic -> getBannerAddress ( 'contact' , $object );
2025-09-22 18:28:04 +00:00
print '<td class="tdoverflowmax150 classfortooltip" title="' . dolPrintHTMLForAttribute ( $addresstoshow ) . '">' ;
2023-04-18 14:40:38 +00:00
print $addresstoshow ;
2020-09-07 08:18:17 +00:00
print '</td>' ;
}
2022-10-17 08:27:57 +00:00
// Note private
if ( ! empty ( $arrayfields [ 't.note_private' ][ 'checked' ])) {
2024-05-15 16:21:50 +00:00
print '<td class="center">' ;
print dolPrintHTML ( $obj -> note_private );
2022-10-17 08:27:57 +00:00
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
// Role
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 'sc.role' ][ 'checked' ])) {
2024-04-24 19:18:36 +00:00
print '<td class="tdoverflowmax150">' ;
2020-09-07 08:18:17 +00:00
print $formcompany -> showRoles ( " roles " , $contactstatic , 'view' );
print '</td>' ;
}
2023-01-17 11:16:03 +00:00
// Birthday
if ( ! empty ( $arrayfields [ 't.birthday' ][ 'checked' ])) {
2023-04-18 14:40:38 +00:00
print '<td class="nowraponall">' ;
2023-04-03 14:03:51 +00:00
print dol_print_date ( $db -> jdate ( $obj -> birthday ));
2023-01-17 11:16:03 +00:00
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
// Status
2020-10-27 23:34:59 +00:00
if ( ! empty ( $arrayfields [ 't.statut' ][ 'checked' ])) {
2025-08-04 11:12:22 +00:00
print '<td class="center">' . $contactstatic -> getLibStatut ( 5 ) . '</td>' ;
2020-09-07 08:18:17 +00:00
}
2022-07-18 09:51:28 +00:00
if ( $showuserlogin ) {
2023-04-18 14:40:38 +00:00
print '<td class="tdoverflowmax125">' ;
2024-03-07 19:16:48 +00:00
$tmpuser = new User ( $db );
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
2022-07-18 09:51:28 +00:00
$resfetch = $tmpuser -> fetch ( 0 , '' , '' , 0 , - 1 , '' , $contactstatic -> id );
if ( $resfetch > 0 ) {
2024-05-08 14:01:00 +00:00
print $tmpuser -> getNomUrl ( - 1 , '' , 0 , 0 , 24 , 1 );
2022-07-18 09:51:28 +00:00
}
print '</td>' ;
}
2020-09-07 08:18:17 +00:00
// Extra fields
$extrafieldsobjectkey = $contactstatic -> table_element ;
2025-08-04 11:12:22 +00:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php' ;
2020-09-07 08:18:17 +00:00
// Actions
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-05-31 12:02:05 +00:00
print '<td class="nowrap center">' ;
// Add to agenda
2024-03-07 19:16:48 +00:00
if ( isModEnabled ( 'agenda' ) && $user -> hasRight ( 'agenda' , 'myactions' , 'create' )) {
2025-08-04 11:12:22 +00:00
print '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&actioncode=&contactid=' . $obj -> rowid . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2023-05-31 12:02:05 +00:00
print img_object ( $langs -> trans ( " Event " ), " action " );
print '</a> ' ;
}
2018-03-06 12:26:40 +00:00
2023-05-31 12:02:05 +00:00
// Edit
if ( $user -> hasRight ( 'societe' , 'contact' , 'creer' )) {
2025-08-04 11:12:22 +00:00
print '<a class="editfielda paddingleft" href="' . DOL_URL_ROOT . '/contact/card.php?action=edit&token=' . newToken () . '&id=' . $obj -> rowid . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2023-05-31 12:02:05 +00:00
print img_edit ();
print '</a>' ;
}
2020-09-07 08:18:17 +00:00
2024-03-14 10:58:23 +00:00
// Delete
if ( $user -> hasRight ( 'societe' , 'contact' , 'delete' )) {
2025-08-04 11:12:22 +00:00
print '<a class="marginleftonly right" href="' . DOL_URL_ROOT . '/societe/contact.php?action=delete&token=' . newToken () . '&id=' . $obj -> rowid . '&socid=' . $object -> id . '&backtopage=' . urlencode ( $backtopage ) . '">' ;
2024-03-14 10:58:23 +00:00
print img_delete ();
print '</a>' ;
}
2023-05-31 12:02:05 +00:00
print '</td>' ;
2020-09-07 08:18:17 +00:00
}
print " </tr> \n " ;
$i ++ ;
}
2023-02-20 00:32:45 +00:00
if ( $num == 0 ) {
$colspan = 1 + ( $showuserlogin ? 1 : 0 );
foreach ( $arrayfields as $key => $val ) {
if ( ! empty ( $val [ 'checked' ])) {
$colspan ++ ;
}
}
2025-08-04 11:12:22 +00:00
print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs -> trans ( " NoRecordFound " ) . '</span></td></tr>' ;
2023-02-20 00:32:45 +00:00
}
2020-09-07 08:18:17 +00:00
} else {
2023-02-20 00:32:45 +00:00
$colspan = 1 + ( $showuserlogin ? 1 : 0 );
2021-02-23 21:03:23 +00:00
foreach ( $arrayfields as $key => $val ) {
if ( ! empty ( $val [ 'checked' ])) {
$colspan ++ ;
}
}
2025-08-04 11:12:22 +00:00
print '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs -> trans ( " None " ) . '</span></td></tr>' ;
2020-09-07 08:18:17 +00:00
}
print " \n </table> \n " ;
2017-09-15 22:49:46 +00:00
print '</div>' ;
2010-08-21 15:30:17 +00:00
2025-08-04 11:12:22 +00:00
print '</form>' . " \n " ;
2014-01-05 14:46:39 +00:00
2020-09-07 08:18:17 +00:00
return $i ;
2008-07-27 21:22:44 +00:00
}
2008-01-11 10:25:26 +00:00
/**
2011-04-10 21:30:11 +00:00
* Show html area with actions to do
2012-02-04 13:39:47 +00:00
*
2024-02-29 15:59:32 +00:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Object db
* @ param Adherent | Societe $filterobj Object thirdparty or member
2025-03-11 00:43:54 +00:00
* @ param ? Contact $objcon Object contact
* @ param int < 0 , 1 > $noprint Return string but does not output it
2024-02-29 15:59:32 +00:00
* @ param string | string [] $actioncode Filter on actioncode
2024-08-01 10:59:45 +00:00
* @ return ? string Return html part or null if noprint is 1
2008-07-29 19:20:33 +00:00
*/
2024-03-04 19:14:52 +00:00
function show_actions_todo ( $conf , $langs , $db , $filterobj , $objcon = null , $noprint = 0 , $actioncode = '' )
2008-01-08 08:30:05 +00:00
{
2020-09-07 08:18:17 +00:00
$out = show_actions_done ( $conf , $langs , $db , $filterobj , $objcon , 1 , $actioncode , 'todo' );
2011-04-11 07:35:15 +00:00
2021-02-23 21:03:23 +00:00
if ( $noprint ) {
return $out ;
} else {
print $out ;
2024-08-01 10:59:45 +00:00
return null ;
2021-02-23 21:03:23 +00:00
}
2008-01-08 08:30:05 +00:00
}
2008-01-11 10:25:26 +00:00
/**
2019-06-12 17:32:29 +00:00
* Show html area with actions ( done or not , ignore the name of function ) .
* Note : Global parameter $param must be defined .
2011-12-21 17:56:44 +00:00
*
2024-09-29 19:52:31 +00:00
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Object db
* @ param ? CommonObject $filterobj Filter on object Adherent | Societe | Project | Product | CommandeFournisseur | Dolresource | Ticket ... to list events linked to an object
* @ param ? Contact $objcon Filter on object contact to filter events on a contact
* @ param int < 0 , 1 > $noprint Return string but does not output it
* @ param string | string [] $actioncode Filter on actioncode
* @ param 'done' | 'todo' | '' $donetodo Filter on event 'done' or 'todo' or '' = nofilter ( all ) .
2024-11-04 11:32:13 +00:00
* @ param array < string , string | string [] > $filters Filter on other fields
2024-09-29 19:52:31 +00:00
* @ param string $sortfield Sort field
* @ param string $sortorder Sort order
* @ param string $module You can add module name here if elementtype in table llx_actioncomm is objectkey @ module
* @ return ? string Return html part or void if noprint is 1
2008-07-29 19:20:33 +00:00
*/
2024-03-04 19:14:52 +00:00
function show_actions_done ( $conf , $langs , $db , $filterobj , $objcon = null , $noprint = 0 , $actioncode = '' , $donetodo = 'done' , $filters = array (), $sortfield = 'a.datep,a.id' , $sortorder = 'DESC' , $module = '' )
2008-01-08 08:30:05 +00:00
{
2026-02-12 00:22:01 +00:00
global $hookmanager , $user ;
2020-09-07 08:18:17 +00:00
global $form ;
2026-02-07 20:55:20 +00:00
2020-09-07 08:18:17 +00:00
global $param , $massactionbutton ;
2020-12-29 16:48:52 +00:00
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
$start_year = GETPOSTINT ( 'dateevent_startyear' );
$start_month = GETPOSTINT ( 'dateevent_startmonth' );
$start_day = GETPOSTINT ( 'dateevent_startday' );
$end_year = GETPOSTINT ( 'dateevent_endyear' );
$end_month = GETPOSTINT ( 'dateevent_endmonth' );
$end_day = GETPOSTINT ( 'dateevent_endday' );
2020-12-29 16:48:52 +00:00
$tms_start = '' ;
$tms_end = '' ;
2020-09-07 08:18:17 +00:00
if ( ! empty ( $start_year ) && ! empty ( $start_month ) && ! empty ( $start_day )) {
2021-02-07 18:44:22 +00:00
$tms_start = dol_mktime ( 0 , 0 , 0 , $start_month , $start_day , $start_year , 'tzuserrel' );
2020-09-07 08:18:17 +00:00
}
if ( ! empty ( $end_year ) && ! empty ( $end_month ) && ! empty ( $end_day )) {
2021-02-07 18:44:22 +00:00
$tms_end = dol_mktime ( 23 , 59 , 59 , $end_month , $end_day , $end_year , 'tzuserrel' );
2020-09-07 08:18:17 +00:00
}
2020-10-27 23:34:59 +00:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) { // All test are required to be compatible with all browsers
2020-09-07 08:18:17 +00:00
$tms_start = '' ;
$tms_end = '' ;
}
2024-03-13 17:20:41 +00:00
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php' ;
2020-09-07 08:18:17 +00:00
// Check parameters
2021-02-23 21:03:23 +00:00
if ( ! is_object ( $filterobj ) && ! is_object ( $objcon )) {
2024-01-20 08:22:38 +00:00
dol_print_error ( null , 'BadParameter' );
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
$out = '' ;
$histo = array ();
$numaction = 0 ;
$now = dol_now ( 'tzuser' );
// Open DSI -- Fix order by -- Begin
$sortfield_list = explode ( ',' , $sortfield );
$sortfield_label_list = array ( 'a.id' => 'id' , 'a.datep' => 'dp' , 'a.percent' => 'percent' );
$sortfield_new_list = array ();
foreach ( $sortfield_list as $sortfield_value ) {
$sortfield_new_list [] = $sortfield_label_list [ trim ( $sortfield_value )];
}
$sortfield_new = implode ( ',' , $sortfield_new_list );
2026-04-13 10:50:23 +00:00
$complete = ( string ) ( ! empty ( $filters [ 'search_complete' ]) ? $filters [ 'search_complete' ] : '' ); // Can be 'na', '0', '50', '100'
2025-11-18 20:25:02 +00:00
$percent = $complete !== '' ? $complete : - 1 ;
if (( string ) $complete == '0' ) {
$percent = '0' ;
} elseif (( int ) $complete == 100 ) {
$percent = '100' ;
}
2020-09-07 08:18:17 +00:00
$sql = '' ;
2022-06-09 20:16:48 +00:00
if ( isModEnabled ( 'agenda' )) {
2024-06-30 19:02:50 +00:00
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
2022-11-04 16:46:32 +00:00
$hookmanager -> initHooks ( array ( 'agendadao' ));
2024-08-13 02:12:09 +00:00
$sql = " SELECT a.id, a.label as label, " ;
2020-09-07 08:18:17 +00:00
$sql .= " a.datep as dp, " ;
$sql .= " a.datep2 as dp2, " ;
$sql .= " a.percent as percent, 'action' as type, " ;
$sql .= " a.fk_element, a.elementtype, " ;
$sql .= " a.fk_contact, " ;
2026-03-04 01:20:56 +00:00
$sql .= " a.code, a.fulldayevent, " ;
2020-09-07 08:18:17 +00:00
$sql .= " c.code as acode, c.libelle as alabel, c.picto as apicto, " ;
$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 " ;
2021-02-20 14:52:45 +00:00
if ( is_object ( $filterobj ) && in_array ( get_class ( $filterobj ), array ( 'Societe' , 'Client' , 'Fournisseur' ))) {
$sql .= " , sp.lastname, sp.firstname " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Dolresource' ) {
/* Nothing */
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Project' ) {
/* Nothing */
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) {
$sql .= " , m.lastname, m.firstname " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) {
$sql .= " , o.ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) {
$sql .= " , o.ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Ticket' ) {
$sql .= " , o.ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'BOM' ) {
$sql .= " , o.ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Contrat' ) {
$sql .= " , o.ref " ;
2025-08-07 10:28:09 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Expedition' ) {
$sql .= " , s.ref " ;
2021-09-27 09:20:38 +00:00
} elseif ( is_object ( $filterobj ) && is_array ( $filterobj -> fields ) && is_array ( $filterobj -> fields [ 'rowid' ]) && $filterobj -> table_element && $filterobj -> element ) {
if ( ! empty ( $filterobj -> fields [ 'ref' ])) {
$sql .= " , o.ref " ;
} elseif ( ! empty ( $filterobj -> fields [ 'label' ])) {
$sql .= " , o.label " ;
}
2021-02-20 14:52:45 +00:00
}
2020-09-07 08:18:17 +00:00
2026-02-12 00:22:01 +00:00
$canedit = 1 ;
if ( ! $user -> hasRight ( 'agenda' , 'myactions' , 'read' )) {
$canedit = 0 ;
}
if ( ! $user -> hasRight ( 'agenda' , 'allactions' , 'read' )) {
$canedit = 0 ;
}
if ( ! $user -> hasRight ( 'agenda' , 'allactions' , 'read' )) { // If no permission to see all, we show only affected to me
$filters [ 'search_filtert' ] = ( string ) $user -> id ;
}
2022-11-04 16:46:32 +00:00
// Fields from hook
$parameters = array ( 'sql' => & $sql , 'filterobj' => $filterobj , 'objcon' => $objcon );
$reshook = $hookmanager -> executeHooks ( 'showActionsDoneListSelect' , $parameters ); // Note that $action and $object may have been modified by hook
2023-12-04 11:05:28 +00:00
if ( ! empty ( $hookmanager -> resPrint )) {
2024-03-07 19:16:48 +00:00
$sql .= $hookmanager -> resPrint ;
2023-12-04 11:05:28 +00:00
}
2022-11-04 16:46:32 +00:00
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " actioncomm as a " ;
2024-08-13 02:12:09 +00:00
// Link to the owner of action
2025-08-04 11:12:22 +00:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " user as u on u.rowid = a.fk_user_action " ;
2024-08-13 02:12:09 +00:00
// Link to action types
2025-08-04 11:12:22 +00:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_actioncomm as c ON a.fk_action = c.id " ;
2020-09-07 08:18:17 +00:00
2024-08-13 02:12:09 +00:00
// Set $force_filter_contact:
// - true for a filter on a user or a contact, so a link on table llx_actioncomm_resources or llx_actioncomm.fk_user_action
// - false for a link on table llx_element_resources
2020-09-07 08:18:17 +00:00
$force_filter_contact = false ;
2024-08-13 02:12:09 +00:00
if ( is_object ( $filterobj ) && $filterobj -> id > 0 && get_class ( $filterobj ) == 'User' ) {
2024-02-09 18:01:45 +00:00
$force_filter_contact = true ;
}
2020-09-07 08:18:17 +00:00
if ( is_object ( $objcon ) && $objcon -> id > 0 ) {
$force_filter_contact = true ;
}
2022-11-04 16:46:32 +00:00
// Fields from hook
$parameters = array ( 'sql' => & $sql , 'filterobj' => $filterobj , 'objcon' => $objcon );
$reshook = $hookmanager -> executeHooks ( 'showActionsDoneListFrom' , $parameters ); // Note that $action and $object may have been modified by hook
2023-12-04 11:05:28 +00:00
if ( ! empty ( $hookmanager -> resPrint )) {
2024-03-07 19:16:48 +00:00
$sql .= $hookmanager -> resPrint ;
2023-12-04 11:05:28 +00:00
}
2021-02-23 21:03:23 +00:00
if ( is_object ( $filterobj ) && in_array ( get_class ( $filterobj ), array ( 'Societe' , 'Client' , 'Fournisseur' ))) {
2025-08-04 11:12:22 +00:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " socpeople as sp ON a.fk_contact = sp.rowid " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Dolresource' ) {
2025-08-04 11:12:22 +00:00
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . " element_resources as er " ;
2020-09-07 08:18:17 +00:00
$sql .= " ON er.resource_type = 'dolresource' " ;
2025-08-21 13:46:02 +00:00
$sql .= " AND er.element_type = 'action' " ;
2020-09-07 08:18:17 +00:00
$sql .= " AND er.element_id = a.id " ;
2025-08-04 11:12:22 +00:00
$sql .= " AND er.resource_id = " . (( int ) $filterobj -> id );
2021-02-20 14:52:45 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Project' ) {
/* Nothing */
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " adherent as m " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " commande_fournisseur as o " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " product as o " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Ticket' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " ticket as o " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'BOM' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " bom_bom as o " ;
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Contrat' ) {
2025-08-04 11:12:22 +00:00
$sql .= " , " . MAIN_DB_PREFIX . " contrat as o " ;
2025-08-07 10:28:09 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Expedition' ) {
2026-02-01 17:09:39 +00:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " expedition as s ON a.fk_element = s.rowid AND a.elementtype = 'shipping' " ; // JOIN on the shipping tame using the 'ON' constraint
2025-08-07 10:28:09 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Propal' ) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " propal as o ON a.fk_element = o.rowid AND a.elementtype = 'propal' " ;
} elseif (
2025-08-04 11:12:22 +00:00
is_object ( $filterobj ) && is_array ( $filterobj -> fields ) && is_array ( $filterobj -> fields [ 'rowid' ])
&& (( ! empty ( $filterobj -> fields [ 'ref' ]) && is_array ( $filterobj -> fields [ 'ref' ])) || ( ! empty ( $filterobj -> fields [ 'label' ]) && is_array ( $filterobj -> fields [ 'label' ])) || ( ! empty ( $filterobj -> fields [ 'titre' ]) && is_array ( $filterobj -> fields [ 'titre' ]))) // @phan-suppress-current-line PhanTypeInvalidDimOffset
&& $filterobj -> table_element && $filterobj -> element
) {
$sql .= " , " . MAIN_DB_PREFIX . $filterobj -> table_element . " as o " ;
}
$sql .= " WHERE a.entity IN ( " . getEntity ( 'agenda' ) . " ) " ;
2024-08-07 01:05:02 +00:00
if ( ! $force_filter_contact ) {
2021-02-23 21:03:23 +00:00
if ( is_object ( $filterobj ) && in_array ( get_class ( $filterobj ), array ( 'Societe' , 'Client' , 'Fournisseur' )) && $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_soc = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Dolresource' ) {
/* Nothing */
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Project' && $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_project = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2023-03-14 10:12:07 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Commande' ) {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order' " ;
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2023-03-14 10:12:07 +00:00
}
2020-10-27 23:34:59 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2023-03-14 10:12:07 +00:00
}
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Facture' ) {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice' " ;
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2024-09-25 00:35:56 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'FactureFournisseur' ) {
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice_supplier' " ;
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2024-09-25 00:35:56 +00:00
}
2020-10-27 23:34:59 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2020-10-27 23:34:59 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Ticket' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2020-10-27 23:34:59 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'BOM' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2020-10-27 23:34:59 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Contrat' ) {
2020-09-07 08:18:17 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
}
2025-08-07 10:28:09 +00:00
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Expedition' ) {
2026-02-01 18:07:15 +00:00
$sql .= " AND a.fk_element = s.rowid AND a.elementtype = 'shipping' " ; // shipping filter
2025-08-04 11:12:22 +00:00
if ( $filterobj -> id ) {
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2025-08-07 10:28:09 +00:00
} elseif (
2025-08-04 11:12:22 +00:00
is_object ( $filterobj ) && is_array ( $filterobj -> fields ) && is_array ( $filterobj -> fields [ 'rowid' ])
2024-11-04 11:32:13 +00:00
&& (( ! empty ( $filterobj -> fields [ 'ref' ]) && is_array ( $filterobj -> fields [ 'ref' ])) || ( ! empty ( $filterobj -> fields [ 'label' ]) && is_array ( $filterobj -> fields [ 'label' ])) || ( ! empty ( $filterobj -> fields [ 'titre' ]) && is_array ( $filterobj -> fields [ 'titre' ]))) // ref, titre, label do not exist on $fields - @phan-suppress-current-line PhanTypeInvalidDimOffset
2025-08-04 11:12:22 +00:00
&& $filterobj -> table_element && $filterobj -> element
) {
2023-07-29 19:02:52 +00:00
// Generic case (if there is a $filterobj and a field rowid and (ref or label) exists.
Qual/Sec: Use db->sanitize instead of db->escape when not quoted, fix some quoting (#39286)
* FIX phpstan: Societe::$client (int<0,3>) does not accept -1 (#39244)
Societe::$client is annotated @var int<0,3> (domain 0=no customer,
1=customer, 2=prospect, 3=both) in societe.class.php, but the create
form in societe/card.php pre-set it to -1 as a transient "nothing
pre-selected" placeholder, tripping PHPStan level 10 on develop.
The value is never persisted (save paths compute 0..3) and the only
reader, the switch() building the form, treats -1 and 0 identically via
its default case. Use 0 (the property's own default) so the assignment
matches the declared type. No behavior change.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* Qual: Fix entity handling in bonprelevement.class.php
The variable name 'entities' was changed to 'entity' to better reflect the singular nature of the value being retrieved.
It was also casted to an int instead of using an unquoted db->escape.
* Qual: Improve SQL query construction in company.lib.php
By escaping the concatenated string, injection verification does not identify a false positive.
* Qual: Avoid void positive, sanitize instead of escape
* Qual: Avoid false positive, sanitize instead of escape
* Sec: Fix potential injection with cast to int (timespent_duration)
* Qual: Avoid false positive, sanitize instead of escape
* Qual: Avoid false positive, sanitize instead of escape
* fix: Replace escape() with sanitize() in SQL queries
# FIX: Replace escape() with sanitize() in SQL queries
- Replace escape() with sanitize() in SQL queries to ensure proper SQL injection protection
- Update SQL queries in multiple files to use sanitize() instead of escape()
- Ensure consistent use of sanitize() across the codebase for better security
* fix(sql): Replace escape with sanitize in SQL queries
# FIX: Replace escape with sanitize in SQL queries
- Replace `escape` with `sanitize` in SQL queries to ensure proper SQL injection prevention
* Qual: Improve field escaping/quoting
# Qual: Qual: Improve field escaping/quoting
---------
Co-authored-by: Jam Balaya <jambalaya.pyoncafe@outlook.jp>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 11:00:33 +00:00
$sql .= " AND a.fk_element = o.rowid AND a.elementtype = ' " . $db -> escape ( $filterobj -> element . ( $module ? " @ " . $module : " " )) . " ' " ;
2021-02-23 21:03:23 +00:00
if ( $filterobj -> id ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND a.fk_element = " . (( int ) $filterobj -> id );
2021-02-23 21:03:23 +00:00
}
2023-07-29 19:02:52 +00:00
} elseif ( is_object ( $filterobj )) {
return 'Bad value for $filterobj' ;
2020-09-07 08:18:17 +00:00
}
2024-02-09 18:01:45 +00:00
} else {
2024-08-13 02:12:09 +00:00
if ( is_object ( $filterobj ) && $filterobj -> id > 0 && get_class ( $filterobj ) == 'User' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND (u.rowid = " . (( int ) $filterobj -> id ) . ' OR ' ;
$sql .= " EXISTS (SELECT r.rowid FROM " . MAIN_DB_PREFIX . " actioncomm_resources as r WHERE a.id = r.fk_actioncomm " ;
$sql .= " AND r.element_type = ' " . $db -> escape ( $filterobj -> table_element ) . " ' AND r.fk_element = " . (( int ) $filterobj -> id ) . ')' ;
2024-08-13 02:12:09 +00:00
$sql .= " ) " ;
}
if ( is_object ( $objcon ) && $objcon -> id > 0 ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND EXISTS (SELECT r.rowid FROM " . MAIN_DB_PREFIX . " actioncomm_resources as r WHERE a.id = r.fk_actioncomm " ;
$sql .= " AND r.element_type = ' " . $db -> escape ( $objcon -> table_element ) . " ' AND r.fk_element = " . (( int ) $objcon -> id ) . ')' ;
2024-08-13 02:12:09 +00:00
}
2020-09-07 08:18:17 +00:00
}
2021-02-07 18:44:22 +00:00
if ( ! empty ( $tms_start ) && ! empty ( $tms_end )) {
2025-08-04 11:12:22 +00:00
$sql .= " AND ((a.datep BETWEEN ' " . $db -> idate ( $tms_start ) . " ' AND ' " . $db -> idate ( $tms_end ) . " ') OR (a.datep2 BETWEEN ' " . $db -> idate ( $tms_start ) . " ' AND ' " . $db -> idate ( $tms_end ) . " ')) " ;
2021-02-23 21:03:23 +00:00
} elseif ( empty ( $tms_start ) && ! empty ( $tms_end )) {
2025-08-04 11:12:22 +00:00
$sql .= " AND ((a.datep <= ' " . $db -> idate ( $tms_end ) . " ') OR (a.datep2 <= ' " . $db -> idate ( $tms_end ) . " ')) " ;
2021-02-23 21:03:23 +00:00
} elseif ( ! empty ( $tms_start ) && empty ( $tms_end )) {
2025-08-04 11:12:22 +00:00
$sql .= " AND ((a.datep >= ' " . $db -> idate ( $tms_start ) . " ') OR (a.datep2 >= ' " . $db -> idate ( $tms_start ) . " ')) " ;
2020-09-07 08:18:17 +00:00
}
2020-09-08 19:27:28 +00:00
if ( is_array ( $actioncode ) && ! empty ( $actioncode )) {
2025-01-27 08:48:13 +00:00
$tmpsql = '' ;
2020-09-07 08:18:17 +00:00
foreach ( $actioncode as $key => $code ) {
2025-01-27 08:48:13 +00:00
if (( string ) $code === '-1' || ( string ) $code === '' ) {
2024-09-25 00:35:56 +00:00
continue ;
}
2021-02-23 21:03:23 +00:00
if ( $key != 0 ) {
2025-01-27 08:48:13 +00:00
$tmpsql .= " OR " ;
2021-02-23 21:03:23 +00:00
}
if ( ! empty ( $code )) {
2025-01-27 08:48:13 +00:00
addEventTypeSQL ( $tmpsql , $code , " " );
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
}
2025-01-27 08:48:13 +00:00
if ( $tmpsql ) {
$sql .= ' AND (' ;
$sql .= $tmpsql ;
$sql .= ')' ;
}
2024-09-25 00:35:56 +00:00
} elseif ( ! empty ( $actioncode ) && $actioncode != '-1' ) {
2021-09-10 13:45:03 +00:00
addEventTypeSQL ( $sql , $actioncode );
2020-09-07 08:18:17 +00:00
}
2021-09-10 13:45:03 +00:00
addOtherFilterSQL ( $sql , $donetodo , $now , $filters );
2022-11-04 16:46:32 +00:00
// Fields from hook
$parameters = array ( 'sql' => & $sql , 'filterobj' => $filterobj , 'objcon' => $objcon , 'module' => $module );
$reshook = $hookmanager -> executeHooks ( 'showActionsDoneListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
2023-12-04 11:05:28 +00:00
if ( ! empty ( $hookmanager -> resPrint )) {
2024-03-07 19:16:48 +00:00
$sql .= $hookmanager -> resPrint ;
2023-12-04 11:05:28 +00:00
}
2022-11-04 16:46:32 +00:00
2025-01-21 13:08:52 +00:00
// Now add events of emailing module
2025-03-19 14:21:48 +00:00
if ( is_array ( $actioncode ) && $objcon !== null ) {
2020-09-07 08:18:17 +00:00
foreach ( $actioncode as $code ) {
$sql2 = addMailingEventTypeSQL ( $code , $objcon , $filterobj );
2020-09-08 19:27:28 +00:00
if ( ! empty ( $sql2 )) {
2021-02-23 21:03:23 +00:00
if ( ! empty ( $sql )) {
2025-08-04 11:12:22 +00:00
$sql = $sql . " UNION " . $sql2 ;
2021-02-23 21:03:23 +00:00
} elseif ( empty ( $sql )) {
$sql = $sql2 ;
}
2020-09-07 08:18:17 +00:00
break ;
}
}
2026-04-13 10:50:23 +00:00
} elseif ( $objcon !== null ) {
2020-09-07 08:18:17 +00:00
$sql2 = addMailingEventTypeSQL ( $actioncode , $objcon , $filterobj );
2020-09-08 19:27:28 +00:00
if ( ! empty ( $sql ) && ! empty ( $sql2 )) {
2025-08-04 11:12:22 +00:00
$sql = $sql . " UNION " . $sql2 ;
2021-02-23 21:03:23 +00:00
} elseif ( empty ( $sql ) && ! empty ( $sql2 )) {
2020-09-07 08:18:17 +00:00
$sql = $sql2 ;
}
}
}
2026-02-07 20:31:33 +00:00
$MAXWITHOUTPAGINATION = getDolGlobalInt ( 'AGENDA_MAX_EVENTS_ON_PAGE_WITHOUT_PAGINATION' , 100 );
2026-02-07 22:57:41 +00:00
$num = 0 ;
2026-02-07 20:31:33 +00:00
2020-10-27 23:34:59 +00:00
if ( $sql ) {
2026-02-07 20:31:33 +00:00
// TODO Add navigation with this limits by replacing call of show_actions_done by the code found into comm/action/list.php...
2024-01-31 01:47:49 +00:00
$offset = 0 ;
2026-02-07 20:31:33 +00:00
$limit = $MAXWITHOUTPAGINATION ;
2024-01-31 01:47:49 +00:00
// Complete request and execute it with limit
2026-07-19 13:53:14 +00:00
$sql .= $db -> order ( $sortfield_new , $sortorder ); // @phan-suppress-current-line SqlInjection
2025-02-18 09:24:00 +00:00
if ( $limit ) { // @phpstan-ignore-line
2024-01-31 01:47:49 +00:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
}
2023-02-20 00:12:15 +00:00
2020-09-07 08:18:17 +00:00
dol_syslog ( " company.lib::show_actions_done " , LOG_DEBUG );
2023-02-20 00:12:15 +00:00
2020-09-07 08:18:17 +00:00
$resql = $db -> query ( $sql );
2020-10-27 23:34:59 +00:00
if ( $resql ) {
2020-09-07 08:18:17 +00:00
$i = 0 ;
$num = $db -> num_rows ( $resql );
2024-01-31 01:47:49 +00:00
$imaxinloop = ( $limit ? min ( $num , $limit ) : $num );
while ( $i < $imaxinloop ) {
2020-09-07 08:18:17 +00:00
$obj = $db -> fetch_object ( $resql );
2025-11-18 15:57:50 +00:00
if ( empty ( $obj )) {
break ;
}
2020-09-07 08:18:17 +00:00
if ( $obj -> type == 'action' ) {
$contactaction = new ActionComm ( $db );
$contactaction -> id = $obj -> id ;
$result = $contactaction -> fetchResources ();
if ( $result < 0 ) {
dol_print_error ( $db );
2024-01-13 18:48:20 +00:00
setEventMessage ( " company.lib::show_actions_done Error fetch resource " , 'errors' );
2020-09-07 08:18:17 +00:00
}
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '' ;
2021-02-23 21:03:23 +00:00
if (( $obj -> percent >= 0 and $obj -> percent < 100 ) || ( $obj -> percent == - 1 && ( ! empty ( $obj -> datep ) && $obj -> datep > $now ))) {
$tododone = 'todo' ;
}
2020-09-07 08:18:17 +00:00
$histo [ $numaction ] = array (
2024-03-07 19:16:48 +00:00
'type' => $obj -> type ,
'tododone' => $tododone ,
2024-11-04 11:32:13 +00:00
'id' => ( int ) $obj -> id ,
2024-03-07 19:16:48 +00:00
'datestart' => $db -> jdate ( $obj -> dp ),
'dateend' => $db -> jdate ( $obj -> dp2 ),
2026-03-04 01:20:56 +00:00
'fulldayevent' => ( int ) $obj -> fulldayevent ,
2024-03-07 19:16:48 +00:00
'note' => $obj -> label ,
2024-11-04 11:32:13 +00:00
'percent' => ( int ) $obj -> percent ,
2024-03-07 19:16:48 +00:00
2024-11-04 11:32:13 +00:00
'userid' => ( int ) $obj -> user_id ,
2024-03-07 19:16:48 +00:00
'login' => $obj -> user_login ,
'userfirstname' => $obj -> user_firstname ,
'userlastname' => $obj -> user_lastname ,
'userphoto' => $obj -> user_photo ,
2024-11-04 11:32:13 +00:00
'contact_id' => ( int ) $obj -> fk_contact ,
2020-09-07 08:18:17 +00:00
'socpeopleassigned' => $contactaction -> socpeopleassigned ,
2021-06-16 09:50:52 +00:00
'lastname' => empty ( $obj -> lastname ) ? '' : $obj -> lastname ,
'firstname' => empty ( $obj -> firstname ) ? '' : $obj -> firstname ,
2024-11-04 11:32:13 +00:00
'fk_element' => ( int ) $obj -> fk_element ,
2024-03-07 19:16:48 +00:00
'elementtype' => $obj -> elementtype ,
2025-01-21 13:08:52 +00:00
'code' => $obj -> code ,
2020-09-07 08:18:17 +00:00
// Type of event
2024-03-07 19:16:48 +00:00
'acode' => $obj -> acode ,
'alabel' => $obj -> alabel ,
'libelle' => $obj -> alabel , // deprecated
'apicto' => $obj -> apicto
2020-09-07 08:18:17 +00:00
);
} else {
$histo [ $numaction ] = array (
2024-03-07 19:16:48 +00:00
'type' => $obj -> type ,
'tododone' => 'done' ,
2024-11-04 11:32:13 +00:00
'id' => ( int ) $obj -> id ,
2024-03-07 19:16:48 +00:00
'datestart' => $db -> jdate ( $obj -> dp ),
'dateend' => $db -> jdate ( $obj -> dp2 ),
2026-03-04 01:20:56 +00:00
'fulldayevent' => ( int ) $obj -> fulldayevent ,
2024-03-07 19:16:48 +00:00
'note' => $obj -> label ,
2024-11-04 11:32:13 +00:00
'percent' => ( int ) $obj -> percent ,
2025-01-21 13:08:52 +00:00
'code' => $obj -> code ,
// Type of event
2024-03-07 19:16:48 +00:00
'acode' => $obj -> acode ,
2024-11-04 11:32:13 +00:00
'userid' => ( int ) $obj -> user_id ,
2024-03-07 19:16:48 +00:00
'login' => $obj -> user_login ,
'userfirstname' => $obj -> user_firstname ,
'userlastname' => $obj -> user_lastname ,
'userphoto' => $obj -> user_photo
2020-09-07 08:18:17 +00:00
);
}
$numaction ++ ;
$i ++ ;
}
} else {
dol_print_error ( $db );
}
}
2026-03-05 10:40:00 +00:00
'@phan-var-force array<int,array{userid:int,type:string,tododone:string,apicto:string,acode:string,alabel:string,note:string,id:int,percent:int<0,100>,datestart:int,dateend:int,fulldayevent:int,fk_element:string,elementtype:string,contact_id:int,lastname:string,firstname:string,contact_photo:string,socpeopleassigned:int[],login:string,userfirstname:string,userlastname:string,userphoto:string}> $histo' ;
2024-03-13 18:57:49 +00:00
2024-03-07 19:16:48 +00:00
if ( isModEnabled ( 'agenda' ) || ( isModEnabled ( 'mailing' ) && ! empty ( $objcon -> email ))) {
2024-09-06 12:01:55 +00:00
$delay_warning = getDolGlobalInt ( 'MAIN_DELAY_ACTIONS_TODO' ) * 24 * 60 * 60 ;
2020-09-07 08:18:17 +00:00
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2020-09-07 08:18:17 +00:00
$formactions = new FormActions ( $db );
$actionstatic = new ActionComm ( $db );
$userstatic = new User ( $db );
2020-10-27 23:34:59 +00:00
$userlinkcache = array ();
2020-09-07 08:18:17 +00:00
$contactstatic = new Contact ( $db );
2020-10-27 23:34:59 +00:00
$elementlinkcache = array ();
2020-09-07 08:18:17 +00:00
2025-08-04 11:12:22 +00:00
$out .= '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER [ " PHP_SELF " ] . '" method="POST">' ;
$out .= '<input type="hidden" name="token" value="' . newToken () . '">' ;
if (
$objcon && get_class ( $objcon ) == 'Contact' &&
( is_null ( $filterobj ) || get_class ( $filterobj ) == 'Societe' )
) {
$out .= '<input type="hidden" name="id" value="' . $objcon -> id . '" />' ;
2020-09-07 08:18:17 +00:00
} else {
2025-08-04 11:12:22 +00:00
$out .= '<input type="hidden" name="id" value="' . $filterobj -> id . '" />' ;
2020-09-07 08:18:17 +00:00
}
2021-02-23 21:03:23 +00:00
if ( $filterobj && get_class ( $filterobj ) == 'Societe' ) {
2025-08-04 11:12:22 +00:00
$out .= '<input type="hidden" name="socid" value="' . $filterobj -> id . '" />' ;
2024-02-09 18:01:45 +00:00
} else {
2025-08-04 11:12:22 +00:00
$out .= '<input type="hidden" name="userid" value="' . $filterobj -> id . '" />' ;
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
$out .= " \n " ;
$out .= '<div class="div-table-responsive-no-min">' ;
$out .= '<table class="noborder centpercent">' ;
2025-11-18 20:25:02 +00:00
$out .= '<tr class="liste_titre_filter">' ;
2023-07-10 00:25:33 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= '<th class="liste_titre width50 middle">' ;
$searchpicto = $form -> showFilterAndCheckAddButtons ( $massactionbutton ? 1 : 0 , 'checkforselect' , 1 );
$out .= $searchpicto ;
$out .= '</th>' ;
}
2020-10-27 23:34:59 +00:00
if ( $donetodo ) {
2020-09-07 08:18:17 +00:00
$out .= '<td class="liste_titre"></td>' ;
}
2023-02-20 00:32:45 +00:00
2024-05-29 21:23:20 +00:00
// ID
2025-08-04 11:12:22 +00:00
$out .= '<td class="liste_titre"><input type="text" class="width50" name="search_rowid" value="' . ( isset ( $filters [ 'search_rowid' ]) ? $filters [ 'search_rowid' ] : '' ) . '"></td>' ;
2024-05-29 21:23:20 +00:00
// Date
$out .= '<td class="liste_titre center">' ;
$out .= $form -> selectDateToDate ( $tms_start , $tms_end , 'dateevent' , 1 );
$out .= '</td>' ;
// Owner
2026-02-12 00:22:01 +00:00
$out .= '<td class="liste_titre">' ;
2026-04-21 13:37:35 +00:00
$out .= $form -> select_dolusers (( isset ( $filters [ 'search_filtert' ]) && $filters [ 'search_filtert' ] > 0 ? $filters [ 'search_filtert' ] : '' ), 'search_filtert' , 1 , null , 0 , '' , '' , '0' , 0 , 0 , '' , 2 , '' , 'minwidth100 maxwidth250 widthcentpercentminusx' );
2026-02-12 00:22:01 +00:00
$out .= '</td>' ;
2024-05-29 21:23:20 +00:00
// Type
2020-09-07 08:18:17 +00:00
$out .= '<td class="liste_titre">' ;
2026-03-05 00:34:36 +00:00
$out .= $formactions -> select_type_actions ( $actioncode , " actioncode " , '' , getDolGlobalString ( 'AGENDA_USE_EVENT_TYPE' ) ? - 1 : 1 , 0 , ( getDolGlobalString ( 'AGENDA_USE_MULTISELECT_TYPE' ) ? 1 : 0 ), 1 , 'selecttype combolargeelem minwidth75 maxwidth125' , 1 );
2020-09-07 08:18:17 +00:00
$out .= '</td>' ;
2026-02-07 19:07:09 +00:00
// Label - Title
2026-03-05 00:34:36 +00:00
$out .= '<td class="liste_titre maxwidth100onsmartphone"><input type="text" class="maxwidth200" name="search_agenda_label" value="' . $filters [ 'search_agenda_label' ] . '"></td>' ;
2020-09-07 08:18:17 +00:00
$out .= '<td class="liste_titre"></td>' ;
$out .= '<td class="liste_titre"></td>' ;
2025-11-18 20:25:02 +00:00
// Status ($percent can be 'na'or < 100 or 100)
$out .= '<td class="liste_titre parentonrightofpage">' ;
$out .= $formactions -> form_select_status_action ( 'formaction' , $percent , 1 , 'search_complete' , 1 , 2 , 'search_status width100 onrightofpage' , 1 );
2025-11-18 15:57:50 +00:00
$out .= '</td>' ;
2020-09-07 08:18:17 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= '<td class="liste_titre" align="middle">' ;
$searchpicto = $form -> showFilterAndCheckAddButtons ( $massactionbutton ? 1 : 0 , 'checkforselect' , 1 );
$out .= $searchpicto ;
$out .= '</td>' ;
}
2020-09-07 08:18:17 +00:00
$out .= '</tr>' ;
$out .= '<tr class="liste_titre">' ;
2023-07-10 00:25:33 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= getTitleFieldOfList ( '' , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder , 'maxwidthsearch ' );
}
2024-09-30 08:05:24 +00:00
if ( $donetodo && $filterobj !== null ) {
2020-09-07 08:18:17 +00:00
$tmp = '' ;
2021-02-23 21:03:23 +00:00
if ( get_class ( $filterobj ) == 'Societe' ) {
2025-08-04 11:12:22 +00:00
$tmp .= '<a href="' . DOL_URL_ROOT . '/comm/action/list.php?mode=show_list&socid=' . $filterobj -> id . '&status=done">' ;
2021-02-23 21:03:23 +00:00
}
2024-02-09 18:01:45 +00:00
if ( get_class ( $filterobj ) == 'User' ) {
2025-08-04 11:12:22 +00:00
$tmp .= '<a href="' . DOL_URL_ROOT . '/comm/action/list.php?mode=show_list&userid=' . $filterobj -> id . '&status=done">' ;
2024-02-09 18:01:45 +00:00
}
2020-09-07 08:18:17 +00:00
$tmp .= ( $donetodo != 'done' ? $langs -> trans ( " ActionsToDoShort " ) : '' );
$tmp .= ( $donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '' );
$tmp .= ( $donetodo != 'todo' ? $langs -> trans ( " ActionsDoneShort " ) : '' );
//$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort");
2021-02-23 21:03:23 +00:00
if ( get_class ( $filterobj ) == 'Societe' ) {
$tmp .= '</a>' ;
}
2024-02-09 18:01:45 +00:00
if ( get_class ( $filterobj ) == 'User' ) {
$tmp .= '</a>' ;
}
2020-09-07 08:18:17 +00:00
$out .= getTitleFieldOfList ( $tmp );
2015-07-21 08:24:54 +00:00
}
2022-02-02 16:57:20 +00:00
$out .= getTitleFieldOfList ( " Ref " , 0 , $_SERVER [ " PHP_SELF " ], 'a.id' , '' , $param , '' , $sortfield , $sortorder );
2024-05-29 21:23:20 +00:00
$out .= getTitleFieldOfList ( " Date " , 0 , $_SERVER [ " PHP_SELF " ], 'a.datep,a.id' , '' , $param , '' , $sortfield , $sortorder , 'center ' );
2022-02-02 16:57:20 +00:00
$out .= getTitleFieldOfList ( " Owner " );
$out .= getTitleFieldOfList ( " Type " );
2026-02-07 19:07:09 +00:00
$out .= getTitleFieldOfList ( " Title " , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder );
2022-02-02 16:57:20 +00:00
$out .= getTitleFieldOfList ( " ActionOnContact " , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder , 'tdoverflowmax125 ' , 0 , '' , 0 );
2026-02-07 19:07:09 +00:00
$out .= getTitleFieldOfList ( " LinkedObject " , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder );
2022-02-02 16:57:20 +00:00
$out .= getTitleFieldOfList ( " Status " , 0 , $_SERVER [ " PHP_SELF " ], 'a.percent' , '' , $param , '' , $sortfield , $sortorder , 'center ' );
2023-07-10 00:25:33 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= getTitleFieldOfList ( '' , 0 , $_SERVER [ " PHP_SELF " ], '' , '' , $param , '' , $sortfield , $sortorder , 'maxwidthsearch ' );
}
2019-11-13 18:35:02 +00:00
$out .= '</tr>' ;
2017-06-26 08:09:22 +00:00
2025-08-04 11:12:22 +00:00
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/cactioncomm.class.php' ;
2019-11-13 18:35:02 +00:00
$caction = new CActionComm ( $db );
2025-01-21 13:08:52 +00:00
$arraylist = $caction -> liste_array ( 1 , 'code' , '' , ( getDolGlobalString ( 'AGENDA_USE_EVENT_TYPE' ) ? 0 : 1 ), '' , 1 );
2018-03-22 09:46:42 +00:00
2020-10-27 23:34:59 +00:00
foreach ( $histo as $key => $value ) {
2019-11-13 18:35:02 +00: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 15:52:58 +00:00
2025-01-21 13:08:52 +00:00
if ( empty ( $actionstatic -> code )) {
$actionstatic -> code = $histo [ $key ][ 'acode' ];
}
2024-09-12 19:10:01 +00:00
$actionstatic -> type_picto = $histo [ $key ][ 'apicto' ] ? ? '' ;
2019-11-13 18:35:02 +00:00
$actionstatic -> type_code = $histo [ $key ][ 'acode' ];
2018-03-22 09:46:42 +00:00
2020-09-07 08:18:17 +00:00
$out .= '<tr class="oddeven">' ;
2023-07-10 00:25:33 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= '<td></td>' ;
}
2020-09-07 08:18:17 +00:00
// Done or todo
2020-10-27 23:34:59 +00:00
if ( $donetodo ) {
2020-09-07 08:18:17 +00:00
$out .= '<td class="nowrap">' ;
$out .= '</td>' ;
}
// Ref
$out .= '<td class="nowraponall">' ;
if ( isset ( $histo [ $key ][ 'type' ]) && $histo [ $key ][ 'type' ] == 'mailing' ) {
2025-08-04 11:12:22 +00:00
$out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo [ $key ][ 'id' ] . '">' . img_object ( $langs -> trans ( " ShowEMailing " ), " email " ) . ' ' ;
2020-09-07 08:18:17 +00:00
$out .= $histo [ $key ][ 'id' ];
$out .= '</a>' ;
} else {
$out .= $actionstatic -> getNomUrl ( 1 , - 1 );
}
$out .= '</td>' ;
2024-05-29 21:23:20 +00:00
// Date
2026-02-07 19:07:09 +00:00
$out .= '<td class="center nowraponall nopaddingtopimp nopaddingbottomimp">' ;
2026-03-04 01:20:56 +00:00
2026-03-05 10:40:00 +00:00
$out .= dolOutputDates ( $histo [ $key ][ 'datestart' ], $histo [ $key ][ 'dateend' ], ( int ) $histo [ $key ][ 'fulldayevent' ], 0 , '' , 'tzuserrel' , 1 );
2026-03-04 01:20:56 +00:00
2025-11-21 00:02:28 +00:00
// Add the late warning
$late = 0 ;
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 ;
}
if ( $late ) {
$out .= img_warning ( $langs -> trans ( " Late " )) . ' ' ;
}
$out .= '</td>' ;
2020-09-07 08:18:17 +00:00
// Author of event
2023-09-18 16:41:52 +00:00
$out .= '<td class="tdoverflowmax125">' ;
2020-10-31 13:32:18 +00:00
if ( $histo [ $key ][ 'userid' ] > 0 ) {
if ( isset ( $userlinkcache [ $histo [ $key ][ 'userid' ]])) {
$link = $userlinkcache [ $histo [ $key ][ 'userid' ]];
} else {
$userstatic -> fetch ( $histo [ $key ][ 'userid' ]);
$link = $userstatic -> getNomUrl ( - 1 , '' , 0 , 0 , 16 , 0 , 'firstelselast' , '' );
$userlinkcache [ $histo [ $key ][ 'userid' ]] = $link ;
}
$out .= $link ;
}
2020-09-07 08:18:17 +00:00
$out .= '</td>' ;
2025-01-21 13:08:52 +00:00
// type_code // column "acode" in the sql = code in type of actioncomm, example: AC_OTH_AUTO, AC_EMAILING
// code // columne code in the sql (not yet added), can be AC_CONTACT_SENTBYMAIL, ...
2020-09-07 08:18:17 +00:00
// Type
2025-01-21 13:08:52 +00:00
$labelOfTypeToShow = $actionstatic -> type_code ;
//$typelabel = $actionstatic->type_label;
$code = $actionstatic -> code ;
if ( ! getDolGlobalString ( 'AGENDA_USE_EVENT_TYPE' ) && empty ( $arraylist [ $labelOfTypeToShow ])) {
$labelOfTypeToShow = 'AC_OTH' ;
2021-02-23 21:03:23 +00:00
}
2023-06-13 14:01:52 +00:00
if ( ! empty ( $actionstatic -> code ) && preg_match ( '/^TICKET_MSG/' , $actionstatic -> code )) {
2025-01-21 13:08:52 +00:00
$labelOfTypeToShow = $langs -> trans ( " Message " );
2020-09-07 08:18:17 +00:00
} else {
2025-01-21 13:08:52 +00:00
if ( ! empty ( $arraylist [ $labelOfTypeToShow ])) {
$labelOfTypeToShow = $arraylist [ $labelOfTypeToShow ];
} elseif ( $actionstatic -> type_code == 'AC_EMAILING' ) {
2025-01-22 01:38:41 +00:00
$langs -> load ( " mails " );
2025-01-21 13:08:52 +00:00
$labelOfTypeToShow = $langs -> trans ( " Emailing " );
2021-02-23 21:03:23 +00:00
}
2025-01-21 13:08:52 +00:00
if ( $actionstatic -> type_code == 'AC_OTH_AUTO' && ( $actionstatic -> type_code != $actionstatic -> code ) && $labelOfTypeToShow && ! empty ( $arraylist [ $actionstatic -> code ])) {
2025-08-04 11:12:22 +00:00
$labelOfTypeToShow .= ' - ' . $arraylist [ $actionstatic -> code ]; // Show also detailed code
2021-02-23 21:03:23 +00:00
}
2020-09-07 08:18:17 +00:00
}
2025-01-21 13:08:52 +00:00
$labelOfTypeToShowLong = $labelOfTypeToShow ;
if ( $actionstatic -> type_code == 'AC_OTH_AUTO' ) {
$labelOfTypeToShowLong .= ' (auto)' ;
}
2025-08-04 11:12:22 +00:00
$out .= '<td class="tdoverflowmax125" title="' . $labelOfTypeToShowLong . '">' ;
2026-02-07 19:07:09 +00:00
// Example $actionstatic->code = AC_COMPANY_MODIFY and $actionstatic->type_code = AC_OTH_AUTO
2021-03-17 10:34:19 +00:00
$out .= $actionstatic -> getTypePicto ();
2025-01-21 13:08:52 +00:00
$out .= $labelOfTypeToShow ;
2026-04-19 17:53:46 +00:00
if ( preg_match ( '/PRIVATE/' , $actionstatic -> code )) {
$out .= ' ' . img_picto ( $langs -> trans ( " Private " ), 'lock' , 'class="valignmiddle"' );
}
2020-09-07 08:18:17 +00:00
$out .= '</td>' ;
2022-02-02 16:57:20 +00:00
// Title/Label of event
$out .= '<td class="tdoverflowmax300"' ;
2020-10-27 23:34:59 +00:00
if ( isset ( $histo [ $key ][ 'type' ]) && $histo [ $key ][ 'type' ] == 'action' ) {
2025-08-04 11:12:22 +00:00
$transcode = $langs -> trans ( " Action " . $histo [ $key ][ 'acode' ]);
2023-08-05 23:14:36 +00:00
//$libelle = ($transcode != "Action".$histo[$key]['acode'] ? $transcode : $histo[$key]['alabel']);
2025-01-21 13:08:52 +00:00
$label = $histo [ $key ][ 'note' ];
2020-09-07 08:18:17 +00:00
$actionstatic -> id = $histo [ $key ][ 'id' ];
2025-08-04 11:12:22 +00:00
$out .= ' title="' . dol_escape_htmltag ( $label ) . '">' ;
2026-04-19 17:53:46 +00:00
$label = preg_replace ( '/^\[[^\[]*\]/' , '[...]' , $label );
2025-01-21 13:08:52 +00:00
$out .= dol_trunc ( $label , 120 );
2020-09-07 08:18:17 +00:00
}
2020-10-27 23:34:59 +00:00
if ( isset ( $histo [ $key ][ 'type' ]) && $histo [ $key ][ 'type' ] == 'mailing' ) {
2025-08-04 11:12:22 +00:00
$transcode = $langs -> trans ( " Action " . $histo [ $key ][ 'acode' ]);
$label = ( $transcode != " Action " . $histo [ $key ][ 'acode' ] ? $transcode : 'Send mass mailing' );
$label .= ' - ' . $histo [ $key ][ 'note' ];
$out .= '<a href="' . DOL_URL_ROOT . '/comm/mailing/card.php?id=' . $histo [ $key ][ 'id' ] . '"' ;
$out .= ' title="' . dol_escape_htmltag ( $label ) . '">' ;
2026-04-19 17:53:46 +00:00
$label = preg_replace ( '/^\[[^\[]*\]/' , '[...]' , $label );
2025-01-21 13:08:52 +00:00
$out .= dol_trunc ( $label , 120 );
2025-01-09 19:26:22 +00:00
$out .= '</a>' ;
2020-09-07 08:18:17 +00:00
}
$out .= '</td>' ;
// Contact(s) for action
2022-02-02 16:57:20 +00:00
if ( isset ( $histo [ $key ][ 'socpeopleassigned' ]) && is_array ( $histo [ $key ][ 'socpeopleassigned' ]) && count ( $histo [ $key ][ 'socpeopleassigned' ]) > 0 ) {
$out .= '<td class="valignmiddle">' ;
2020-01-07 13:01:12 +00:00
$contact = new Contact ( $db );
2022-12-31 12:23:09 +00:00
foreach ( $histo [ $key ][ 'socpeopleassigned' ] as $cid => $cvalue ) {
2018-10-04 07:45:12 +00:00
$result = $contact -> fetch ( $cid );
2021-02-23 21:03:23 +00:00
if ( $result < 0 ) {
2018-10-04 07:45:12 +00:00
dol_print_error ( $db , $contact -> error );
2026-02-07 20:31:33 +00:00
} elseif ( $result > 0 ) {
if ( count ( $histo [ $key ][ 'socpeopleassigned' ]) > 1 ) {
$out .= $contact -> getNomUrl ( - 2 , '' , 0 , '' , - 1 , 0 , 'paddingright' );
} else {
$out .= $contact -> getNomUrl ( - 3 , '' , 0 , '' , - 1 , 0 , 'paddingright' );
if ( isset ( $histo [ $key ][ 'acode' ]) && $histo [ $key ][ 'acode' ] == 'AC_TEL' ) {
if ( ! empty ( $contact -> phone_pro )) {
$out .= '(' . dol_print_phone ( $contact -> phone_pro ) . ')' ;
}
2021-02-23 21:03:23 +00:00
}
2018-10-04 07:45:12 +00:00
}
}
}
$out .= '</td>' ;
2022-02-02 16:57:20 +00:00
} elseif ( empty ( $objcon -> id ) && isset ( $histo [ $key ][ 'contact_id' ]) && $histo [ $key ][ 'contact_id' ] > 0 ) {
$contactstatic -> lastname = $histo [ $key ][ 'lastname' ];
$contactstatic -> firstname = $histo [ $key ][ 'firstname' ];
$contactstatic -> id = $histo [ $key ][ 'contact_id' ];
$contactstatic -> photo = $histo [ $key ][ 'contact_photo' ];
2025-08-04 11:12:22 +00:00
$out .= '<td width="120">' . $contactstatic -> getNomUrl ( - 1 , '' , 10 ) . '</td>' ;
2020-05-21 13:05:19 +00:00
} else {
2020-09-07 08:18:17 +00:00
$out .= '<td> </td>' ;
}
2010-08-21 15:30:17 +00:00
2026-02-07 19:07:09 +00:00
// Linked object
$out .= '<td class="tdoverflowmax200 nowraponall">' ;
if ( isset ( $histo [ $key ][ 'elementtype' ]) && ! empty ( $histo [ $key ][ 'fk_element' ])) {
if ( isset ( $elementlinkcache [ $histo [ $key ][ 'elementtype' ]]) && isset ( $elementlinkcache [ $histo [ $key ][ 'elementtype' ]][ $histo [ $key ][ 'fk_element' ]])) {
$link = $elementlinkcache [ $histo [ $key ][ 'elementtype' ]][ $histo [ $key ][ 'fk_element' ]];
} else {
if ( ! isset ( $elementlinkcache [ $histo [ $key ][ 'elementtype' ]])) {
$elementlinkcache [ $histo [ $key ][ 'elementtype' ]] = array ();
}
$link = dolGetElementUrl (( int ) $histo [ $key ][ 'fk_element' ], $histo [ $key ][ 'elementtype' ], 1 );
$elementlinkcache [ $histo [ $key ][ 'elementtype' ]][ $histo [ $key ][ 'fk_element' ]] = $link ;
}
$out .= $link ;
}
$out .= '</td>' ;
2025-06-21 13:29:54 +00:00
// Status / Progression
2025-11-18 15:57:50 +00:00
$out .= '<td class="nowrap center">' ;
$out .= $actionstatic -> LibStatut ( $histo [ $key ][ 'percent' ], 2 , 0 , $histo [ $key ][ 'datestart' ]);
$out .= '</td>' ;
2010-08-21 15:30:17 +00:00
2023-07-10 00:25:33 +00:00
// Action column
2026-04-23 15:41:15 +00:00
if ( ! $conf -> main_checkbox_left_column ) {
2023-07-10 00:25:33 +00:00
$out .= '<td></td>' ;
}
2017-06-26 08:09:22 +00:00
2020-09-07 08:18:17 +00:00
$out .= " </tr> \n " ;
}
2022-09-30 11:59:26 +00:00
if ( empty ( $histo )) {
$colspan = 9 ;
2025-08-04 11:12:22 +00:00
$out .= '<tr><td colspan="' . $colspan . '"><span class="opacitymedium">' . $langs -> trans ( " NoRecordFound " ) . '</span></td></tr>' ;
2022-09-30 11:59:26 +00:00
}
2026-02-07 20:38:51 +00:00
if ( $num > $MAXWITHOUTPAGINATION ) {
$langs -> load ( " errors " );
$colspan = 9 ;
2026-02-07 20:55:20 +00:00
$out .= '<tr><td class="center" colspan="' . $colspan . '"><span class="opacitymedium">...' . $langs -> trans ( " WarningTooManyDataPleaseUseMoreFilters " , $MAXWITHOUTPAGINATION ) . '...</span></td></tr>' ;
2026-02-07 20:38:51 +00:00
}
2020-09-07 08:18:17 +00:00
$out .= " </table> \n " ;
$out .= " </div> \n " ;
2008-08-06 14:50:06 +00:00
2020-09-07 08:18:17 +00:00
$out .= '</form>' ;
}
2017-06-26 08:09:22 +00:00
2021-02-23 21:03:23 +00:00
if ( $noprint ) {
return $out ;
} else {
print $out ;
2024-08-01 10:59:45 +00:00
return null ;
2021-02-23 21:03:23 +00:00
}
2008-07-29 19:20:33 +00:00
}
2011-03-22 19:31:29 +00:00
/**
* Show html area for list of subsidiaries
2012-02-04 13:39:47 +00:00
*
* @ param Conf $conf Object conf
* @ param Translate $langs Object langs
* @ param DoliDB $db Database handler
* @ param Societe $object Third party object
2019-02-13 21:43:12 +00:00
* @ return int
2011-03-22 19:31:29 +00:00
*/
2019-01-27 14:20:16 +00:00
function show_subsidiaries ( $conf , $langs , $db , $object )
2011-03-22 19:31:29 +00:00
{
2019-11-13 18:35:02 +00:00
$i = - 1 ;
2011-03-22 19:31:29 +00:00
2024-11-16 09:57:03 +00: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, s.status " ;
2025-08-04 11:12:22 +00:00
$sql .= " FROM " . MAIN_DB_PREFIX . " societe as s " ;
$sql .= " WHERE s.parent = " . (( int ) $object -> id );
$sql .= " AND s.entity IN ( " . getEntity ( 'societe' ) . " ) " ;
2019-11-13 18:35:02 +00:00
$sql .= " ORDER BY s.nom " ;
2011-03-22 19:31:29 +00:00
$result = $db -> query ( $sql );
$num = $db -> num_rows ( $result );
2020-10-27 23:34:59 +00:00
if ( $num ) {
2011-03-22 19:31:29 +00:00
$socstatic = new Societe ( $db );
2011-04-10 21:30:11 +00:00
2016-12-05 12:45:57 +00:00
print load_fiche_titre ( $langs -> trans ( " Subsidiaries " ), '' , '' );
2021-07-22 22:02:14 +00:00
2025-08-04 11:12:22 +00:00
print " \n " . '<div class="div-table-responsive-no-min">' . " \n " ;
print '<table class="noborder centpercent">' . " \n " ;
2011-03-22 19:31:29 +00:00
2025-08-04 11:12:22 +00:00
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>' ;
2011-03-22 19:31:29 +00:00
print " <td> </td> " ;
print " </tr> " ;
2019-11-13 18:35:02 +00:00
$i = 0 ;
2011-03-22 19:31:29 +00:00
2020-10-27 23:34:59 +00:00
while ( $i < $num ) {
2011-03-22 19:31:29 +00:00
$obj = $db -> fetch_object ( $result );
$socstatic -> id = $obj -> rowid ;
$socstatic -> name = $obj -> name ;
2018-06-20 20:02:36 +00:00
$socstatic -> name_alias = $obj -> name_alias ;
$socstatic -> email = $obj -> email ;
$socstatic -> code_client = $obj -> code_client ;
2023-12-14 20:58:20 +00:00
$socstatic -> code_fournisseur = $obj -> code_fournisseur ;
2018-06-20 20:02:36 +00:00
$socstatic -> code_compta = $obj -> code_compta ;
2024-08-14 14:51:53 +00:00
$socstatic -> code_compta_client = $obj -> code_compta ;
2018-06-20 20:02:36 +00:00
$socstatic -> code_compta_fournisseur = $obj -> code_compta_fournisseur ;
$socstatic -> email = $obj -> email ;
2011-03-22 19:31:29 +00:00
$socstatic -> canvas = $obj -> canvas ;
2018-06-20 20:02:36 +00:00
$socstatic -> client = $obj -> client ;
$socstatic -> fournisseur = $obj -> fournisseur ;
2024-11-16 09:57:03 +00:00
$socstatic -> status = $obj -> status ;
2018-06-20 20:02:36 +00:00
print '<tr class="oddeven">' ;
2021-07-22 22:02:14 +00:00
print '<td class="tdoverflowmax150">' ;
2011-03-22 19:31:29 +00:00
print $socstatic -> getNomUrl ( 1 );
print '</td>' ;
2025-08-04 11:12:22 +00:00
print '<td class="tdoverflowmax400" title="' . dol_escape_htmltag ( $obj -> address ) . '">' . dol_escape_htmltag ( $obj -> address ) . '</td>' ;
print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag ( $obj -> zip ) . '">' . $obj -> zip . '</td>' ;
print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag ( $obj -> town ) . '">' . $obj -> town . '</td>' ;
print '<td class="tdoverflowmax200" title="' . dol_escape_htmltag ( $obj -> code_client ) . '">' . $obj -> code_client . '</td>' ;
2011-03-22 19:31:29 +00:00
2019-12-12 09:31:08 +00:00
print '<td class="center">' ;
2025-08-04 11:12:22 +00:00
print '<a class="editfielda" href="' . DOL_URL_ROOT . '/societe/card.php?socid=' . (( int ) $obj -> rowid ) . '&action=edit&token=' . newToken () . '">' ;
2011-03-22 19:31:29 +00:00
print img_edit ();
print '</a></td>' ;
print " </tr> \n " ;
$i ++ ;
}
print " \n </table> \n " ;
2025-08-04 11:12:22 +00:00
print '</div>' . " \n " ;
2011-03-22 19:31:29 +00:00
}
print " <br> \n " ;
return $i ;
}
2020-06-08 13:58:20 +00:00
/**
* Add Event Type SQL
*
* @ param string $sql $sql modified
* @ param string $actioncode Action code
2025-03-11 00:43:54 +00:00
* @ param 'AND' | 'OR' | '' $sqlANDOR " AND " , " OR " or " " sql condition
2020-07-01 12:04:41 +00:00
* @ return string sql request
2020-06-08 13:58:20 +00:00
*/
2021-09-10 13:45:03 +00:00
function addEventTypeSQL ( & $sql , $actioncode , $sqlANDOR = " AND " )
2020-06-08 14:00:57 +00:00
{
2024-09-25 00:35:56 +00:00
global $db ;
2020-09-07 08:18:17 +00:00
// Condition on actioncode
2020-06-08 12:43:14 +00:00
2024-09-25 00:35:56 +00:00
if (( string ) $actioncode == '-1' ) {
return $sql ;
}
2023-11-27 10:39:32 +00:00
if ( ! getDolGlobalString ( 'AGENDA_USE_EVENT_TYPE' )) {
2021-02-23 21:03:23 +00:00
if ( $actioncode == 'AC_NON_AUTO' ) {
2023-12-17 20:20:11 +00:00
$sql .= " $sqlANDOR c.type <> 'systemauto' " ;
2021-02-23 21:03:23 +00:00
} elseif ( $actioncode == 'AC_ALL_AUTO' ) {
$sql .= " $sqlANDOR c.type = 'systemauto' " ;
} else {
if ( $actioncode == 'AC_OTH' ) {
2023-12-17 20:20:11 +00:00
$sql .= " $sqlANDOR c.type <> 'systemauto' " ;
2021-02-23 21:03:23 +00:00
} elseif ( $actioncode == 'AC_OTH_AUTO' ) {
$sql .= " $sqlANDOR c.type = 'systemauto' " ;
}
}
} else {
if ( $actioncode == 'AC_NON_AUTO' ) {
2023-12-17 20:20:11 +00:00
$sql .= " $sqlANDOR c.type <> 'systemauto' " ;
2021-02-23 21:03:23 +00:00
} elseif ( $actioncode == 'AC_ALL_AUTO' ) {
$sql .= " $sqlANDOR c.type = 'systemauto' " ;
} else {
2025-08-04 11:12:22 +00:00
$sql .= " $sqlANDOR c.code = ' " . $db -> escape ( $actioncode ) . " ' " ;
2020-06-08 14:00:57 +00:00
}
}
2020-06-08 12:43:14 +00:00
2021-09-10 13:45:03 +00:00
return $sql ;
}
/**
2025-11-18 20:25:02 +00:00
* Add more SQL filters for event list
2021-09-10 13:45:03 +00:00
*
* @ param string $sql $sql modified
* @ param string $donetodo donetodo
2024-09-05 14:05:37 +00:00
* @ param int $now now
2024-11-04 11:32:13 +00:00
* @ param array < string , string | string [] > $filters array
2025-03-11 00:43:54 +00:00
* @ return string SQL request
2021-09-10 13:45:03 +00:00
*/
function addOtherFilterSQL ( & $sql , $donetodo , $now , $filters )
{
2023-03-19 09:43:27 +00:00
global $db ;
2021-09-10 13:45:03 +00:00
2021-02-23 21:03:23 +00:00
if ( $donetodo == 'todo' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > ' " . $db -> idate ( $now ) . " ')) " ;
2021-02-23 21:03:23 +00:00
} elseif ( $donetodo == 'done' ) {
2025-08-04 11:12:22 +00:00
$sql .= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= ' " . $db -> idate ( $now ) . " ')) " ;
2021-02-23 21:03:23 +00:00
}
2025-11-18 20:25:02 +00:00
if ( is_array ( $filters ) && isset ( $filters [ 'search_complete' ]) && $filters [ 'search_complete' ] === 'na' ) {
$sql .= " AND a.percent = -1 " ;
}
if ( is_array ( $filters ) && isset ( $filters [ 'search_complete' ]) && $filters [ 'search_complete' ] === '0' ) {
$sql .= " AND a.percent = 0 " ;
}
if ( is_array ( $filters ) && isset ( $filters [ 'search_complete' ]) && $filters [ 'search_complete' ] === '50' ) {
$sql .= " AND a.percent > 0 AND a.percent < 100 " ;
}
if ( is_array ( $filters ) && isset ( $filters [ 'search_complete' ]) && $filters [ 'search_complete' ] === 'todo' ) {
$sql .= " AND a.percent >= 0 AND a.percent < 100 " ;
}
if ( is_array ( $filters ) && isset ( $filters [ 'search_complete' ]) && $filters [ 'search_complete' ] === '100' ) {
$sql .= " AND a.percent = 100 " ;
}
2023-02-21 15:14:14 +00:00
if ( is_array ( $filters ) && ! empty ( $filters [ 'search_agenda_label' ])) {
2021-02-23 21:03:23 +00:00
$sql .= natural_search ( 'a.label' , $filters [ 'search_agenda_label' ]);
}
2023-02-21 15:14:14 +00:00
if ( is_array ( $filters ) && ! empty ( $filters [ 'search_rowid' ])) {
2023-02-20 00:32:45 +00:00
$sql .= natural_search ( 'a.id' , $filters [ 'search_rowid' ], 1 );
}
2026-03-04 15:52:48 +00:00
if ( is_array ( $filters ) && ! empty ( $filters [ 'search_filtert' ]) && (( int ) $filters [ 'search_filtert' ]) != - 1 ) {
2026-02-12 00:22:01 +00:00
$sql .= natural_search ( 'a.fk_user_action' , $filters [ 'search_filtert' ], 1 );
}
2020-07-01 12:04:41 +00:00
2020-09-07 08:18:17 +00:00
return $sql ;
2020-06-08 12:43:14 +00:00
}
2020-06-08 13:58:20 +00:00
/**
2020-10-27 23:34:59 +00:00
* Add Mailing Event Type SQL
2020-06-08 13:58:20 +00:00
*
2020-10-27 23:34:59 +00:00
* @ param string $actioncode Action code
2026-04-13 10:50:23 +00:00
* @ param Contact $objcon objcon
2025-03-11 00:43:54 +00:00
* @ param ? Object $filterobj filterobj
2020-10-27 23:34:59 +00:00
* @ return string
2020-06-08 13:58:20 +00:00
*/
2020-06-08 14:00:57 +00:00
function addMailingEventTypeSQL ( $actioncode , $objcon , $filterobj )
{
2023-03-19 09:43:27 +00:00
global $db ;
2020-09-07 08:18:17 +00:00
2023-03-19 09:43:27 +00: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.
if ( isModEnabled ( 'mailing' ) && ! empty ( $objcon -> email ) && ( empty ( $actioncode ) || $actioncode == 'AC_OTH_AUTO' || $actioncode == 'AC_EMAILING' )) {
2020-09-07 08:18:17 +00:00
$sql2 = " SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type " ;
2021-12-10 10:40:25 +00:00
$sql2 .= " , null as fk_element, '' as elementtype, null as contact_id " ;
2025-01-21 13:08:52 +00:00
$sql2 .= " , 'AC_EMAILING' as code, 'AC_EMAILING' as acode, '' as alabel, '' as apicto " ;
2020-09-07 08:18:17 +00:00
$sql2 .= " , 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
2021-02-23 21:03:23 +00:00
if ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Societe' ) {
$sql2 .= " , '' as lastname, '' as firstname " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Adherent' ) {
$sql2 .= " , '' as lastname, '' as firstname " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'CommandeFournisseur' ) {
$sql2 .= " , '' as ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Product' ) {
$sql2 .= " , '' as ref " ;
} elseif ( is_object ( $filterobj ) && get_class ( $filterobj ) == 'Ticket' ) {
$sql2 .= " , '' as ref " ;
}
2025-08-04 11:12:22 +00:00
$sql2 .= " FROM " . MAIN_DB_PREFIX . " mailing as m, " . MAIN_DB_PREFIX . " mailing_cibles as mc, " . MAIN_DB_PREFIX . " user as u " ;
$sql2 .= " WHERE mc.email = ' " . $db -> escape ( $objcon -> email ) . " ' " ; // Search is done on email.
2020-09-07 08:18:17 +00:00
$sql2 .= " AND mc.statut = 1 " ;
$sql2 .= " AND u.rowid = m.fk_user_valid " ;
$sql2 .= " AND mc.fk_mailing=m.rowid " ;
2023-03-19 09:43:27 +00:00
2020-09-07 08:18:17 +00:00
return $sql2 ;
2023-03-19 09:43:27 +00:00
} else {
return '' ;
2020-09-07 08:18:17 +00:00
}
2020-06-08 12:43:14 +00:00
}
2023-03-30 08:18:43 +00:00
2025-02-12 21:46:09 +00:00
/**
2025-04-08 10:02:07 +00:00
* Show the header of a company in HTML public pages
2025-02-12 21:46:09 +00:00
*
* @ param Societe $mysoc Third party
* @ param Translate $langs Output language
2025-04-08 11:51:35 +00:00
* @ param int | string $showlogo '1' = Show logo or 'url' for click on logo
2025-04-08 10:49:19 +00:00
* @ param string $alttext Text to show in header
* @ param string $subimageconst Constant to check if we must add image under the main header
2025-04-08 10:02:07 +00:00
* @ param string $altlogo1 To use an alternative logo defined into setup ( instead of company logo )
* @ param string $altlogo2 To use an alternative logo defined into setup ( instead of company logo )
2025-02-12 21:46:09 +00:00
* @ return void
*/
2025-04-08 11:51:35 +00:00
function htmlPrintOnlineHeader ( $mysoc , $langs , $showlogo = 1 , $alttext = '' , $subimageconst = '' , $altlogo1 = '' , $altlogo2 = '' )
2025-02-12 21:46:09 +00:00
{
2025-04-08 10:02:07 +00:00
global $conf , $dolibarr_main_url_root ;
// Set logo of company by default
$logosmall = $mysoc -> logo_small ;
$logo = $mysoc -> logo ;
if ( $altlogo1 && getDolGlobalString ( $altlogo1 )) {
$logosmall = getDolGlobalString ( $altlogo1 );
} elseif ( $altlogo2 && getDolGlobalString ( $altlogo2 )) {
$logosmall = getDolGlobalString ( $altlogo2 );
}
2025-04-08 12:12:08 +00:00
// Define $urllogo and $urllogopublic
//$urllogo = '';
$urllogopublic = '' ;
2025-04-08 10:49:19 +00:00
if ( $showlogo ) {
2025-08-04 11:12:22 +00:00
if ( ! empty ( $mysoc -> logo_small ) && is_readable ( $conf -> mycompany -> dir_output . '/logos/thumbs/' . $logosmall )) {
2025-04-08 12:12:08 +00:00
//$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$logosmall);
2025-08-04 11:12:22 +00:00
$urllogopublic = $dolibarr_main_url_root . '/viewimage.php?modulepart=mycompany&entity=' . $conf -> entity . '&file=' . urlencode ( 'logos/thumbs/' . $logosmall );
} elseif ( ! empty ( $mysoc -> logo ) && is_readable ( $conf -> mycompany -> dir_output . '/logos/' . $logo )) {
2025-04-08 12:12:08 +00:00
//$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$logo);
2025-08-04 11:12:22 +00:00
$urllogopublic = $dolibarr_main_url_root . '/viewimage.php?modulepart=mycompany&entity=' . $conf -> entity . '&file=' . urlencode ( 'logos/' . $logo );
} elseif ( is_readable ( DOL_DOCUMENT_ROOT . '/theme/dolibarr_logo.svg' )) {
2025-04-08 12:12:08 +00:00
//$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
2025-08-04 11:12:22 +00:00
$urllogopublic = $dolibarr_main_url_root . '/theme/dolibarr_logo.svg' ;
2025-04-08 10:49:19 +00:00
}
2025-02-12 21:46:09 +00:00
}
print '<header class="center">' ;
// Output html code for logo
2025-04-08 12:12:08 +00:00
if ( $urllogopublic || $alttext ) {
2025-04-08 10:49:19 +00:00
print '<div class="backgreypublicpayment">' ;
print '<div class="logopublicpayment">' ;
2025-04-08 12:12:08 +00:00
if ( $urllogopublic ) {
2025-04-08 10:49:19 +00:00
if ( ! is_numeric ( $showlogo )) {
2025-08-04 11:12:22 +00:00
print '<a href="' . $showlogo . '">' ;
2025-04-08 10:49:19 +00:00
}
2025-08-04 11:12:22 +00:00
print '<img id="dolpaymentlogo" src="' . $urllogopublic . '">' ;
2025-04-08 10:49:19 +00:00
if ( ! is_numeric ( $showlogo )) {
print '</a>' ;
}
}
if ( $alttext ) {
2025-08-04 11:12:22 +00:00
print '<div class="clearboth"></div><strong>' . $alttext . '</strong>' ;
2025-04-08 10:49:19 +00:00
}
print '</div>' ;
if ( ! getDolGlobalString ( 'MAIN_HIDE_POWERED_BY' )) {
2025-08-04 11:12:22 +00:00
print '<div class="poweredbypublicpayment opacitymedium right hideonsmartphone"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">' . $langs -> trans ( " PoweredBy " ) . '<br><img class="poweredbyimg" src="' . DOL_URL_ROOT . '/theme/dolibarr_logo.svg" width="80px"></a></div>' ;
2025-04-08 10:49:19 +00:00
}
print '</div>' ;
2025-02-12 21:46:09 +00:00
}
2025-04-08 12:12:08 +00:00
// Add an optional image under the ban with logo/title
2025-04-08 10:49:19 +00:00
if ( getDolGlobalString ( $subimageconst )) {
print '<div class="backimagepublicsubimage">' ;
2025-08-04 11:12:22 +00:00
print '<img id="id' . $subimageconst . '" src="' . getDolGlobalString ( $subimageconst ) . '">' ;
2025-02-12 21:46:09 +00:00
print '</div>' ;
}
print '</header>' ;
}
2023-03-30 08:18:43 +00:00
/**
2025-02-12 21:46:09 +00:00
* Show footer of company in HTML public pages
2023-03-30 08:18:43 +00:00
*
* @ param Societe $fromcompany Third party
* @ param Translate $langs Output language
* @ param int $addformmessage Add the payment form message
* @ param string $suffix Suffix to use on constants
2024-11-04 11:32:13 +00:00
* @ param null | CommonObject | CommonHookActions $object Object related to payment
2023-03-30 08:18:43 +00:00
* @ return void
*/
function htmlPrintOnlineFooter ( $fromcompany , $langs , $addformmessage = 0 , $suffix = '' , $object = null )
{
$reg = array ();
// Juridical status
$line1 = " " ;
if ( $fromcompany -> forme_juridique_code ) {
2025-08-04 11:12:22 +00:00
$line1 .= ( $line1 ? " - " : " " ) . getFormeJuridiqueLabel (( string ) $fromcompany -> forme_juridique_code );
2023-03-30 08:18:43 +00:00
}
// Capital
if ( $fromcompany -> capital ) {
2025-11-18 11:03:23 +00:00
$line1 .= ( $line1 ? " - " : " " ) . $langs -> transnoentities ( " CapitalOf " , ( string ) $fromcompany -> capital ) . " " . $langs -> transnoentities ( " Currency " . getDolCurrency ());
2023-03-30 08:18:43 +00:00
}
// Prof Id 1
if ( $fromcompany -> idprof1 && ( $fromcompany -> country_code != 'FR' || ! $fromcompany -> idprof2 )) {
$field = $langs -> transcountrynoentities ( " ProfId1 " , $fromcompany -> country_code );
if ( preg_match ( '/\((.*)\)/i' , $field , $reg )) {
$field = $reg [ 1 ];
}
2025-08-04 11:12:22 +00:00
$line1 .= ( $line1 ? " - " : " " ) . $field . " : " . $fromcompany -> idprof1 ;
2023-03-30 08:18:43 +00:00
}
// Prof Id 2
if ( $fromcompany -> idprof2 ) {
$field = $langs -> transcountrynoentities ( " ProfId2 " , $fromcompany -> country_code );
if ( preg_match ( '/\((.*)\)/i' , $field , $reg )) {
$field = $reg [ 1 ];
}
2025-08-04 11:12:22 +00:00
$line1 .= ( $line1 ? " - " : " " ) . $field . " : " . $fromcompany -> idprof2 ;
2023-03-30 08:18:43 +00:00
}
// Second line of company infos
$line2 = " " ;
// Prof Id 3
if ( $fromcompany -> idprof3 ) {
$field = $langs -> transcountrynoentities ( " ProfId3 " , $fromcompany -> country_code );
if ( preg_match ( '/\((.*)\)/i' , $field , $reg )) {
$field = $reg [ 1 ];
}
2025-08-04 11:12:22 +00:00
$line2 .= ( $line2 ? " - " : " " ) . $field . " : " . $fromcompany -> idprof3 ;
2023-03-30 08:18:43 +00:00
}
// Prof Id 4
if ( $fromcompany -> idprof4 ) {
$field = $langs -> transcountrynoentities ( " ProfId4 " , $fromcompany -> country_code );
if ( preg_match ( '/\((.*)\)/i' , $field , $reg )) {
$field = $reg [ 1 ];
}
2025-08-04 11:12:22 +00:00
$line2 .= ( $line2 ? " - " : " " ) . $field . " : " . $fromcompany -> idprof4 ;
2023-03-30 08:18:43 +00:00
}
// IntraCommunautary VAT
if ( $fromcompany -> tva_intra != '' ) {
2025-08-04 11:12:22 +00:00
$line2 .= ( $line2 ? " - " : " " ) . $langs -> transnoentities ( " VATIntraShort " ) . " : " . $fromcompany -> tva_intra ;
2023-03-30 08:18:43 +00:00
}
2025-08-04 11:12:22 +00:00
print '<!-- htmlPrintOnlineFooter -->' . " \n " ;
2023-03-30 08:18:43 +00:00
2023-08-23 00:18:31 +00:00
// css centpercent has been removed from class="..." because not compatible with paddingleft/right and there is an horizontal scroll appearring on payment page for example.
2026-03-25 23:10:01 +00:00
print '<footer class="center centpercent opacitymedium paddingbottom">' . " \n " ;
2023-03-30 08:18:43 +00:00
print '<br>' ;
if ( $addformmessage ) {
2025-08-04 11:12:22 +00:00
print '<!-- object = ' . ( empty ( $object ) ? 'undefined' : $object -> element ) . ' -->' ;
2023-03-30 08:18:43 +00:00
print '<br>' ;
2025-08-04 11:12:22 +00:00
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_' . $suffix ;
2023-11-17 10:39:16 +00:00
if ( getDolGlobalString ( $parammessageform ) !== '' ) {
print $langs -> transnoentities ( getDolGlobalString ( $parammessageform ));
} elseif ( getDolGlobalString ( 'ONLINE_PAYMENT_MESSAGE_FORM' ) !== '' ) {
print $langs -> transnoentities ( getDolGlobalString ( 'ONLINE_PAYMENT_MESSAGE_FORM' ));
2023-03-30 08:18:43 +00:00
}
// Add other message if VAT exists
if ( ! empty ( $object -> total_vat ) || ! empty ( $object -> total_tva )) {
2025-08-04 11:12:22 +00:00
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_' . $suffix ;
2023-11-17 10:39:16 +00:00
if ( getDolGlobalString ( $parammessageform ) !== '' ) {
print $langs -> transnoentities ( getDolGlobalString ( $parammessageform ));
} elseif ( getDolGlobalString ( 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT' ) !== '' ) {
print $langs -> transnoentities ( getDolGlobalString ( 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT' ));
2023-03-30 08:18:43 +00:00
}
}
}
2025-08-04 11:12:22 +00:00
print '<span style="font-size: 10px;"><br><hr>' . " \n " ;
print $fromcompany -> name . '<br>' ;
2023-03-30 08:18:43 +00:00
print $line1 ;
2025-08-04 11:12:22 +00:00
if ( strlen ( $line1 . $line2 ) > 50 ) {
2023-03-30 08:18:43 +00:00
print '<br>' ;
} else {
print ' - ' ;
}
print $line2 ;
print '</span>' ;
2025-08-04 11:12:22 +00:00
print '</footer>' . " \n " ;
2023-03-30 08:18:43 +00:00
}