FIX Include the ticket and mo table in merge process of thirdparty

This commit is contained in:
Laurent Destailleur 2020-10-16 17:08:23 +02:00
parent 885e6caaa1
commit 27282d7e3d
5 changed files with 40 additions and 6 deletions

View File

@ -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);
}
}
/**

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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);
}
}