2010-05-03 10:22:35 +02:00
< ? php
2012-07-28 12:35:11 +02:00
/* Copyright ( C ) 2008 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2008 - 2012 Regis Houssin < regis . houssin @ inodbox . com >
2014-07-03 17:39:31 +02:00
* Copyright ( C ) 2014 Juanjo Menent < jmenent @ 2 byte . es >
2017-09-01 17:10:19 +02:00
* Copyright ( C ) 2017 Rui Strecht < rui . strecht @ aliartalentos . com >
2020-04-27 17:35:14 +02:00
* Copyright ( C ) 2020 Open - Dsi < support @ open - dsi . fr >
2024-03-03 16:51:16 +01:00
* Copyright ( C ) 2024 Frédéric France < frederic . france @ free . fr >
2025-02-08 18:30:42 +01:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2010-05-03 10:22:35 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2010-05-03 10:22:35 +02:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2010-05-03 10:22:35 +02:00
*/
/**
2010-06-08 01:52:43 +02:00
* \file htdocs / core / class / html . formcompany . class . php
2010-11-22 10:18:53 +01:00
* \ingroup core
2010-05-03 10:22:35 +02:00
* \brief File of class to build HTML component for third parties management
*/
/**
2012-01-27 15:17:36 +01:00
* Class to build HTML component for third parties management
* Only common components are here .
2010-05-03 10:22:35 +02:00
*/
2018-09-06 21:27:18 +02:00
2023-03-27 12:20:02 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php' ;
2010-05-03 10:22:35 +02:00
2020-05-03 22:47:43 +02:00
/**
* Class of forms component to manage companies
*/
2019-09-03 17:04:42 +02:00
class FormCompany extends Form
{
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2011-06-08 00:05:07 +02:00
* Return list of labels ( translated ) of third parties type
2011-12-29 23:23:31 +01:00
*
2024-09-30 10:05:24 +02:00
* @ param int < 0 , 1 > $mode 0 = Return id + label , 1 = Return code + label
* @ param string $filter Add a SQL filter to select . Data must not come from user input .
* @ return array < string , string > Array of types
2010-05-03 10:22:35 +02:00
*/
2019-02-27 20:45:07 +01:00
public function typent_array ( $mode = 0 , $filter = '' )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-11-13 19:35:39 +01:00
global $langs , $mysoc ;
2010-05-03 10:22:35 +02:00
$effs = array ();
2023-08-06 01:14:36 +02:00
$sql = " SELECT id, code, libelle as label " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_typent " ;
$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . ( empty ( $mysoc -> country_id ) ? '0' : $mysoc -> country_id ) . " ) " ;
2021-02-23 22:03:23 +01:00
if ( $filter ) {
2023-03-27 12:20:02 +02:00
$sql .= " " . $filter ;
2021-02-23 22:03:23 +01:00
}
2019-11-13 19:35:39 +01:00
$sql .= " ORDER by position, id " ;
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . '::typent_array' , LOG_DEBUG );
2019-11-13 19:35:39 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2010-05-03 10:22:35 +02:00
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
2021-02-23 22:03:23 +01:00
while ( $i < $num ) {
2010-05-03 10:22:35 +02:00
$objp = $this -> db -> fetch_object ( $resql );
2021-02-23 22:03:23 +01:00
if ( ! $mode ) {
$key = $objp -> id ;
} else {
$key = $objp -> code ;
}
if ( $langs -> trans ( $objp -> code ) != $objp -> code ) {
$effs [ $key ] = $langs -> trans ( $objp -> code );
} else {
2023-08-06 01:14:36 +02:00
$effs [ $key ] = $objp -> label ;
2021-02-23 22:03:23 +01:00
}
if ( $effs [ $key ] == '-' ) {
$effs [ $key ] = '' ;
}
2010-05-03 10:22:35 +02:00
$i ++ ;
}
$this -> db -> free ( $resql );
}
return $effs ;
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2024-05-09 14:55:50 +02:00
* Return the list of entries for staff ( no translation , it is number ranges )
2011-12-29 23:23:31 +01:00
*
2024-09-30 10:05:24 +02:00
* @ param int < 0 , 1 > $mode 0 = return id + label , 1 = return code + Label
* @ param string $filter Add a SQL filter to select . Data must not come from user input .
* @ return array < string , string > Array of types d ' effectifs
2010-05-03 10:22:35 +02:00
*/
2019-02-27 20:45:07 +01:00
public function effectif_array ( $mode = 0 , $filter = '' )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2010-05-03 10:22:35 +02:00
$effs = array ();
2023-08-06 01:14:36 +02:00
$sql = " SELECT id, code, libelle as label " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_effectif " ;
2019-11-13 19:35:39 +01:00
$sql .= " WHERE active = 1 " ;
2021-02-23 22:03:23 +01:00
if ( $filter ) {
2023-03-27 12:20:02 +02:00
$sql .= " " . $filter ;
2021-02-23 22:03:23 +01:00
}
2010-05-03 10:22:35 +02:00
$sql .= " ORDER BY id ASC " ;
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . '::effectif_array' , LOG_DEBUG );
2019-11-13 19:35:39 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2010-05-03 10:22:35 +02:00
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
2021-02-23 22:03:23 +01:00
while ( $i < $num ) {
2010-05-03 10:22:35 +02:00
$objp = $this -> db -> fetch_object ( $resql );
2021-02-23 22:03:23 +01:00
if ( ! $mode ) {
$key = $objp -> id ;
} else {
$key = $objp -> code ;
}
2010-05-03 10:22:35 +02:00
2024-09-30 10:05:24 +02:00
$effs [ $key ] = $objp -> label != '-' ? ( string ) $objp -> label : '' ;
2010-05-03 10:22:35 +02:00
$i ++ ;
}
$this -> db -> free ( $resql );
}
2024-03-16 11:17:00 +01:00
//return natural sorted list
natsort ( $effs );
2024-09-30 10:05:24 +02:00
'@phan-var-force array<string,string> $effs' ;
2010-05-03 10:22:35 +02:00
return $effs ;
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2011-12-29 23:23:31 +01:00
* Affiche formulaire de selection des modes de reglement
*
* @ param int $page Page
* @ param int $selected Id or code preselected
* @ param string $htmlname Nom du formulaire select
* @ param int $empty Add empty value in list
* @ return void
2010-05-03 10:22:35 +02:00
*/
2024-02-28 20:36:53 +01:00
public function form_prospect_level ( $page , $selected = 0 , $htmlname = 'prospect_level_id' , $empty = 0 )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2017-01-23 10:23:24 +01:00
global $user , $langs ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
print '<form method="post" action="' . $page . '">' ;
2010-05-03 10:22:35 +02:00
print '<input type="hidden" name="action" value="setprospectlevel">' ;
2023-03-27 12:20:02 +02:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . '::form_prospect_level' , LOG_DEBUG );
2010-05-03 10:22:35 +02:00
$sql = " SELECT code, label " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_prospectlevel " ;
2019-11-13 19:35:39 +01:00
$sql .= " WHERE active > 0 " ;
$sql .= " ORDER BY sortorder " ;
2010-05-03 10:22:35 +02:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2016-04-16 21:33:23 +02:00
$options = array ();
2010-05-03 10:22:35 +02:00
2016-04-16 21:33:23 +02:00
if ( $empty ) {
$options [ '' ] = '' ;
}
2010-05-03 10:22:35 +02:00
2016-04-16 21:33:23 +02:00
while ( $obj = $this -> db -> fetch_object ( $resql )) {
$level = $langs -> trans ( $obj -> code );
if ( $level == $obj -> code ) {
$level = $langs -> trans ( $obj -> label );
}
$options [ $obj -> code ] = $level ;
2010-05-03 10:22:35 +02:00
}
2016-04-16 21:33:23 +02:00
print Form :: selectarray ( $htmlname , $options , $selected );
2021-02-23 22:03:23 +01:00
} else {
dol_print_error ( $this -> db );
}
if ( ! empty ( $htmlname ) && $user -> admin ) {
2023-03-27 12:20:02 +02:00
print ' ' . info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
2021-02-23 22:03:23 +01:00
}
2023-03-27 12:20:02 +02:00
print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs -> trans ( " Modify " ) . '">' ;
2016-09-26 00:10:29 +02:00
print '</form>' ;
2010-05-03 10:22:35 +02:00
}
2010-10-31 21:09:50 +01:00
2020-04-27 17:35:14 +02:00
/**
* Affiche formulaire de selection des niveau de prospection pour les contacts
*
* @ param int $page Page
* @ param int $selected Id or code preselected
* @ param string $htmlname Nom du formulaire select
* @ param int $empty Add empty value in list
* @ return void
*/
2024-02-28 20:36:53 +01:00
public function formProspectContactLevel ( $page , $selected = 0 , $htmlname = 'prospect_contact_level_id' , $empty = 0 )
2020-04-27 17:35:14 +02:00
{
global $user , $langs ;
2023-03-27 12:20:02 +02:00
print '<form method="post" action="' . $page . '">' ;
2020-04-27 17:35:14 +02:00
print '<input type="hidden" name="action" value="setprospectcontactlevel">' ;
2023-03-27 12:20:02 +02:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2020-04-27 17:35:14 +02:00
2020-04-27 18:01:07 +02:00
dol_syslog ( __METHOD__ , LOG_DEBUG );
2020-04-27 17:35:14 +02:00
$sql = " SELECT code, label " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_prospectcontactlevel " ;
2020-04-27 18:01:07 +02:00
$sql .= " WHERE active > 0 " ;
$sql .= " ORDER BY sortorder " ;
2020-04-27 17:35:14 +02:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2020-04-27 17:35:14 +02:00
$options = array ();
2021-02-23 22:03:23 +01:00
if ( $empty ) {
2020-04-27 17:35:14 +02:00
$options [ '' ] = '' ;
}
2021-02-23 22:03:23 +01:00
while ( $obj = $this -> db -> fetch_object ( $resql )) {
2020-04-27 17:35:14 +02:00
$level = $langs -> trans ( $obj -> code );
2021-02-23 22:03:23 +01:00
if ( $level == $obj -> code ) {
2020-04-27 17:35:14 +02:00
$level = $langs -> trans ( $obj -> label );
}
$options [ $obj -> code ] = $level ;
}
print Form :: selectarray ( $htmlname , $options , $selected );
2021-02-23 22:03:23 +01:00
} else {
dol_print_error ( $this -> db );
}
if ( ! empty ( $htmlname ) && $user -> admin ) {
2023-03-27 12:20:02 +02:00
print ' ' . info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
2020-04-27 17:35:14 +02:00
}
2023-03-27 12:20:02 +02:00
print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs -> trans ( " Modify " ) . '">' ;
2020-04-27 17:35:14 +02:00
print '</form>' ;
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2019-02-21 19:50:03 +01:00
* Returns the drop - down list of departments / provinces / cantons for all countries or for a given country .
2020-09-07 10:18:17 +02:00
* In the case of an all - country list , the display breaks on the country .
* The key of the list is the code ( there can be several entries for a given code but in this case , the country field differs ) .
* Thus the links with the departments are done on a department independently of its name .
2011-12-29 23:23:31 +01:00
*
2025-02-08 18:30:42 +01:00
* @ param string $selected Code state preselected
* @ param int | string $country_codeid 0 = list for all countries , otherwise country code or country rowid to show
* @ param string $htmlname Id of department
2011-12-29 23:23:31 +01:00
* @ return void
2010-05-03 10:22:35 +02:00
*/
2019-02-27 20:45:07 +01:00
public function select_departement ( $selected = '' , $country_codeid = 0 , $htmlname = 'state_id' )
2010-09-01 22:51:10 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-01-27 11:55:16 +01:00
print $this -> select_state ( $selected , $country_codeid , $htmlname );
2010-09-01 22:51:10 +02:00
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-09-01 22:51:10 +02:00
/**
2019-02-21 19:50:03 +01:00
* Returns the drop - down list of departments / provinces / cantons for all countries or for a given country .
2020-09-07 10:18:17 +02:00
* In the case of an all - country list , the display breaks on the country .
* The key of the list is the code ( there can be several entries for a given code but in this case , the country field differs ) .
* Thus the links with the departments are done on a department independently of its name .
2011-12-29 23:23:31 +01:00
*
2025-02-08 18:30:42 +01:00
* @ param int $selected Code state preselected ( must be state id )
* @ param int | string $country_codeid Country code or id : 0 = list for all countries , otherwise country code or country rowid to show
* @ param string $htmlname Id of department . If '' , we want only the string with < option >
* @ param string $morecss Add more css
* @ return string String with HTML select
2019-04-04 18:33:12 +02:00
* @ see select_country ()
2010-09-01 22:51:10 +02:00
*/
2021-12-10 15:57:10 +01:00
public function select_state ( $selected = 0 , $country_codeid = 0 , $htmlname = 'state_id' , $morecss = 'maxwidth200onsmartphone minwidth300' )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-11-13 19:35:39 +01:00
global $conf , $langs , $user ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . " ::select_departement selected= " . $selected . " , country_codeid= " . $country_codeid , LOG_DEBUG );
2010-05-03 10:22:35 +02:00
$langs -> load ( " dict " );
2010-10-31 21:09:50 +01:00
2019-11-13 19:35:39 +01:00
$out = '' ;
2010-05-03 10:22:35 +02:00
2024-01-13 19:48:20 +01:00
// Search departements/cantons/province active d'une region et pays actif
2017-09-01 16:53:06 +02:00
$sql = " SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM " ;
2023-03-27 12:20:02 +02:00
$sql .= " " . $this -> db -> prefix () . " c_departements as d, " . $this -> db -> prefix () . " c_regions as r, " . $this -> db -> prefix () . " c_country as c " ;
2014-08-10 13:37:39 +02:00
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid " ;
$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1 " ;
2021-02-23 22:03:23 +01:00
if ( $country_codeid && is_numeric ( $country_codeid )) {
2023-03-27 12:20:02 +02:00
$sql .= " AND c.rowid = ' " . $this -> db -> escape ( $country_codeid ) . " ' " ;
2021-02-23 22:03:23 +01:00
}
if ( $country_codeid && ! is_numeric ( $country_codeid )) {
2023-03-27 12:20:02 +02:00
$sql .= " AND c.code = ' " . $this -> db -> escape ( $country_codeid ) . " ' " ;
2021-02-23 22:03:23 +01:00
}
2014-08-10 13:37:39 +02:00
$sql .= " ORDER BY c.code, d.code_departement " ;
2010-05-03 10:22:35 +02:00
2019-11-13 19:35:39 +01:00
$result = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $result ) {
if ( ! empty ( $htmlname )) {
2023-03-27 12:20:02 +02:00
$out .= '<select id="' . $htmlname . '" class="flat' . ( $morecss ? ' ' . $morecss : '' ) . '" name="' . $htmlname . '">' ;
2021-02-23 22:03:23 +01:00
}
if ( $country_codeid ) {
$out .= '<option value="0"> </option>' ;
}
2010-05-03 10:22:35 +02:00
$num = $this -> db -> num_rows ( $result );
$i = 0 ;
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . " ::select_departement num= " . $num , LOG_DEBUG );
2021-02-23 22:03:23 +01:00
if ( $num ) {
2019-11-13 19:35:39 +01:00
$country = '' ;
2021-02-23 22:03:23 +01:00
while ( $i < $num ) {
2010-05-03 10:22:35 +02:00
$obj = $this -> db -> fetch_object ( $result );
2021-02-23 22:03:23 +01:00
if ( $obj -> code == '0' ) { // Le code peut etre une chaine
2019-11-13 19:35:39 +01:00
$out .= '<option value="0"> </option>' ;
2020-05-21 15:05:19 +02:00
} else {
2021-02-23 22:03:23 +01:00
if ( ! $country || $country != $obj -> country ) {
2021-04-25 15:09:56 +02:00
// Show break if we are in list with multiple countries
2021-02-23 22:03:23 +01:00
if ( ! $country_codeid && $obj -> country_code ) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="-1" disabled data-html="----- ' . $obj -> country . ' -----">----- ' . $obj -> country . " -----</option> \n " ;
2019-11-13 19:35:39 +01:00
$country = $obj -> country ;
2010-05-03 10:22:35 +02:00
}
}
2021-02-23 22:03:23 +01:00
if ( ! empty ( $selected ) && $selected == $obj -> rowid ) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $obj -> rowid . '" selected>' ;
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $obj -> rowid . '">' ;
2010-05-03 10:22:35 +02:00
}
2017-09-18 17:48:13 +02:00
2024-01-13 19:48:20 +01:00
// Si traduction existe, on l'utilise, sinon on prend le libelle par default
2023-03-27 12:20:02 +02:00
if (
2023-11-27 11:24:19 +01:00
getDolGlobalString ( 'MAIN_SHOW_STATE_CODE' ) &&
2024-07-03 18:35:19 +02:00
( getDolGlobalInt ( 'MAIN_SHOW_STATE_CODE' ) == 1 || getDolGlobalInt ( 'MAIN_SHOW_STATE_CODE' ) == 2 || getDolGlobalString ( 'MAIN_SHOW_STATE_CODE' ) === 'all' )
2023-03-27 12:20:02 +02:00
) {
2023-10-08 23:19:49 +02:00
if ( getDolGlobalInt ( 'MAIN_SHOW_REGION_IN_STATE_SELECT' ) == 1 ) {
2023-03-27 12:20:02 +02:00
$out .= $obj -> region_name . ' - ' . $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
$out .= $obj -> code . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2017-09-18 17:48:13 +02:00
}
2020-05-21 15:05:19 +02:00
} else {
2023-10-08 23:19:49 +02:00
if ( getDolGlobalInt ( 'MAIN_SHOW_REGION_IN_STATE_SELECT' ) == 1 ) {
2023-03-27 12:20:02 +02:00
$out .= $obj -> region_name . ' - ' . ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2020-05-21 15:05:19 +02:00
} else {
2019-11-13 19:35:39 +01:00
$out .= ( $langs -> trans ( $obj -> code ) != $obj -> code ? $langs -> trans ( $obj -> code ) : ( $obj -> name != '-' ? $obj -> name : '' ));
2017-09-18 17:48:13 +02:00
}
2017-09-01 16:53:06 +02:00
}
2017-09-18 17:48:13 +02:00
2019-11-13 19:35:39 +01:00
$out .= '</option>' ;
2010-05-03 10:22:35 +02:00
}
$i ++ ;
}
}
2021-02-23 22:03:23 +01:00
if ( ! empty ( $htmlname )) {
$out .= '</select>' ;
}
if ( ! empty ( $htmlname ) && $user -> admin ) {
2023-03-27 12:20:02 +02:00
$out .= ' ' . info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
2021-02-23 22:03:23 +01:00
}
2020-05-21 15:05:19 +02:00
} else {
2010-05-03 10:22:35 +02:00
dol_print_error ( $this -> db );
}
2010-10-31 21:09:50 +01:00
2018-08-13 16:44:49 +02:00
// Make select dynamic
2021-02-23 22:03:23 +01:00
if ( ! empty ( $htmlname )) {
2023-03-27 12:20:02 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php' ;
2018-08-13 16:44:49 +02:00
$out .= ajax_combobox ( $htmlname );
}
2015-05-31 12:25:33 +02:00
2010-09-01 22:51:10 +02:00
return $out ;
2010-05-03 10:22:35 +02:00
}
2022-05-21 18:54:38 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop - down list of departments / provinces / cantons for all countries or for a given country .
* In the case of an all - country list , the display breaks on the country .
* The key of the list is the code ( there can be several entries for a given code but in this case , the country field differs ) .
* Thus the links with the departments are done on a department independently of its name .
*
2024-09-23 00:37:30 +02:00
* @ param string $parent_field_id Parent select name to monitor
* @ param int $selected Code state preselected ( must be state id )
* @ param int $country_codeid Country code or id : 0 = list for all countries , otherwise country code or country rowid to show
2022-05-21 18:54:38 +02:00
* @ param string $htmlname Id of department . If '' , we want only the string with < option >
* @ param string $morecss Add more css
* @ return string String with HTML select
* @ see select_country ()
*/
2022-05-21 19:00:45 +02:00
public function select_state_ajax ( $parent_field_id = 'country_id' , $selected = 0 , $country_codeid = 0 , $htmlname = 'state_id' , $morecss = 'maxwidth200onsmartphone minwidth300' )
2022-05-21 18:54:38 +02:00
{
$html = '<script>' ;
2024-08-07 01:20:43 +02:00
$html .= '$("select[name=\"' . $parent_field_id . ' \ " ] " ) . change ( function (){
2022-05-21 19:00:45 +02:00
$ . ajax ( " '.dol_buildpath('/core/ajax/ziptown.php', 2).' " , { data : { selected : $ ( " select[name= \" '. $htmlname .' \" ] " ) . val (), country_codeid : $ ( this ) . val (), htmlname : " '. $htmlname .' " , morecss : " '. $morecss .' " } } )
2022-05-21 18:54:38 +02:00
. done ( function ( msg ) {
$ ( " span#target_'. $htmlname .' " ) . html ( msg );
})
}); ' ;
2022-05-21 19:00:45 +02:00
return $html . '</script><span id="target_' . $htmlname . '">' . $this -> select_state ( $selected , $country_codeid , $htmlname , $morecss ) . '</span>' ;
2022-05-21 18:54:38 +02:00
}
2010-05-03 10:22:35 +02:00
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2024-08-07 01:20:43 +02:00
* Provides the dropdown of the active regions including the actif country .
* The key of the list is the code ( there may be more than one entry for a
* code but in that case the fields country and language are different ) .
2011-12-29 23:23:31 +01:00
* un code donnee mais dans ce cas , le champ pays et lang differe ) .
2024-08-07 01:20:43 +02:00
* This way the links with the regions are made independent of its name .
2011-12-29 23:23:31 +01:00
*
* @ param string $selected Preselected value
* @ param string $htmlname Name of HTML select field
* @ return void
2010-05-03 10:22:35 +02:00
*/
2019-02-27 20:45:07 +01:00
public function select_region ( $selected = '' , $htmlname = 'region_id' )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-11-13 19:35:39 +01:00
global $conf , $langs ;
2010-05-03 10:22:35 +02:00
$langs -> load ( " dict " );
2014-08-17 17:47:25 +02:00
$sql = " SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_regions as r, " . $this -> db -> prefix () . " c_country as c " ;
2019-11-13 19:35:39 +01:00
$sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1 " ;
$sql .= " ORDER BY c.code, c.label ASC " ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . " ::select_region " , LOG_DEBUG );
2019-11-13 19:35:39 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2023-03-27 12:20:02 +02:00
print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">' ;
2010-05-03 10:22:35 +02:00
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
2021-02-23 22:03:23 +01:00
if ( $num ) {
2019-11-13 19:35:39 +01:00
$country = '' ;
2021-02-23 22:03:23 +01:00
while ( $i < $num ) {
2010-05-03 10:22:35 +02:00
$obj = $this -> db -> fetch_object ( $resql );
if ( $obj -> code == 0 ) {
print '<option value="0"> </option>' ;
2020-05-21 15:05:19 +02:00
} else {
2021-02-23 22:03:23 +01:00
if ( $country == '' || $country != $obj -> country ) {
2010-05-03 10:22:35 +02:00
// Show break
2023-03-27 12:20:02 +02:00
$key = $langs -> trans ( " Country " . strtoupper ( $obj -> country_code ));
$valuetoshow = ( $key != " Country " . strtoupper ( $obj -> country_code )) ? $obj -> country_code . " - " . $key : $obj -> country ;
print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option> \n " ;
2019-11-13 19:35:39 +01:00
$country = $obj -> country ;
2010-05-03 10:22:35 +02:00
}
2021-02-23 22:03:23 +01:00
if ( $selected > 0 && $selected == $obj -> code ) {
2023-03-27 12:20:02 +02:00
print '<option value="' . $obj -> code . '" selected>' . $obj -> label . '</option>' ;
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
print '<option value="' . $obj -> code . '">' . $obj -> label . '</option>' ;
2010-05-03 10:22:35 +02:00
}
}
$i ++ ;
}
}
print '</select>' ;
2020-10-16 20:17:54 +02:00
print ajax_combobox ( $htmlname );
2020-05-21 15:05:19 +02:00
} else {
2010-05-03 10:22:35 +02:00
dol_print_error ( $this -> db );
}
}
2010-10-31 21:09:50 +01:00
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2011-10-22 15:55:08 +02:00
* Return combo list with people title
*
2019-07-25 17:46:48 +02:00
* @ param string $selected Civility / Title code preselected
2013-06-09 18:29:06 +02:00
* @ param string $htmlname Name of HTML select combo field
2017-06-02 12:27:46 +02:00
* @ param string $morecss Add more css on SELECT element
2020-08-18 11:52:00 +02:00
* @ param int $addjscombo Add js combo
2013-06-09 18:29:06 +02:00
* @ return string String with HTML select
2010-09-01 22:51:10 +02:00
*/
2021-03-17 22:01:25 +01:00
public function select_civility ( $selected = '' , $htmlname = 'civility_id' , $morecss = 'maxwidth150' , $addjscombo = 1 )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-11-13 19:35:39 +01:00
global $conf , $langs , $user ;
2010-05-03 10:22:35 +02:00
$langs -> load ( " dict " );
2010-10-31 21:09:50 +01:00
2019-11-13 19:35:39 +01:00
$out = '' ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
$sql = " SELECT rowid, code, label, active FROM " . $this -> db -> prefix () . " c_civility " ;
2019-11-13 19:35:39 +01:00
$sql .= " WHERE active = 1 " ;
2010-05-03 10:22:35 +02:00
2014-06-12 11:31:53 +02:00
dol_syslog ( " Form::select_civility " , LOG_DEBUG );
2019-11-13 19:35:39 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2023-03-27 12:20:02 +02:00
$out .= '<select class="flat' . ( $morecss ? ' ' . $morecss : '' ) . '" name="' . $htmlname . '" id="' . $htmlname . '">' ;
2019-11-13 19:35:39 +01:00
$out .= '<option value=""> </option>' ;
2010-05-03 10:22:35 +02:00
$num = $this -> db -> num_rows ( $resql );
$i = 0 ;
2021-02-23 22:03:23 +01:00
if ( $num ) {
while ( $i < $num ) {
2010-05-03 10:22:35 +02:00
$obj = $this -> db -> fetch_object ( $resql );
2021-02-23 22:03:23 +01:00
if ( $selected == $obj -> code ) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $obj -> code . '" selected>' ;
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $obj -> code . '">' ;
2010-05-03 10:22:35 +02:00
}
2024-01-13 19:48:20 +01:00
// If translation exists, we use it, otherwise, we use the hard coded label
2023-03-27 12:20:02 +02:00
$out .= ( $langs -> trans ( " Civility " . $obj -> code ) != " Civility " . $obj -> code ? $langs -> trans ( " Civility " . $obj -> code ) : ( $obj -> label != '-' ? $obj -> label : '' ));
2019-11-13 19:35:39 +01:00
$out .= '</option>' ;
2010-05-03 10:22:35 +02:00
$i ++ ;
}
}
2019-11-13 19:35:39 +01:00
$out .= '</select>' ;
2021-02-23 22:03:23 +01:00
if ( $user -> admin ) {
$out .= info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
}
2020-08-18 11:52:00 +02:00
if ( $addjscombo ) {
// Enhance with select2
2023-03-27 12:20:02 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php' ;
2020-08-18 11:52:00 +02:00
$out .= ajax_combobox ( $htmlname );
}
2020-05-21 15:05:19 +02:00
} else {
2010-05-03 10:22:35 +02:00
dol_print_error ( $this -> db );
}
2010-10-31 21:09:50 +01:00
2010-09-01 22:51:10 +02:00
return $out ;
2010-05-03 10:22:35 +02:00
}
2010-10-31 21:09:50 +01:00
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-05-03 10:22:35 +02:00
/**
2024-01-13 19:48:20 +01:00
* Return the list of all juridical entity types for all countries or a specific country .
* A country separator is included in case the list for all countries is returned .
2011-12-29 23:23:31 +01:00
*
2024-09-23 00:37:30 +02:00
* @ param int $selected Preselected code for juridical type
* @ param int $country_codeid 0 = All countries , else the code of the country to display
2011-12-29 23:23:31 +01:00
* @ param string $filter Add a SQL filter on list
* @ return void
2014-05-04 23:46:36 +02:00
* @ deprecated Use print xxx -> select_juridicalstatus instead
2015-04-23 23:21:06 +02:00
* @ see select_juridicalstatus ()
2010-05-03 10:22:35 +02:00
*/
2024-09-23 00:37:30 +02:00
public function select_forme_juridique ( $selected = 0 , $country_codeid = 0 , $filter = '' )
2010-09-01 22:51:10 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2011-12-29 23:23:31 +01:00
print $this -> select_juridicalstatus ( $selected , $country_codeid , $filter );
2010-09-01 22:51:10 +02:00
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-09-01 22:51:10 +02:00
/**
2024-01-13 19:48:20 +01:00
* Return the list of all juridical entity types for all countries or a specific country .
* A country separator is included in case the list for all countries is returned .
2011-12-29 23:23:31 +01:00
*
2024-09-23 00:37:30 +02:00
* @ param int $selected Preselected code of juridical type
2014-05-04 23:46:36 +02:00
* @ param int $country_codeid 0 = list for all countries , otherwise list only country requested
2021-06-14 13:51:09 +02:00
* @ param string $filter Add a SQL filter on list . Data must not come from user input .
2020-09-07 10:18:17 +02:00
* @ param string $htmlname HTML name of select
* @ param string $morecss More CSS
* @ return string String with HTML select
2010-09-01 22:51:10 +02:00
*/
2024-09-23 00:37:30 +02:00
public function select_juridicalstatus ( $selected = 0 , $country_codeid = 0 , $filter = '' , $htmlname = 'forme_juridique_code' , $morecss = '' )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2019-11-13 19:35:39 +01:00
global $conf , $langs , $user ;
2010-05-03 10:22:35 +02:00
$langs -> load ( " dict " );
2010-10-31 21:09:50 +01:00
2019-11-13 19:35:39 +01:00
$out = '' ;
2010-05-03 10:22:35 +02:00
2024-01-13 19:48:20 +01:00
// Lookup the active juridical types for the active countries
2014-08-10 13:37:39 +02:00
$sql = " SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code " ;
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " c_forme_juridique as f, " . $this -> db -> prefix () . " c_country as c " ;
2014-08-10 13:37:39 +02:00
$sql .= " WHERE f.fk_pays=c.rowid " ;
$sql .= " AND f.active = 1 AND c.active = 1 " ;
2021-02-23 22:03:23 +01:00
if ( $country_codeid ) {
2023-03-27 12:20:02 +02:00
$sql .= " AND c.code = ' " . $this -> db -> escape ( $country_codeid ) . " ' " ;
2021-02-23 22:03:23 +01:00
}
if ( $filter ) {
2023-03-27 12:20:02 +02:00
$sql .= " " . $filter ;
2021-02-23 22:03:23 +01:00
}
2014-08-10 13:37:39 +02:00
$sql .= " ORDER BY c.code " ;
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
dol_syslog ( get_class ( $this ) . " ::select_juridicalstatus " , LOG_DEBUG );
2019-11-13 19:35:39 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2019-11-13 19:35:39 +01:00
$out .= '<div id="particulier2" class="visible">' ;
2023-03-27 12:20:02 +02:00
$out .= '<select class="flat minwidth200' . ( $morecss ? ' ' . $morecss : '' ) . '" name="' . $htmlname . '" id="' . $htmlname . '">' ;
2021-02-23 22:03:23 +01:00
if ( $country_codeid ) {
$out .= '<option value="0"> </option>' ; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
}
2014-05-04 23:46:36 +02:00
$num = $this -> db -> num_rows ( $resql );
2021-02-23 22:03:23 +01:00
if ( $num ) {
2014-05-04 23:46:36 +02:00
$i = 0 ;
2021-03-01 20:37:16 +01:00
$country = '' ;
$arraydata = array ();
2021-02-23 22:03:23 +01:00
while ( $i < $num ) {
2014-05-04 23:46:36 +02:00
$obj = $this -> db -> fetch_object ( $resql );
2015-04-01 21:00:51 +02:00
2021-02-23 22:03:23 +01:00
if ( $obj -> code ) { // We exclude empty line, we will add it later
2023-03-27 12:20:02 +02:00
$labelcountry = (( $langs -> trans ( " Country " . $obj -> country_code ) != " Country " . $obj -> country_code ) ? $langs -> trans ( " Country " . $obj -> country_code ) : $obj -> country );
$labeljs = (( $langs -> trans ( " JuridicalStatus " . $obj -> code ) != " JuridicalStatus " . $obj -> code ) ? $langs -> trans ( " JuridicalStatus " . $obj -> code ) : ( $obj -> label != '-' ? $obj -> label : '' )); // $obj->label is already in output charset (converted by database driver)
$arraydata [ $obj -> code ] = array ( 'code' => $obj -> code , 'label' => $labeljs , 'label_sort' => $labelcountry . '_' . $labeljs , 'country_code' => $obj -> country_code , 'country' => $labelcountry );
2015-04-01 21:00:51 +02:00
}
2014-05-04 23:46:36 +02:00
$i ++ ;
}
2010-05-03 10:22:35 +02:00
2019-11-13 19:35:39 +01:00
$arraydata = dol_sort_array ( $arraydata , 'label_sort' , 'ASC' );
2021-02-23 22:03:23 +01:00
if ( empty ( $country_codeid )) { // Introduce empty value (if $country_codeid not empty, empty value was already added)
2023-03-27 12:20:02 +02:00
$arraydata [ 0 ] = array ( 'code' => 0 , 'label' => '' , 'label_sort' => '_' , 'country_code' => '' , 'country' => '' );
2015-04-01 21:00:51 +02:00
}
2014-05-04 23:46:36 +02:00
2021-02-23 22:03:23 +01:00
foreach ( $arraydata as $key => $val ) {
if ( ! $country || $country != $val [ 'country' ]) {
2014-05-04 23:46:36 +02:00
// Show break when we are in multi country mode
2021-02-23 22:03:23 +01:00
if ( empty ( $country_codeid ) && $val [ 'country_code' ]) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val [ 'country' ] . " -----</option> \n " ;
2019-11-13 19:35:39 +01:00
$country = $val [ 'country' ];
2010-05-03 10:22:35 +02:00
}
}
2014-05-04 23:46:36 +02:00
2021-02-23 22:03:23 +01:00
if ( $selected > 0 && $selected == $val [ 'code' ]) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $val [ 'code' ] . '" selected>' ;
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
$out .= '<option value="' . $val [ 'code' ] . '">' ;
2014-05-04 23:46:36 +02:00
}
// If translation exists, we use it, otherwise we use default label in database
2019-11-13 19:35:39 +01:00
$out .= $val [ 'label' ];
$out .= '</option>' ;
2010-05-03 10:22:35 +02:00
}
}
2019-11-13 19:35:39 +01:00
$out .= '</select>' ;
2021-02-23 22:03:23 +01:00
if ( $user -> admin ) {
2023-03-27 12:20:02 +02:00
$out .= ' ' . info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
2021-02-23 22:03:23 +01:00
}
2015-05-31 12:25:33 +02:00
2020-09-07 10:18:17 +02:00
// Make select dynamic
2023-03-27 12:20:02 +02:00
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php' ;
2020-09-07 10:18:17 +02:00
$out .= ajax_combobox ( $htmlname );
2015-05-31 12:25:33 +02:00
2019-11-13 19:35:39 +01:00
$out .= '</div>' ;
2020-05-21 15:05:19 +02:00
} else {
2010-05-03 10:22:35 +02:00
dol_print_error ( $this -> db );
}
2010-10-31 21:09:50 +01:00
2010-09-01 22:51:10 +02:00
return $out ;
2010-05-03 10:22:35 +02:00
}
/**
2014-02-04 20:49:07 +01:00
* Output list of third parties .
2011-12-29 23:23:31 +01:00
*
2013-11-07 21:23:29 +01:00
* @ param object $object Object we try to find contacts
2012-03-14 14:00:20 +01:00
* @ param string $var_id Name of id field
2024-03-03 16:51:16 +01:00
* @ param int $selected Pre - selected third party
2012-03-14 14:00:20 +01:00
* @ param string $htmlname Name of HTML form
2024-09-30 10:05:24 +02:00
* @ param int [] $limitto Disable answers that are not id in this array list
2013-01-02 14:35:16 +01:00
* @ param int $forceid This is to force another object id than object -> id
2020-09-07 10:18:17 +02:00
* @ param string $moreparam String with more param to add into url when noajax search is used .
* @ param string $morecss More CSS on select component
2014-02-04 20:49:07 +01:00
* @ return int The selected third party ID
2010-05-03 10:22:35 +02:00
*/
2024-03-03 16:51:16 +01:00
public function selectCompaniesForNewContact ( $object , $var_id , $selected = 0 , $htmlname = 'newcompany' , $limitto = [], $forceid = 0 , $moreparam = '' , $morecss = '' )
2010-05-03 10:22:35 +02:00
{
2022-03-18 11:11:25 +01:00
global $conf , $hookmanager ;
2010-05-03 10:22:35 +02:00
2023-11-27 11:24:19 +01:00
if ( ! empty ( $conf -> use_javascript_ajax ) && getDolGlobalString ( 'COMPANY_USE_SEARCH_TO_SELECT' )) {
2014-12-05 13:26:47 +01:00
// Use Ajax search
2024-01-05 04:18:53 +01:00
$minLength = ( is_numeric ( getDolGlobalString ( 'COMPANY_USE_SEARCH_TO_SELECT' )) ? $conf -> global -> COMPANY_USE_SEARCH_TO_SELECT : 2 );
2012-02-25 01:34:05 +01:00
2021-03-01 20:37:16 +01:00
$socid = 0 ;
$name = '' ;
2021-02-23 22:03:23 +01:00
if ( $selected > 0 ) {
2019-11-13 19:35:39 +01:00
$tmpthirdparty = new Societe ( $this -> db );
2014-12-05 13:26:47 +01:00
$result = $tmpthirdparty -> fetch ( $selected );
2021-02-23 22:03:23 +01:00
if ( $result > 0 ) {
2014-12-05 13:26:47 +01:00
$socid = $selected ;
$name = $tmpthirdparty -> name ;
2010-05-03 10:22:35 +02:00
}
2014-12-05 13:26:47 +01:00
}
2010-05-03 10:22:35 +02:00
2019-11-13 19:35:39 +01:00
$events = array ();
2016-02-14 23:53:42 +01:00
// Add an entry 'method' to say 'yes, we must execute url with param action = method';
// Add an entry 'url' to say which url to execute
2017-06-02 12:27:46 +02:00
// Add an entry htmlname to say which element we must change once url is called
// Add entry params => array('cssid' => 'attr') to say to remov or add attribute attr if answer of url return 0 or >0 lines
2016-02-14 23:53:42 +01:00
// To refresh contacts list on thirdparty list change
2019-11-13 19:35:39 +01:00
$events [] = array ( 'method' => 'getContacts' , 'url' => dol_buildpath ( '/core/ajax/contacts.php' , 1 ), 'htmlname' => 'contactid' , 'params' => array ( 'add-customer-contact' => 'disabled' ));
2017-06-02 12:27:46 +02:00
2021-02-23 22:03:23 +01:00
if ( count ( $events )) { // If there is some ajax events to run once selection is done, we add code here to run events
2023-03-27 12:20:02 +02:00
print '<script nonce="' . getNonce () . ' " type= " text / javascript " >
2014-12-05 13:26:47 +01:00
jQuery ( document ) . ready ( function () {
2023-03-27 12:20:02 +02:00
$ ( " #search_' . $htmlname . ' " ) . change ( function () {
var obj = ' . json_encode($events) . ' ;
2014-12-05 13:26:47 +01:00
$ . each ( obj , function ( key , values ) {
if ( values . method . length ) {
2023-03-27 12:20:02 +02:00
runJsCodeForEvent ' . $htmlname . ' ( values );
2014-12-05 13:26:47 +01:00
}
});
2018-12-18 09:40:58 +01:00
$ ( this ) . trigger ( " blur " );
2014-12-05 13:26:47 +01:00
});
2017-06-02 12:27:46 +02:00
2014-12-05 13:26:47 +01:00
// Function used to execute events when search_htmlname change
2023-03-27 12:20:02 +02:00
function runJsCodeForEvent ' . $htmlname . ' ( obj ) {
var id = $ ( " #' . $htmlname . ' " ) . val ();
2014-12-05 13:26:47 +01:00
var method = obj . method ;
var url = obj . url ;
var htmlname = obj . htmlname ;
2018-05-22 19:43:28 +02:00
var showempty = obj . showempty ;
2023-03-27 12:20:02 +02:00
console . log ( " Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id= " + id + " method= " + method + " showempty= " + showempty + " url= " + url + " htmlname= " + htmlname );
2014-12-05 13:26:47 +01:00
$ . getJSON ( url ,
{
action : method ,
id : id ,
htmlname : htmlname
},
function ( response ) {
if ( response != null )
{
2017-11-12 13:40:05 +01:00
console . log ( " Change select# " + htmlname + " with content " + response . value )
2014-12-05 13:26:47 +01:00
$ . each ( obj . params , function ( key , action ) {
if ( key . length ) {
var num = response . num ;
if ( num > 0 ) {
$ ( " # " + key ) . removeAttr ( action );
} else {
$ ( " # " + key ) . attr ( action , action );
}
2014-02-04 20:49:07 +01:00
}
});
2014-12-05 13:26:47 +01:00
$ ( " select# " + htmlname ) . html ( response . value );
}
}
);
2022-12-30 18:43:43 +01:00
}
2014-12-05 13:26:47 +01:00
});
</ script > ' ;
}
2010-05-03 10:22:35 +02:00
2023-03-27 12:20:02 +02:00
print " \n " . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . " \n " ;
print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />' ;
2024-09-05 16:05:37 +02:00
print ajax_autocompleter (( string ) ( $socid ? $socid : - 1 ), $htmlname , DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php' , '' , $minLength , 0 );
2014-12-05 13:26:47 +01:00
return $socid ;
2020-05-21 15:05:19 +02:00
} else {
2014-12-05 13:26:47 +01:00
// Search to list thirdparties
2021-10-08 13:17:09 +02:00
$sql = " SELECT s.rowid, s.nom as name " ;
2023-11-27 11:24:19 +01:00
if ( getDolGlobalString ( 'SOCIETE_ADD_REF_IN_LIST' )) {
2021-10-08 13:17:09 +02:00
$sql .= " , s.code_client, s.code_fournisseur " ;
}
2023-11-27 11:24:19 +01:00
if ( getDolGlobalString ( 'COMPANY_SHOW_ADDRESS_SELECTLIST' )) {
2021-10-08 13:17:09 +02:00
$sql .= " , s.address, s.zip, s.town " ;
$sql .= " , dictp.code as country_code " ;
}
2023-03-27 12:20:02 +02:00
$sql .= " FROM " . $this -> db -> prefix () . " societe as s " ;
2023-11-27 11:24:19 +01:00
if ( getDolGlobalString ( 'COMPANY_SHOW_ADDRESS_SELECTLIST' )) {
2023-03-27 12:20:02 +02:00
$sql .= " LEFT JOIN " . $this -> db -> prefix () . " c_country as dictp ON dictp.rowid = s.fk_pays " ;
2021-10-08 13:17:09 +02:00
}
2023-03-27 12:20:02 +02:00
$sql .= " WHERE s.entity IN ( " . getEntity ( 'societe' ) . " ) " ;
2014-12-05 13:26:47 +01:00
// For ajax search we limit here. For combo list, we limit later
2021-02-23 22:03:23 +01:00
if ( is_array ( $limitto ) && count ( $limitto )) {
Qual: Apply automatic phan fixes (deprecations, unneeded imports) (#28154)
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
* Qual: Apply automatic phan fixes (deprecations, unneeded imports)
# Qual: Apply automatic phan fixes (deprecations, unneeded imports)
This applies automatic fixes by phan for deprecated functions, unneeded imports).
2024-02-13 21:46:12 +01:00
$sql .= " AND s.rowid IN ( " . $this -> db -> sanitize ( implode ( ',' , $limitto )) . " ) " ;
2010-05-03 10:22:35 +02:00
}
2022-03-18 11:11:25 +01:00
// Add where from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'selectCompaniesForNewContactListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2019-11-13 19:35:39 +01:00
$sql .= " ORDER BY s.nom ASC " ;
2014-12-05 13:26:47 +01:00
$resql = $this -> db -> query ( $sql );
2021-02-23 22:03:23 +01:00
if ( $resql ) {
2023-03-27 12:20:02 +02:00
print '<select class="flat' . ( $morecss ? ' ' . $morecss : '' ) . '" id="' . $htmlname . '" name="' . $htmlname . '"' ;
2021-02-23 22:03:23 +01:00
if ( $conf -> use_javascript_ajax ) {
2023-03-27 12:20:02 +02:00
$javaScript = " window.location=' " . dol_escape_js ( $_SERVER [ 'PHP_SELF' ]) . " ? " . $var_id . " = " . ( $forceid > 0 ? $forceid : $object -> id ) . $moreparam . " & " . $htmlname . " =' + form. " . $htmlname . " .options[form. " . $htmlname . " .selectedIndex].value; " ;
print ' onChange="' . $javaScript . '"' ;
2014-02-04 20:49:07 +01:00
}
print '>' ;
2021-09-07 23:38:33 +02:00
print '<option value="-1"> </option>' ;
2021-09-08 21:19:01 +02:00
2011-06-13 16:17:44 +02:00
$num = $this -> db -> num_rows ( $resql );
2010-05-03 10:22:35 +02:00
$i = 0 ;
2024-09-30 10:05:24 +02:00
$firstCompany = 0 ; // For static analysis
2021-02-23 22:03:23 +01:00
if ( $num ) {
while ( $i < $num ) {
2011-06-13 16:17:44 +02:00
$obj = $this -> db -> fetch_object ( $resql );
2021-02-23 22:03:23 +01:00
if ( $i == 0 ) {
$firstCompany = $obj -> rowid ;
}
2019-11-13 19:35:39 +01:00
$disabled = 0 ;
2021-02-23 22:03:23 +01:00
if ( is_array ( $limitto ) && count ( $limitto ) && ! in_array ( $obj -> rowid , $limitto )) {
$disabled = 1 ;
}
if ( $selected > 0 && $selected == $obj -> rowid ) {
2023-03-27 12:20:02 +02:00
print '<option value="' . $obj -> rowid . '"' ;
2021-02-23 22:03:23 +01:00
if ( $disabled ) {
print ' disabled' ;
}
2023-07-31 14:17:38 +02:00
print ' selected>' . dol_escape_htmltag ( $obj -> name , 0 , 0 , '' , 0 , 1 ) . '</option>' ;
2010-05-03 10:22:35 +02:00
$firstCompany = $obj -> rowid ;
2020-05-21 15:05:19 +02:00
} else {
2023-03-27 12:20:02 +02:00
print '<option value="' . $obj -> rowid . '"' ;
2021-02-23 22:03:23 +01:00
if ( $disabled ) {
print ' disabled' ;
}
2023-07-31 14:17:38 +02:00
print '>' . dol_escape_htmltag ( $obj -> name , 0 , 0 , '' , 0 , 1 ) . '</option>' ;
2010-05-03 10:22:35 +02:00
}
2019-11-13 19:35:39 +01:00
$i ++ ;
2010-05-03 10:22:35 +02:00
}
}
print " </select> \n " ;
2019-06-03 16:20:04 +02:00
print ajax_combobox ( $htmlname );
2010-05-03 10:22:35 +02:00
return $firstCompany ;
2020-05-21 15:05:19 +02:00
} else {
2014-12-05 13:26:47 +01:00
dol_print_error ( $this -> db );
2019-06-03 16:20:04 +02:00
return 0 ;
2014-12-05 13:26:47 +01:00
}
2010-05-03 10:22:35 +02:00
}
}
2020-09-07 10:18:17 +02:00
/**
* Return a select list with types of contacts
*
2025-01-13 20:04:35 +01:00
* @ param ? Object $object Object to use to find type of contact
2021-09-23 11:33:58 +02:00
* @ param string $selected Default selected value
* @ param string $htmlname HTML select name
* @ param string $source Source ( 'internal' or 'external' )
* @ param string $sortorder Sort criteria ( 'position' , 'code' , ... )
* @ param int $showempty 1 = Add en empty line
* @ param string $morecss Add more css to select component
2024-09-30 10:05:24 +02:00
* @ param int < 0 , 1 > $output 0 = return HTML , 1 = direct print
* @ param int < 0 , 1 > $forcehidetooltip Force hide tooltip for admin
2021-09-23 11:33:58 +02:00
* @ return string | void Depending on $output param , return the HTML select list ( recommended method ) or nothing
2020-09-07 10:18:17 +02:00
*/
2021-02-09 17:52:33 +01:00
public function selectTypeContact ( $object , $selected , $htmlname = 'type' , $source = 'internal' , $sortorder = 'position' , $showempty = 0 , $morecss = '' , $output = 1 , $forcehidetooltip = 0 )
2010-05-03 10:22:35 +02:00
{
2020-09-07 10:18:17 +02:00
global $user , $langs ;
2021-09-23 11:33:58 +02:00
2020-12-11 17:38:38 +01:00
$out = '' ;
2021-02-23 22:03:23 +01:00
if ( is_object ( $object ) && method_exists ( $object , 'liste_type_contact' )) {
2024-09-30 10:05:24 +02:00
'@phan-var-force CommonObject $object' ; // CommonObject has the method.
2024-11-12 03:17:55 +01:00
$lesTypes = $object -> liste_type_contact ( $source , $sortorder , 2 , 1 ); // List of types into c_type_contact for element=$object->element
2020-03-14 14:45:37 +01:00
2023-03-27 12:20:02 +02:00
$out .= '<select class="flat valignmiddle' . ( $morecss ? ' ' . $morecss : '' ) . '" name="' . $htmlname . '" id="' . $htmlname . '">' ;
2021-02-23 22:03:23 +01:00
if ( $showempty ) {
2021-09-16 02:24:25 +02:00
$out .= '<option value="0"> </option>' ;
2021-02-23 22:03:23 +01:00
}
2024-11-12 03:17:55 +01:00
foreach ( $lesTypes as $key => $arrayvalue ) {
$out .= '<option value="' . $key . '" data-code="' . $arrayvalue [ 'code' ] . '"' ;
2021-02-23 22:03:23 +01:00
if ( $key == $selected ) {
$out .= ' selected' ;
}
2024-11-12 03:17:55 +01:00
$out .= '>' . $arrayvalue [ 'label' ] . '</option>' ;
2012-10-31 09:59:24 +01:00
}
2020-12-11 17:38:38 +01:00
$out .= " </select> " ;
2021-02-23 22:03:23 +01:00
if ( $user -> admin && empty ( $forcehidetooltip )) {
2024-11-12 03:17:55 +01:00
$out .= ' ' . info_admin ( $langs -> trans ( " YouCanChangeValuesForThisListFromDictionarySetup " ), 1 );
2012-10-31 09:59:24 +01:00
}
2019-02-11 14:51:59 +01:00
2020-12-11 17:38:38 +01:00
$out .= ajax_combobox ( $htmlname );
2019-02-11 14:51:59 +01:00
2020-12-11 17:38:38 +01:00
$out .= " \n " ;
}
if ( empty ( $output )) {
return $out ;
} else {
print $out ;
2010-05-03 10:22:35 +02:00
}
}
2010-10-31 21:09:50 +01:00
2019-09-03 17:04:42 +02:00
/**
* showContactRoles on view and edit mode
*
2024-08-14 14:39:58 +02:00
* @ param string $htmlname Html component name and id
* @ param Contact $contact Contact Object
* @ param string $rendermode view , edit
2024-09-30 10:05:24 +02:00
* @ param array < array { id : int } > $selected $key => $val $val is selected Roles for input mode
2024-08-14 14:39:58 +02:00
* @ param string $morecss More css
* @ param string $placeholder Placeholder text ( used when $rendermode is 'edit' )
* @ return string String with contacts roles
2019-09-03 17:04:42 +02:00
*/
2024-08-14 14:39:58 +02:00
public function showRoles ( $htmlname , Contact $contact , $rendermode = 'view' , $selected = array (), $morecss = 'minwidth500' , $placeholder = '' )
2019-09-03 17:04:42 +02:00
{
if ( $rendermode === 'view' ) {
$toprint = array ();
foreach ( $contact -> roles as $key => $val ) {
2023-03-27 12:20:02 +02:00
$toprint [] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val [ 'label' ] . '</li>' ;
2019-09-03 17:04:42 +02:00
}
2023-03-27 12:20:02 +02:00
return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode ( ' ' , $toprint ) . '</ul></div>' ;
2019-09-03 17:04:42 +02:00
}
2024-08-14 14:39:58 +02:00
if ( $rendermode === 'edit' ) { // A multiselect combo list
2024-09-30 10:05:24 +02:00
$contactType = $contact -> listeTypeContacts ( 'external' , 0 , 1 , '' , '' , 'agenda' ); // We exclude agenda as there is no contact on such element
2019-11-13 19:35:39 +01:00
if ( count ( $selected ) > 0 ) {
$newselected = array ();
2021-02-23 22:03:23 +01:00
foreach ( $selected as $key => $val ) {
2019-09-03 17:04:42 +02:00
if ( is_array ( $val ) && array_key_exists ( 'id' , $val ) && in_array ( $val [ 'id' ], array_keys ( $contactType ))) {
2019-11-13 19:35:39 +01:00
$newselected [] = $val [ 'id' ];
2019-09-03 17:04:42 +02:00
} else {
break ;
}
}
2021-02-23 22:03:23 +01:00
if ( count ( $newselected ) > 0 ) {
$selected = $newselected ;
}
2019-09-03 17:04:42 +02:00
}
2024-08-14 14:39:58 +02:00
return $this -> multiselectarray ( $htmlname , $contactType , $selected , 0 , 0 , $morecss , 0 , '90%' , '' , '' , $placeholder );
2019-09-03 17:04:42 +02:00
}
2019-11-13 19:35:39 +01:00
return 'ErrorBadValueForParameterRenderMode' ; // Should not happened
2019-09-03 17:04:42 +02:00
}
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
2010-10-12 14:56:31 +02:00
/**
2011-02-14 17:49:04 +01:00
* Return a select list with zip codes and their town
2011-12-29 23:23:31 +01:00
*
* @ param string $selected Preselected value
* @ param string $htmlname HTML select name
2024-08-21 13:23:35 +02:00
* @ param string [] $fields Array with key of fields to refresh after selection
2011-12-29 23:23:31 +01:00
* @ param int $fieldsize Field size
2015-06-20 17:24:34 +02:00
* @ param int $disableautocomplete 1 To disable ajax autocomplete features ( browser autocomplete may still occurs )
* @ param string $moreattrib Add more attribute on HTML input field
2016-11-05 03:27:56 +01:00
* @ param string $morecss More css
2015-02-10 10:45:48 +01:00
* @ return string
2010-10-12 14:56:31 +02:00
*/
2023-05-01 15:09:43 +02:00
public function select_ziptown ( $selected = '' , $htmlname = 'zipcode' , $fields = array (), $fieldsize = 0 , $disableautocomplete = 0 , $moreattrib = '' , $morecss = '' )
2010-10-12 14:56:31 +02:00
{
2020-09-07 10:18:17 +02:00
// phpcs:enable
2010-10-13 09:38:48 +02:00
global $conf ;
2010-10-31 21:09:50 +01:00
2019-11-13 19:35:39 +01:00
$out = '' ;
2010-10-31 21:09:50 +01:00
2019-11-13 19:35:39 +01:00
$size = '' ;
2021-02-23 22:03:23 +01:00
if ( ! empty ( $fieldsize )) {
2023-03-27 12:20:02 +02:00
$size = 'size="' . $fieldsize . '"' ;
2021-02-23 22:03:23 +01:00
}
2010-10-31 21:09:50 +01:00
2021-02-23 22:03:23 +01:00
if ( $conf -> use_javascript_ajax && empty ( $disableautocomplete )) {
2023-03-27 12:20:02 +02:00
$out .= ajax_multiautocompleter ( $htmlname , $fields , DOL_URL_ROOT . '/core/ajax/ziptown.php' ) . " \n " ;
2019-11-13 19:35:39 +01:00
$moreattrib .= ' autocomplete="off"' ;
2015-06-20 17:24:34 +02:00
}
2023-03-27 12:20:02 +02:00
$out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ( $morecss ? ' ' . $morecss : '' ) . '" type="text"' . ( $moreattrib ? ' ' . $moreattrib : '' ) . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . " \n " ;
2010-10-31 21:09:50 +01:00
2010-10-13 15:54:30 +02:00
return $out ;
2010-10-12 14:56:31 +02:00
}
2010-05-03 10:22:35 +02:00
2020-09-07 10:18:17 +02:00
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML string to use as input of professional id into a HTML page ( siren , siret , etc ... )
*
2024-09-30 10:05:24 +02:00
* @ param int < 1 , 4 > $idprof 1 , 2 , 3 , 4 ( Example : 1 = siren , 2 = siret , 3 = naf , 4 = rcs / rm )
* @ param string $htmlname Name of HTML select
* @ param string $preselected Default value to show
* @ param string $country_code FR , IT , ...
* @ param string $morecss More css
* @ return string HTML string with prof id
2020-09-07 10:18:17 +02:00
*/
2023-02-28 22:44:22 +01:00
public function get_input_id_prof ( $idprof , $htmlname , $preselected , $country_code , $morecss = 'maxwidth200' )
2020-09-07 10:18:17 +02:00
{
// phpcs:enable
global $conf , $langs , $hookmanager ;
$formlength = 0 ;
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'MAIN_DISABLEPROFIDRULES' )) {
2021-02-23 22:03:23 +01:00
if ( $country_code == 'FR' ) {
2020-09-07 10:18:17 +02:00
if ( isset ( $idprof )) {
2021-02-23 22:03:23 +01:00
if ( $idprof == 1 ) {
$formlength = 9 ;
} elseif ( $idprof == 2 ) {
$formlength = 14 ;
} elseif ( $idprof == 3 ) {
$formlength = 5 ; // 4 chiffres et 1 lettre depuis janvier
} elseif ( $idprof == 4 ) {
$formlength = 32 ; // No maximum as we need to include a town name in this id
}
}
} elseif ( $country_code == 'ES' ) {
if ( $idprof == 1 ) {
$formlength = 9 ; //CIF/NIF/NIE 9 digits
}
if ( $idprof == 2 ) {
$formlength = 12 ; //NASS 12 digits without /
}
if ( $idprof == 3 ) {
$formlength = 5 ; //CNAE 5 digits
}
if ( $idprof == 4 ) {
$formlength = 32 ; //depend of college
2020-09-07 10:18:17 +02:00
}
}
}
$selected = $preselected ;
if ( ! $selected && isset ( $idprof )) {
2021-02-23 22:03:23 +01:00
if ( $idprof == 1 && ! empty ( $this -> idprof1 )) {
$selected = $this -> idprof1 ;
} elseif ( $idprof == 2 && ! empty ( $this -> idprof2 )) {
$selected = $this -> idprof2 ;
} elseif ( $idprof == 3 && ! empty ( $this -> idprof3 )) {
$selected = $this -> idprof3 ;
} elseif ( $idprof == 4 && ! empty ( $this -> idprof4 )) {
$selected = $this -> idprof4 ;
}
2020-09-07 10:18:17 +02:00
}
$maxlength = $formlength ;
2024-11-07 05:25:36 +01:00
$maxlength += getDolGlobalInt ( " MAIN_PROFID_MAXLENGTH_PLUS " );
2021-02-23 22:03:23 +01:00
if ( empty ( $formlength )) {
2021-03-01 20:37:16 +01:00
$formlength = 24 ;
$maxlength = 128 ;
2021-02-23 22:03:23 +01:00
}
2020-09-07 10:18:17 +02:00
$out = '' ;
// Execute hook getInputIdProf to complete or replace $out
2023-03-27 12:20:02 +02:00
$parameters = array ( 'formlength' => $formlength , 'selected' => $preselected , 'idprof' => $idprof , 'htmlname' => $htmlname , 'country_code' => $country_code );
2020-09-07 10:18:17 +02:00
$reshook = $hookmanager -> executeHooks ( 'getInputIdProf' , $parameters );
2021-02-23 22:03:23 +01:00
if ( empty ( $reshook )) {
2023-03-27 12:20:02 +02:00
$out .= '<input type="text" ' . ( $morecss ? 'class="' . $morecss . '" ' : '' ) . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">' ;
2020-09-07 10:18:17 +02:00
}
$out .= $hookmanager -> resPrint ;
return $out ;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select with localtax values for thirdparties
*
* @ param int $local LocalTax
2024-03-29 12:28:55 +01:00
* @ param float $selected Preselected value
2020-09-07 10:18:17 +02:00
* @ param string $htmlname HTML select name
* @ return void
*/
public function select_localtax ( $local , $selected , $htmlname )
{
// phpcs:enable
$tax = get_localtax_by_third ( $local );
2023-03-19 11:25:36 +01:00
if ( $tax ) {
2020-09-07 10:18:17 +02:00
$valors = explode ( " : " , $tax );
2023-03-19 11:25:36 +01:00
$nbvalues = count ( $valors );
2020-09-07 10:18:17 +02:00
2023-03-19 11:25:36 +01:00
if ( $nbvalues > 1 ) {
2020-09-07 10:18:17 +02:00
//montar select
print '<select class="flat" name="' . $htmlname . '" id="' . $htmlname . '">' ;
2023-03-19 11:25:36 +01:00
$i = 0 ;
while ( $i < $nbvalues ) {
2021-02-23 22:03:23 +01:00
if ( $selected == $valors [ $i ]) {
2023-03-27 12:20:02 +02:00
print '<option value="' . $valors [ $i ] . '" selected>' ;
2020-09-07 10:18:17 +02:00
} else {
2023-03-27 12:20:02 +02:00
print '<option value="' . $valors [ $i ] . '">' ;
2020-09-07 10:18:17 +02:00
}
print $valors [ $i ];
print '</option>' ;
$i ++ ;
}
2023-03-19 11:25:36 +01:00
print '</select>' ;
2020-09-07 10:18:17 +02:00
}
}
}
/**
* Return a HTML select for thirdparty type
*
2025-02-15 17:44:33 +01:00
* @ param int < 0 , 4 >| '0' | '2,3' | '1,3' | '4' $selected Selected value
2021-09-14 17:24:53 +02:00
* @ param string $htmlname HTML select name
* @ param string $htmlidname HTML select id
* @ param string $typeinput HTML output
* @ param string $morecss More css
* @ param string $allowempty Allow empty value or not
* @ return string HTML string
2020-09-07 10:18:17 +02:00
*/
2021-09-14 17:24:53 +02:00
public function selectProspectCustomerType ( $selected , $htmlname = 'client' , $htmlidname = 'customerprospect' , $typeinput = 'form' , $morecss = '' , $allowempty = '' )
2020-09-07 10:18:17 +02:00
{
global $conf , $langs ;
2023-11-27 11:24:19 +01:00
if ( getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' ) && getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' ) && ! isModEnabled ( 'fournisseur' )) {
2023-03-27 12:20:02 +02:00
return '' ;
2021-04-26 09:05:47 +02:00
}
2020-09-07 10:18:17 +02:00
2023-03-27 12:20:02 +02:00
$out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">' ;
2020-09-07 10:18:17 +02:00
if ( $typeinput == 'form' ) {
2021-09-14 17:24:53 +02:00
if ( $allowempty || ( $selected == '' || $selected == '-1' )) {
$out .= '<option value="-1">' ;
if ( is_numeric ( $allowempty )) {
$out .= ' ' ;
} else {
$out .= $langs -> trans ( $allowempty );
}
$out .= '</option>' ;
2021-02-23 22:03:23 +01:00
}
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="2"' . ( $selected == 2 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Prospect' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' ) && ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' ) && ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTSCUSTOMERS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="3"' . ( $selected == 3 ? ' selected' : '' ) . '>' . $langs -> trans ( 'ProspectCustomer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="1"' . ( $selected == 1 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2023-03-27 12:20:02 +02:00
$out .= '<option value="0"' . (( string ) $selected == '0' ? ' selected' : '' ) . '>' . $langs -> trans ( 'NorProspectNorCustomer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
} elseif ( $typeinput == 'list' ) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="-1"' . (( $selected == '' || $selected == '-1' ) ? ' selected' : '' ) . '> </option>' ;
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="2,3"' . ( $selected == '2,3' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Prospect' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="1,3"' . ( $selected == '1,3' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2022-08-23 20:05:09 +02:00
if ( isModEnabled ( " fournisseur " )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="4"' . ( $selected == '4' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Supplier' ) . '</option>' ;
2021-04-26 09:05:47 +02:00
}
2023-03-27 12:20:02 +02:00
$out .= '<option value="0"' . ( $selected == '0' ? ' selected' : '' ) . '>' . $langs -> trans ( 'Other' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
} elseif ( $typeinput == 'admin' ) {
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTS' ) && ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' ) && ! getDolGlobalString ( 'SOCIETE_DISABLE_PROSPECTSCUSTOMERS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="3"' . ( $selected == 3 ? ' selected' : '' ) . '>' . $langs -> trans ( 'ProspectCustomer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
2023-11-27 11:24:19 +01:00
if ( ! getDolGlobalString ( 'SOCIETE_DISABLE_CUSTOMERS' )) {
2023-03-27 12:20:02 +02:00
$out .= '<option value="1"' . ( $selected == 1 ? ' selected' : '' ) . '>' . $langs -> trans ( 'Customer' ) . '</option>' ;
2020-09-07 10:18:17 +02:00
}
}
$out .= '</select>' ;
2020-10-16 15:40:52 +02:00
$out .= ajax_combobox ( $htmlidname );
2020-09-07 10:18:17 +02:00
return $out ;
}
2020-12-13 19:50:35 +01:00
/**
* Output html select to select third - party type
*
2025-02-15 17:44:33 +01:00
* @ param string $page Page
* @ param string $selected Id preselected
* @ param string $htmlname Name of HTML select
* @ param string $filter optional filters criteras
* @ param int < 0 , 1 > $nooutput No print output . Return it only .
2020-12-13 19:50:35 +01:00
* @ return void | string
*/
public function formThirdpartyType ( $page , $selected = '' , $htmlname = 'socid' , $filter = '' , $nooutput = 0 )
{
// phpcs:enable
2021-02-18 09:05:44 +01:00
global $conf , $langs ;
2020-12-13 19:50:35 +01:00
$out = '' ;
2021-02-18 09:05:44 +01:00
if ( $htmlname != " none " ) {
2023-03-27 12:20:02 +02:00
$out .= '<form method="post" action="' . $page . '">' ;
2020-12-13 19:50:35 +01:00
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">' ;
2023-03-27 12:20:02 +02:00
$out .= '<input type="hidden" name="token" value="' . newToken () . '">' ;
2023-11-27 11:24:19 +01:00
$sortparam = ( ! getDolGlobalString ( 'SOCIETE_SORT_ON_TYPEENT' ) ? 'ASC' : $conf -> global -> SOCIETE_SORT_ON_TYPEENT ); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
2021-02-04 09:05:58 +01:00
$out .= $this -> selectarray ( $htmlname , $this -> typent_array ( 0 , $filter ), $selected , 1 , 0 , 0 , '' , 0 , 0 , 0 , $sortparam , '' , 1 );
2023-03-27 12:20:02 +02:00
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs -> trans ( " Modify " ) . '">' ;
2020-12-13 19:50:35 +01:00
$out .= '</form>' ;
} else {
2021-07-19 11:01:06 +02:00
if ( $selected > 0 ) {
2020-12-13 19:50:35 +01:00
$arr = $this -> typent_array ( 0 );
2024-05-20 19:05:53 +02:00
$typent = empty ( $arr [ $selected ]) ? '' : $arr [ $selected ];
2020-12-13 19:50:35 +01:00
$out .= $typent ;
} else {
$out .= " " ;
}
}
2021-02-18 09:05:44 +01:00
if ( $nooutput ) {
return $out ;
} else {
print $out ;
}
2020-12-13 19:50:35 +01:00
}
2023-03-27 12:20:02 +02:00
/**
* Output html select to select prospect status
*
2025-02-15 17:44:33 +01:00
* @ param string $htmlname Name of HTML select
* @ param Contact | Client | null $prospectstatic Prospect object
* @ param int $statusprospect status of prospect
* @ param int $idprospect id of prospect
* @ param 'html' | 'js' $mode select if we want activate de html part or js
2023-03-27 12:20:02 +02:00
* @ return void
*/
2023-12-07 20:11:37 +01:00
public function selectProspectStatus ( $htmlname , $prospectstatic , $statusprospect , $idprospect , $mode = " html " )
2023-03-27 12:20:02 +02:00
{
2024-02-17 19:30:42 +01:00
global $user , $langs ;
2023-03-27 12:20:02 +02:00
if ( $mode === " html " ) {
2023-06-26 15:34:09 +02:00
$actioncode = empty ( $prospectstatic -> cacheprospectstatus [ $statusprospect ]) ? '' : $prospectstatic -> cacheprospectstatus [ $statusprospect ][ 'code' ];
$actionpicto = empty ( $prospectstatic -> cacheprospectstatus [ $statusprospect ][ 'picto' ]) ? '' : $prospectstatic -> cacheprospectstatus [ $statusprospect ][ 'picto' ];
2023-05-15 16:29:57 +02:00
//print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']);
2023-07-03 17:43:51 +02:00
print img_action ( '' , $actioncode , $actionpicto , 'class="inline-block valignmiddle paddingright pictoprospectstatus"' );
2024-02-17 19:30:42 +01:00
print '<select class="flat selectprospectstatus maxwidth150" id="' . $htmlname . $idprospect . '" data-socid="' . $idprospect . '" name="' . $htmlname . '"' ;
if ( ! $user -> hasRight ( 'societe' , 'creer' )) {
print ' disabled' ;
}
print '>' ;
2023-03-27 12:20:02 +02:00
foreach ( $prospectstatic -> cacheprospectstatus as $key => $val ) {
2024-02-17 19:30:42 +01:00
//$titlealt = (empty($val['label']) ? 'default' : $val['label']);
2023-05-15 16:29:57 +02:00
$label = $val [ 'label' ];
2023-03-27 12:20:02 +02:00
if ( ! empty ( $val [ 'code' ]) && ! in_array ( $val [ 'code' ], array ( 'ST_NO' , 'ST_NEVER' , 'ST_TODO' , 'ST_PEND' , 'ST_DONE' ))) {
2024-02-17 19:30:42 +01:00
//$titlealt = $val['label'];
2023-05-15 16:29:57 +02:00
$label = (( $langs -> trans ( " StatusProspect " . $val [ 'code' ]) != " StatusProspect " . $val [ 'code' ]) ? $langs -> trans ( " StatusProspect " . $val [ 'code' ]) : $label );
2023-03-27 12:20:02 +02:00
} else {
2023-05-15 16:29:57 +02:00
$label = (( $langs -> trans ( " StatusProspect " . $val [ 'id' ]) != " StatusProspect " . $val [ 'id' ]) ? $langs -> trans ( " StatusProspect " . $val [ 'id' ]) : $label );
2023-03-27 12:20:02 +02:00
}
2023-05-15 16:29:57 +02:00
print '<option value="' . $val [ 'id' ] . '" data-html="' . dol_escape_htmltag ( img_action ( '' , $val [ 'code' ], $val [ 'picto' ]) . ' ' . $label ) . '" title="' . dol_escape_htmltag ( $label ) . '"' . ( $statusprospect == $val [ 'id' ] ? ' selected' : '' ) . '>' ;
print dol_escape_htmltag ( $label );
print '</option>' ;
2023-03-27 12:20:02 +02:00
}
print '</select>' ;
2023-05-15 16:29:57 +02:00
print ajax_combobox ( $htmlname . $idprospect );
2023-03-27 12:20:02 +02:00
} elseif ( $mode === " js " ) {
print ' < script >
jQuery ( document ) . ready ( function () {
$ ( " .selectprospectstatus " ) . on ( " change " , function () {
2023-05-15 16:29:57 +02:00
console . log ( " We change a value into a field selectprospectstatus " );
2023-03-27 12:20:02 +02:00
var statusid = $ ( this ) . val ();
2023-05-15 16:29:57 +02:00
var prospectid = $ ( this ) . attr ( " data-socid " );
2023-07-03 17:43:51 +02:00
var image = $ ( this ) . prev ( " .pictoprospectstatus " );
2023-05-15 16:29:57 +02:00
$ . ajax ({
type : " POST " ,
url : \ '' . DOL_URL_ROOT . ' / core / ajax / ajaxstatusprospect . php\ ' ,
2023-07-03 17:37:39 +02:00
data : { id : statusid , prospectid : prospectid , token : \ '' . newToken () . ' \ ' , action : \ ' updatestatusprospect\ ' },
2023-05-15 16:29:57 +02:00
success : function ( response ) {
2023-07-05 11:03:18 +02:00
console . log ( response . img );
2023-07-03 17:37:39 +02:00
image . replaceWith ( response . img );
2023-06-26 23:40:39 +02:00
},
error : function () {
console . error ( " Error on status prospect " );
},
2023-03-27 12:20:02 +02:00
});
});
});
</ script > ' ;
}
}
2010-05-03 10:22:35 +02:00
}