Skip to content

Commit

Permalink
Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 19, 2024
2 parents 15bea06 + aa4d75a commit 14a9b1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4847,6 +4847,15 @@ public function isObjectUsed($id = 0, $entity = 0)
$haschild = 0;
foreach ($arraytoscan as $table => $element) {
//print $id.'-'.$table.'-'.$elementname.'<br>';

// Check if module is enabled (to avoid error if tables of module not created)
if (isset($element['enabled']) && !empty($element['enabled'])) {
$enabled = (int) dol_eval($element['enabled'], 1);
if (empty($enabled)) {
continue;
}
}

// Check if element can be deleted
$sql = "SELECT COUNT(*) as nb";
$sql .= " FROM ".$this->db->prefix().$table." as c";
Expand Down
6 changes: 3 additions & 3 deletions htdocs/product/class/product.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ class Product extends CommonObject
'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'),
'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'),
'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'),
'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo' ),
'bom_bom' => array('name' => 'BOM'),
'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom'),
'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo', 'enabled' => 'isModEnabled("mrp")'),
'bom_bom' => array('name' => 'BOM', 'enabled' => 'isModEnabled("bom")'),
'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom', 'enabled' => 'isModEnabled("bom")'),
);

/**
Expand Down

0 comments on commit 14a9b1e

Please sign in to comment.