diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 685c78f5f1b..d8115e48cac 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1708,7 +1708,7 @@ class Account extends CommonObject if ($dbs->query($sql)) { return true; } else { - //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. + //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $dbs->lasterror(); return false; } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 5b523d8d7e8..f1487c7d8be 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -978,6 +978,23 @@ class ProductFournisseur extends Product return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Function used to replace a product id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old product id + * @param int $dest_id New product id + * @return bool + */ + public static function replaceProduct(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'product_fournisseur_price' + ); + + return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables); + } + /** * List supplier prices log of a supplier price * diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c17f3290df9..25503bdbf60 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -246,8 +246,6 @@ if (empty($reshook)) { $db->begin(); // Recopy some data - //$object->client = $object->client | $productOrigin->client; - //$object->fournisseur = $object->fournisseur | $productOrigin->fournisseur; $listofproperties = array( 'ref', 'ref_ext', @@ -310,7 +308,7 @@ if (empty($reshook)) { // Move links if (!$error) { - // This list is also into the api_products.class.php + // TODO add this functionality into the api_products.class.php // TODO Mutualise the list into object product.class.php $objects = array( 'Categorie' => '/categories/class/categorie.class.php', @@ -327,11 +325,8 @@ if (empty($reshook)) { 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - // 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Delivery' => '/delivery/class/delivery.class.php', - // 'Project' => '/projet/class/project.class.php', - // 'Ticket' => '/ticket/class/ticket.class.php', - // 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' ); //First, all core objects must update their tables @@ -382,6 +377,7 @@ if (empty($reshook)) { if (!$error) { // We finally remove the old product + // TODO merge attached files from old product into new one before delete if ($productOrigin->delete($user) < 1) { $error++; }