can merge products but experimental
This commit is contained in:
parent
799862362d
commit
99cddfa235
@ -1708,7 +1708,7 @@ class Account extends CommonObject
|
|||||||
if ($dbs->query($sql)) {
|
if ($dbs->query($sql)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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();
|
//$this->errors = $dbs->lasterror();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -978,6 +978,23 @@ class ProductFournisseur extends Product
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
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
|
* List supplier prices log of a supplier price
|
||||||
*
|
*
|
||||||
|
|||||||
@ -246,8 +246,6 @@ if (empty($reshook)) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Recopy some data
|
// Recopy some data
|
||||||
//$object->client = $object->client | $productOrigin->client;
|
|
||||||
//$object->fournisseur = $object->fournisseur | $productOrigin->fournisseur;
|
|
||||||
$listofproperties = array(
|
$listofproperties = array(
|
||||||
'ref',
|
'ref',
|
||||||
'ref_ext',
|
'ref_ext',
|
||||||
@ -310,7 +308,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Move links
|
// Move links
|
||||||
if (!$error) {
|
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
|
// TODO Mutualise the list into object product.class.php
|
||||||
$objects = array(
|
$objects = array(
|
||||||
'Categorie' => '/categories/class/categorie.class.php',
|
'Categorie' => '/categories/class/categorie.class.php',
|
||||||
@ -327,11 +325,8 @@ if (empty($reshook)) {
|
|||||||
'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php',
|
'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php',
|
||||||
'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php',
|
'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php',
|
||||||
'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.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',
|
'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
|
//First, all core objects must update their tables
|
||||||
@ -382,6 +377,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// We finally remove the old product
|
// We finally remove the old product
|
||||||
|
// TODO merge attached files from old product into new one before delete
|
||||||
if ($productOrigin->delete($user) < 1) {
|
if ($productOrigin->delete($user) < 1) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user