Merge pull request #7742 from aspangaro/7.0-accountancyproductvariant
NEW Accountancy Add variant on sell account for intracommunity sales & export sales
This commit is contained in:
commit
fa999dfa65
@ -524,6 +524,9 @@ ALTER TABLE llx_actioncomm_reminder ADD UNIQUE INDEX uk_actioncomm_reminder_uniq
|
|||||||
-- May have error due to duplicate keys
|
-- May have error due to duplicate keys
|
||||||
ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
ALTER TABLE llx_resource ADD UNIQUE INDEX uk_resource_ref (ref, entity);
|
||||||
|
|
||||||
|
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_intra varchar(32) AFTER accountancy_code_sell;
|
||||||
|
ALTER TABLE llx_product ADD COLUMN accountancy_code_sell_export varchar(32) AFTER accountancy_code_sell_intra;
|
||||||
|
|
||||||
-- SPEC : use database type 'double' to store monetary values
|
-- SPEC : use database type 'double' to store monetary values
|
||||||
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
|
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
|
||||||
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
|
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
|
||||||
|
|||||||
@ -48,10 +48,10 @@ create table llx_product
|
|||||||
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
default_vat_code varchar(10), -- Same code than into table llx_c_tva (but no constraints). Should be used in priority to find default vat, npr, localtaxes for product.
|
||||||
tva_tx double(6,3), -- Default VAT rate of product
|
tva_tx double(6,3), -- Default VAT rate of product
|
||||||
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
|
recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT
|
||||||
localtax1_tx double(6,3) DEFAULT 0, --
|
localtax1_tx double(6,3) DEFAULT 0,
|
||||||
localtax1_type varchar(10) NOT NULL DEFAULT '0', --
|
localtax1_type varchar(10) NOT NULL DEFAULT '0',
|
||||||
localtax2_tx double(6,3) DEFAULT 0, --
|
localtax2_tx double(6,3) DEFAULT 0,
|
||||||
localtax2_type varchar(10) NOT NULL DEFAULT '0', --
|
localtax2_type varchar(10) NOT NULL DEFAULT '0',
|
||||||
fk_user_author integer DEFAULT NULL, -- user making creation
|
fk_user_author integer DEFAULT NULL, -- user making creation
|
||||||
fk_user_modif integer, -- user making last change
|
fk_user_modif integer, -- user making last change
|
||||||
tosell tinyint DEFAULT 1, -- Product you sell
|
tosell tinyint DEFAULT 1, -- Product you sell
|
||||||
@ -65,6 +65,8 @@ create table llx_product
|
|||||||
barcode varchar(255) DEFAULT NULL, -- barcode
|
barcode varchar(255) DEFAULT NULL, -- barcode
|
||||||
fk_barcode_type integer DEFAULT NULL, -- barcode type
|
fk_barcode_type integer DEFAULT NULL, -- barcode type
|
||||||
accountancy_code_sell varchar(32), -- Selling accountancy code
|
accountancy_code_sell varchar(32), -- Selling accountancy code
|
||||||
|
accountancy_code_sell_intra varchar(32), -- Selling accountancy code for vat intracommunity
|
||||||
|
accountancy_code_sell_export varchar(32), -- Selling accountancy code for vat export
|
||||||
accountancy_code_buy varchar(32), -- Buying accountancy code
|
accountancy_code_buy varchar(32), -- Buying accountancy code
|
||||||
partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode.
|
partnumber varchar(32), -- Part/Serial number. TODO To use it into screen if not a duplicate of barcode.
|
||||||
weight float DEFAULT NULL,
|
weight float DEFAULT NULL,
|
||||||
@ -91,5 +93,5 @@ create table llx_product
|
|||||||
fk_price_expression integer, -- Link to the rule for dynamic price calculation
|
fk_price_expression integer, -- Link to the rule for dynamic price calculation
|
||||||
desiredstock integer DEFAULT 0,
|
desiredstock integer DEFAULT 0,
|
||||||
fk_unit integer DEFAULT NULL,
|
fk_unit integer DEFAULT NULL,
|
||||||
price_autogen TINYINT DEFAULT 0
|
price_autogen tinyint DEFAULT 0
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -22,6 +22,8 @@ MassBarcodeInit=Mass barcode init
|
|||||||
MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete.
|
MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete.
|
||||||
ProductAccountancyBuyCode=Accounting code (purchase)
|
ProductAccountancyBuyCode=Accounting code (purchase)
|
||||||
ProductAccountancySellCode=Accounting code (sale)
|
ProductAccountancySellCode=Accounting code (sale)
|
||||||
|
ProductAccountancySellIntraCode=Accounting code (sale intra-community)
|
||||||
|
ProductAccountancySellExportCode=Accounting code (sale export)
|
||||||
ProductOrService=Product or Service
|
ProductOrService=Product or Service
|
||||||
ProductsAndServices=Products and Services
|
ProductsAndServices=Products and Services
|
||||||
ProductsOrServices=Products or Services
|
ProductsOrServices=Products or Services
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012-2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
@ -306,9 +306,13 @@ if (empty($reshook))
|
|||||||
$object->fk_unit = GETPOST('units');
|
$object->fk_unit = GETPOST('units');
|
||||||
|
|
||||||
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
||||||
|
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra');
|
||||||
|
$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export');
|
||||||
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
||||||
|
|
||||||
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
||||||
|
if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; }
|
||||||
|
if ($accountancy_code_sell_export <= 0) { $object->accountancy_code_sell_export = ''; } else { $object->accountancy_code_sell_export = $accountancy_code_sell_export; }
|
||||||
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
||||||
|
|
||||||
// MultiPrix
|
// MultiPrix
|
||||||
@ -430,9 +434,13 @@ if (empty($reshook))
|
|||||||
$object->barcode_type_label = $stdobject->barcode_type_label;
|
$object->barcode_type_label = $stdobject->barcode_type_label;
|
||||||
|
|
||||||
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
$accountancy_code_sell = GETPOST('accountancy_code_sell');
|
||||||
|
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra');
|
||||||
|
$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export');
|
||||||
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
$accountancy_code_buy = GETPOST('accountancy_code_buy');
|
||||||
|
|
||||||
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; }
|
||||||
|
if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; }
|
||||||
|
if ($accountancy_code_sell_export <= 0) { $object->accountancy_code_sell_export = ''; } else { $object->accountancy_code_sell_export = $accountancy_code_sell_export; }
|
||||||
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
if ($accountancy_code_buy <= 0) { $object->accountancy_code_buy = ''; } else { $object->accountancy_code_buy = $accountancy_code_buy; }
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
@ -1160,6 +1168,18 @@ else
|
|||||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, '');
|
print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, '');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_intra
|
||||||
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccounting->select_account(GETPOST('accountancy_code_sell_intra'), 'accountancy_code_sell_intra', 1, null, 1, 1, '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_export
|
||||||
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccounting->select_account(GETPOST('accountancy_code_sell_export'), 'accountancy_code_sell_export', 1, null, 1, 1, '');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_code_buy
|
// Accountancy_code_buy
|
||||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1173,6 +1193,16 @@ else
|
|||||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_intra
|
||||||
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||||
|
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_export
|
||||||
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||||
|
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_code_buy
|
// Accountancy_code_buy
|
||||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
||||||
@ -1454,6 +1484,18 @@ else
|
|||||||
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_intra
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_export
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_code_buy
|
// Accountancy_code_buy
|
||||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1467,6 +1509,16 @@ else
|
|||||||
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
|
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_intra
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||||
|
print '<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.$object->accountancy_code_sell_intra.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy_code_sell_export
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||||
|
print '<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.$object->accountancy_code_sell_export.'">';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy_code_buy
|
// Accountancy_code_buy
|
||||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||||
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
||||||
@ -1590,16 +1642,46 @@ else
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy sell code intra-community
|
||||||
|
print '<tr><td class="nowrap">';
|
||||||
|
print $langs->trans("ProductAccountancySellIntraCode");
|
||||||
|
print '</td><td colspan="2">';
|
||||||
|
if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
$accountingaccount2 = new AccountingAccount($db);
|
||||||
|
$accountingaccount2->fetch('',$object->accountancy_code_sell_intra,1);
|
||||||
|
|
||||||
|
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
||||||
|
} else {
|
||||||
|
print $object->accountancy_code_sell_intra;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy sell code export
|
||||||
|
print '<tr><td class="nowrap">';
|
||||||
|
print $langs->trans("ProductAccountancySellExportCode");
|
||||||
|
print '</td><td colspan="2">';
|
||||||
|
if (! empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
$accountingaccount3 = new AccountingAccount($db);
|
||||||
|
$accountingaccount3->fetch('',$object->accountancy_code_sell_export,1);
|
||||||
|
|
||||||
|
print $accountingaccount3->getNomUrl(0,1,1,'',1);
|
||||||
|
} else {
|
||||||
|
print $object->accountancy_code_sell_export;
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy buy code
|
// Accountancy buy code
|
||||||
print '<tr><td class="nowrap">';
|
print '<tr><td class="nowrap">';
|
||||||
print $langs->trans("ProductAccountancyBuyCode");
|
print $langs->trans("ProductAccountancyBuyCode");
|
||||||
print '</td><td colspan="2">';
|
print '</td><td colspan="2">';
|
||||||
if (! empty($conf->accounting->enabled))
|
if (! empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
$accountingaccount2 = new AccountingAccount($db);
|
$accountingaccount4 = new AccountingAccount($db);
|
||||||
$accountingaccount2->fetch('',$object->accountancy_code_buy,1);
|
$accountingaccount4->fetch('',$object->accountancy_code_buy,1);
|
||||||
|
|
||||||
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
print $accountingaccount4->getNomUrl(0,1,1,'',1);
|
||||||
} else {
|
} else {
|
||||||
print $object->accountancy_code_buy;
|
print $object->accountancy_code_buy;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2011-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2011-2017 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||||
@ -228,6 +228,8 @@ class Product extends CommonObject
|
|||||||
public $volume_units;
|
public $volume_units;
|
||||||
|
|
||||||
public $accountancy_code_buy;
|
public $accountancy_code_buy;
|
||||||
|
public $accountancy_code_buy_intra;
|
||||||
|
public $accountancy_code_buy_export;
|
||||||
public $accountancy_code_sell;
|
public $accountancy_code_sell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -438,6 +440,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||||
$this->accountancy_code_sell= trim($this->accountancy_code_sell);
|
$this->accountancy_code_sell= trim($this->accountancy_code_sell);
|
||||||
|
$this->accountancy_code_sell_intra= trim($this->accountancy_code_sell_intra);
|
||||||
|
$this->accountancy_code_sell_export= trim($this->accountancy_code_sell_export);
|
||||||
|
|
||||||
// Barcode value
|
// Barcode value
|
||||||
$this->barcode=trim($this->barcode);
|
$this->barcode=trim($this->barcode);
|
||||||
@ -519,6 +523,8 @@ class Product extends CommonObject
|
|||||||
$sql.= ", tosell";
|
$sql.= ", tosell";
|
||||||
$sql.= ", accountancy_code_buy";
|
$sql.= ", accountancy_code_buy";
|
||||||
$sql.= ", accountancy_code_sell";
|
$sql.= ", accountancy_code_sell";
|
||||||
|
$sql.= ", accountancy_code_sell_intra";
|
||||||
|
$sql.= ", accountancy_code_sell_export";
|
||||||
$sql.= ", canvas";
|
$sql.= ", canvas";
|
||||||
$sql.= ", finished";
|
$sql.= ", finished";
|
||||||
$sql.= ", tobatch";
|
$sql.= ", tobatch";
|
||||||
@ -540,6 +546,8 @@ class Product extends CommonObject
|
|||||||
$sql.= ", ".$this->status_buy;
|
$sql.= ", ".$this->status_buy;
|
||||||
$sql.= ", '".$this->db->escape($this->accountancy_code_buy)."'";
|
$sql.= ", '".$this->db->escape($this->accountancy_code_buy)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->accountancy_code_sell)."'";
|
$sql.= ", '".$this->db->escape($this->accountancy_code_sell)."'";
|
||||||
|
$sql.= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
|
||||||
|
$sql.= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
|
||||||
$sql.= ", '".$this->db->escape($this->canvas)."'";
|
$sql.= ", '".$this->db->escape($this->canvas)."'";
|
||||||
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
|
$sql.= ", ".((! isset($this->finished) || $this->finished < 0 || $this->finished == '') ? 'null' : (int) $this->finished);
|
||||||
$sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch);
|
$sql.= ", ".((empty($this->status_batch) || $this->status_batch < 0)? '0':$this->status_batch);
|
||||||
@ -772,6 +780,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||||
$this->accountancy_code_sell= trim($this->accountancy_code_sell);
|
$this->accountancy_code_sell= trim($this->accountancy_code_sell);
|
||||||
|
$this->accountancy_code_sell_intra= trim($this->accountancy_code_sell_intra);
|
||||||
|
$this->accountancy_code_sell_export= trim($this->accountancy_code_sell_export);
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -883,6 +893,8 @@ class Product extends CommonObject
|
|||||||
$sql.= ", duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."'";
|
$sql.= ", duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."'";
|
||||||
$sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'";
|
$sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'";
|
||||||
$sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'";
|
$sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'";
|
||||||
|
$sql.= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra)."'";
|
||||||
|
$sql.= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export)."'";
|
||||||
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
|
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
|
||||||
$sql.= ", cost_price = " . ($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
|
$sql.= ", cost_price = " . ($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
|
||||||
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||||
@ -1325,7 +1337,7 @@ class Product extends CommonObject
|
|||||||
* Sets an accountancy code for a product.
|
* Sets an accountancy code for a product.
|
||||||
* Also calls PRODUCT_MODIFY trigger when modified
|
* Also calls PRODUCT_MODIFY trigger when modified
|
||||||
*
|
*
|
||||||
* @param string $type It can be 'buy' or 'sell'
|
* @param string $type It can be 'buy', 'sell', 'sell_intra' or 'sell_export'
|
||||||
* @param string $value Accountancy code
|
* @param string $value Accountancy code
|
||||||
* @return int <0 KO >0 OK
|
* @return int <0 KO >0 OK
|
||||||
*/
|
*/
|
||||||
@ -1339,6 +1351,10 @@ class Product extends CommonObject
|
|||||||
$field = 'accountancy_code_buy';
|
$field = 'accountancy_code_buy';
|
||||||
} elseif ($type == 'sell') {
|
} elseif ($type == 'sell') {
|
||||||
$field = 'accountancy_code_sell';
|
$field = 'accountancy_code_sell';
|
||||||
|
} elseif ($type == 'sell_intra') {
|
||||||
|
$field = 'accountancy_code_sell_intra';
|
||||||
|
} elseif ($type == 'sell_export') {
|
||||||
|
$field = 'accountancy_code_sell_export';
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1831,7 +1847,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas, weight, weight_units,";
|
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas, weight, weight_units,";
|
||||||
$sql.= " length, length_units, width, width_units, height, height_units,";
|
$sql.= " length, length_units, width, width_units, height, height_units,";
|
||||||
$sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
$sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
||||||
$sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,";
|
$sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
|
||||||
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
|
$sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
|
||||||
$sql.= " fk_price_expression, price_autogen";
|
$sql.= " fk_price_expression, price_autogen";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
@ -1907,6 +1923,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||||
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
||||||
|
$this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
|
||||||
|
$this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
|
||||||
|
|
||||||
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
|
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
|
||||||
$this->desiredstock = $obj->desiredstock;
|
$this->desiredstock = $obj->desiredstock;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user