dolibarr
19.0.0-dev
|
Parent class of all other business classes (invoices, contracts, proposals, orders, ...) More...
Public Member Functions | |
setErrorsFromObject ($object) | |
setErrorsFromObject More... | |
getTooltipContentArray ($params) | |
Return array of datas to show into a tooltip. More... | |
getTooltipContent ($params) | |
getTooltipContent More... | |
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... | |
getFullAddress ($withcountry=0, $sep="\n", $withregion=0, $extralangcode='') | |
Return full address of contact. 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... | |
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 (by children). 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... | |
delThumbs ($file) | |
Delete thumbs. More... | |
getDefaultCreateValueFor ($fieldname, $alternatevalue=null, $type='alphanohtml') | |
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 ($fields, $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, $overwritetitle=0, $usesharelink=0, $cache='', $addphotorefcss='photoref') | |
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... | |
emtpyObjectVars () | |
Sets all object fields to null. 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 $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0) |
Function used to replace a thirdparty id with another one. More... | |
static | commonReplaceProduct (DoliDB $dbs, $origin_id, $dest_id, array $tables, $ignoreerrors=0) |
Function used to replace a product id with another one. More... | |
Public Attributes | |
$fk_projet | |
$note | |
$date_modification | |
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 prepare a part of the query for insert by returning an array with all properties of object. More... | |
quote ($value, $fieldsentry) | |
Add quote to field value if necessary. More... | |
Parent class of all other business classes (invoices, contracts, proposals, orders, ...)
Definition at line 45 of file commonobject.class.php.
CommonObject::__clone | ( | ) |
Overwrite magic function to solve problem of cloning object that are kept as references.
Definition at line 5357 of file commonobject.class.php.
CommonObject::add_contact | ( | $fk_socpeople, | |
$type_contact, | |||
$source = 'external' , |
|||
$notrigger = 0 |
|||
) |
Add a link between element $this->element and a contact.
int | $fk_socpeople | Id of thirdparty contact (if source = 'external') or id of user (if souce = 'internal') to link |
int | string | $type_contact | Type of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL |
string | $source | external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) |
int | $notrigger | Disable all triggers |
Definition at line 1023 of file commonobject.class.php.
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.
int | $resource_id | Resource id |
string | $resource_type | 'resource' |
int | $busy | Busy or not |
int | $mandatory | Mandatory or not |
Definition at line 5280 of file commonobject.class.php.
CommonObject::add_object_linked | ( | $origin = null , |
|
$origin_id = null , |
|||
$f_user = null , |
|||
$notrigger = 0 |
|||
) |
Add an object link into llx_element_element.
string | $origin | Linked element type |
int | $origin_id | Linked element id |
User | $f_user | User that create |
int | $notrigger | 1=Does not execute triggers, 0=execute triggers |
Definition at line 3780 of file commonobject.class.php.
CommonObject::addThumbs | ( | $file | ) |
Build thumb.
string | $file | Path file in UTF8 to original file to create thumbs from. |
Definition at line 5680 of file commonobject.class.php.
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.
string | $triggerName | trigger's name to execute |
User | $user | Object user |
Reimplemented in EcmDirectory.
Definition at line 5790 of file commonobject.class.php.
|
protected |
Function test if field can be null.
array | $info | content informations of field |
Definition at line 8984 of file commonobject.class.php.
CommonObject::clearFieldError | ( | $fieldKey | ) |
clear validation message result for a field
string | $fieldKey | Key of attribute to clear |
Definition at line 7871 of file commonobject.class.php.
CommonObject::clearObjectLinkedCache | ( | ) |
Clear the cache saying that all linked object were already loaded.
So next fetchObjectLinked will reload all links.
Definition at line 4099 of file commonobject.class.php.
CommonObject::cloneCategories | ( | $fromId, | |
$toId, | |||
$type = '' |
|||
) |
Copy related categories to another object.
int | $fromId | Id object source |
int | $toId | Id object cible |
string | $type | Type of category ('product', ...) |
Definition at line 10135 of file commonobject.class.php.
|
protected |
Common function for all objects extending CommonObject for generating documents.
string | $modelspath | Relative folder where generators are placed |
string | $modele | Generator to use. Caller must set it to obj->model_pdf or GETPOST('model_pdf','alpha') for example. |
Translate | $outputlangs | Output language to use |
int | $hidedetails | 1 to hide details. 0 by default |
int | $hidedesc | 1 to hide product description. 0 by default |
int | $hideref | 1 to hide product reference. 0 by default |
null | array | $moreparams | Array to provide more information |
Definition at line 5381 of file commonobject.class.php.
|
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
DoliDB | $dbs | Database handler |
int | $origin_id | Old product id (the product to delete) |
int | $dest_id | New product id (the product that will received element of the other) |
string[] | $tables | Tables that need to be changed |
int | $ignoreerrors | Ignore 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) |
Definition at line 8553 of file commonobject.class.php.
Referenced by FichinterRec\replaceProduct(), ProductFournisseur\replaceProduct(), Delivery\replaceProduct(), BOM\replaceProduct(), FactureRec\replaceProduct(), Reception\replaceProduct(), Contrat\replaceProduct(), SupplierProposal\replaceProduct(), FactureFournisseur\replaceProduct(), CommandeFournisseur\replaceProduct(), Propal\replaceProduct(), Commande\replaceProduct(), and Facture\replaceProduct().
|
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
DoliDB | $dbs | Database handler |
int | $origin_id | Old thirdparty id (the thirdparty to delete) |
int | $dest_id | New thirdparty id (the thirdparty that will received element of the other) |
string[] | $tables | Tables that need to be changed |
int | $ignoreerrors | Ignore 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) |
Definition at line 8524 of file commonobject.class.php.
Referenced by Fournisseur\replaceThirdparty(), Bookmark\replaceThirdparty(), FichinterRec\replaceThirdparty(), ProductFournisseur\replaceThirdparty(), Don\replaceThirdparty(), ConferenceOrBoothAttendee\replaceThirdparty(), Delivery\replaceThirdparty(), Fichinter\replaceThirdparty(), Mo\replaceThirdparty(), FactureFournisseurRec\replaceThirdparty(), Contact\replaceThirdparty(), FactureRec\replaceThirdparty(), Reception\replaceThirdparty(), Categorie\replaceThirdparty(), Project\replaceThirdparty(), ActionComm\replaceThirdparty(), Expedition\replaceThirdparty(), Contrat\replaceThirdparty(), SupplierProposal\replaceThirdparty(), Adherent\replaceThirdparty(), FactureFournisseur\replaceThirdparty(), CommandeFournisseur\replaceThirdparty(), User\replaceThirdparty(), Propal\replaceThirdparty(), Commande\replaceThirdparty(), Facture\replaceThirdparty(), and Product\replaceThirdparty().
CommonObject::copy_linked_contact | ( | $objFrom, | |
$source = 'internal' |
|||
) |
Copy contact from one element to current.
CommonObject | $objFrom | Source element |
string | $source | Nature of contact ('internal' or 'external') |
Definition at line 1132 of file commonobject.class.php.
CommonObject::createCommon | ( | User | $user, |
$notrigger = false |
|||
) |
Create object into database.
User | $user | User that creates |
bool | $notrigger | false=launch triggers after, true=disable triggers |
Definition at line 9228 of file commonobject.class.php.
Referenced by ExpenseReportIk\create(), PartnershipType\create(), ExpenseReportRule\create(), EmailSenderProfile\create(), StockTransferLine\create(), ActionCommReminder\create(), DefaultValues\create(), SocieteAccount\create(), Workstation\create(), AssetModel\create(), ProductFournisseurPrice\create(), Skilldet\create(), WebsitePage\create(), RecruitmentCandidature\create(), Evaluationline\create(), Job\create(), StockTransfer\create(), Target\create(), Position\create(), CTicketCategory\create(), Evaluation\create(), KnowledgeRecord\create(), Calendar\create(), RecruitmentJobPosition\create(), CompanyPaymentMode\create(), Booking\create(), Availabilities\create(), TimeSpent\create(), Hook\create(), MyObject\create(), BOM\create(), InventoryLine\create(), and BOMLine\create().
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
float | $unitPrice | Product unit price |
float | $discountPercent | Line discount percent |
int | $fk_product | Product id |
Definition at line 8582 of file commonobject.class.php.
CommonObject::delete_contact | ( | $rowid, | |
$notrigger = 0 |
|||
) |
Delete a link to contact line.
int | $rowid | Id of contact link line to delete |
int | $notrigger | Disable all triggers |
Definition at line 1184 of file commonobject.class.php.
CommonObject::delete_linked_contact | ( | $source = '' , |
|
$code = '' |
|||
) |
Delete all links between an object $this and all its contacts in llx_element_contact.
string | $source | '' or 'internal' or 'external' |
string | $code | Type of contact (code or id) |
Definition at line 1222 of file commonobject.class.php.
CommonObject::delete_resource | ( | $rowid, | |
$element, | |||
$notrigger = 0 |
|||
) |
Delete a link to resource line.
int | $rowid | Id of resource line to delete |
int | $element | element name (for trigger) TODO: use $this->element into commonobject class |
int | $notrigger | Disable all triggers |
Definition at line 5321 of file commonobject.class.php.
|
static |
Function used to remove all items linked to an object id in association table.
int | $fk_object_where | id of object we need to remove linked items |
string | $field_where | name of field of object we need to delete linked items |
string | $table_element | name of association table |
Definition at line 4298 of file commonobject.class.php.
CommonObject::deleteByParentField | ( | $parentId = 0 , |
|
$parentField = '' , |
|||
$filter = array() , |
|||
$filtermode = "AND" |
|||
) |
Delete all child object from a parent ID.
int | $parentId | Parent Id |
string | $parentField | Name of Foreign key parent column |
array | $filter | an array filter |
string | $filtermode | AND or OR |
Exception |
Definition at line 9744 of file commonobject.class.php.
CommonObject::deleteCommon | ( | User | $user, |
$notrigger = false , |
|||
$forcechilddeletion = 0 |
|||
) |
Delete object in database.
User | $user | User that deletes |
bool | $notrigger | false=launch triggers after, true=disable triggers |
int | $forcechilddeletion | 0=no, 1=Force deletion of children |
Definition at line 9605 of file commonobject.class.php.
Referenced by ExpenseReportIk\delete(), ExpenseReportRule\delete(), ActionCommReminder\delete(), PartnershipType\delete(), EmailCollectorAction\delete(), EmailSenderProfile\delete(), EmailCollectorFilter\delete(), Salary\delete(), DefaultValues\delete(), CompanyPaymentMode\delete(), CashControl\delete(), SocieteAccount\delete(), StockTransferLine\delete(), ProductFournisseurPrice\delete(), AssetModel\delete(), Skilldet\delete(), Evaluationline\delete(), Job\delete(), RecruitmentCandidature\delete(), CTicketCategory\delete(), Position\delete(), Target\delete(), RecruitmentJobPosition\delete(), Calendar\delete(), Availabilities\delete(), Booking\delete(), StockTransfer\delete(), TimeSpent\delete(), Evaluation\delete(), SkillRank\delete(), Hook\delete(), Workstation\delete(), ConferenceOrBoothAttendee\delete(), Asset\delete(), Skill\delete(), Inventory\delete(), MyObject\delete(), EmailCollector\delete(), Partnership\delete(), BOM\delete(), UserGroup\delete(), Mo\delete(), InventoryLine\delete(), MouvementStock\delete(), BOMLine\delete(), and MoLine\delete().
CommonObject::deleteEcmFiles | ( | $mode = 0 | ) |
Delete related files of object in database.
integer | $mode | 0=Use path to find record, 1=Use src_object_xxx fields (Mode 1 is recommanded for new objects) |
Definition at line 10166 of file commonobject.class.php.
CommonObject::deleteExtraFields | ( | ) |
Delete all extra fields values for the current object.
Definition at line 6117 of file commonobject.class.php.
CommonObject::deleteLineCommon | ( | User | $user, |
$idline, | |||
$notrigger = false |
|||
) |
Delete a line of object in database.
User | $user | User that delete |
int | $idline | Id of line to delete |
bool | $notrigger | false=launch triggers after, true=disable triggers |
Definition at line 9821 of file commonobject.class.php.
CommonObject::deleteObjectLinked | ( | $sourceid = null , |
|
$sourcetype = '' , |
|||
$targetid = null , |
|||
$targettype = '' , |
|||
$rowid = '' , |
|||
$f_user = null , |
|||
$notrigger = 0 |
|||
) |
Delete all links between an object $this.
int | $sourceid | Object source id |
string | $sourcetype | Object source type |
int | $targetid | Object target id |
string | $targettype | Object target type |
int | $rowid | Row id of line to delete. If defined, other parameters are not used. |
User | $f_user | User that create |
int | $notrigger | 1=Does not execute triggers, 0= execute triggers |
Definition at line 4190 of file commonobject.class.php.
CommonObject::delThumbs | ( | $file | ) |
Delete thumbs.
string | $file | Path file in UTF8 to original file to delete thumbs. |
Definition at line 5712 of file commonobject.class.php.
CommonObject::emtpyObjectVars | ( | ) |
Sets all object fields to null.
Useful for example in lists, when printing multiple lines and a different object os fetched for each line.
Definition at line 9167 of file commonobject.class.php.
CommonObject::errorsToString | ( | ) |
Method to output saved errors.
Definition at line 846 of file commonobject.class.php.
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.
Definition at line 1716 of file commonobject.class.php.
CommonObject::fetch_contact | ( | $contactid = null | ) |
Load object contact with id=$this->contact_id into $this->contact.
int | $contactid | Id du contact. Use this->contact_id if empty. |
Definition at line 1621 of file commonobject.class.php.
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.
int | $rowid | Id of line. Use the id of object if not defined. Deprecated. Function must be called without parameters. |
array | $optionsArray | Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. |
Definition at line 6006 of file commonobject.class.php.
CommonObject::fetch_origin | ( | ) |
CommonObject::fetch_product | ( | ) |
Load the product with id $this->fk_product into this->product.
Definition at line 1801 of file commonobject.class.php.
CommonObject::fetch_project | ( | ) |
Load the project with id $this->fk_project into this->project.
Definition at line 1763 of file commonobject.class.php.
CommonObject::fetch_projet | ( | ) |
Load the project with id $this->fk_project into this->project.
Reimplemented in ConferenceOrBoothAttendee.
Definition at line 1775 of file commonobject.class.php.
CommonObject::fetch_thirdparty | ( | $force_thirdparty_id = 0 | ) |
Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty.
int | $force_thirdparty_id | Force thirdparty id |
Reimplemented in Paiement, and PaiementFourn.
Definition at line 1646 of file commonobject.class.php.
CommonObject::fetch_user | ( | $userid | ) |
Load the user with id $userid into this->user.
int | $userid | Id du contact |
Definition at line 1824 of file commonobject.class.php.
CommonObject::fetchComments | ( | ) |
Load comments linked with current task.
Definition at line 9982 of file commonobject.class.php.
CommonObject::fetchCommon | ( | $id, | |
$ref = null , |
|||
$morewhere = '' |
|||
) |
Load object in memory from the database.
int | $id | Id object |
string | $ref | Ref |
string | $morewhere | More SQL filters (' AND ...') |
Definition at line 9395 of file commonobject.class.php.
Referenced by ProductFournisseurPrice\fetch().
CommonObject::fetchLinesCommon | ( | $morewhere = '' | ) |
Load object in memory from the database.
string | $morewhere | More SQL filters (' AND ...') |
Definition at line 9451 of file commonobject.class.php.
CommonObject::fetchNoCompute | ( | $id | ) |
Function to make a fetch but set environment to avoid to load computed values before.
int | $id | ID of object |
Definition at line 5982 of file commonobject.class.php.
CommonObject::fetchObjectFrom | ( | $table, | |
$field, | |||
$key, | |||
$element = null |
|||
) |
Load object from specific field.
string | $table | Table element or element line |
string | $field | Field selected |
string | $key | Import key |
string | $element | Element name |
Definition at line 1868 of file commonobject.class.php.
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:
int | $sourceid | Object source id (if not defined, $this->id) |
string | $sourcetype | Object source type (if not defined, $this->element) |
int | $targetid | Object target id (if not defined, $this->id) |
string | $targettype | Object target type (if not defined, $this->element) |
string | $clause | 'OR' or 'AND' clause used when both source id and target id are provided |
int | $alsosametype | 0=Return only links to object that differs from source type. 1=Include also link to objects of same type. |
string | $orderby | SQL 'ORDER BY' clause |
int | string | $loadalsoobjects | Load 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. |
Definition at line 3878 of file commonobject.class.php.
Referenced by Delivery\getRemainingDelivered(), and Propal\InvoiceArrayList().
CommonObject::fetchOneLike | ( | $ref | ) |
Looks for an object with ref matching the wildcard provided It does only work when $this->table_ref_field is set.
string | $ref | Wildcard |
Definition at line 1689 of file commonobject.class.php.
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.
Definition at line 5828 of file commonobject.class.php.
CommonObject::formAddObjectLine | ( | $dateSelector, | |
$seller, | |||
$buyer, | |||
$defaulttpldir = '/core/tpl' |
|||
) |
Show add free and predefined products/services form.
int | $dateSelector | 1=Show also date range input fields |
Societe | $seller | Object thirdparty who sell |
Societe | $buyer | Object thirdparty who buy |
string | $defaulttpldir | Directory where to find the template |
Reimplemented in ProductAttribute.
Definition at line 4817 of file commonobject.class.php.
|
static |
Function used to get an array with all items linked to an object id in association table.
int | $fk_object_where | id of object we need to get linked items |
string | $field_select | name of field we need to get a list |
string | $field_where | name of field of object we need to get linked items |
string | $table_element | name of association table |
Definition at line 4269 of file commonobject.class.php.
CommonObject::getCanvas | ( | $id = 0 , |
|
$ref = '' |
|||
) |
Load type of canvas of an object if it exists.
int | $id | Record id |
string | $ref | Record ref |
Definition at line 4453 of file commonobject.class.php.
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.
string | $type_categ | Category type ('customer', 'supplier', 'website_page', ...) |
Definition at line 10037 of file commonobject.class.php.
CommonObject::getChildrenOfLine | ( | $id, | |
$includealltree = 0 |
|||
) |
Get children of line.
int | $id | Id of parent line |
int | $includealltree | 0 = 1st level child, 1 = All level child |
Definition at line 3100 of file commonobject.class.php.
CommonObject::getDefaultCreateValueFor | ( | $fieldname, | |
$alternatevalue = null , |
|||
$type = 'alphanohtml' |
|||
) |
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)
string | $fieldname | Name of field |
string | $alternatevalue | Alternate value to use |
string | $type | Type of data |
Definition at line 5738 of file commonobject.class.php.
CommonObject::getFieldError | ( | $fieldKey | ) |
get field error message
string | $fieldKey | Key of attribute |
Definition at line 7900 of file commonobject.class.php.
CommonObject::getFieldList | ( | $alias = '' | ) |
Function to concat keys of fields.
string | $alias | String of alias of table for fields. For example 't'. It is recommended to use '' and set alias into fields defintion. |
Definition at line 9180 of file commonobject.class.php.
CommonObject::getFormatedCustomerRef | ( | $objref | ) |
Return customer ref for screen output.
string | $objref | Customer ref |
Definition at line 858 of file commonobject.class.php.
CommonObject::getFormatedSupplierRef | ( | $objref | ) |
Return supplier ref for screen output.
string | $objref | Supplier ref |
Definition at line 877 of file commonobject.class.php.
CommonObject::getFullAddress | ( | $withcountry = 0 , |
|
$sep = "\n" , |
|||
$withregion = 0 , |
|||
$extralangcode = '' |
|||
) |
Return full address of contact.
int | $withcountry | 1=Add country into address string |
string | $sep | Separator to use to build string |
int | $withregion | 1=Add region into address string |
string | $extralangcode | User extralanguages as value |
Definition at line 899 of file commonobject.class.php.
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')
string | $source | 'external' or 'internal' |
string | $code | 'BILLING', 'SHIPPING', 'SALESREPFOLL', ... |
int | $status | limited to a certain status |
Definition at line 1553 of file commonobject.class.php.
Referenced by Contrat\getIdBillingContact(), Facture\getIdBillingContact(), Contrat\getIdServiceContact(), and Facture\getIdShippingContact().
CommonObject::getIdOfLine | ( | $rang | ) |
Get rowid of the line relative to its position.
int | $rang | Rang value |
Definition at line 3311 of file commonobject.class.php.
References $sql.
CommonObject::getJSListDependancies | ( | $type = '_extra' | ) |
string | $type | Type for prefix |
Definition at line 8418 of file commonobject.class.php.
CommonObject::getLastMainDocLink | ( | $modulepart, | |
$initsharekey = 0 , |
|||
$relativelink = 0 |
|||
) |
Return the link of last main doc file for direct public download.
string | $modulepart | Module related to document |
int | $initsharekey | Init the share key if it was not yet defined |
int | $relativelink | 0=Return full external link, 1=Return link relative to root of file |
Definition at line 929 of file commonobject.class.php.
CommonObject::getListContactId | ( | $source = 'external' | ) |
Return list of id of contacts of object.
string | $source | Source of contact: external (llx_socpeople) or internal (llx_user) or thirdparty (llx_societe) |
Reimplemented in Task.
Definition at line 2254 of file commonobject.class.php.
CommonObject::getNbComments | ( | ) |
Return nb comments already posted.
Definition at line 10002 of file commonobject.class.php.
CommonObject::getRangOfLine | ( | $rowid | ) |
Get position of line (rang)
int | $rowid | Id of line |
Definition at line 3285 of file commonobject.class.php.
CommonObject::getRights | ( | ) |
Returns the rights used for this class.
Reimplemented in Product, CommandeFournisseur, and FactureFournisseur.
Definition at line 8493 of file commonobject.class.php.
CommonObject::getSpecialCode | ( | $lineid | ) |
Get special code of a line.
int | $lineid | Id of line |
Definition at line 4499 of file commonobject.class.php.
CommonObject::getTooltipContent | ( | $params | ) |
getTooltipContent
array | $params | params |
Definition at line 772 of file commonobject.class.php.
CommonObject::getTooltipContentArray | ( | $params | ) |
Return array of datas to show into a tooltip.
This method must be implemented in each object class.
array | $params | params to construct tooltip data |
Reimplemented in Product, Commande, Propal, ContratLigne, User, FactureFournisseur, Societe, SupplierProposal, Adherent, Contrat, Facture, Expedition, ExpenseReport, Categorie, ActionComm, Ticket, Contact, Account, Holiday, Project, Mo, BOM, Cronjob, Partnership, Productlot, CommandeFournisseur, Fichinter, Dolresource, UserGroup, MyObject, Mailing, Delivery, Task, KnowledgeRecord, Entrepot, TimeSpent, Calendar, AdherentType, Workstation, Salary, Opensurveysondage, SocieteAccount, and Fiscalyear.
Definition at line 760 of file commonobject.class.php.
CommonObject::getTotalDiscount | ( | ) |
Function that returns the total amount HT of discounts applied for all lines.
Definition at line 4639 of file commonobject.class.php.
References $sql, and dol_syslog().
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.
Definition at line 4681 of file commonobject.class.php.
CommonObject::getValueFrom | ( | $table, | |
$id, | |||
$field | |||
) |
Getter generic.
Load value from a specific field
string | $table | Table of element or element line |
int | $id | Element id |
string | $field | Field selected |
Definition at line 1903 of file commonobject.class.php.
CommonObject::hasProductsOrServices | ( | $predefined = -1 | ) |
Function to say how many lines object contains.
int | $predefined | -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service |
Definition at line 4605 of file commonobject.class.php.
CommonObject::indexFile | ( | $destfull, | |
$update_main_doc_field | |||
) |
Index a file into the ECM database.
string | $destfull | Full path of file to index |
int | $update_main_doc_field | Update 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']. |
Definition at line 5565 of file commonobject.class.php.
CommonObject::initAsSpecimenCommon | ( | ) |
Initialise object with example values Id must be 0 if object instance is a specimen.
Definition at line 9933 of file commonobject.class.php.
Referenced by ActionCommReminder\initAsSpecimen(), DefaultValues\initAsSpecimen(), EmailSenderProfile\initAsSpecimen(), PartnershipType\initAsSpecimen(), EmailCollectorAction\initAsSpecimen(), EmailCollectorFilter\initAsSpecimen(), CompanyPaymentMode\initAsSpecimen(), SocieteAccount\initAsSpecimen(), CTicketCategory\initAsSpecimen(), Hook\initAsSpecimen(), ConferenceOrBooth\initAsSpecimen(), Inventory\initAsSpecimen(), ProductFournisseurPrice\initAsSpecimen(), AssetModel\initAsSpecimen(), Workstation\initAsSpecimen(), Skilldet\initAsSpecimen(), StockTransferLine\initAsSpecimen(), StockTransfer\initAsSpecimen(), Evaluationline\initAsSpecimen(), Target\initAsSpecimen(), SkillRank\initAsSpecimen(), Evaluation\initAsSpecimen(), RecruitmentCandidature\initAsSpecimen(), Job\initAsSpecimen(), Booking\initAsSpecimen(), Availabilities\initAsSpecimen(), Skill\initAsSpecimen(), Position\initAsSpecimen(), KnowledgeRecord\initAsSpecimen(), RecruitmentJobPosition\initAsSpecimen(), ConferenceOrBoothAttendee\initAsSpecimen(), Calendar\initAsSpecimen(), TimeSpent\initAsSpecimen(), MyObject\initAsSpecimen(), Partnership\initAsSpecimen(), BOM\initAsSpecimen(), Mo\initAsSpecimen(), Asset\initAsSpecimen(), and BOMLine\initAsSpecimen().
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.
string | $trigger | If defined, call also the trigger (for example COMPANY_MODIFY) |
User | $userused | Object user |
Definition at line 6157 of file commonobject.class.php.
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.
string | $trigger | If defined, call also the trigger (for example COMPANY_MODIFY) |
User | $userused | Object user |
Definition at line 6440 of file commonobject.class.php.
|
protected |
Function test if type is array.
array | $info | content informations of field |
Definition at line 8878 of file commonobject.class.php.
CommonObject::isDate | ( | $info | ) |
Function test if type is date.
array | $info | content informations of field |
Definition at line 8896 of file commonobject.class.php.
CommonObject::isDuration | ( | $info | ) |
Function test if type is duration.
array | $info | content informations of field |
Definition at line 8910 of file commonobject.class.php.
|
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.
string | $element | String of element ('product', 'facture', ...) |
int | $id | Id of object |
string | $ref | Ref of object to check |
string | $ref_ext | Ref ext of object to check |
Definition at line 701 of file commonobject.class.php.
CommonObject::isFloat | ( | $info | ) |
Function test if type is float.
array | $info | content informations of field |
Definition at line 8948 of file commonobject.class.php.
|
protected |
Function test if field is forced to null if zero or empty.
array | $info | content informations of field |
Definition at line 9002 of file commonobject.class.php.
|
protected |
Function test if is indexed.
array | $info | content informations of field |
Definition at line 9020 of file commonobject.class.php.
CommonObject::isInt | ( | $info | ) |
Function test if type is integer.
array | $info | content informations of field |
Definition at line 8929 of file commonobject.class.php.
CommonObject::isObjectUsed | ( | $id = 0 , |
|
$entity = 0 |
|||
) |
Function to check if an object is used by others (by children).
Check is done into this->childtables. There is no check into llx_element_element.
int | $id | Force id of object |
int | $entity | Force entity to check |
Definition at line 4520 of file commonobject.class.php.
CommonObject::isText | ( | $info | ) |
Function test if type is text.
array | $info | content informations of field |
Definition at line 8966 of file commonobject.class.php.
CommonObject::line_ajaxorder | ( | $rows | ) |
Update position of line with ajax (rang)
array | $rows | Array of rows |
Definition at line 3209 of file commonobject.class.php.
CommonObject::line_down | ( | $rowid, | |
$fk_parent_line = true |
|||
) |
Update a line to have a higher rank.
int | $rowid | Id of line |
boolean | $fk_parent_line | Table with fk_parent_line field or not |
Definition at line 3157 of file commonobject.class.php.
CommonObject::line_max | ( | $fk_parent_line = 0 | ) |
Get max value used for position of line (rang)
int | $fk_parent_line | Parent line id |
Definition at line 3337 of file commonobject.class.php.
References $sql, and dol_syslog().
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.
boolean | $renum | True to renum all already ordered lines, false to renum only not already ordered lines. |
string | $rowidorder | ASC or DESC |
boolean | $fk_parent_line | Table with fk_parent_line field or not |
Definition at line 3015 of file commonobject.class.php.
References $sql, and dol_syslog().
CommonObject::line_up | ( | $rowid, | |
$fk_parent_line = true |
|||
) |
Update a line to have a lower rank.
int | $rowid | Id of line |
boolean | $fk_parent_line | Table with fk_parent_line field or not |
Definition at line 3137 of file commonobject.class.php.
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.
int | $statusoflink | Status of links to get (-1=all). Not used. |
string | $source | Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user) |
int | $list | 0:Returned array contains all properties, 1:Return array contains just id |
string | $code | Filter on this code of contact type ('SHIPPING', 'BILLING', ...) |
int | $status | Status of user or company |
array | $arrayoftcids | Array 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. |
Definition at line 1267 of file commonobject.class.php.
CommonObject::liste_type_contact | ( | $source = 'internal' , |
|
$order = 'position' , |
|||
$option = 0 , |
|||
$activeonly = 0 , |
|||
$code = '' |
|||
) |
Return array with list of possible values for type of contacts.
string | $source | 'internal', 'external' or 'all' |
string | $order | Sort order by : 'position', 'code', 'rowid'... |
int | $option | 0=Return array id->label, 1=Return array code->label |
int | $activeonly | 0=all status of contact, 1=only the active |
string | $code | Type of contact (Example: 'CUSTOMER', 'SERVICE') |
Definition at line 1402 of file commonobject.class.php.
CommonObject::listeTypeContacts | ( | $source = 'internal' , |
|
$option = 0 , |
|||
$activeonly = 0 , |
|||
$code = '' , |
|||
$element = '' , |
|||
$excludeelement = '' |
|||
) |
Return array with list of possible values for type of contacts.
string | $source | 'internal', 'external' or 'all' |
int | $option | 0=Return array id->label, 1=Return array code->label |
int | $activeonly | 0=all status of contact, 1=only the active |
string | $code | Type of contact (Example: 'CUSTOMER', 'SERVICE') |
string | $element | Filter on 1 element type |
string | $excludeelement | Exclude 1 element type. Example: 'agenda' |
Definition at line 1465 of file commonobject.class.php.
CommonObject::load_previous_next_ref | ( | $filter, | |
$fieldid, | |||
$nodbprefix = 0 |
|||
) |
Load properties id_previous and id_next by comparing $fieldid with $this->ref.
string | $filter | Optional filter. Example: " AND (t.field1 = 'aa' OR t.field2 = 'bb')". Do not allow user input data here. |
string | $fieldid | Name of field to use for the select MAX and MIN |
int | $nodbprefix | Do not include DB prefix to forge table name |
Definition at line 2063 of file commonobject.class.php.
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)
string | $action | GET/POST action |
CommonObjectLine | $line | Selected object line to output |
string | $var | Not used |
int | $num | Number of line (0) |
int | $i | I |
int | $dateSelector | 1=Show also date range input fields |
Societe | $seller | Object of seller third party |
Societe | $buyer | Object of buyer third party |
int | $selected | ID line selected |
Extrafields | $extrafields | Object of extrafields |
string | $defaulttpldir | Directory where to find the template (deprecated) |
Reimplemented in ProductAttribute.
Definition at line 4961 of file commonobject.class.php.
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.
string | $action | Action code |
Societe | $seller | Object of seller third party |
Societe | $buyer | Object of buyer third party |
int | $selected | ID line selected |
int | $dateSelector | 1=Show also date range input fields |
string | $defaulttpldir | Directory where to find the template |
Definition at line 4870 of file commonobject.class.php.
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.
CommonObjectLine | $line | Line |
string | $var | Var |
string | $restrictlist | ''=All lines, 'services'=Restrict to services only (strike line if not) |
string | $defaulttpldir | Directory where to find the template |
array | $selectedLines | Array of lines id for selected lines |
Reimplemented in Mo.
Definition at line 5138 of file commonobject.class.php.
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.
string | $restrictlist | ''=All lines, 'services'=Restrict to services only |
array | $selectedLines | Array of lines id for selected lines |
Reimplemented in Mo.
Definition at line 5085 of file commonobject.class.php.
|
protected |
Add quote to field value if necessary.
string | int | $value | Value to protect |
array | $fieldsentry | Properties of field |
Definition at line 9201 of file commonobject.class.php.
CommonObject::setBankAccount | ( | $fk_account, | |
$notrigger = false , |
|||
$userused = null |
|||
) |
Change the bank account.
int | $fk_account | Id of bank account |
bool | $notrigger | false=launch triggers after, true=disable triggers |
User | $userused | Object user |
Definition at line 2951 of file commonobject.class.php.
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.
int[] | int | $categories | Category ID or array of Categories IDs |
string | $type_categ | Category type ('customer', 'supplier', 'website_page', ...) definied into const class Categorie type |
boolean | $remove_existing | True: Remove existings categories from Object if not supplies by $categories, False: let them |
Definition at line 10060 of file commonobject.class.php.
CommonObject::setDeliveryAddress | ( | $id | ) |
Define delivery address.
int | $id | Address id |
Definition at line 2796 of file commonobject.class.php.
CommonObject::setDocModel | ( | $user, | |
$modelpdf | |||
) |
Set last model used by doc generator.
Definition at line 2917 of file commonobject.class.php.
CommonObject::setErrorsFromObject | ( | $object | ) |
setErrorsFromObject
CommonObject | $object | commonobject |
Definition at line 743 of file commonobject.class.php.
CommonObject::setExtraParameters | ( | ) |
Set extra parameters.
Definition at line 4779 of file commonobject.class.php.
References $sql, and dol_syslog().
CommonObject::setFieldError | ( | $fieldKey, | |
$msg = '' |
|||
) |
set validation error message a field
string | $fieldKey | Key of attribute |
string | $msg | the field error message |
Definition at line 7884 of file commonobject.class.php.
CommonObject::setMulticurrencyCode | ( | $code | ) |
Change the multicurrency code.
string | $code | multicurrency code |
Definition at line 2416 of file commonobject.class.php.
CommonObject::setPaymentMethods | ( | $id | ) |
Change the payments methods.
int | $id | Id of new payment method |
Definition at line 2350 of file commonobject.class.php.
CommonObject::setPaymentTerms | ( | $id, | |
$deposit_percent = null |
|||
) |
Change the payments terms.
int | $id | Id of new payment terms |
string | $deposit_percent | % of deposit if needed by payment terms |
Definition at line 2668 of file commonobject.class.php.
CommonObject::setProject | ( | $projectid, | |
$notrigger = 0 |
|||
) |
Link element with a project.
int | $projectid | Project id to link element to |
int | $notrigger | Disable the trigger |
Definition at line 2279 of file commonobject.class.php.
CommonObject::setRetainedWarrantyPaymentTerms | ( | $id | ) |
Change the retained warranty payments terms.
int | $id | Id of new payment terms |
Definition at line 2764 of file commonobject.class.php.
|
protected |
Function to prepare a part of the query for insert by returning an array with all properties of 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).
Definition at line 9041 of file commonobject.class.php.
CommonObject::setShippingMethod | ( | $shipping_method_id, | |
$notrigger = false , |
|||
$userused = null |
|||
) |
Change the shipping method.
int | $shipping_method_id | Id of shipping method |
bool | $notrigger | false=launch triggers after, true=disable triggers |
User | $userused | Object user |
Definition at line 2826 of file commonobject.class.php.
CommonObject::setStatusCommon | ( | $user, | |
$status, | |||
$notrigger = 0 , |
|||
$triggercode = '' |
|||
) |
Set to a status.
User | $user | Object user that modify |
int | $status | New status to set (often a constant like self::STATUS_XXX) |
int | $notrigger | 1=Does not execute triggers, 0=Execute triggers |
string | $triggercode | Trigger code to use |
Definition at line 9883 of file commonobject.class.php.
Referenced by ConferenceOrBooth\cancel(), AssetModel\cancel(), ProductFournisseurPrice\cancel(), Skilldet\cancel(), RecruitmentCandidature\cancel(), Evaluationline\cancel(), Target\cancel(), Position\cancel(), RecruitmentJobPosition\cancel(), Calendar\cancel(), StockTransferLine\cancel(), Availabilities\cancel(), Booking\cancel(), StockTransfer\cancel(), TimeSpent\cancel(), SkillRank\cancel(), Job\cancel(), KnowledgeRecord\cancel(), Evaluation\cancel(), Skill\cancel(), ConferenceOrBoothAttendee\cancel(), MyObject\cancel(), Partnership\cancel(), BOM\cancel(), Mo\cancel(), ConferenceOrBooth\reopen(), AssetModel\reopen(), ProductFournisseurPrice\reopen(), Skilldet\reopen(), RecruitmentCandidature\reopen(), Evaluationline\reopen(), Target\reopen(), Position\reopen(), Calendar\reopen(), StockTransferLine\reopen(), Availabilities\reopen(), Booking\reopen(), StockTransfer\reopen(), TimeSpent\reopen(), SkillRank\reopen(), Job\reopen(), Evaluation\reopen(), KnowledgeRecord\reopen(), Skill\reopen(), ConferenceOrBoothAttendee\reopen(), MyObject\reopen(), RecruitmentJobPosition\reopen(), Don\reopen(), Partnership\reopen(), BOM\reopen(), Mo\reopen(), Workstation\setDisabled(), ConferenceOrBooth\setDraft(), AssetModel\setDraft(), ProductFournisseurPrice\setDraft(), Skilldet\setDraft(), RecruitmentCandidature\setDraft(), Evaluationline\setDraft(), Target\setDraft(), Position\setDraft(), RecruitmentJobPosition\setDraft(), Calendar\setDraft(), StockTransferLine\setDraft(), Booking\setDraft(), Availabilities\setDraft(), StockTransfer\setDraft(), TimeSpent\setDraft(), SkillRank\setDraft(), Job\setDraft(), KnowledgeRecord\setDraft(), Evaluation\setDraft(), Skill\setDraft(), ConferenceOrBoothAttendee\setDraft(), MyObject\setDraft(), Partnership\setDraft(), BOM\setDraft(), Mo\setDraft(), Expedition\setDraft(), and Workstation\setEnabled().
CommonObject::setStatut | ( | $status, | |
$elementId = null , |
|||
$elementType = '' , |
|||
$trigkey = '' , |
|||
$fieldstatus = 'fk_statut' |
|||
) |
Set status of an object.
int | $status | Status to set |
int | $elementId | Id of element to force (use this->id by default if null) |
string | $elementType | Type of element to force (use this->table_element by default) |
string | $trigkey | Trigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated. |
string | $fieldstatus | Name of status field in this->table_element |
Definition at line 4326 of file commonobject.class.php.
CommonObject::setTransportMode | ( | $id | ) |
Change the transport mode methods.
int | $id | Id of transport mode |
Definition at line 2723 of file commonobject.class.php.
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.
string | $field | Field to update |
mixed | $value | New value |
string | $table | To force other table element or element line (should not be used) |
int | $id | To force other object id (should not be used) |
string | $format | Data format ('text', 'int', 'date'). 'text' is used if not defined |
string | $id_field | To force rowid field name. 'rowid' is used if not defined |
User | string | $fuser | Update the user of last update field with this user. If not provided, current user is used except if value is 'none' |
string | $trigkey | Trigger key to run (in most cases something like 'XXX_MODIFY') |
string | $fk_user_field | Name of field to save user id making change |
Definition at line 1936 of file commonobject.class.php.
CommonObject::setValuesForExtraLanguages | ( | $onlykey = '' | ) |
Fill array_options property of object by extrafields value (using for data sent by forms)
string | $onlykey | Only 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. |
Definition at line 5897 of file commonobject.class.php.
CommonObject::setVarsFromFetchObj | ( | & | $obj | ) |
Function to load data from a SQL pointer into properties of current object $this.
stdClass | $obj | Contain data of object from database |
Definition at line 9109 of file commonobject.class.php.
CommonObject::setWarehouse | ( | $warehouse_id | ) |
Change the warehouse.
int | $warehouse_id | Id of warehouse |
Definition at line 2884 of file commonobject.class.php.
CommonObject::show_photos | ( | $modulepart, | |
$sdir, | |||
$size = 0 , |
|||
$nbmax = 0 , |
|||
$nbbyrow = 5 , |
|||
$showfilename = 0 , |
|||
$showaction = 0 , |
|||
$maxHeight = 120 , |
|||
$maxWidth = 160 , |
|||
$nolink = 0 , |
|||
$overwritetitle = 0 , |
|||
$usesharelink = 0 , |
|||
$cache = '' , |
|||
$addphotorefcss = 'photoref' |
|||
) |
Show photos of an object (nbmax maximum), into several columns.
string | $modulepart | 'product', 'ticket', ... |
string | $sdir | Directory to scan (full absolute path) |
int | $size | 0=original size, 1='small' use thumbnail if possible |
int | $nbmax | Nombre maximum de photos (0=pas de max) |
int | $nbbyrow | Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'. |
int | $showfilename | 1=Show filename |
int | $showaction | 1=Show icon with action links (resize, delete) |
int | $maxHeight | Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image. |
int | $maxWidth | Max width of original image when size='small' |
int | $nolink | Do not add a href link to view enlarged imaged into a new tab |
int | string | $overwritetitle | Do not add title tag on image |
int | $usesharelink | Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) |
string | $cache | A string if we want to use a cached version of image |
string | $addphotorefcss | Add CSS to img of photos |
Definition at line 8655 of file commonobject.class.php.
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.
array | null | $val | Array of properties for field to show (used only if ->fields not defined) |
string | $key | Key of attribute |
string | array | $value | Preselected 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 | $moreparam | To add more parameters on html input tag |
string | $keysuffix | Prefix string to add into name and id of field (can be used to avoid duplicate names) |
string | $keyprefix | Suffix string to add into name and id of field (can be used to avoid duplicate names) |
string | int | $morecss | Value for css to define style/length of field. May also be a numeric. |
int | $nonewbutton | Force to not show the new button on field that are links to object |
Reimplemented in Position.
Definition at line 6809 of file commonobject.class.php.
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
Extrafields | $extrafields | Extrafield Object |
string | $mode | Show output ('view') or input ('create' or 'edit') for extrafield |
array | $params | Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan) |
string | $keysuffix | Suffix string to add after name and id of field (can be used to avoid duplicate names) |
string | $keyprefix | Prefix string to add before name and id of field (can be used to avoid duplicate names) |
string | $onetrtd | All 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...) |
Definition at line 8108 of file commonobject.class.php.
CommonObject::swapContactStatus | ( | $rowid | ) |
Update status of a contact linked to object.
int | $rowid | Id of link between object and contact |
Definition at line 1367 of file commonobject.class.php.
CommonObject::trimParameters | ( | $parameters | ) |
Trim object parameters.
string[] | $parameters | array of parameters to trim |
Definition at line 10013 of file commonobject.class.php.
CommonObject::update_contact | ( | $rowid, | |
$statut, | |||
$type_contact_id = 0 , |
|||
$fk_socpeople = 0 |
|||
) |
Update a link to contact line.
int | $rowid | Id of line contact-element |
int | $statut | New status of link |
int | $type_contact_id | Id of contact type (not modified if 0) |
int | $fk_socpeople | Id of soc_people to update (not modified if 0) |
Definition at line 1154 of file commonobject.class.php.
CommonObject::update_note | ( | $note, | |
$suffix = '' |
|||
) |
Update note of element.
string | $note | New value for note |
string | $suffix | '', '_public' or '_private' |
Definition at line 3414 of file commonobject.class.php.
CommonObject::update_note_public | ( | $note | ) |
Update public note (kept for backward compatibility)
string | $note | New value for note |
Definition at line 3474 of file commonobject.class.php.
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.
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 | $nodatabaseupdate | 1=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 | $seller | If 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). |
Definition at line 3491 of file commonobject.class.php.
Referenced by SupplierProposal\set_remise_absolue(), and SupplierProposal\set_remise_percent().
CommonObject::update_ref_ext | ( | $ref_ext | ) |
Update external ref of element.
string | $ref_ext | Update field ref_ext |
Definition at line 3384 of file commonobject.class.php.
References $sql, and dol_syslog().
CommonObject::updateCommon | ( | User | $user, |
$notrigger = false |
|||
) |
Update object into database.
User | $user | User that modifies |
bool | $notrigger | false=launch triggers after, true=disable triggers |
Definition at line 9501 of file commonobject.class.php.
Referenced by ExpenseReportIk\update(), ExpenseReportRule\update(), ActionCommReminder\update(), PartnershipType\update(), EmailCollectorAction\update(), EmailSenderProfile\update(), EmailCollectorFilter\update(), DefaultValues\update(), CompanyPaymentMode\update(), CashControl\update(), SocieteAccount\update(), StockTransferLine\update(), ProductFournisseurPrice\update(), AssetModel\update(), BonPrelevement\update(), Skilldet\update(), Evaluationline\update(), Job\update(), RecruitmentCandidature\update(), CTicketCategory\update(), Target\update(), Position\update(), KnowledgeRecord\update(), RecruitmentJobPosition\update(), Calendar\update(), Availabilities\update(), Booking\update(), TimeSpent\update(), Evaluation\update(), SkillRank\update(), Hook\update(), ConferenceOrBoothAttendee\update(), Skill\update(), Inventory\update(), MyObject\update(), BOM\update(), InventoryLine\update(), BOMLine\update(), and MoLine\update().
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', ...)
string | $key | Key of the extrafield to update (without starting 'options_') |
string | $trigger | If defined, call also the trigger (for example COMPANY_MODIFY) |
User | $userused | Object user |
Definition at line 6558 of file commonobject.class.php.
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', ...)
string | $key | Key of the extrafield (without starting 'options_') |
string | $trigger | If defined, call also the trigger (for example COMPANY_MODIFY) |
User | $userused | Object user |
Definition at line 6777 of file commonobject.class.php.
CommonObject::updateLineDown | ( | $rowid, | |
$rang, | |||
$max | |||
) |
Update position of line down (rang)
int | $rowid | Id of line |
int | $rang | Position |
int | $max | Max |
Definition at line 3256 of file commonobject.class.php.
CommonObject::updateLineUp | ( | $rowid, | |
$rang | |||
) |
Update position of line up (rang)
int | $rowid | Id of line |
int | $rang | Position |
Definition at line 3225 of file commonobject.class.php.
CommonObject::updateObjectLinked | ( | $sourceid = null , |
|
$sourcetype = '' , |
|||
$targetid = null , |
|||
$targettype = '' , |
|||
$f_user = null , |
|||
$notrigger = 0 |
|||
) |
Update object linked of a current object.
int | $sourceid | Object source id |
string | $sourcetype | Object source type |
int | $targetid | Object target id |
string | $targettype | Object target type |
User | $f_user | User that create |
int | $notrigger | 1=Does not execute triggers, 0= execute triggers |
Definition at line 4120 of file commonobject.class.php.
CommonObject::updateRangOfLine | ( | $rowid, | |
$rang | |||
) |
Update position of line (rang)
int | $rowid | Id of line |
int | $rang | Position |
Definition at line 3179 of file commonobject.class.php.
array To store error results of CommonObject::validateField | ( | $fields, | |
$fieldKey, | |||
$fieldValue | |||
) |
Return validation test result for a field.
array | $fields | Array of properties of field to show |
string | $fieldKey | Key of attribute |
string | $fieldValue | value of attribute |
Definition at line 7916 of file commonobject.class.php.
integer string CommonObject::$date_modification |
Definition at line 570 of file commonobject.class.php.
CommonObject::$fk_projet |
CommonObject::$note |
Definition at line 493 of file commonobject.class.php.
Referenced by Propal\reopen().