dolibarr  9.0.0
Public Member Functions | Static Public Member Functions | List of all members
FormMail Class Reference

Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new FormMail($db) $formmail->proprietes=1 ou chaine ou tableau de valeurs $formmail->show_form() affiche le formulaire. More...

+ Inheritance diagram for FormMail:
+ Collaboration diagram for FormMail:

Public Member Functions

 __construct ($db)
 Constructor. More...
 
 clear_attached_files ()
 Clear list of attached files in send mail form (also stored in session) More...
 
 add_attached_files ($path, $file='', $type='')
 Add a file into the list of attached files (stored in SECTION array) More...
 
 remove_attached_files ($keytodelete)
 Remove a file from the list of attached files (stored in SECTION array) More...
 
 get_attached_files ()
 Return list of attached files (stored in SECTION array) More...
 
 show_form ($addfileaction='addfile', $removefileaction='removefile')
 Show the form to input an email this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files this->withmaindocfile. More...
 
 get_form ($addfileaction='addfile', $removefileaction='removefile')
 Get the form to input an email this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files this->withfile this->param: Contains more parameters like email templates info. More...
 
 getEMailTemplate ($db, $type_template, $user, $outputlangs, $id=0, $active=1, $label='')
 Return templates of email with type = $type_template or type = 'all'. More...
 
 isEMailTemplate ($type_template, $user, $outputlangs)
 Find if template exists Search into table c_email_templates. More...
 
 fetchAllEMailTemplate ($type_template, $user, $outputlangs, $active=1)
 Find if template exists and are available for current user, then set them into $this->lines_module. More...
 
 setSubstitFromObject ($object, $outputlangs)
 Set substit array from object. More...
 
- Public Member Functions inherited from Form
 __construct ($db)
 Constructor. More...
 
 editfieldkey ($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0, $paramid='id')
 Output key field for an editable field. More...
 
 editfieldval ($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='', $notabletag=0, $formatfunc='', $paramid='id')
 Output value of a field for an editable field. More...
 
 textwithtooltip ($text, $htmltext, $tooltipon=1, $direction=0, $img='', $extracss='', $notabs=2, $incbefore='', $noencodehtmltext=0, $tooltiptrigger='', $forcenowrap=0)
 Show a text and picto with tooltip on text or picto. More...
 
 textwithpicto ($text, $htmltext, $direction=1, $type='help', $extracss='', $noencodehtmltext=0, $notabs=2, $tooltiptrigger='', $forcenowrap=0)
 Show a text with a picto and a tooltip on picto. More...
 
 selectMassAction ($selected, $arrayofaction, $alwaysvisible=0)
 Generate select HTML to choose massaction. More...
 
 select_country ($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0, $addspecialentries=0)
 Return combo list of activated countries, into language of user. More...
 
 select_incoterms ($selected='', $location_incoterms='', $page='', $htmlname='incoterm_id', $htmloption='', $forcecombo=1, $events=array())
 Return select list of incoterms. More...
 
 select_type_of_lines ($selected='', $htmlname='type', $showempty=0, $hidetext=0, $forceall=0)
 Return list of types of lines (product or service) Example: 0=product, 1=service, 9=other (for external module) More...
 
 load_cache_types_fees ()
 Load into cache cache_types_fees, array of types of fees. More...
 
 select_type_fees ($selected='', $htmlname='type', $showempty=0)
 Return list of types of notes. More...
 
 select_thirdparty ($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0)
 Return HTML code to select a company. More...
 
 select_company ($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false)
 Output html form to select a third party. More...
 
 select_thirdparty_list ($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false)
 Output html form to select a third party. More...
 
 select_remises ($selected, $htmlname, $filter, $socid, $maxvalue=0)
 Return HTML combo list of absolute discounts. More...
 
 select_contacts ($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $events=array(), $options_only=false, $moreparam='', $htmlid='')
 Return list of all contacts (for a third party or all) More...
 
 selectcontacts ($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='', $multiple=false)
 Return HTML code of the SELECT of list of all contacts (for a third party or all). More...
 
 select_users ($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0')
 Return select list of users. More...
 
 select_dolusers ($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false)
 Return select list of users. More...
 
 select_dolusers_forevent ($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array())
 Return select list of users. More...
 
 select_produits ($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations=array())
 Return list of products for customer in Ajax if Ajax activated or go to select_produits_list. More...
 
 select_produits_list ($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $filterkey='', $status=1, $finished=2, $outputmode=0, $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='')
 Return list of products for a customer. More...
 
 select_produits_fournisseurs ($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0, $morecss='')
 Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) More...
 
 select_produits_fournisseurs_list ($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $filterkey='', $statut=-1, $outputmode=0, $limit=100, $alsoproductwithnosupplierprice=0, $morecss='')
 Return list of suppliers products. More...
 
 select_product_fourn_price ($productid, $htmlname='productfournpriceid', $selected_supplier='')
 Return list of suppliers prices for a product. More...
 
 select_address ($selected, $socid, $htmlname='address_id', $showempty=0)
 Return list of delivery address. More...
 
 load_cache_conditions_paiements ()
 Load into cache list of payment terms. More...
 
 load_cache_availability ()
 Charge dans cache la liste des délais de livraison possibles. More...
 
 selectAvailabilityDelay ($selected='', $htmlname='availid', $filtertype='', $addempty=0)
 Retourne la liste des types de delais de livraison possibles. More...
 
 loadCacheInputReason ()
 Load into cache cache_demand_reason, array of input reasons. More...
 
 selectInputReason ($selected='', $htmlname='demandreasonid', $exclude='', $addempty=0)
 Return list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason. More...
 
 load_cache_types_paiements ()
 Charge dans cache la liste des types de paiements possibles. More...
 
 select_conditions_paiements ($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='')
 Return list of payment modes. More...
 
 select_types_paiements ($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='')
 Return list of payment methods. More...
 
 selectPriceBaseType ($selected='', $htmlname='price_base_type')
 Selection HT or TTC. More...
 
 selectShippingMethod ($selected='', $htmlname='shipping_method_id', $filtre='', $useempty=0, $moreattrib='')
 Return a HTML select list of shipping mode. More...
 
 formSelectShippingMethod ($page, $selected='', $htmlname='shipping_method_id', $addempty=0)
 Display form to select shipping mode. More...
 
 selectSituationInvoices ($selected='', $socid=0)
 Creates HTML last in cycle situation invoices selector. More...
 
 selectUnits ($selected='', $htmlname='units', $showempty=0)
 Creates HTML units selector (code => label) More...
 
 select_comptes ($selected='', $htmlname='accountid', $statut=0, $filtre='', $useempty=0, $moreattrib='', $showcurrency=0)
 Return a HTML select list of bank accounts. More...
 
 formSelectAccount ($page, $selected='', $htmlname='fk_account', $addempty=0)
 Display form to select bank account. More...
 
 select_all_categories ($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0)
 Return list of categories having choosed type. More...
 
 form_confirm ($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500)
 Show a confirmation HTML form or AJAX popup. More...
 
 formconfirm ($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=210, $width=500, $disableformtag=0)
 Show a confirmation HTML form or AJAX popup. More...
 
 form_project ($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0)
 Show a form to select a project. More...
 
 form_conditions_reglement ($page, $selected='', $htmlname='cond_reglement_id', $addempty=0)
 Show a form to select payment conditions. More...
 
 form_availability ($page, $selected='', $htmlname='availability', $addempty=0)
 Show a form to select a delivery delay. More...
 
 formInputReason ($page, $selected='', $htmlname='demandreason', $addempty=0)
 Output HTML form to select list of input reason (events that triggered an object creation, like after sending an emailing, making an advert, ...) List found into table c_input_reason loaded by loadCacheInputReason. More...
 
 form_date ($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0)
 Show a form + html select a date. More...
 
 form_users ($page, $selected='', $htmlname='userid', $exclude='', $include='')
 Show a select form to choose a user. More...
 
 form_modes_reglement ($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1, $addempty=0)
 Show form with payment mode. More...
 
 form_multicurrency_code ($page, $selected='', $htmlname='multicurrency_code')
 Show form with multicurrency code. More...
 
 form_multicurrency_rate ($page, $rate='', $htmlname='multicurrency_tx', $currency='')
 Show form with multicurrency rate. More...
 
 form_remise_dispo ($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0, $discount_type=0)
 Show a select box with available absolute discounts. More...
 
 form_contacts ($page, $societe, $selected='', $htmlname='contactid')
 Show forms to select a contact. More...
 
 form_thirdparty ($page, $selected='', $htmlname='socid', $filter='', $showempty=0, $showtype=0, $forcecombo=0, $events=array(), $nooutput=0)
 Output html select to select thirdparty. More...
 
 select_currency ($selected='', $htmlname='currency_id')
 Retourne la liste des devises, dans la langue de l'utilisateur. More...
 
 selectCurrency ($selected='', $htmlname='currency_id')
 Retourne la liste des devises, dans la langue de l'utilisateur. More...
 
 selectMultiCurrency ($selected='', $htmlname='multicurrency_code', $useempty=0)
 Return array of currencies in user language. More...
 
 load_cache_vatrates ($country_code)
 Load into the cache vat rates of a country. More...
 
 load_tva ($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0)
 Output an HTML select vat rate. More...
 
 select_date ($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
 Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. More...
 
 selectDate ($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
 Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. More...
 
 select_duration ($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0)
 Function to show a form to select a duration on a page. More...
 
 selectForForms ($objectdesc, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0)
 Generic method to select a component from a combo list. More...
 
 selectForFormsList ($objecttmp, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0, $outputmode=0)
 Output html form to select an object. More...
 
 showCategories ($id, $type, $rendermode=0)
 Render list of categories linked to object with id $id and type $type. More...
 
 showLinkedObjectBlock ($object, $morehtmlright='', $compatibleImportElementsList=false)
 Show linked object block. More...
 
 showLinkToObjectBlock ($object, $restrictlinksto=array(), $excludelinksto=array())
 Show block with links to link to other objects. More...
 
 selectyesno ($htmlname, $value='', $option=0, $disabled=false, $useempty=0)
 Return an html string with a select combo box to choose yes or no. More...
 
 select_export_model ($selected='', $htmlname='exportmodelid', $type='', $useempty=0)
 Return list of export templates. More...
 
 showrefnav ($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $morehtmlright='')
 Return a HTML area with the reference of object and a navigation bar for a business object Note: To complete search with a particular filter on select, you can set $object->next_prev_filter set to define SQL criterias. More...
 
 showbarcode (&$object, $width=100)
 Return HTML code to output a barcode. More...
 
 select_dolgroups ($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false)
 Return select list of groups. More...
 
 showFilterButtons ()
 Return HTML to show the search and clear seach button. More...
 
 showCheckAddButtons ($cssclass='checkforaction', $calljsfunction=0)
 Return HTML to show the search and clear seach button. More...
 
 showFilterAndCheckAddButtons ($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0)
 Return HTML to show the search and clear seach button. More...
 
 selectExpenseCategories ($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array())
 Return HTML to show the select of expense categories. More...
 
 selectExpenseRanges ($selected='', $htmlname='fk_range', $useempty=0)
 Return HTML to show the select ranges of expense range. More...
 
 selectExpense ($selected='', $htmlname='fk_c_type_fees', $useempty=0, $allchoice=1, $useid=0)
 Return HTML to show a select of expense. More...
 

Static Public Member Functions

static getAvailableSubstitKey ($mode='formemail', $object=null)
 Get list of substitution keys available for emails. More...
 
- Static Public Member Functions inherited from Form
static selectarray ($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='', $disablebademail=0, $nohtmlescape=0)
 Return a HTML select string, built from an array of key+value. More...
 
static selectArrayAjax ($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
 Return a HTML select string, built from an array of key+value, but content returned into select come from an Ajax call of an URL. More...
 
static selectArrayFilter ($htmlname, $array, $id='', $moreparam='', $disableFiltering=0, $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
 Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter. More...
 
static multiselectarray ($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1)
 Show a multiselect form from an array. More...
 
static multiSelectArrayWithCheckbox ($htmlname, &$array, $varpage)
 Show a multiselect dropbox from an array. More...
 
static showphoto ($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0, $forcecapture='')
 Return HTML code to output a photo. More...
 

Detailed Description

Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new FormMail($db) $formmail->proprietes=1 ou chaine ou tableau de valeurs $formmail->show_form() affiche le formulaire.

Definition at line 37 of file html.formmail.class.php.

Constructor & Destructor Documentation

◆ __construct()

FormMail::__construct (   $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 124 of file html.formmail.class.php.

Member Function Documentation

◆ add_attached_files()

FormMail::add_attached_files (   $path,
  $file = '',
  $type = '' 
)

Add a file into the list of attached files (stored in SECTION array)

Parameters
string$pathFull absolute path on filesystem of file, including file name
string$fileOnly filename (can be basename($path))
string$typeMime type (can be dol_mimetype($file))
Returns
void

Definition at line 186 of file html.formmail.class.php.

◆ clear_attached_files()

FormMail::clear_attached_files ( )

Clear list of attached files in send mail form (also stored in session)

Returns
void

Definition at line 160 of file html.formmail.class.php.

◆ fetchAllEMailTemplate()

FormMail::fetchAllEMailTemplate (   $type_template,
  $user,
  $outputlangs,
  $active = 1 
)

Find if template exists and are available for current user, then set them into $this->lines_module.

Search into table c_email_templates

Parameters
string$type_templateGet message for key module
string$userUse template public or limited to this user
Translate$outputlangsOutput lang object
int$active1=Only active template, 0=Only disabled, -1=All
Returns
int <0 if KO, nb of records found if OK

Definition at line 1241 of file html.formmail.class.php.

◆ get_attached_files()

FormMail::get_attached_files ( )

Return list of attached files (stored in SECTION array)

Returns
array array('paths'=> ,'names'=>, 'mimes'=> )

Definition at line 247 of file html.formmail.class.php.

◆ get_form()

FormMail::get_form (   $addfileaction = 'addfile',
  $removefileaction = 'removefile' 
)

Get the form to input an email this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files this->withfile this->param: Contains more parameters like email templates info.

Parameters
string$addfileactionName of action when posting file attachments
string$removefileactionName of action when removing file attachments
Returns
string Form to show

Definition at line 288 of file html.formmail.class.php.

Referenced by show_form().

◆ getAvailableSubstitKey()

static FormMail::getAvailableSubstitKey (   $mode = 'formemail',
  $object = null 
)
static

Get list of substitution keys available for emails.

This is used for tooltips help. This include the complete_substitutions_array.

Parameters
string$mode'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
Object$objectObject if applicable
Returns
array Array of substitution values for emails.

Definition at line 1352 of file html.formmail.class.php.

◆ getEMailTemplate()

FormMail::getEMailTemplate (   $db,
  $type_template,
  $user,
  $outputlangs,
  $id = 0,
  $active = 1,
  $label = '' 
)

Return templates of email with type = $type_template or type = 'all'.

This search into table c_email_templates. Used by the get_form function.

Parameters
DoliDB$dbDatabase handler
string$type_templateGet message for model/type=$type_template, type='all' also included.
string$userGet template public or limited to this user
Translate$outputlangsOutput lang object
int$idId of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
int$active1=Only active template, 0=Only disabled, -1=All
string$labelLabel of template
Returns
ModelMail One instance of ModelMail

Definition at line 1117 of file html.formmail.class.php.

◆ isEMailTemplate()

FormMail::isEMailTemplate (   $type_template,
  $user,
  $outputlangs 
)

Find if template exists Search into table c_email_templates.

Parameters
string$type_templateGet message for key module
string$userUse template public or limited to this user
Translate$outputlangsOutput lang object
Returns
int <0 if KO,

Definition at line 1204 of file html.formmail.class.php.

◆ remove_attached_files()

FormMail::remove_attached_files (   $keytodelete)

Remove a file from the list of attached files (stored in SECTION array)

Parameters
string$keytodeleteKey in file array (0, 1, 2, ...)
Returns
void

Definition at line 218 of file html.formmail.class.php.

◆ setSubstitFromObject()

FormMail::setSubstitFromObject (   $object,
  $outputlangs 
)

Set substit array from object.

This is call when suggesting the email template into forms before sending email.

Parameters
CommonObject$objectObject to use
Translate$outputlangsObject lang
Returns
void
See also
getCommonSubstitutionArray

Definition at line 1295 of file html.formmail.class.php.

◆ show_form()

FormMail::show_form (   $addfileaction = 'addfile',
  $removefileaction = 'removefile' 
)

Show the form to input an email this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files this->withmaindocfile.

Parameters
string$addfileactionName of action when posting file attachments
string$removefileactionName of action when removing file attachments
Returns
void

Definition at line 271 of file html.formmail.class.php.

References get_form(), and print.


The documentation for this class was generated from the following file: