Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
efa09301b1
@ -2404,7 +2404,7 @@ class Adherent extends CommonObject
|
||||
$this->country_id = 1;
|
||||
$this->country_code = 'FR';
|
||||
$this->country = 'France';
|
||||
$this->morphy = 1;
|
||||
$this->morphy = 'mor';
|
||||
$this->email = 'specimen@specimen.com';
|
||||
$this->skype = 'skypepseudo';
|
||||
$this->twitter = 'twitterpseudo';
|
||||
|
||||
@ -163,9 +163,9 @@ class Asset extends CommonObject
|
||||
*/
|
||||
//public $class_element_line = 'Assetline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('assetdet');
|
||||
//protected $childtables=array();
|
||||
/**
|
||||
* @var AssetLine[] Array of subtable lines
|
||||
*/
|
||||
|
||||
@ -41,12 +41,6 @@ class BOM extends CommonObject
|
||||
*/
|
||||
public $table_element = 'bom_bom';
|
||||
|
||||
/**
|
||||
* @var string Name of subtable if this object has sub lines
|
||||
*/
|
||||
public $table_element_line = 'bom_bomline';
|
||||
public $fk_element = 'fk_bom';
|
||||
|
||||
/**
|
||||
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
@ -134,27 +128,32 @@ class BOM extends CommonObject
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
*/
|
||||
//public $table_element_line = 'bomdet';
|
||||
public $table_element_line = 'bom_bomline';
|
||||
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
*/
|
||||
//public $fk_element = 'fk_bom';
|
||||
public $fk_element = 'fk_bom';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable class that manage subtable lines
|
||||
*/
|
||||
//public $class_element_line = 'BillOfMaterialsline';
|
||||
public $class_element_line = 'BOMLine';
|
||||
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('bomdet');
|
||||
//protected $childtables=array();
|
||||
|
||||
/**
|
||||
* @var BillOfMaterialsLine[] Array of subtable lines
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
*/
|
||||
//public $lines = array();
|
||||
protected $childtablesoncascade=array('bom_bomline');
|
||||
|
||||
/**
|
||||
* @var BOMLine[] Array of subtable lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -7490,7 +7490,7 @@ abstract class CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($forcechilddeletion)
|
||||
if ($forcechilddeletion) // Force also delete of childtables that should lock deletion in standard case when option force is off
|
||||
{
|
||||
foreach($this->childtables as $table)
|
||||
{
|
||||
@ -7518,6 +7518,20 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Delete cascade first
|
||||
foreach($this->childtablesoncascade as $table)
|
||||
{
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$table.' WHERE '.$this->fk_element.' = '.$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->error;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (! $notrigger) {
|
||||
// Call triggers
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
// TODO Remove this class (used in Expensereportik and ExpenseReportRule
|
||||
class CoreObject extends CommonObject
|
||||
{
|
||||
public $withChild = true;
|
||||
@ -175,7 +176,7 @@ class CoreObject extends CommonObject
|
||||
*/
|
||||
public function fetchChild()
|
||||
{
|
||||
if($this->withChild && !empty($this->childtables) && !empty($this->fk_element))
|
||||
if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element))
|
||||
{
|
||||
foreach($this->childtables as &$childTable)
|
||||
{
|
||||
|
||||
@ -131,9 +131,9 @@ class EmailSenderProfile extends CommonObject
|
||||
*/
|
||||
//public $class_element_line = 'EmailSenderProfileline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('emailsenderprofiledet');
|
||||
//protected $childtables=array();
|
||||
/**
|
||||
* @var EmailSenderProfileLine[] Array of subtable lines
|
||||
*/
|
||||
|
||||
@ -160,10 +160,10 @@ abstract class DoliDB implements Database
|
||||
}
|
||||
|
||||
/**
|
||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||
* Cancel a transaction and go back to initial data values
|
||||
*
|
||||
* @param string $log Add more log to default log line
|
||||
* @return resource|int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||
* @return resource|int 1 if cancelation is ok or transaction not open, 0 if error
|
||||
*/
|
||||
public function rollback($log = '')
|
||||
{
|
||||
|
||||
@ -24,6 +24,7 @@ class DolQueryCollector extends DataCollector implements Renderable, AssetProvid
|
||||
{
|
||||
global $db;
|
||||
|
||||
// Replace $db handler with new handler override by TraceableDB
|
||||
$db = new TraceableDB($db);
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
@ -7,7 +7,6 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
|
||||
*
|
||||
* Used to log queries into DebugBar
|
||||
*/
|
||||
|
||||
class TraceableDB extends DoliDB
|
||||
{
|
||||
/**
|
||||
@ -275,10 +274,10 @@ class TraceableDB extends DoliDB
|
||||
}
|
||||
|
||||
/**
|
||||
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||
* Cancel a transaction and go back to initial data values
|
||||
*
|
||||
* @param string $log Add more log to default log line
|
||||
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||
* @param string $log Add more log to default log line
|
||||
* @return resource|int 1 if cancelation is ok or transaction not open, 0 if error
|
||||
*/
|
||||
public function rollback($log = '')
|
||||
{
|
||||
|
||||
@ -62,9 +62,13 @@ class EmailCollector extends CommonObject
|
||||
public $fk_element = 'fk_emailcollector';
|
||||
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
protected $childtables=array('emailcollector_emailcollectorfilter', 'emailcollector_emailcollectoraction');
|
||||
protected $childtables=array();
|
||||
/**
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
*/
|
||||
protected $childtablesoncascade=array('emailcollector_emailcollectorfilter','emailcollector_emailcollectoraction');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -127,9 +127,9 @@ class EmailCollectorAction extends CommonObject
|
||||
//public $class_element_line = 'EmailcollectorActionline';
|
||||
|
||||
// /**
|
||||
// * @var array Array of child tables (child tables to delete before deleting a record)
|
||||
// * @var array List of child tables. To test if we can delete object.
|
||||
// */
|
||||
//protected $childtables=array('emailcollectoractiondet');
|
||||
//protected $childtables=array();
|
||||
|
||||
// /**
|
||||
// * @var EmailcollectorActionLine[] Array of subtable lines
|
||||
|
||||
@ -42,12 +42,6 @@ class MyObject extends CommonObject
|
||||
*/
|
||||
public $table_element = 'mymodule_myobject';
|
||||
|
||||
/**
|
||||
* @var string Name of subtable if this object has sub lines
|
||||
*/
|
||||
//public $table_element_line = 'mymodule_myobjectline';
|
||||
//public $fk_element = 'fk_myobject';
|
||||
|
||||
/**
|
||||
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
*/
|
||||
@ -171,13 +165,12 @@ class MyObject extends CommonObject
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
|
||||
// If this object has a subtable with lines
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
*/
|
||||
//public $table_element_line = 'myobjectdet';
|
||||
//public $table_element_line = 'mymodule_myobjectline';
|
||||
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
@ -190,9 +183,14 @@ class MyObject extends CommonObject
|
||||
//public $class_element_line = 'MyObjectline';
|
||||
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('myobjectdet');
|
||||
//protected $childtables=array();
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
*/
|
||||
//protected $childtablesoncascade=array('mymodule_myobjectdet');
|
||||
|
||||
/**
|
||||
* @var MyObjectLine[] Array of subtable lines
|
||||
|
||||
@ -59,7 +59,10 @@ class Product extends CommonObject
|
||||
*/
|
||||
public $fk_element='fk_product';
|
||||
|
||||
protected $childtables=array('supplier_proposaldet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
protected $childtables=array('supplier_proposaldet', 'propaldet', 'commandedet', 'facturedet', 'contratdet', 'facture_fourn_det', 'commande_fournisseurdet');
|
||||
|
||||
/**
|
||||
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
@ -169,9 +169,13 @@ class Inventory extends CommonObject
|
||||
public $class_element_line = 'Inventoryline';
|
||||
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
protected $childtables=array('inventorydet');
|
||||
protected $childtables=array();
|
||||
/**
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
*/
|
||||
protected $childtablesoncascade=array('inventorydet');
|
||||
|
||||
/**
|
||||
* @var InventoryLine[] Array of subtable lines
|
||||
|
||||
@ -48,7 +48,11 @@ class Task extends CommonObject
|
||||
public $fk_element='fk_task';
|
||||
|
||||
public $picto = 'task';
|
||||
protected $childtables=array('projet_task_time'); // To test if we can delete object
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
protected $childtables=array('projet_task_time');
|
||||
|
||||
/**
|
||||
* @var int ID parent task
|
||||
|
||||
@ -204,9 +204,9 @@ class CompanyPaymentMode extends CommonObject
|
||||
*/
|
||||
//public $class_element_line = 'CompanyPaymentModeline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('companypaymentmodedet');
|
||||
//protected $childtables=array();
|
||||
/**
|
||||
* @var CompanyPaymentModeLine[] Array of subtable lines
|
||||
*/
|
||||
|
||||
@ -59,8 +59,16 @@ class Societe extends CommonObject
|
||||
public $fk_element='fk_soc';
|
||||
|
||||
public $fieldsforcombobox='nom,name_alias';
|
||||
protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); // To test if we can delete object
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord');
|
||||
/**
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
*/
|
||||
protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm");
|
||||
|
||||
public $picto = 'company';
|
||||
|
||||
/**
|
||||
|
||||
@ -164,9 +164,9 @@ class SocieteAccount extends CommonObject
|
||||
*/
|
||||
//public $class_element_line = 'societeAccountline';
|
||||
/**
|
||||
* @var array Array of child tables (child tables to delete before deleting a record)
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array('societe_accountdet');
|
||||
//protected $childtables=array();
|
||||
/**
|
||||
* @var societeAccountLine[] Array of subtable lines
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user