dolibarr  17.0.4
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
CommonObject Class Reference

Parent class of all other business classes (invoices, contracts, proposals, orders, ...) More...

Inheritance diagram for CommonObject:
Inheritance graph
[legend]
Collaboration diagram for CommonObject:
Collaboration graph
[legend]

Public Member Functions

 errorsToString ()
 Method to output saved errors. More...
 
 getFormatedCustomerRef ($objref)
 Return customer ref for screen output. More...
 
 getFormatedSupplierRef ($objref)
 Return supplier ref for screen output. More...
 
 getFullName ($langs, $option=0, $nameorder=-1, $maxlen=0)
 Return full name (civility+' '+name+' '+lastname) More...
 
 setUpperOrLowerCase ()
 Set to upper or ucwords/lower if needed. More...
 
 getKanbanView ($option='')
 Return clicable link of object (with eventually picto) More...
 
 getFullAddress ($withcountry=0, $sep="\n", $withregion=0, $extralangcode='')
 Return full address of contact. More...
 
 getBannerAddress ($htmlkey, $object)
 Return full address for banner. More...
 
 getLastMainDocLink ($modulepart, $initsharekey=0, $relativelink=0)
 Return the link of last main doc file for direct public download. More...
 
 add_contact ($fk_socpeople, $type_contact, $source='external', $notrigger=0)
 Add a link between element $this->element and a contact. More...
 
 copy_linked_contact ($objFrom, $source='internal')
 Copy contact from one element to current. More...
 
 update_contact ($rowid, $statut, $type_contact_id=0, $fk_socpeople=0)
 Update a link to contact line. More...
 
 delete_contact ($rowid, $notrigger=0)
 Delete a link to contact line. More...
 
 delete_linked_contact ($source='', $code='')
 Delete all links between an object $this and all its contacts in llx_element_contact. More...
 
 liste_contact ($statusoflink=-1, $source='external', $list=0, $code='', $status=-1, $arrayoftcids=array())
 Get array of all contacts for an object. More...
 
 swapContactStatus ($rowid)
 Update status of a contact linked to object. More...
 
 liste_type_contact ($source='internal', $order='position', $option=0, $activeonly=0, $code='')
 Return array with list of possible values for type of contacts. More...
 
 listeTypeContacts ($source='internal', $option=0, $activeonly=0, $code='', $element='', $excludeelement='')
 Return array with list of possible values for type of contacts. More...
 
 getIdContact ($source, $code, $status=0)
 Return id of contacts for a source and a contact code. More...
 
 fetch_contact ($contactid=null)
 Load object contact with id=$this->contact_id into $this->contact. More...
 
 fetch_thirdparty ($force_thirdparty_id=0)
 Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty. More...
 
 fetchOneLike ($ref)
 Looks for an object with ref matching the wildcard provided It does only work when $this->table_ref_field is set. More...
 
 fetch_barcode ()
 Load data for barcode into properties ->barcode_type* Properties ->barcode_type that is id of barcode. More...
 
 fetch_project ()
 Load the project with id $this->fk_project into this->project. More...
 
 fetch_projet ()
 Load the project with id $this->fk_project into this->project. More...
 
 fetch_product ()
 Load the product with id $this->fk_product into this->product. More...
 
 fetch_user ($userid)
 Load the user with id $userid into this->user. More...
 
 fetch_origin ()
 Read linked origin object. More...
 
 fetchObjectFrom ($table, $field, $key, $element=null)
 Load object from specific field. More...
 
 getValueFrom ($table, $id, $field)
 Getter generic. More...
 
 setValueFrom ($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='', $fk_user_field='fk_user_modif')
 Setter generic. More...
 
 load_previous_next_ref ($filter, $fieldid, $nodbprefix=0)
 Load properties id_previous and id_next by comparing $fieldid with $this->ref. More...
 
 getListContactId ($source='external')
 Return list of id of contacts of object. More...
 
 setProject ($projectid, $notrigger=0)
 Link element with a project. More...
 
 setPaymentMethods ($id)
 Change the payments methods. More...
 
 setMulticurrencyCode ($code)
 Change the multicurrency code. More...
 
 setMulticurrencyRate ($rate, $mode=1)
 Change the multicurrency rate. More...
 
 setPaymentTerms ($id, $deposit_percent=null)
 Change the payments terms. More...
 
 setTransportMode ($id)
 Change the transport mode methods. More...
 
 setRetainedWarrantyPaymentTerms ($id)
 Change the retained warranty payments terms. More...
 
 setDeliveryAddress ($id)
 Define delivery address. More...
 
 setShippingMethod ($shipping_method_id, $notrigger=false, $userused=null)
 Change the shipping method. More...
 
 setWarehouse ($warehouse_id)
 Change the warehouse. More...
 
 setDocModel ($user, $modelpdf)
 Set last model used by doc generator. More...
 
 setBankAccount ($fk_account, $notrigger=false, $userused=null)
 Change the bank account. More...
 
 line_order ($renum=false, $rowidorder='ASC', $fk_parent_line=true)
 Save a new position (field rang) for details lines. More...
 
 getChildrenOfLine ($id, $includealltree=0)
 Get children of line. More...
 
 line_up ($rowid, $fk_parent_line=true)
 Update a line to have a lower rank. More...
 
 line_down ($rowid, $fk_parent_line=true)
 Update a line to have a higher rank. More...
 
 updateRangOfLine ($rowid, $rang)
 Update position of line (rang) More...
 
 line_ajaxorder ($rows)
 Update position of line with ajax (rang) More...
 
 updateLineUp ($rowid, $rang)
 Update position of line up (rang) More...
 
 updateLineDown ($rowid, $rang, $max)
 Update position of line down (rang) More...
 
 getRangOfLine ($rowid)
 Get position of line (rang) More...
 
 getIdOfLine ($rang)
 Get rowid of the line relative to its position. More...
 
 line_max ($fk_parent_line=0)
 Get max value used for position of line (rang) More...
 
 update_ref_ext ($ref_ext)
 Update external ref of element. More...
 
 update_note ($note, $suffix='')
 Update note of element. More...
 
 update_note_public ($note)
 Update public note (kept for backward compatibility) More...
 
 update_price ($exclspec=0, $roundingadjust='none', $nodatabaseupdate=0, $seller=null)
 Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). More...
 
 add_object_linked ($origin=null, $origin_id=null, $f_user=null, $notrigger=0)
 Add an object link into llx_element_element. More...
 
 fetchObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $clause='OR', $alsosametype=1, $orderby='sourcetype', $loadalsoobjects=1)
 Fetch array of objects linked to current object (object of enabled modules only). More...
 
 clearObjectLinkedCache ()
 Clear the cache saying that all linked object were already loaded. More...
 
 updateObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $f_user=null, $notrigger=0)
 Update object linked of a current object. More...
 
 deleteObjectLinked ($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $rowid='', $f_user=null, $notrigger=0)
 Delete all links between an object $this. More...
 
 setStatut ($status, $elementId=null, $elementType='', $trigkey='', $fieldstatus='fk_statut')
 Set status of an object. More...
 
 getCanvas ($id=0, $ref='')
 Load type of canvas of an object if it exists. More...
 
 getSpecialCode ($lineid)
 Get special code of a line. More...
 
 isObjectUsed ($id=0, $entity=0)
 Function to check if an object is used by others. More...
 
 hasProductsOrServices ($predefined=-1)
 Function to say how many lines object contains. More...
 
 getTotalDiscount ()
 Function that returns the total amount HT of discounts applied for all lines. More...
 
 getTotalWeightVolume ()
 Return into unit=0, the calculated total of weight and volume of all lines * qty Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line. More...
 
 setExtraParameters ()
 Set extra parameters. More...
 
 formAddObjectLine ($dateSelector, $seller, $buyer, $defaulttpldir='/core/tpl')
 Show add free and predefined products/services form. More...
 
 printObjectLines ($action, $seller, $buyer, $selected=0, $dateSelector=0, $defaulttpldir='/core/tpl')
 Return HTML table for object lines TODO Move this into an output class file (htmlline.class.php) If lines are into a template, title must also be into a template But for the moment we don't know if it's possible as we keep a method available on overloaded objects. More...
 
 printObjectLine ($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected=0, $extrafields=null, $defaulttpldir='/core/tpl')
 Return HTML content of a detail line TODO Move this into an output class file (htmlline.class.php) More...
 
 printOriginLinesList ($restrictlist='', $selectedLines=array())
 Return HTML table table of source object lines TODO Move this and previous function into output html class file (htmlline.class.php). More...
 
 printOriginLine ($line, $var, $restrictlist='', $defaulttpldir='/core/tpl', $selectedLines=array())
 Return HTML with a line of table array of source object lines TODO Move this and previous function into output html class file (htmlline.class.php). More...
 
 add_element_resource ($resource_id, $resource_type, $busy=0, $mandatory=0)
 Add resources to the current object : add entry into llx_element_resources Need $this->element & $this->id. More...
 
 delete_resource ($rowid, $element, $notrigger=0)
 Delete a link to resource line. More...
 
 __clone ()
 Overwrite magic function to solve problem of cloning object that are kept as references. More...
 
 indexFile ($destfull, $update_main_doc_field)
 Index a file into the ECM database. More...
 
 addThumbs ($file)
 Build thumb. More...
 
 getDefaultCreateValueFor ($fieldname, $alternatevalue=null)
 Return the default value to use for a field when showing the create form of object. More...
 
 call_trigger ($triggerName, $user)
 Call trigger based on this instance. More...
 
 fetchValuesForExtraLanguages ()
 Function to get alternative languages of a data into $this->array_languages This method is NOT called by method fetch of objects but must be called separately. More...
 
 setValuesForExtraLanguages ($onlykey='')
 Fill array_options property of object by extrafields value (using for data sent by forms) More...
 
 fetchNoCompute ($id)
 Function to make a fetch but set environment to avoid to load computed values before. More...
 
 fetch_optionals ($rowid=null, $optionsArray=null)
 Function to get extra fields of an object into $this->array_options This method is in most cases called by method fetch of objects but you can call it separately. More...
 
 deleteExtraFields ()
 Delete all extra fields values for the current object. More...
 
 insertExtraFields ($trigger='', $userused=null)
 Add/Update all extra fields values for the current object. More...
 
 insertExtraLanguages ($trigger='', $userused=null)
 Add/Update all extra fields values for the current object. More...
 
 updateExtraField ($key, $trigger=null, $userused=null)
 Update 1 extra field value for the current object. More...
 
 updateExtraLanguages ($key, $trigger=null, $userused=null)
 Update an extra language value for the current object. More...
 
 showInputField ($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0, $nonewbutton=0)
 Return HTML string to put an input field into a page Code very similar with showInputField of extra fields. More...
 
 clearFieldError ($fieldKey)
 clear validation message result for a field More...
 
 setFieldError ($fieldKey, $msg='')
 set validation error message a field More...
 
 getFieldError ($fieldKey)
 get field error message More...
 
 validateField ($val, $fieldKey, $fieldValue)
 Return validation test result for a field. More...
 
 showOptionals ($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0, $display_type='card')
 Function to show lines of extrafields with output datas. More...
 
 getJSListDependancies ($type='_extra')
 
 getRights ()
 Returns the rights used for this class. More...
 
 defineBuyPrice ($unitPrice=0.0, $discountPercent=0.0, $fk_product=0)
 Get buy price to use for margin calculation. More...
 
 show_photos ($modulepart, $sdir, $size=0, $nbmax=0, $nbbyrow=5, $showfilename=0, $showaction=0, $maxHeight=120, $maxWidth=160, $nolink=0, $notitle=0, $usesharelink=0)
 Show photos of an object (nbmax maximum), into several columns. More...
 
 isDate ($info)
 Function test if type is date. More...
 
 isDuration ($info)
 Function test if type is duration. More...
 
 isInt ($info)
 Function test if type is integer. More...
 
 isFloat ($info)
 Function test if type is float. More...
 
 isText ($info)
 Function test if type is text. More...
 
 setVarsFromFetchObj (&$obj)
 Function to load data from a SQL pointer into properties of current object $this. More...
 
 getFieldList ($alias='')
 Function to concat keys of fields. More...
 
 createCommon (User $user, $notrigger=false)
 Create object into database. More...
 
 fetchCommon ($id, $ref=null, $morewhere='')
 Load object in memory from the database. More...
 
 fetchLinesCommon ($morewhere='')
 Load object in memory from the database. More...
 
 updateCommon (User $user, $notrigger=false)
 Update object into database. More...
 
 deleteCommon (User $user, $notrigger=false, $forcechilddeletion=0)
 Delete object in database. More...
 
 deleteByParentField ($parentId=0, $parentField='', $filter=array(), $filtermode="AND")
 Delete all child object from a parent ID. More...
 
 deleteLineCommon (User $user, $idline, $notrigger=false)
 Delete a line of object in database. More...
 
 setStatusCommon ($user, $status, $notrigger=0, $triggercode='')
 Set to a status. More...
 
 initAsSpecimenCommon ()
 Initialise object with example values Id must be 0 if object instance is a specimen. More...
 
 fetchComments ()
 Load comments linked with current task. More...
 
 getNbComments ()
 Return nb comments already posted. More...
 
 trimParameters ($parameters)
 Trim object parameters. More...
 
 getCategoriesCommon ($type_categ)
 Sets object to given categories. More...
 
 setCategoriesCommon ($categories, $type_categ='', $remove_existing=true)
 Sets object to given categories. More...
 
 cloneCategories ($fromId, $toId, $type='')
 Copy related categories to another object. More...
 
 deleteEcmFiles ($mode=0)
 Delete related files of object in database. More...
 

Static Public Member Functions

static isExistingObject ($element, $id, $ref='', $ref_ext='')
 Check an object id/ref exists If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch. More...
 
static getAllItemsLinkedByObjectID ($fk_object_where, $field_select, $field_where, $table_element)
 Function used to get an array with all items linked to an object id in association table. More...
 
static deleteAllItemsLinkedByObjectID ($fk_object_where, $field_where, $table_element)
 Function used to remove all items linked to an object id in association table. More...
 
static commonReplaceThirdparty (DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
 Function used to replace a thirdparty id with another one. More...
 
static commonReplaceProduct (DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0)
 Function used to replace a product id with another one. More...
 

Public Attributes

 $projet
 
 $fk_projet
 
 $note
 

Protected Member Functions

 commonGenerateDocument ($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null)
 Common function for all objects extending CommonObject for generating documents. More...
 
 isArray ($info)
 Function test if type is array. More...
 
 canBeNull ($info)
 Function test if field can be null. More...
 
 isForcedToNullIfZero ($info)
 Function test if field is forced to null if zero or empty. More...
 
 isIndex ($info)
 Function test if is indexed. More...
 
 setSaveQuery ()
 Function to return the array of data key-value from the ->fields and all the ->properties of an object. More...
 
 quote ($value, $fieldsentry)
 Add quote to field value if necessary. More...
 

Detailed Description

Parent class of all other business classes (invoices, contracts, proposals, orders, ...)

Definition at line 44 of file commonobject.class.php.

Member Function Documentation

◆ __clone()

CommonObject::__clone ( )

Overwrite magic function to solve problem of cloning object that are kept as references.

Returns
void

Definition at line 5416 of file commonobject.class.php.

◆ add_contact()

CommonObject::add_contact (   $fk_socpeople,
  $type_contact,
  $source = 'external',
  $notrigger = 0 
)

Add a link between element $this->element and a contact.

Parameters
int$fk_socpeopleId of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link
int | string$type_contactType of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL
string$sourceexternal=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
int$notriggerDisable all triggers
Returns
int <0 if KO, 0 if already added or code not valid, >0 if OK

Definition at line 1141 of file commonobject.class.php.

◆ add_element_resource()

CommonObject::add_element_resource (   $resource_id,
  $resource_type,
  $busy = 0,
  $mandatory = 0 
)

Add resources to the current object : add entry into llx_element_resources Need $this->element & $this->id.

Parameters
int$resource_idResource id
string$resource_type'resource'
int$busyBusy or not
int$mandatoryMandatory or not
Returns
int <=0 if KO, >0 if OK

Definition at line 5339 of file commonobject.class.php.

◆ add_object_linked()

CommonObject::add_object_linked (   $origin = null,
  $origin_id = null,
  $f_user = null,
  $notrigger = 0 
)

Add an object link into llx_element_element.

Parameters
string$originLinked element type
int$origin_idLinked element id
User$f_userUser that create
int$notrigger1=Does not execute triggers, 0=execute triggers
Returns
int <=0 if KO, >0 if OK
See also
fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked()

Definition at line 3847 of file commonobject.class.php.

◆ addThumbs()

CommonObject::addThumbs (   $file)

Build thumb.

Parameters
string$filePath file in UTF8 to original file to create thumbs from.
Returns
void

Definition at line 5741 of file commonobject.class.php.

◆ call_trigger()

CommonObject::call_trigger (   $triggerName,
  $user 
)

Call trigger based on this instance.

Some context information may also be provided into array property this->context. NB: Error from trigger are stacked in interface->errors NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction.

Parameters
string$triggerNametrigger's name to execute
User$userObject user
Returns
int Result of run_triggers

Reimplemented in EcmDirectory.

Definition at line 5831 of file commonobject.class.php.

◆ canBeNull()

CommonObject::canBeNull (   $info)
protected

Function test if field can be null.

Parameters
array$infocontent informations of field
Returns
bool true if it can be null

Definition at line 8971 of file commonobject.class.php.

◆ clearFieldError()

CommonObject::clearFieldError (   $fieldKey)

clear validation message result for a field

Parameters
string$fieldKeyKey of attribute to clear
Returns
null

Definition at line 7880 of file commonobject.class.php.

◆ clearObjectLinkedCache()

CommonObject::clearObjectLinkedCache ( )

Clear the cache saying that all linked object were already loaded.

So next fetchObjectLinked will reload all links.

Returns
int <0 if KO, >0 if OK
See also
fetchObjectLinked()

Definition at line 4166 of file commonobject.class.php.

◆ cloneCategories()

CommonObject::cloneCategories (   $fromId,
  $toId,
  $type = '' 
)

Copy related categories to another object.

Parameters
int$fromIdId object source
int$toIdId object cible
string$typeType of category ('product', ...)
Returns
int < 0 if error, > 0 if ok

Definition at line 10121 of file commonobject.class.php.

◆ commonGenerateDocument()

CommonObject::commonGenerateDocument (   $modelspath,
  $modele,
  $outputlangs,
  $hidedetails,
  $hidedesc,
  $hideref,
  $moreparams = null 
)
protected

Common function for all objects extending CommonObject for generating documents.

Parameters
string$modelspathRelative folder where generators are placed
string$modeleGenerator to use. Caller must set it to obj->model_pdf or GETPOST('model_pdf','alpha') for example.
Translate$outputlangsOutput language to use
int$hidedetails1 to hide details. 0 by default
int$hidedesc1 to hide product description. 0 by default
int$hideref1 to hide product reference. 0 by default
null | array$moreparamsArray to provide more information
Returns
int >0 if OK, <0 if KO
See also
addFileIntoDatabaseIndex()

Definition at line 5440 of file commonobject.class.php.

◆ commonReplaceProduct()

static CommonObject::commonReplaceProduct ( DoliDB  $db,
  $origin_id,
  $dest_id,
array  $tables,
  $ignoreerrors = 0 
)
static

Function used to replace a product id with another one.

This function is meant to be called from replaceProduct with the appropriate tables Column name fk_product MUST be used to identify products

Parameters
DoliDB$dbDatabase handler
int$origin_idOld product id (the product to delete)
int$dest_idNew product id (the product that will received element of the other)
string[]$tablesTables that need to be changed
int$ignoreerrorsIgnore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old product may already exists on new one)
Returns
bool True if success, False if error

Definition at line 8541 of file commonobject.class.php.

Referenced by BOM\replaceProduct(), Propal\replaceProduct(), Commande\replaceProduct(), FactureRec\replaceProduct(), Facture\replaceProduct(), Contrat\replaceProduct(), Delivery\replaceProduct(), FichinterRec\replaceProduct(), CommandeFournisseur\replaceProduct(), FactureFournisseur\replaceProduct(), ProductFournisseur\replaceProduct(), Reception\replaceProduct(), and SupplierProposal\replaceProduct().

◆ commonReplaceThirdparty()

static CommonObject::commonReplaceThirdparty ( DoliDB  $db,
  $origin_id,
  $dest_id,
array  $tables,
  $ignoreerrors = 0 
)
static

Function used to replace a thirdparty id with another one.

This function is meant to be called from replaceThirdparty with the appropriate tables Column name fk_soc MUST be used to identify thirdparties

Parameters
DoliDB$dbDatabase handler
int$origin_idOld thirdparty id (the thirdparty to delete)
int$dest_idNew thirdparty id (the thirdparty that will received element of the other)
string[]$tablesTables that need to be changed
int$ignoreerrorsIgnore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one)
Returns
bool True if success, False if error

Definition at line 8512 of file commonobject.class.php.

Referenced by Mo\replaceThirdparty(), Bookmark\replaceThirdparty(), Categorie\replaceThirdparty(), ActionComm\replaceThirdparty(), Propal\replaceThirdparty(), Commande\replaceThirdparty(), FactureRec\replaceThirdparty(), Facture\replaceThirdparty(), Contact\replaceThirdparty(), Contrat\replaceThirdparty(), Delivery\replaceThirdparty(), Don\replaceThirdparty(), Expedition\replaceThirdparty(), Fichinter\replaceThirdparty(), FichinterRec\replaceThirdparty(), Fournisseur\replaceThirdparty(), CommandeFournisseur\replaceThirdparty(), FactureFournisseurRec\replaceThirdparty(), FactureFournisseur\replaceThirdparty(), ProductFournisseur\replaceThirdparty(), Product\replaceThirdparty(), Project\replaceThirdparty(), Reception\replaceThirdparty(), and SupplierProposal\replaceThirdparty().

◆ copy_linked_contact()

CommonObject::copy_linked_contact (   $objFrom,
  $source = 'internal' 
)

Copy contact from one element to current.

Parameters
CommonObject$objFromSource element
string$sourceNature of contact ('internal' or 'external')
Returns
int >0 if OK, <0 if KO

Definition at line 1249 of file commonobject.class.php.

◆ createCommon()

CommonObject::createCommon ( User  $user,
  $notrigger = false 
)

◆ defineBuyPrice()

CommonObject::defineBuyPrice (   $unitPrice = 0.0,
  $discountPercent = 0.0,
  $fk_product = 0 
)

Get buy price to use for margin calculation.

This function is called when buy price is unknown. Set buy price = sell price if ForceBuyingPriceIfNull configured, elseif calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice elseif calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice else set min buy price as buy price

Parameters
float$unitPriceProduct unit price
float$discountPercentLine discount percent
int$fk_productProduct id
Returns
float <0 if KO, buyprice if OK

Definition at line 8570 of file commonobject.class.php.

◆ delete_contact()

CommonObject::delete_contact (   $rowid,
  $notrigger = 0 
)

Delete a link to contact line.

Parameters
int$rowidId of contact link line to delete
int$notriggerDisable all triggers
Returns
int >0 if OK, <0 if KO

Definition at line 1301 of file commonobject.class.php.

◆ delete_linked_contact()

CommonObject::delete_linked_contact (   $source = '',
  $code = '' 
)

Delete all links between an object $this and all its contacts in llx_element_contact.

Parameters
string$source'' or 'internal' or 'external'
string$codeType of contact (code or id)
Returns
int <0 if KO, 0=Nothing done, >0 if OK

Definition at line 1351 of file commonobject.class.php.

◆ delete_resource()

CommonObject::delete_resource (   $rowid,
  $element,
  $notrigger = 0 
)

Delete a link to resource line.

Parameters
int$rowidId of resource line to delete
int$elementelement name (for trigger) TODO: use $this->element into commonobject class
int$notriggerDisable all triggers
Returns
int >0 if OK, <0 if KO

Definition at line 5380 of file commonobject.class.php.

◆ deleteAllItemsLinkedByObjectID()

static CommonObject::deleteAllItemsLinkedByObjectID (   $fk_object_where,
  $field_where,
  $table_element 
)
static

Function used to remove all items linked to an object id in association table.

Parameters
int$fk_object_whereid of object we need to remove linked items
string$field_wherename of field of object we need to delete linked items
string$table_elementname of association table
Returns
int <0 if KO, 0 if nothing done, >0 if OK and something done

Definition at line 4365 of file commonobject.class.php.

◆ deleteByParentField()

CommonObject::deleteByParentField (   $parentId = 0,
  $parentField = '',
  $filter = array(),
  $filtermode = "AND" 
)

Delete all child object from a parent ID.

Parameters
int$parentIdParent Id
string$parentFieldName of Foreign key parent column
array$filteran array filter
string$filtermodeAND or OR
Returns
int <0 if KO, >0 if OK
Exceptions
Exception

Definition at line 9730 of file commonobject.class.php.

◆ deleteCommon()

CommonObject::deleteCommon ( User  $user,
  $notrigger = false,
  $forcechilddeletion = 0 
)

◆ deleteEcmFiles()

CommonObject::deleteEcmFiles (   $mode = 0)

Delete related files of object in database.

Parameters
integer$mode0=Use path to find record, 1=Use src_object_xxx fields (Mode 1 is recommanded for new objects)
Returns
bool True if OK, False if KO

Definition at line 10152 of file commonobject.class.php.

◆ deleteExtraFields()

CommonObject::deleteExtraFields ( )

Delete all extra fields values for the current object.

Returns
int <0 if KO, >0 if OK
See also
deleteExtraLanguages(), insertExtraField(), updateExtraField(), setValueFrom()

Definition at line 6158 of file commonobject.class.php.

◆ deleteLineCommon()

CommonObject::deleteLineCommon ( User  $user,
  $idline,
  $notrigger = false 
)

Delete a line of object in database.

Parameters
User$userUser that delete
int$idlineId of line to delete
bool$notriggerfalse=launch triggers after, true=disable triggers
Returns
int >0 if OK, <0 if KO

Definition at line 9807 of file commonobject.class.php.

◆ deleteObjectLinked()

CommonObject::deleteObjectLinked (   $sourceid = null,
  $sourcetype = '',
  $targetid = null,
  $targettype = '',
  $rowid = '',
  $f_user = null,
  $notrigger = 0 
)

Delete all links between an object $this.

Parameters
int$sourceidObject source id
string$sourcetypeObject source type
int$targetidObject target id
string$targettypeObject target type
int$rowidRow id of line to delete. If defined, other parameters are not used.
User$f_userUser that create
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int >0 if OK, <0 if KO
See also
add_object_linked(), updateObjectLinked(), fetchObjectLinked()

Definition at line 4257 of file commonobject.class.php.

◆ errorsToString()

CommonObject::errorsToString ( )

Method to output saved errors.

Returns
string String with errors

Definition at line 677 of file commonobject.class.php.

◆ fetch_barcode()

CommonObject::fetch_barcode ( )

Load data for barcode into properties ->barcode_type* Properties ->barcode_type that is id of barcode.

Type is used to find other properties, but if it is not defined, ->element must be defined to know default barcode type.

Returns
int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded)

Definition at line 1844 of file commonobject.class.php.

◆ fetch_contact()

CommonObject::fetch_contact (   $contactid = null)

Load object contact with id=$this->contact_id into $this->contact.

Parameters
int$contactidId du contact. Use this->contact_id if empty.
Returns
int <0 if KO, >0 if OK

Definition at line 1749 of file commonobject.class.php.

◆ fetch_optionals()

CommonObject::fetch_optionals (   $rowid = null,
  $optionsArray = null 
)

Function to get extra fields of an object into $this->array_options This method is in most cases called by method fetch of objects but you can call it separately.

Parameters
int$rowidId of line. Use the id of object if not defined. Deprecated. Function must be called without parameters.
array$optionsArrayArray resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters.
Returns
int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded
See also
fetchValuesForExtraLanguages()

Definition at line 6047 of file commonobject.class.php.

◆ fetch_origin()

CommonObject::fetch_origin ( )

Read linked origin object.

Returns
void

Definition at line 1967 of file commonobject.class.php.

◆ fetch_product()

CommonObject::fetch_product ( )

Load the product with id $this->fk_product into this->product.

Returns
int <0 if KO, >=0 if OK

Definition at line 1929 of file commonobject.class.php.

◆ fetch_project()

CommonObject::fetch_project ( )

Load the project with id $this->fk_project into this->project.

Returns
int <0 if KO, >=0 if OK

Definition at line 1891 of file commonobject.class.php.

◆ fetch_projet()

CommonObject::fetch_projet ( )

Load the project with id $this->fk_project into this->project.

Returns
int <0 if KO, >=0 if OK

Reimplemented in ConferenceOrBoothAttendee.

Definition at line 1903 of file commonobject.class.php.

◆ fetch_thirdparty()

CommonObject::fetch_thirdparty (   $force_thirdparty_id = 0)

Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty.

Parameters
int$force_thirdparty_idForce thirdparty id
Returns
int <0 if KO, >0 if OK

Reimplemented in PaiementFourn, and Paiement.

Definition at line 1774 of file commonobject.class.php.

◆ fetch_user()

CommonObject::fetch_user (   $userid)

Load the user with id $userid into this->user.

Parameters
int$useridId du contact
Returns
int <0 if KO, >0 if OK

Definition at line 1952 of file commonobject.class.php.

◆ fetchComments()

CommonObject::fetchComments ( )

Load comments linked with current task.

Returns
boolean 1 if ok

Definition at line 9968 of file commonobject.class.php.

◆ fetchCommon()

CommonObject::fetchCommon (   $id,
  $ref = null,
  $morewhere = '' 
)

Load object in memory from the database.

Parameters
int$idId object
string$refRef
string$morewhereMore SQL filters (' AND ...')
Returns
int <0 if KO, 0 if not found, >0 if OK

Definition at line 9381 of file commonobject.class.php.

Referenced by ProductFournisseurPrice\fetch().

◆ fetchLinesCommon()

CommonObject::fetchLinesCommon (   $morewhere = '')

Load object in memory from the database.

Parameters
string$morewhereMore SQL filters (' AND ...')
Returns
int <0 if KO, 0 if not found, >0 if OK

Definition at line 9437 of file commonobject.class.php.

◆ fetchNoCompute()

CommonObject::fetchNoCompute (   $id)

Function to make a fetch but set environment to avoid to load computed values before.

Parameters
int$idID of object
Returns
int >0 if OK, 0 if not found, <0 if KO

Definition at line 6023 of file commonobject.class.php.

◆ fetchObjectFrom()

CommonObject::fetchObjectFrom (   $table,
  $field,
  $key,
  $element = null 
)

Load object from specific field.

Parameters
string$tableTable element or element line
string$fieldField selected
string$keyImport key
string$elementElement name
Returns
int <0 if KO, >0 if OK

Definition at line 1996 of file commonobject.class.php.

◆ fetchObjectLinked()

mixed Array of linked objects Loaded by CommonObject::fetchObjectLinked (   $sourceid = null,
  $sourcetype = '',
  $targetid = null,
  $targettype = '',
  $clause = 'OR',
  $alsosametype = 1,
  $orderby = 'sourcetype',
  $loadalsoobjects = 1 
)

Fetch array of objects linked to current object (object of enabled modules only).

Links are loaded into this->linkedObjectsIds array + this->linkedObjects array if $loadalsoobjects = 1 or $loadalsoobjects = type Possible usage for parameters:

  • all parameters empty -> we look all link to current object (current object can be source or target)
  • source id+type -> will get list of targets linked to source
  • target id+type -> will get list of sources linked to target
  • source id+type + target type -> will get list of targets of the type linked to source
  • target id+type + source type -> will get list of sources of the type linked to target
Parameters
int$sourceidObject source id (if not defined, id of object)
string$sourcetypeObject source type (if not defined, element name of object)
int$targetidObject target id (if not defined, id of object)
string$targettypeObject target type (if not defined, element name of object)
string$clause'OR' or 'AND' clause used when both source id and target id are provided
int$alsosametype0=Return only links to object that differs from source type. 1=Include also link to objects of same type.
string$orderbySQL 'ORDER BY' clause
int | string$loadalsoobjectsLoad also array this->linkedObjects. Use 0 to increase performances, Use 1 to load all, Use value of type ('facture', 'facturerec', ...) to load only a type of object.
Returns
int <0 if KO, >0 if OK
See also
add_object_linked(), updateObjectLinked(), deleteObjectLinked()

Definition at line 3945 of file commonobject.class.php.

Referenced by Propal\InvoiceArrayList().

◆ fetchOneLike()

CommonObject::fetchOneLike (   $ref)

Looks for an object with ref matching the wildcard provided It does only work when $this->table_ref_field is set.

Parameters
string$refWildcard
Returns
int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO

Definition at line 1817 of file commonobject.class.php.

◆ fetchValuesForExtraLanguages()

CommonObject::fetchValuesForExtraLanguages ( )

Function to get alternative languages of a data into $this->array_languages This method is NOT called by method fetch of objects but must be called separately.

Returns
int <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded
See also
fetch_optionnals()

Definition at line 5869 of file commonobject.class.php.

◆ formAddObjectLine()

CommonObject::formAddObjectLine (   $dateSelector,
  $seller,
  $buyer,
  $defaulttpldir = '/core/tpl' 
)

Show add free and predefined products/services form.

Parameters
int$dateSelector1=Show also date range input fields
Societe$sellerObject thirdparty who sell
Societe$buyerObject thirdparty who buy
string$defaulttpldirDirectory where to find the template
Returns
void

Reimplemented in ProductAttribute.

Definition at line 4874 of file commonobject.class.php.

◆ getAllItemsLinkedByObjectID()

static CommonObject::getAllItemsLinkedByObjectID (   $fk_object_where,
  $field_select,
  $field_where,
  $table_element 
)
static

Function used to get an array with all items linked to an object id in association table.

Parameters
int$fk_object_whereid of object we need to get linked items
string$field_selectname of field we need to get a list
string$field_wherename of field of object we need to get linked items
string$table_elementname of association table
Returns
array Array of record

Definition at line 4336 of file commonobject.class.php.

◆ getBannerAddress()

CommonObject::getBannerAddress (   $htmlkey,
  $object 
)

Return full address for banner.

Parameters
string$htmlkeyHTML id to make banner content unique
Object$objectObject (thirdparty, thirdparty of contact for contact, null for a member)
Returns
string Full address string

Definition at line 851 of file commonobject.class.php.

◆ getCanvas()

CommonObject::getCanvas (   $id = 0,
  $ref = '' 
)

Load type of canvas of an object if it exists.

Parameters
int$idRecord id
string$refRecord ref
Returns
int <0 if KO, 0 if nothing done, >0 if OK

Definition at line 4520 of file commonobject.class.php.

◆ getCategoriesCommon()

CommonObject::getCategoriesCommon (   $type_categ)

Sets object to given categories.

Deletes object from existing categories not supplied. Adds it to non existing supplied categories. Existing categories are left untouch.

Parameters
string$type_categCategory type ('customer', 'supplier', 'website_page', ...)
Returns
int Array of category objects or < 0 if KO

Definition at line 10023 of file commonobject.class.php.

◆ getChildrenOfLine()

CommonObject::getChildrenOfLine (   $id,
  $includealltree = 0 
)

Get children of line.

Parameters
int$idId of parent line
int$includealltree0 = 1st level child, 1 = All level child
Returns
array Array with list of children lines id

Definition at line 3178 of file commonobject.class.php.

◆ getDefaultCreateValueFor()

CommonObject::getDefaultCreateValueFor (   $fieldname,
  $alternatevalue = null 
)

Return the default value to use for a field when showing the create form of object.

Return values in this order: 1) If parameter is available into POST, we return it first. 2) If not but an alternate value was provided as parameter of function, we return it. 3) If not but a constant $conf->global->OBJECTELEMENT_FIELDNAME is set, we return it (It is better to use the dedicated table). 4) Return value found into database (TODO No yet implemented)

Parameters
string$fieldnameName of field
string$alternatevalueAlternate value to use
Returns
string|string[] Default value (can be an array if the GETPOST return an array)

Definition at line 5782 of file commonobject.class.php.

◆ getFieldError()

CommonObject::getFieldError (   $fieldKey)

get field error message

Parameters
string$fieldKeyKey of attribute
Returns
string Error message of validation ('' if no error)

Definition at line 7907 of file commonobject.class.php.

◆ getFieldList()

CommonObject::getFieldList (   $alias = '')

Function to concat keys of fields.

Parameters
string$aliasString of alias of table for fields. For example 't'. It is recommended to use '' and set alias into fields defintion.
Returns
string list of alias fields

Definition at line 9156 of file commonobject.class.php.

◆ getFormatedCustomerRef()

CommonObject::getFormatedCustomerRef (   $objref)

Return customer ref for screen output.

Parameters
string$objrefCustomer ref
Returns
string Customer ref formated

Definition at line 689 of file commonobject.class.php.

◆ getFormatedSupplierRef()

CommonObject::getFormatedSupplierRef (   $objref)

Return supplier ref for screen output.

Parameters
string$objrefSupplier ref
Returns
string Supplier ref formated

Definition at line 708 of file commonobject.class.php.

◆ getFullAddress()

CommonObject::getFullAddress (   $withcountry = 0,
  $sep = "\n",
  $withregion = 0,
  $extralangcode = '' 
)

Return full address of contact.

Parameters
int$withcountry1=Add country into address string
string$sepSeparator to use to build string
int$withregion1=Add region into address string
string$extralangcodeUser extralanguages as value
Returns
string Full address string

Definition at line 822 of file commonobject.class.php.

◆ getFullName()

CommonObject::getFullName (   $langs,
  $option = 0,
  $nameorder = -1,
  $maxlen = 0 
)

Return full name (civility+' '+name+' '+lastname)

Parameters
Translate$langsLanguage object for translation of civility (used only if option is 1)
int$option0=No option, 1=Add civility
int$nameorder-1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
int$maxlenMaximum length
Returns
string String with full name

Definition at line 730 of file commonobject.class.php.

◆ getIdContact()

CommonObject::getIdContact (   $source,
  $code,
  $status = 0 
)

Return id of contacts for a source and a contact code.

Example: contact client de facturation ('external', 'BILLING') Example: contact client de livraison ('external', 'SHIPPING') Example: contact interne suivi paiement ('internal', 'SALESREPFOLL')

Parameters
string$source'external' or 'internal'
string$code'BILLING', 'SHIPPING', 'SALESREPFOLL', ...
int$statuslimited to a certain status
Returns
array List of id for such contacts

Definition at line 1681 of file commonobject.class.php.

Referenced by Facture\getIdBillingContact(), Contrat\getIdBillingContact(), Contrat\getIdServiceContact(), and Facture\getIdShippingContact().

◆ getIdOfLine()

CommonObject::getIdOfLine (   $rang)

Get rowid of the line relative to its position.

Parameters
int$rangRang value
Returns
int Rowid of the line

Definition at line 3387 of file commonobject.class.php.

◆ getJSListDependancies()

CommonObject::getJSListDependancies (   $type = '_extra')
Parameters
string$typeType for prefix
Returns
string Javacript code to manage dependency

Definition at line 8406 of file commonobject.class.php.

◆ getKanbanView()

CommonObject::getKanbanView (   $option = '')

Return clicable link of object (with eventually picto)

Parameters
string$optionWhere point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
Returns
string HTML Code for Kanban thumb.

Reimplemented in User.

Definition at line 791 of file commonobject.class.php.

◆ getLastMainDocLink()

CommonObject::getLastMainDocLink (   $modulepart,
  $initsharekey = 0,
  $relativelink = 0 
)

Return the link of last main doc file for direct public download.

Parameters
string$modulepartModule related to document
int$initsharekeyInit the share key if it was not yet defined
int$relativelink0=Return full external link, 1=Return link relative to root of file
Returns
string Link or empty string if there is no download link

Definition at line 1047 of file commonobject.class.php.

◆ getListContactId()

CommonObject::getListContactId (   $source = 'external')

Return list of id of contacts of object.

Parameters
string$sourceSource of contact: external (llx_socpeople) or internal (llx_user) or thirdparty (llx_societe)
Returns
array Array of id of contacts (if source=external or internal) Array of id of third parties with at least one contact on object (if source=thirdparty)

Reimplemented in Task.

Definition at line 2344 of file commonobject.class.php.

◆ getNbComments()

CommonObject::getNbComments ( )

Return nb comments already posted.

Returns
int

Definition at line 9988 of file commonobject.class.php.

◆ getRangOfLine()

CommonObject::getRangOfLine (   $rowid)

Get position of line (rang)

Parameters
int$rowidId of line
Returns
int Value of rang in table of lines

Definition at line 3363 of file commonobject.class.php.

◆ getRights()

CommonObject::getRights ( )

Returns the rights used for this class.

Returns
array Array of permission for the module

Reimplemented in Product, FactureFournisseur, and CommandeFournisseur.

Definition at line 8481 of file commonobject.class.php.

◆ getSpecialCode()

CommonObject::getSpecialCode (   $lineid)

Get special code of a line.

Parameters
int$lineidId of line
Returns
int Special code

Definition at line 4566 of file commonobject.class.php.

◆ getTotalDiscount()

CommonObject::getTotalDiscount ( )

Function that returns the total amount HT of discounts applied for all lines.

Returns
float|string Total amout of discount

Definition at line 4696 of file commonobject.class.php.

◆ getTotalWeightVolume()

CommonObject::getTotalWeightVolume ( )

Return into unit=0, the calculated total of weight and volume of all lines * qty Calculate by adding weight and volume of each product line, so properties ->volume/volume_units/weight/weight_units must be loaded on line.

Returns
array array('weight'=>...,'volume'=>...)

Definition at line 4738 of file commonobject.class.php.

◆ getValueFrom()

CommonObject::getValueFrom (   $table,
  $id,
  $field 
)

Getter generic.

Load value from a specific field

Parameters
string$tableTable of element or element line
int$idElement id
string$fieldField selected
Returns
int <0 if KO, >0 if OK

Definition at line 2031 of file commonobject.class.php.

◆ hasProductsOrServices()

CommonObject::hasProductsOrServices (   $predefined = -1)

Function to say how many lines object contains.

Parameters
int$predefined-1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service
Returns
int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found

Definition at line 4662 of file commonobject.class.php.

◆ indexFile()

CommonObject::indexFile (   $destfull,
  $update_main_doc_field 
)

Index a file into the ECM database.

Parameters
string$destfullFull path of file to index
int$update_main_doc_fieldUpdate field main_doc fied into the table of object. This param is set when called for a document generation if document generator hase ->update_main_doc_field set and returns ->result['fullpath'].
Returns
int <0 if KO, >0 if OK

Definition at line 5626 of file commonobject.class.php.

◆ initAsSpecimenCommon()

CommonObject::initAsSpecimenCommon ( )

◆ insertExtraFields()

CommonObject::insertExtraFields (   $trigger = '',
  $userused = null 
)

Add/Update all extra fields values for the current object.

Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) This function delete record with all extrafields and insert them again from the array $this->array_options.

Parameters
string$triggerIf defined, call also the trigger (for example COMPANY_MODIFY)
User$userusedObject user
Returns
int -1=error, O=did nothing, 1=OK
See also
insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom()

Definition at line 6198 of file commonobject.class.php.

◆ insertExtraLanguages()

CommonObject::insertExtraLanguages (   $trigger = '',
  $userused = null 
)

Add/Update all extra fields values for the current object.

Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...) This function delete record with all extrafields and insert them again from the array $this->array_options.

Parameters
string$triggerIf defined, call also the trigger (for example COMPANY_MODIFY)
User$userusedObject user
Returns
int -1=error, O=did nothing, 1=OK
See also
insertExtraFields(), updateExtraField(), setValueFrom()

Definition at line 6466 of file commonobject.class.php.

◆ isArray()

CommonObject::isArray (   $info)
protected

Function test if type is array.

Parameters
array$infocontent informations of field
Returns
bool true if array

Definition at line 8865 of file commonobject.class.php.

◆ isDate()

CommonObject::isDate (   $info)

Function test if type is date.

Parameters
array$infocontent informations of field
Returns
bool true if date

Definition at line 8883 of file commonobject.class.php.

◆ isDuration()

CommonObject::isDuration (   $info)

Function test if type is duration.

Parameters
array$infocontent informations of field
Returns
bool true if field of type duration

Definition at line 8897 of file commonobject.class.php.

◆ isExistingObject()

static CommonObject::isExistingObject (   $element,
  $id,
  $ref = '',
  $ref_ext = '' 
)
static

Check an object id/ref exists If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch.

Parameters
string$elementString of element ('product', 'facture', ...)
int$idId of object
string$refRef of object to check
string$ref_extRef ext of object to check
Returns
int <0 if KO, 0 if OK but not found, >0 if OK and exists

Definition at line 635 of file commonobject.class.php.

◆ isFloat()

CommonObject::isFloat (   $info)

Function test if type is float.

Parameters
array$infocontent informations of field
Returns
bool true if float

Definition at line 8935 of file commonobject.class.php.

◆ isForcedToNullIfZero()

CommonObject::isForcedToNullIfZero (   $info)
protected

Function test if field is forced to null if zero or empty.

Parameters
array$infocontent informations of field
Returns
bool true if forced to null

Definition at line 8989 of file commonobject.class.php.

◆ isIndex()

CommonObject::isIndex (   $info)
protected

Function test if is indexed.

Parameters
array$infocontent informations of field
Returns
bool

Definition at line 9007 of file commonobject.class.php.

◆ isInt()

CommonObject::isInt (   $info)

Function test if type is integer.

Parameters
array$infocontent informations of field
Returns
bool true if integer

Definition at line 8916 of file commonobject.class.php.

◆ isObjectUsed()

CommonObject::isObjectUsed (   $id = 0,
  $entity = 0 
)

Function to check if an object is used by others.

Check is done into this->childtables. There is no check into llx_element_element.

Parameters
int$idForce id of object
int$entityForce entity to check
Returns
int <0 if KO, 0 if not used, >0 if already used

Definition at line 4585 of file commonobject.class.php.

◆ isText()

CommonObject::isText (   $info)

Function test if type is text.

Parameters
array$infocontent informations of field
Returns
bool true if type text

Definition at line 8953 of file commonobject.class.php.

◆ line_ajaxorder()

CommonObject::line_ajaxorder (   $rows)

Update position of line with ajax (rang)

Parameters
array$rowsArray of rows
Returns
void

Definition at line 3287 of file commonobject.class.php.

◆ line_down()

CommonObject::line_down (   $rowid,
  $fk_parent_line = true 
)

Update a line to have a higher rank.

Parameters
int$rowidId of line
boolean$fk_parent_lineTable with fk_parent_line field or not
Returns
void

Definition at line 3235 of file commonobject.class.php.

◆ line_max()

CommonObject::line_max (   $fk_parent_line = 0)

Get max value used for position of line (rang)

Parameters
int$fk_parent_lineParent line id
Returns
int Max value of rang in table of lines

Definition at line 3411 of file commonobject.class.php.

◆ line_order()

CommonObject::line_order (   $renum = false,
  $rowidorder = 'ASC',
  $fk_parent_line = true 
)

Save a new position (field rang) for details lines.

You can choose to set position for lines with already a position or lines without any position defined.

Parameters
boolean$renumTrue to renum all already ordered lines, false to renum only not already ordered lines.
string$rowidorderASC or DESC
boolean$fk_parent_lineTable with fk_parent_line field or not
Returns
int <0 if KO, >0 if OK

Definition at line 3093 of file commonobject.class.php.

◆ line_up()

CommonObject::line_up (   $rowid,
  $fk_parent_line = true 
)

Update a line to have a lower rank.

Parameters
int$rowidId of line
boolean$fk_parent_lineTable with fk_parent_line field or not
Returns
void

Definition at line 3215 of file commonobject.class.php.

◆ liste_contact()

array To store result of CommonObject::liste_contact (   $statusoflink = -1,
  $source = 'external',
  $list = 0,
  $code = '',
  $status = -1,
  $arrayoftcids = array() 
)

Get array of all contacts for an object.

Parameters
int$statusoflinkStatus of links to get (-1=all). Not used.
string$sourceSource of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user)
int$list0:Returned array contains all properties, 1:Return array contains just id
string$codeFilter on this code of contact type ('SHIPPING', 'BILLING', ...)
int$statusStatus of user or company
array$arrayoftcidsArray with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented.
Returns
array|int Array of contacts, -1 if error

Definition at line 1396 of file commonobject.class.php.

◆ liste_type_contact()

CommonObject::liste_type_contact (   $source = 'internal',
  $order = 'position',
  $option = 0,
  $activeonly = 0,
  $code = '' 
)

Return array with list of possible values for type of contacts.

Parameters
string$source'internal', 'external' or 'all'
string$orderSort order by : 'position', 'code', 'rowid'...
int$option0=Return array id->label, 1=Return array code->label
int$activeonly0=all status of contact, 1=only the active
string$codeType of contact (Example: 'CUSTOMER', 'SERVICE')
Returns
array Array list of type of contacts (id->label if option=0, code->label if option=1)

Definition at line 1530 of file commonobject.class.php.

◆ listeTypeContacts()

CommonObject::listeTypeContacts (   $source = 'internal',
  $option = 0,
  $activeonly = 0,
  $code = '',
  $element = '',
  $excludeelement = '' 
)

Return array with list of possible values for type of contacts.

Parameters
string$source'internal', 'external' or 'all'
int$option0=Return array id->label, 1=Return array code->label
int$activeonly0=all status of contact, 1=only the active
string$codeType of contact (Example: 'CUSTOMER', 'SERVICE')
string$elementFilter on 1 element type
string$excludeelementExclude 1 element type. Example: 'agenda'
Returns
array Array list of type of contacts (id->label if option=0, code->label if option=1)

Definition at line 1593 of file commonobject.class.php.

◆ load_previous_next_ref()

CommonObject::load_previous_next_ref (   $filter,
  $fieldid,
  $nodbprefix = 0 
)

Load properties id_previous and id_next by comparing $fieldid with $this->ref.

Parameters
string$filterOptional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here.
string$fieldidName of field to use for the select MAX and MIN
int$nodbprefixDo not include DB prefix to forge table name
Returns
int <0 if KO, >0 if OK

Definition at line 2161 of file commonobject.class.php.

◆ printObjectLine()

CommonObject::printObjectLine (   $action,
  $line,
  $var,
  $num,
  $i,
  $dateSelector,
  $seller,
  $buyer,
  $selected = 0,
  $extrafields = null,
  $defaulttpldir = '/core/tpl' 
)

Return HTML content of a detail line TODO Move this into an output class file (htmlline.class.php)

Parameters
string$actionGET/POST action
CommonObjectLine$lineSelected object line to output
string$varNot used
int$numNumber of line (0)
int$iI
int$dateSelector1=Show also date range input fields
string$sellerObject of seller third party
string$buyerObject of buyer third party
int$selectedObject line selected
Extrafields$extrafieldsObject of extrafields
string$defaulttpldirDirectory where to find the template (deprecated)
Returns
void

Reimplemented in ProductAttribute.

Definition at line 5018 of file commonobject.class.php.

◆ printObjectLines()

CommonObject::printObjectLines (   $action,
  $seller,
  $buyer,
  $selected = 0,
  $dateSelector = 0,
  $defaulttpldir = '/core/tpl' 
)

Return HTML table for object lines TODO Move this into an output class file (htmlline.class.php) If lines are into a template, title must also be into a template But for the moment we don't know if it's possible as we keep a method available on overloaded objects.

Parameters
string$actionAction code
string$sellerObject of seller third party
string$buyerObject of buyer third party
int$selectedObject line selected
int$dateSelector1=Show also date range input fields
string$defaulttpldirDirectory where to find the template
Returns
void

Definition at line 4927 of file commonobject.class.php.

◆ printOriginLine()

CommonObject::printOriginLine (   $line,
  $var,
  $restrictlist = '',
  $defaulttpldir = '/core/tpl',
  $selectedLines = array() 
)

Return HTML with a line of table array of source object lines TODO Move this and previous function into output html class file (htmlline.class.php).

If lines are into a template, title must also be into a template But for the moment we don't know if it's possible as we keep a method available on overloaded objects.

Parameters
CommonObjectLine$lineLine
string$varVar
string$restrictlist''=All lines, 'services'=Restrict to services only (strike line if not)
string$defaulttpldirDirectory where to find the template
array$selectedLinesArray of lines id for selected lines
Returns
void

Reimplemented in Mo.

Definition at line 5197 of file commonobject.class.php.

◆ printOriginLinesList()

CommonObject::printOriginLinesList (   $restrictlist = '',
  $selectedLines = array() 
)

Return HTML table table of source object lines TODO Move this and previous function into output html class file (htmlline.class.php).

If lines are into a template, title must also be into a template But for the moment we don't know if it's possible, so we keep the method available on overloaded objects.

Parameters
string$restrictlist''=All lines, 'services'=Restrict to services only
array$selectedLinesArray of lines id for selected lines
Returns
void

Reimplemented in Mo.

Definition at line 5144 of file commonobject.class.php.

◆ quote()

CommonObject::quote (   $value,
  $fieldsentry 
)
protected

Add quote to field value if necessary.

Parameters
string | int$valueValue to protect
array$fieldsentryProperties of field
Returns
string

Definition at line 9177 of file commonobject.class.php.

◆ setBankAccount()

CommonObject::setBankAccount (   $fk_account,
  $notrigger = false,
  $userused = null 
)

Change the bank account.

Parameters
int$fk_accountId of bank account
bool$notriggerfalse=launch triggers after, true=disable triggers
User$userusedObject user
Returns
int 1 if OK, 0 if KO

Definition at line 3029 of file commonobject.class.php.

◆ setCategoriesCommon()

CommonObject::setCategoriesCommon (   $categories,
  $type_categ = '',
  $remove_existing = true 
)

Sets object to given categories.

Adds it to non existing supplied categories. Deletes object from existing categories not supplied (if remove_existing==true). Existing categories are left untouch.

Parameters
int[] | int$categoriesCategory ID or array of Categories IDs
string$type_categCategory type ('customer', 'supplier', 'website_page', ...) definied into const class Categorie type
boolean$remove_existingTrue: Remove existings categories from Object if not supplies by $categories, False: let them
Returns
int <0 if KO, >0 if OK

Definition at line 10046 of file commonobject.class.php.

◆ setDeliveryAddress()

CommonObject::setDeliveryAddress (   $id)

Define delivery address.

Deprecated:
Parameters
int$idAddress id
Returns
int <0 si ko, >0 si ok

Definition at line 2874 of file commonobject.class.php.

◆ setDocModel()

CommonObject::setDocModel (   $user,
  $modelpdf 
)

Set last model used by doc generator.

Parameters
User$userUser object that make change
string$modelpdfModele name
Returns
int <0 if KO, >0 if OK

Definition at line 2995 of file commonobject.class.php.

◆ setExtraParameters()

CommonObject::setExtraParameters ( )

Set extra parameters.

Returns
int <0 if KO, >0 if OK

Definition at line 4836 of file commonobject.class.php.

◆ setFieldError()

CommonObject::setFieldError (   $fieldKey,
  $msg = '' 
)

set validation error message a field

Parameters
string$fieldKeyKey of attribute
string$msgthe field error message
Returns
null

Definition at line 7893 of file commonobject.class.php.

◆ setMulticurrencyCode()

CommonObject::setMulticurrencyCode (   $code)

Change the multicurrency code.

Parameters
string$codemulticurrency code
Returns
int >0 if OK, <0 if KO

Definition at line 2506 of file commonobject.class.php.

◆ setMulticurrencyRate()

CommonObject::setMulticurrencyRate (   $rate,
  $mode = 1 
)

Change the multicurrency rate.

Parameters
double$ratemulticurrency rate
int$modemode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency will be recalculated
Returns
int >0 if OK, <0 if KO

Definition at line 2544 of file commonobject.class.php.

◆ setPaymentMethods()

CommonObject::setPaymentMethods (   $id)

Change the payments methods.

Parameters
int$idId of new payment method
Returns
int >0 if OK, <0 if KO

Definition at line 2440 of file commonobject.class.php.

◆ setPaymentTerms()

CommonObject::setPaymentTerms (   $id,
  $deposit_percent = null 
)

Change the payments terms.

Parameters
int$idId of new payment terms
string$deposit_percent% of deposit if needed by payment terms
Returns
int >0 if OK, <0 if KO

Definition at line 2746 of file commonobject.class.php.

◆ setProject()

CommonObject::setProject (   $projectid,
  $notrigger = 0 
)

Link element with a project.

Parameters
int$projectidProject id to link element to
int$notriggerDisable the trigger
Returns
int <0 if KO, >0 if OK

Definition at line 2369 of file commonobject.class.php.

◆ setRetainedWarrantyPaymentTerms()

CommonObject::setRetainedWarrantyPaymentTerms (   $id)

Change the retained warranty payments terms.

Parameters
int$idId of new payment terms
Returns
int >0 if OK, <0 if KO

Definition at line 2842 of file commonobject.class.php.

◆ setSaveQuery()

CommonObject::setSaveQuery ( )
protected

Function to return the array of data key-value from the ->fields and all the ->properties of an object.

Note: $this->${field} are set by the page that make the createCommon() or the updateCommon(). $this->${field} should be a clean and string value (so date are formated for SQL insert).

Returns
array Array with all values of each properties to update

Definition at line 9028 of file commonobject.class.php.

◆ setShippingMethod()

CommonObject::setShippingMethod (   $shipping_method_id,
  $notrigger = false,
  $userused = null 
)

Change the shipping method.

Parameters
int$shipping_method_idId of shipping method
bool$notriggerfalse=launch triggers after, true=disable triggers
User$userusedObject user
Returns
int 1 if OK, 0 if KO

Definition at line 2904 of file commonobject.class.php.

◆ setStatusCommon()

CommonObject::setStatusCommon (   $user,
  $status,
  $notrigger = 0,
  $triggercode = '' 
)

Set to a status.

Parameters
User$userObject user that modify
int$statusNew status to set (often a constant like self::STATUS_XXX)
int$notrigger1=Does not execute triggers, 0=Execute triggers
string$triggercodeTrigger code to use
Returns
int <0 if KO, >0 if OK

Definition at line 9869 of file commonobject.class.php.

Referenced by AssetModel\cancel(), BOM\cancel(), Availabilities\cancel(), Booking\cancel(), ConferenceOrBooth\cancel(), ConferenceOrBoothAttendee\cancel(), Evaluation\cancel(), Evaluationline\cancel(), Job\cancel(), Position\cancel(), Skill\cancel(), Skilldet\cancel(), SkillRank\cancel(), KnowledgeRecord\cancel(), MyObject\cancel(), Mo\cancel(), Partnership\cancel(), ProductFournisseurPrice\cancel(), StockTransfer\cancel(), StockTransferLine\cancel(), RecruitmentCandidature\cancel(), RecruitmentJobPosition\cancel(), Target\cancel(), AssetModel\reopen(), BOM\reopen(), Availabilities\reopen(), Booking\reopen(), Don\reopen(), ConferenceOrBooth\reopen(), ConferenceOrBoothAttendee\reopen(), Evaluation\reopen(), Evaluationline\reopen(), Job\reopen(), Position\reopen(), Skill\reopen(), Skilldet\reopen(), SkillRank\reopen(), KnowledgeRecord\reopen(), MyObject\reopen(), Mo\reopen(), Partnership\reopen(), ProductFournisseurPrice\reopen(), StockTransfer\reopen(), StockTransferLine\reopen(), RecruitmentCandidature\reopen(), RecruitmentJobPosition\reopen(), Target\reopen(), Workstation\setDisabled(), AssetModel\setDraft(), BOM\setDraft(), Availabilities\setDraft(), Booking\setDraft(), ConferenceOrBooth\setDraft(), ConferenceOrBoothAttendee\setDraft(), Evaluation\setDraft(), Evaluationline\setDraft(), Job\setDraft(), Position\setDraft(), Skill\setDraft(), Skilldet\setDraft(), SkillRank\setDraft(), KnowledgeRecord\setDraft(), MyObject\setDraft(), Mo\setDraft(), Partnership\setDraft(), ProductFournisseurPrice\setDraft(), StockTransfer\setDraft(), StockTransferLine\setDraft(), RecruitmentCandidature\setDraft(), RecruitmentJobPosition\setDraft(), Target\setDraft(), and Workstation\setEnabled().

◆ setStatut()

CommonObject::setStatut (   $status,
  $elementId = null,
  $elementType = '',
  $trigkey = '',
  $fieldstatus = 'fk_statut' 
)

Set status of an object.

Parameters
int$statusStatus to set
int$elementIdId of element to force (use this->id by default if null)
string$elementTypeType of element to force (use this->table_element by default)
string$trigkeyTrigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated.
string$fieldstatusName of status field in this->table_element
Returns
int <0 if KO, >0 if OK

Definition at line 4393 of file commonobject.class.php.

◆ setTransportMode()

CommonObject::setTransportMode (   $id)

Change the transport mode methods.

Parameters
int$idId of transport mode
Returns
int >0 if OK, <0 if KO

Definition at line 2801 of file commonobject.class.php.

◆ setUpperOrLowerCase()

CommonObject::setUpperOrLowerCase ( )

Set to upper or ucwords/lower if needed.

Returns
void;

Definition at line 758 of file commonobject.class.php.

◆ setValueFrom()

CommonObject::setValueFrom (   $field,
  $value,
  $table = '',
  $id = null,
  $format = '',
  $id_field = '',
  $fuser = null,
  $trigkey = '',
  $fk_user_field = 'fk_user_modif' 
)

Setter generic.

Update a specific field into database. Warning: Trigger is run only if param trigkey is provided.

Parameters
string$fieldField to update
mixed$valueNew value
string$tableTo force other table element or element line (should not be used)
int$idTo force other object id (should not be used)
string$formatData format ('text', 'date'). 'text' is used if not defined
string$id_fieldTo force rowid field name. 'rowid' is used if not defined
User | string$fuserUpdate the user of last update field with this user. If not provided, current user is used except if value is 'none'
string$trigkeyTrigger key to run (in most cases something like 'XXX_MODIFY')
string$fk_user_fieldName of field to save user id making change
Returns
int <0 if KO, >0 if OK
See also
updateExtraField()

Definition at line 2064 of file commonobject.class.php.

◆ setValuesForExtraLanguages()

CommonObject::setValuesForExtraLanguages (   $onlykey = '')

Fill array_options property of object by extrafields value (using for data sent by forms)

Parameters
string$onlykeyOnly the following key is filled. When we make update of only one language field ($action = 'update_languages'), calling page must set this to avoid to have other languages being reset.
Returns
int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)

Definition at line 5938 of file commonobject.class.php.

◆ setVarsFromFetchObj()

CommonObject::setVarsFromFetchObj ( $obj)

Function to load data from a SQL pointer into properties of current object $this.

Parameters
stdClass$objContain data of object from database
Returns
void

Definition at line 9096 of file commonobject.class.php.

◆ setWarehouse()

CommonObject::setWarehouse (   $warehouse_id)

Change the warehouse.

Parameters
int$warehouse_idId of warehouse
Returns
int 1 if OK, 0 if KO

Definition at line 2962 of file commonobject.class.php.

◆ show_photos()

CommonObject::show_photos (   $modulepart,
  $sdir,
  $size = 0,
  $nbmax = 0,
  $nbbyrow = 5,
  $showfilename = 0,
  $showaction = 0,
  $maxHeight = 120,
  $maxWidth = 160,
  $nolink = 0,
  $notitle = 0,
  $usesharelink = 0 
)

Show photos of an object (nbmax maximum), into several columns.

Parameters
string$modulepart'product', 'ticket', ...
string$sdirDirectory to scan (full absolute path)
int$size0=original size, 1='small' use thumbnail if possible
int$nbmaxNombre maximum de photos (0=pas de max)
int$nbbyrowNumber of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
int$showfilename1=Show filename
int$showaction1=Show icon with action links (resize, delete)
int$maxHeightMax height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
int$maxWidthMax width of original image when size='small'
int$nolinkDo not add a href link to view enlarged imaged into a new tab
int$notitleDo not add title tag on image
int$usesharelinkUse the public shared link of image (if not available, the 'nophoto' image will be shown instead)
Returns
string Html code to show photo. Number of photos shown is saved in this->nbphoto

Definition at line 8641 of file commonobject.class.php.

◆ showInputField()

CommonObject::showInputField (   $val,
  $key,
  $value,
  $moreparam = '',
  $keysuffix = '',
  $keyprefix = '',
  $morecss = 0,
  $nonewbutton = 0 
)

Return HTML string to put an input field into a page Code very similar with showInputField of extra fields.

Parameters
array$valArray of properties for field to show (used only if ->fields not defined)
string$keyKey of attribute
string | array$valuePreselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array)
string$moreparamTo add more parameters on html input tag
string$keysuffixPrefix string to add into name and id of field (can be used to avoid duplicate names)
string$keyprefixSuffix string to add into name and id of field (can be used to avoid duplicate names)
string | int$morecssValue for css to define style/length of field. May also be a numeric.
int$nonewbuttonForce to not show the new button on field that are links to object
Returns
string

Reimplemented in Position.

Definition at line 6820 of file commonobject.class.php.

◆ showOptionals()

CommonObject::showOptionals (   $extrafields,
  $mode = 'view',
  $params = null,
  $keysuffix = '',
  $keyprefix = '',
  $onetrtd = 0,
  $display_type = 'card' 
)

Function to show lines of extrafields with output datas.

This function is responsible to output the

and

according to correct number of columns received into $params['colspan'] or

according to $display_type
Parameters
Extrafields$extrafieldsExtrafield Object
string$modeShow output ('view') or input ('create' or 'edit') for extrafield
array$paramsOptional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
string$keysuffixSuffix string to add after name and id of field (can be used to avoid duplicate names)
string$keyprefixPrefix string to add before name and id of field (can be used to avoid duplicate names)
string$onetrtdAll fields in same tr td. Used by objectline_create.tpl.php for example.
string$display_type"card" for form display, "line" for document line display (extrafields on propal line, order line, etc...)
Returns
string String with html content to show

Definition at line 8110 of file commonobject.class.php.

◆ swapContactStatus()

CommonObject::swapContactStatus (   $rowid)

Update status of a contact linked to object.

Parameters
int$rowidId of link between object and contact
Returns
int <0 if KO, >=0 if OK

Definition at line 1495 of file commonobject.class.php.

◆ trimParameters()

CommonObject::trimParameters (   $parameters)

Trim object parameters.

Parameters
string[]$parametersarray of parameters to trim
Returns
void

Definition at line 9999 of file commonobject.class.php.

◆ update_contact()

CommonObject::update_contact (   $rowid,
  $statut,
  $type_contact_id = 0,
  $fk_socpeople = 0 
)

Update a link to contact line.

Parameters
int$rowidId of line contact-element
int$statutNew status of link
int$type_contact_idId of contact type (not modified if 0)
int$fk_socpeopleId of soc_people to update (not modified if 0)
Returns
int <0 if KO, >= 0 if OK

Definition at line 1271 of file commonobject.class.php.

◆ update_note()

CommonObject::update_note (   $note,
  $suffix = '' 
)

Update note of element.

Parameters
string$noteNew value for note
string$suffix'', '_public' or '_private'
Returns
int <0 if KO, >0 if OK

Definition at line 3486 of file commonobject.class.php.

◆ update_note_public()

CommonObject::update_note_public (   $note)

Update public note (kept for backward compatibility)

Parameters
string$noteNew value for note
Returns
int <0 if KO, >0 if OK
Deprecated:
See also
update_note()

Definition at line 3546 of file commonobject.class.php.

◆ update_price()

CommonObject::update_price (   $exclspec = 0,
  $roundingadjust = 'none',
  $nodatabaseupdate = 0,
  $seller = null 
)

Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).

Must be called at end of methods addline or updateline.

Parameters
int$exclspec>0 = Exclude special product (product_type=9)
string$roundingadjust'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force mode Total of rounding, '1'=Force mode Rounding of total
int$nodatabaseupdate1=Do not update database total fields of the main object. Update only properties in memory. Can be used to save SQL when this method is called several times, so we can do it only once at end.
Societe$sellerIf roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object (used to analyze lines to check corrupted data).
Returns
int <0 if KO, >0 if OK

Definition at line 3563 of file commonobject.class.php.

◆ update_ref_ext()

CommonObject::update_ref_ext (   $ref_ext)

Update external ref of element.

Parameters
string$ref_extUpdate field ref_ext
Returns
int <0 if KO, >0 if OK

Definition at line 3456 of file commonobject.class.php.

◆ updateCommon()

CommonObject::updateCommon ( User  $user,
  $notrigger = false 
)

◆ updateExtraField()

CommonObject::updateExtraField (   $key,
  $trigger = null,
  $userused = null 
)

Update 1 extra field value for the current object.

Keep other fields unchanged. Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)

Parameters
string$keyKey of the extrafield to update (without starting 'options_')
string$triggerIf defined, call also the trigger (for example COMPANY_MODIFY)
User$userusedObject user
Returns
int -1=error, O=did nothing, 1=OK
See also
updateExtraLanguages(), insertExtraFields(), deleteExtraFields(), setValueFrom()

Definition at line 6584 of file commonobject.class.php.

◆ updateExtraLanguages()

CommonObject::updateExtraLanguages (   $key,
  $trigger = null,
  $userused = null 
)

Update an extra language value for the current object.

Data to describe values to update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)

Parameters
string$keyKey of the extrafield (without starting 'options_')
string$triggerIf defined, call also the trigger (for example COMPANY_MODIFY)
User$userusedObject user
Returns
int -1=error, O=did nothing, 1=OK
See also
updateExtraFields(), insertExtraLanguages()

Definition at line 6788 of file commonobject.class.php.

◆ updateLineDown()

CommonObject::updateLineDown (   $rowid,
  $rang,
  $max 
)

Update position of line down (rang)

Parameters
int$rowidId of line
int$rangPosition
int$maxMax
Returns
void

Definition at line 3334 of file commonobject.class.php.

◆ updateLineUp()

CommonObject::updateLineUp (   $rowid,
  $rang 
)

Update position of line up (rang)

Parameters
int$rowidId of line
int$rangPosition
Returns
void

Definition at line 3303 of file commonobject.class.php.

◆ updateObjectLinked()

CommonObject::updateObjectLinked (   $sourceid = null,
  $sourcetype = '',
  $targetid = null,
  $targettype = '',
  $f_user = null,
  $notrigger = 0 
)

Update object linked of a current object.

Parameters
int$sourceidObject source id
string$sourcetypeObject source type
int$targetidObject target id
string$targettypeObject target type
User$f_userUser that create
int$notrigger1=Does not execute triggers, 0= execute triggers
Returns
int >0 if OK, <0 if KO
See also
add_object_linked(), fetObjectLinked(), deleteObjectLinked()

Definition at line 4187 of file commonobject.class.php.

◆ updateRangOfLine()

CommonObject::updateRangOfLine (   $rowid,
  $rang 
)

Update position of line (rang)

Parameters
int$rowidId of line
int$rangPosition
Returns
int <0 if KO, >0 if OK

Definition at line 3257 of file commonobject.class.php.

◆ validateField()

array To store error results of CommonObject::validateField (   $val,
  $fieldKey,
  $fieldValue 
)

Return validation test result for a field.

Parameters
array$valArray of properties of field to show
string$fieldKeyKey of attribute
string$fieldValuevalue of attribute
Returns
bool return false if fail true on success, see $this->error for error message

Definition at line 7923 of file commonobject.class.php.

Member Data Documentation

◆ $fk_projet

CommonObject::$fk_projet
Deprecated:
See also
$fk_project

Definition at line 194 of file commonobject.class.php.

◆ $note

CommonObject::$note
Deprecated:
See also
$note_private

Definition at line 445 of file commonobject.class.php.

◆ $projet

CommonObject::$projet
Deprecated:
See also
project

Definition at line 188 of file commonobject.class.php.


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