diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index c0d6658cab7..b4a3b56faa8 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1328,6 +1328,21 @@ class Mo extends CommonObject $tpl = DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; $res = include $tpl; } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty($db, $origin_id, $dest_id) + { + $tables = array('mrp_production'); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } /** diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 43756f84405..87f737043ac 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -97,7 +97,6 @@ class Dolresource extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."("; - $sql .= "entity,"; $sql .= "ref,"; $sql .= "description,"; @@ -105,9 +104,7 @@ class Dolresource extends CommonObject $sql .= "fk_code_type_resource,"; $sql .= "note_public,"; $sql .= "note_private"; - $sql .= ") VALUES ("; - $sql .= $conf->entity.", "; $sql .= " ".(!isset($this->ref) ? 'NULL' : "'".$this->db->escape($this->ref)."'").","; $sql .= " ".(!isset($this->description) ? 'NULL' : "'".$this->db->escape($this->description)."'").","; @@ -115,7 +112,6 @@ class Dolresource extends CommonObject $sql .= " ".(!isset($this->fk_code_type_resource) ? 'NULL' : "'".$this->db->escape($this->fk_code_type_resource)."'").","; $sql .= " ".(!isset($this->note_public) ? 'NULL' : "'".$this->db->escape($this->note_public)."'").","; $sql .= " ".(!isset($this->note_private) ? 'NULL' : "'".$this->db->escape($this->note_private)."'"); - $sql .= ")"; $this->db->begin(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 346ad15bb07..836c405de1e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -218,6 +218,8 @@ if (empty($reshook)) // Move links if (!$error) { + // This list is also into the api_thirdparties.class.php + // TODO Mutualise the list into object societe.class.php $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', 'Societe' => '/societe/class/societe.class.php', @@ -228,6 +230,7 @@ if (empty($reshook)) 'Facture' => '/compta/facture/class/facture.class.php', 'FactureRec' => '/compta/facture/class/facture-rec.class.php', 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Mo' => '/mrp/class/mo.class.php' 'Contact' => '/contact/class/contact.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Expedition' => '/expedition/class/expedition.class.php', @@ -239,7 +242,8 @@ if (empty($reshook)) 'Livraison' => '/livraison/class/livraison.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', - 'User' => '/user/class/user.class.php', + 'Ticket' => '/ticket/class/ticket.class.php', + 'User' => '/user/class/user.class.php' ); //First, all core objects must update their tables diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 8551cb61f10..735ff6b49af 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -399,6 +399,8 @@ class Thirdparties extends DolibarrApi // Move links if (!$error) { + // This list is also into the societe/card.php file + // TODO Mutualise the list into object societe.class.php $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', 'Societe' => '/societe/class/societe.class.php', @@ -409,6 +411,7 @@ class Thirdparties extends DolibarrApi 'Facture' => '/compta/facture/class/facture.class.php', 'FactureRec' => '/compta/facture/class/facture-rec.class.php', 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Mo' => '/mrp/class/mo.class.php', 'Contact' => '/contact/class/contact.class.php', 'Contrat' => '/contrat/class/contrat.class.php', 'Expedition' => '/expedition/class/expedition.class.php', @@ -420,7 +423,8 @@ class Thirdparties extends DolibarrApi 'Livraison' => '/livraison/class/livraison.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', - 'User' => '/user/class/user.class.php', + 'Ticket' => '/ticket/class/ticket.class.php', + 'User' => '/user/class/user.class.php' ); //First, all core objects must update their tables diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 26a0b77b01f..391bd4dce2d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2957,6 +2957,21 @@ class Ticket extends CommonObject return -1; } } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty($db, $origin_id, $dest_id) + { + $tables = array('ticket'); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } }