dolibarr 24.0.0-beta
company.lib.php File Reference

Ensemble de functions de base pour le module societe. More...

Go to the source code of this file.

Functions

 societe_prepare_head (Societe $object, $subtabs='')
 Return array of tabs to used on pages for third parties cards.
 
 societe_prepare_head2 ($object)
 Return array of tabs to used on page.
 
 societe_admin_prepare_head ()
 Return array head with list of tabs to view object information.
 
 getCountry ($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
 Return country label, code or id from an id, code or label.
 
 getState ($id, $withcode='0', $dbtouse=null, $withregion=0, $outputlangs=null, $entconv=1)
 Return state translated from an id.
 
 currency_name ($code_iso, $withcode=0, $outputlangs=null)
 Return label of currency or code+label.
 
 getFormeJuridiqueLabel ($code)
 Return the name translated of juridical status.
 
 getCountriesInEEC ()
 Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this function as a "memory only" function for performance reasons.
 
 isInEEC ($object)
 Return if a country of an object is inside the EEC (European Economic Community)
 
 getCountriesInSEPA ()
 Return list of countries that are inside the SEPA zone (Single Euro Payment Area) Note: Try to keep this function as a "memory only" function for performance reasons.
 
 isInSEPA ($object)
 Return if a country of an object is inside the SEPA zone (Single Euro Payment Area)
 
 show_projects ($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='', $massactionbutton='')
 Show html area for list of projects.
 
 show_contacts ($conf, $langs, $db, $object, $backtopage='', $showuserlogin=0)
 Show html area for list of contacts.
 
 show_actions_todo ($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='')
 Show html area with actions to do.
 
 show_actions_done ($conf, $langs, $db, $filterobj, $objcon=null, $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC', $module='')
 Show html area with actions (done or not, ignore the name of function).
 
 show_subsidiaries ($conf, $langs, $db, $object)
 Show html area for list of subsidiaries.
 
 addEventTypeSQL (&$sql, $actioncode, $sqlANDOR="AND")
 Add Event Type SQL.
 
 addOtherFilterSQL (&$sql, $donetodo, $now, $filters)
 Add more SQL filters for event list.
 
 addMailingEventTypeSQL ($actioncode, $objcon, $filterobj)
 Add Mailing Event Type SQL.
 
 htmlPrintOnlineHeader ($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
 Show the header of a company in HTML public pages.
 
 htmlPrintOnlineFooter ($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
 Show footer of company in HTML public pages.
 

Detailed Description

Ensemble de functions de base pour le module societe.

Definition in file company.lib.php.

Function Documentation

◆ addEventTypeSQL()

addEventTypeSQL ( & $sql,
$actioncode,
$sqlANDOR = "AND" )

Add Event Type SQL.

Parameters
string$sql$sql modified
string$actioncodeAction code
'AND'|'OR'|''$sqlANDOR "AND", "OR" or "" sql condition
Returns
string sql request

Definition at line 2762 of file company.lib.php.

References $db, and getDolGlobalString().

Referenced by show_actions_done().

◆ addMailingEventTypeSQL()

addMailingEventTypeSQL ( $actioncode,
$objcon,
$filterobj )

Add Mailing Event Type SQL.

Parameters
string$actioncodeAction code
Contact$objconobjcon
?Object$filterobjfilterobj
Returns
string

Definition at line 2851 of file company.lib.php.

References $db, and isModEnabled().

Referenced by show_actions_done().

◆ addOtherFilterSQL()

addOtherFilterSQL ( & $sql,
$donetodo,
$now,
$filters )

Add more SQL filters for event list.

Parameters
string$sql$sql modified
string$donetododonetodo
int$nownow
array<string,string|string[]>$filters array
Returns
string SQL request

Definition at line 2806 of file company.lib.php.

References $db, and natural_search().

Referenced by show_actions_done().

◆ currency_name()

currency_name ( $code_iso,
$withcode = 0,
$outputlangs = null )

Return label of currency or code+label.

Parameters
string$code_isoCode iso of currency
int<0,1>$withcode '1'=show code + label
?Translate$outputlangsOutput language
Returns
string Label translated of currency

Definition at line 813 of file company.lib.php.

References $db.

Referenced by Form\form_multicurrency_code().

◆ getCountriesInEEC()

getCountriesInEEC ( )

Return list of countries that are inside the EEC (European Economic Community) Note: Try to keep this function as a "memory only" function for performance reasons.

Returns
string[] Array of country codes in EEC

Definition at line 901 of file company.lib.php.

References $conf, $db, and dol_print_error().

Referenced by UserBankAccount\checkCountryBankAccount(), and isInEEC().

◆ getCountriesInSEPA()

getCountriesInSEPA ( )

Return list of countries that are inside the SEPA zone (Single Euro Payment Area) Note: Try to keep this function as a "memory only" function for performance reasons.

Returns
string[] Array of country codes in SEPA

Definition at line 956 of file company.lib.php.

References $conf, $db, and dol_print_error().

Referenced by isInSEPA().

◆ getCountry()

getCountry ( $searchkey,
$withcode = '',
$dbtouse = null,
$outputlangs = null,
$entconv = 1,
$searchlabel = '' )

Return country label, code or id from an id, code or label.

Parameters
int | string$searchkeyId or code of country to search
''|'0'|'1'|'2'|'3'|'all'$withcode '' or '0' = Return label, '1'=Return code + label, '2'=Return code from id, '3'=Return id from code, 'all'=Return array('id'=>,'code'=>,'label'=>)
?DoliDB$dbtouseDatabase handler (using in global way may fail because of conflicts with some autoload features)
?Translate$outputlangsLangs object for output translation
int<0,1>$entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output
string$searchlabelLabel of country to search (warning: searching on label is not reliable)
Returns
int|string|array{id:int,code:string,label:string} Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined'

Definition at line 661 of file company.lib.php.

References $db, and dol_print_error().

Referenced by ActionsCardCommon\assign_post(), Form\constructProductListOption(), Account\create(), Entrepot\create(), createProductOrService(), createThirdParty(), AccountancyExport\exportLDCompta10(), Entrepot\fetch(), Product\fetch(), CommonObject\getFullAddress(), Societe\setMysoc(), show_contacts(), Account\update(), Adherent\update(), Contact\update(), Entrepot\update(), Product\update(), Societe\update(), User\update(), updateContact(), updateProductOrService(), updateThirdParty(), pdf_octopus\write_file(), pdf_sponge\write_file(), pdf_standard_asset\write_file(), pdf_standard_myobject\write_file(), and pdf_standard_recruitmentjobposition\write_file().

◆ getFormeJuridiqueLabel()

getFormeJuridiqueLabel ( $code)

Return the name translated of juridical status.

This method include a cache.

Parameters
string$codeCode of juridical status
Returns
string Value of the juridical status

Definition at line 858 of file company.lib.php.

References $conf, $db, and dol_syslog().

Referenced by CommonDocGenerator\get_substitutionarray_mysoc(), html_print_stripe_footer(), htmlPrintOnlineFooter(), pdf_build_address(), and pdf_pagefoot().

◆ getState()

getState ( $id,
$withcode = '0',
$dbtouse = null,
$withregion = 0,
$outputlangs = null,
$entconv = 1 )

Return state translated from an id.

Return value is always utf8 encoded and without entities.

Parameters
int$idid of state (province/departement)
'0'|'1'|'2'|'all'$withcode '0'=Return label, '1'=Return string code + label, '2'=Return code, 'all'=return array('id'=>,'code'=>,'label'=>)
?DoliDB$dbtouseDatabase handler (using in global way may fail because of conflicts with some autoload features)
int<0,1>$withregion '0'=Ignores region, '1'=Add region name/code/id as needed to output,
?Translate$outputlangsLangs object for output translation, not fully implemented yet
int<0,1>$entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output
Returns
string|array{id:int,code:string,label:string}|array{id:int,code:string,label:string,region_code:string,region:string} String with state code or state name or Array('id','code','label')/Array('id','code','label','region_code','region')

Definition at line 741 of file company.lib.php.

References $db, $id, dol_print_error(), and dol_syslog().

Referenced by CommonDocGenerator\get_substitutionarray_contact(), CommonDocGenerator\get_substitutionarray_mysoc(), CommonDocGenerator\get_substitutionarray_thirdparty(), CommonObject\getFullAddress(), pdf_build_address(), and Societe\setMysoc().

◆ htmlPrintOnlineFooter()

htmlPrintOnlineFooter ( $fromcompany,
$langs,
$addformmessage = 0,
$suffix = '',
$object = null )

Show footer of company in HTML public pages.

Parameters
Societe$fromcompanyThird party
Translate$langsOutput language
int$addformmessageAdd the payment form message
string$suffixSuffix to use on constants
null | CommonObject | CommonHookActions$objectObject related to payment
Returns
void

Definition at line 2973 of file company.lib.php.

References $object, getDolCurrency(), getDolGlobalString(), and getFormeJuridiqueLabel().

◆ htmlPrintOnlineHeader()

htmlPrintOnlineHeader ( $mysoc,
$langs,
$showlogo = 1,
$alttext = '',
$subimageconst = '',
$altlogo1 = '',
$altlogo2 = '' )

Show the header of a company in HTML public pages.

Parameters
Societe$mysocThird party
Translate$langsOutput language
int | string$showlogo'1'=Show logo or 'url' for click on logo
string$alttextText to show in header
string$subimageconstConstant to check if we must add image under the main header
string$altlogo1To use an alternative logo defined into setup (instead of company logo)
string$altlogo2To use an alternative logo defined into setup (instead of company logo)
Returns
void

Definition at line 2897 of file company.lib.php.

References $conf, $dolibarr_main_url_root, $mysoc, and getDolGlobalString().

Referenced by llxHeaderSurvey(), llxHeaderTicket(), and llxHeaderVierge().

◆ isInEEC()

isInEEC ( $object)

Return if a country of an object is inside the EEC (European Economic Community)

Parameters
Object$objectObject
Returns
boolean true = country inside EEC, false = country outside EEC

Definition at line 938 of file company.lib.php.

References $object, and getCountriesInEEC().

Referenced by Stripe\customerStripe(), AccountingAccount\getAccountingCodeToBind(), Form\load_tva(), and InterfaceStripe\runTrigger().

◆ isInSEPA()

isInSEPA ( $object)

Return if a country of an object is inside the SEPA zone (Single Euro Payment Area)

Parameters
Object$objectObject
Returns
boolean true = ccountry inside SEPA, false = country outside SEPA

Definition at line 993 of file company.lib.php.

References $object, and getCountriesInSEPA().

◆ show_actions_done()

show_actions_done ( $conf,
$langs,
$db,
$filterobj,
$objcon = null,
$noprint = 0,
$actioncode = '',
$donetodo = 'done',
$filters = array(),
$sortfield = 'a.datep,
a.id' ,
$sortorder = 'DESC',
$module = '' )

Show html area with actions (done or not, ignore the name of function).

Note: Global parameter $param must be defined.

Parameters
Conf$confObject conf
Translate$langsObject langs
DoliDB$dbObject db
?CommonObject$filterobjFilter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket... to list events linked to an object
?Contact$objconFilter on object contact to filter events on a contact
int<0,1>$noprint Return string but does not output it
string | string[]$actioncodeFilter on actioncode
'done'|'todo'|''$donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
array<string,string|string[]>$filters Filter on other fields
string$sortfieldSort field
string$sortorderSort order
string$moduleYou can add module name here if elementtype in table llx_actioncomm is objectkey
Returns
?string Return html part or void if noprint is 1

Definition at line 1899 of file company.lib.php.

References $conf, $db, addEventTypeSQL(), addMailingEventTypeSQL(), addOtherFilterSQL(), dol_escape_htmltag(), dol_mktime(), dol_now(), dol_print_error(), dol_print_phone(), dol_syslog(), dol_trunc(), dolGetElementUrl(), dolOutputDates(), getDolGlobalInt(), getDolGlobalString(), getEntity(), GETPOST(), GETPOSTINT(), getTitleFieldOfList(), img_object(), img_picto(), img_warning(), isModEnabled(), setEventMessage(), and string.

Referenced by ActionsAdherentCardDefault\assign_values(), ActionsContactCardDefault\assign_values(), and show_actions_todo().

◆ show_actions_todo()

show_actions_todo ( $conf,
$langs,
$db,
$filterobj,
$objcon = null,
$noprint = 0,
$actioncode = '' )

Show html area with actions to do.

Parameters
Conf$confObject conf
Translate$langsObject langs
DoliDB$dbObject db
Adherent | Societe$filterobjObject thirdparty or member
?Contact$objconObject contact
int<0,1>$noprint Return string but does not output it
string | string[]$actioncodeFilter on actioncode
Returns
?string Return html part or null if noprint is 1

Definition at line 1869 of file company.lib.php.

References $conf, $db, and show_actions_done().

Referenced by ActionsAdherentCardDefault\assign_values(), and ActionsContactCardDefault\assign_values().

◆ show_contacts()

show_contacts ( $conf,
$langs,
$db,
$object,
$backtopage = '',
$showuserlogin = 0 )

Show html area for list of contacts.

Parameters
Conf$confObject conf
Translate$langsObject langs
DoliDB$dbDatabase handler
Societe$objectThird party object
string$backtopageUrl to go once contact is created
int<0,1>$showuserlogin 1=Show also user login if it exists
Returns
int

Definition at line 1282 of file company.lib.php.

References $conf, $db, $object, dol_escape_htmltag(), dol_mktime(), dol_print_date(), dol_print_error(), dol_sort_array(), dol_syslog(), dolPrintHTML(), getArrayOfSocialNetworks(), getCountry(), getDolGlobalBool(), getDolGlobalString(), getEntity(), GETPOST(), GETPOSTINT(), getTitleFieldOfList(), img_delete(), img_edit(), img_object(), isModEnabled(), load_fiche_titre(), natural_search(), and setEventMessages().

◆ show_projects()

show_projects ( $conf,
$langs,
$db,
$object,
$backtopage = '',
$nocreatelink = 0,
$morehtmlright = '',
$massactionbutton = '' )

Show html area for list of projects.

Parameters
Conf$confObject conf
Translate$langsObject langs
DoliDB$dbDatabase handler
Societe$objectThird party object
string$backtopageUrl to go once contact is created
int<0,1>$nocreatelink 1=Hide create project link
string$morehtmlrightMore html on right of title
string$massactionbuttonMass action button
Returns
int

Definition at line 1019 of file company.lib.php.

References $conf, $db, $object, dol_escape_htmltag(), dol_print_date(), dol_print_error(), getDolGlobalString(), getEntity(), isModEnabled(), load_fiche_titre(), and price().

◆ show_subsidiaries()

show_subsidiaries ( $conf,
$langs,
$db,
$object )

Show html area for list of subsidiaries.

Parameters
Conf$confObject conf
Translate$langsObject langs
DoliDB$dbDatabase handler
Societe$objectThird party object
Returns
int

Definition at line 2680 of file company.lib.php.

References $db, $object, dol_escape_htmltag(), getEntity(), img_edit(), and load_fiche_titre().

◆ societe_admin_prepare_head()

societe_admin_prepare_head ( )

Return array head with list of tabs to view object information.

Returns
array<array{0:string,1:string,2:string}> Array of tabs to show

Definition at line 593 of file company.lib.php.

References $conf, complete_head_from_modules(), dolBuildUrl(), and getDolGlobalString().

◆ societe_prepare_head()

societe_prepare_head ( Societe $object,
$subtabs = '' )

Return array of tabs to used on pages for third parties cards.

Parameters
Societe$objectObject company shown
string$subtabsParameter for choosing subtab, currently used for either conferenceorbooth or attendee
Returns
array<array{0:string,1:string,2:string}> Array of tabs to show

Definition at line 44 of file company.lib.php.

References $conf, $db, $object, complete_head_from_modules(), Link\count(), dol_dir_list(), dol_getcache(), dol_print_error(), dol_setcache(), dol_syslog(), dolBuildUrl(), getDolGlobalInt(), getDolGlobalString(), getEntity(), isModEnabled(), and setEventMessages().

Referenced by ActionsCardCommon\assign_values().

◆ societe_prepare_head2()

societe_prepare_head2 ( $object)

Return array of tabs to used on page.

Parameters
Object$objectObject for tabs
Returns
array<array{0:string,1:string,2:string}> Array of tabs to show

Definition at line 567 of file company.lib.php.

References $object, and dolBuildUrl().