mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Add fields in product card
This commit is contained in:
parent
cc26095467
commit
8d3beef161
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* 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-2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
|
|
@ -306,9 +306,13 @@ if (empty($reshook))
|
|||
$object->fk_unit = GETPOST('units');
|
||||
|
||||
$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');
|
||||
|
||||
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; }
|
||||
|
||||
// MultiPrix
|
||||
|
|
@ -430,9 +434,13 @@ if (empty($reshook))
|
|||
$object->barcode_type_label = $stdobject->barcode_type_label;
|
||||
|
||||
$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');
|
||||
|
||||
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; }
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
|
@ -1154,42 +1162,64 @@ else
|
|||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_sell'), 'accountancy_code_sell', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
// 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
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account(GETPOST('accountancy_code_buy'), 'accountancy_code_buy', 1, null, 1, 1, '');
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
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></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
|
||||
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></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
||||
print ' ';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Product card
|
||||
|
|
@ -1448,42 +1478,64 @@ else
|
|||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
// 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
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else // For external software
|
||||
{
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefield">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
||||
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
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
// Fiche en mode visu
|
||||
else
|
||||
{
|
||||
|
|
@ -1575,35 +1627,65 @@ else
|
|||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
// Accountancy sell code
|
||||
// Accountancy sell code
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancySellCode");
|
||||
print '</td><td colspan="2">';
|
||||
print $langs->trans("ProductAccountancySellCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('',$object->accountancy_code_sell,1);
|
||||
|
||||
print $accountingaccount->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
} else {
|
||||
print $object->accountancy_code_sell;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy buy code
|
||||
// Accountancy sell code intra-community
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancyBuyCode");
|
||||
print '</td><td colspan="2">';
|
||||
print $langs->trans("ProductAccountancySellIntraCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount2 = new AccountingAccount($db);
|
||||
$accountingaccount2->fetch('',$object->accountancy_code_buy,1);
|
||||
$accountingaccount2->fetch('',$object->accountancy_code_sell_intra,1);
|
||||
|
||||
print $accountingaccount2->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
} 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
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("ProductAccountancyBuyCode");
|
||||
print '</td><td colspan="2">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$accountingaccount4 = new AccountingAccount($db);
|
||||
$accountingaccount4->fetch('',$object->accountancy_code_buy,1);
|
||||
|
||||
print $accountingaccount4->getNomUrl(0,1,1,'',1);
|
||||
} else {
|
||||
print $object->accountancy_code_buy;
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to sell)
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* 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-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
|
||||
|
|
@ -228,6 +228,8 @@ class Product extends CommonObject
|
|||
public $volume_units;
|
||||
|
||||
public $accountancy_code_buy;
|
||||
public $accountancy_code_buy_intra;
|
||||
public $accountancy_code_buy_export;
|
||||
public $accountancy_code_sell;
|
||||
|
||||
/**
|
||||
|
|
@ -436,13 +438,15 @@ class Product extends CommonObject
|
|||
$price_min_ttc = price2num($this->price_min * (1 + ($this->tva_tx / 100)),'MU');
|
||||
}
|
||||
|
||||
$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_intra= trim($this->accountancy_code_sell_intra);
|
||||
$this->accountancy_code_sell_export= trim($this->accountancy_code_sell_export);
|
||||
|
||||
// Barcode value
|
||||
$this->barcode=trim($this->barcode);
|
||||
|
||||
// Check parameters
|
||||
// Check parameters
|
||||
if (empty($this->label))
|
||||
{
|
||||
$this->error='ErrorMandatoryParametersNotProvided';
|
||||
|
|
@ -477,19 +481,19 @@ class Product extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type, LOG_DEBUG);
|
||||
|
||||
$now=dol_now();
|
||||
$now=dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts)
|
||||
// For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts)
|
||||
if ($this->barcode == -1) $this->barcode = $this->get_barcode($this,$this->barcode_type_code);
|
||||
|
||||
// Check more parameters
|
||||
// If error, this->errors[] is filled
|
||||
$result = $this->verify();
|
||||
// If error, this->errors[] is filled
|
||||
$result = $this->verify();
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($result >= 0)
|
||||
{
|
||||
$sql = "SELECT count(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE entity IN (".getEntity('product').")";
|
||||
|
|
@ -519,6 +523,8 @@ class Product extends CommonObject
|
|||
$sql.= ", tosell";
|
||||
$sql.= ", accountancy_code_buy";
|
||||
$sql.= ", accountancy_code_sell";
|
||||
$sql.= ", accountancy_code_sell_intra";
|
||||
$sql.= ", accountancy_code_sell_export";
|
||||
$sql.= ", canvas";
|
||||
$sql.= ", finished";
|
||||
$sql.= ", tobatch";
|
||||
|
|
@ -540,6 +546,8 @@ class Product extends CommonObject
|
|||
$sql.= ", ".$this->status_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_intra)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
|
||||
$sql.= ", '".$this->db->escape($this->canvas)."'";
|
||||
$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);
|
||||
|
|
@ -565,25 +573,25 @@ class Product extends CommonObject
|
|||
{
|
||||
if ($this->update($id, $user, true, 'add') <= 0)
|
||||
{
|
||||
$error++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error='ErrorFailedToGetInsertedId';
|
||||
$this->error='ErrorFailedToGetInsertedId';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -597,15 +605,15 @@ class Product extends CommonObject
|
|||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PRODUCT_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('PRODUCT_CREATE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
|
@ -772,6 +780,8 @@ class Product extends CommonObject
|
|||
|
||||
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
|
||||
$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();
|
||||
|
|
@ -883,6 +893,8 @@ class Product extends CommonObject
|
|||
$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_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.= ", cost_price = " . ($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
|
||||
$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.
|
||||
* 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
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
|
|
@ -1339,6 +1351,10 @@ class Product extends CommonObject
|
|||
$field = 'accountancy_code_buy';
|
||||
} elseif ($type == 'sell') {
|
||||
$field = 'accountancy_code_sell';
|
||||
} elseif ($type == 'sell_intra') {
|
||||
$field = 'accountancy_code_sell_intra';
|
||||
} elseif ($type == 'sell_export') {
|
||||
$field = 'accountancy_code_sell_export';
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1831,7 +1847,7 @@ class Product extends CommonObject
|
|||
$sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas, weight, weight_units,";
|
||||
$sql.= " length, length_units, width, width_units, height, height_units,";
|
||||
$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.= " fk_price_expression, price_autogen";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
|
|
@ -1850,78 +1866,80 @@ class Product extends CommonObject
|
|||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->url = $obj->url;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->label = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->url = $obj->url;
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
|
||||
$this->type = $obj->fk_product_type;
|
||||
$this->status = $obj->tosell;
|
||||
$this->status_buy = $obj->tobuy;
|
||||
$this->status_batch = $obj->tobatch;
|
||||
$this->type = $obj->fk_product_type;
|
||||
$this->status = $obj->tosell;
|
||||
$this->status_buy = $obj->tobuy;
|
||||
$this->status_batch = $obj->tobatch;
|
||||
|
||||
$this->customcode = $obj->customcode;
|
||||
$this->country_id = $obj->fk_country;
|
||||
$this->country_code = getCountry($this->country_id,2,$this->db);
|
||||
$this->price = $obj->price;
|
||||
$this->price_ttc = $obj->price_ttc;
|
||||
$this->price_min = $obj->price_min;
|
||||
$this->price_min_ttc = $obj->price_min_ttc;
|
||||
$this->price_base_type = $obj->price_base_type;
|
||||
$this->cost_price = $obj->cost_price;
|
||||
$this->default_vat_code = $obj->default_vat_code;
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->customcode = $obj->customcode;
|
||||
$this->country_id = $obj->fk_country;
|
||||
$this->country_code = getCountry($this->country_id,2,$this->db);
|
||||
$this->price = $obj->price;
|
||||
$this->price_ttc = $obj->price_ttc;
|
||||
$this->price_min = $obj->price_min;
|
||||
$this->price_min_ttc = $obj->price_min_ttc;
|
||||
$this->price_base_type = $obj->price_base_type;
|
||||
$this->cost_price = $obj->cost_price;
|
||||
$this->default_vat_code = $obj->default_vat_code;
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
//! French VAT NPR
|
||||
$this->tva_npr = $obj->tva_npr;
|
||||
$this->recuperableonly = $obj->tva_npr; // For backward compatibility
|
||||
$this->tva_npr = $obj->tva_npr;
|
||||
$this->recuperableonly = $obj->tva_npr; // For backward compatibility
|
||||
//! Local taxes
|
||||
$this->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->localtax1_type = $obj->localtax1_type;
|
||||
$this->localtax2_type = $obj->localtax2_type;
|
||||
$this->localtax1_tx = $obj->localtax1_tx;
|
||||
$this->localtax2_tx = $obj->localtax2_tx;
|
||||
$this->localtax1_type = $obj->localtax1_type;
|
||||
$this->localtax2_type = $obj->localtax2_type;
|
||||
|
||||
$this->finished = $obj->finished;
|
||||
$this->duration = $obj->duration;
|
||||
$this->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1);
|
||||
$this->duration_unit = substr($obj->duration,-1);
|
||||
$this->canvas = $obj->canvas;
|
||||
$this->weight = $obj->weight;
|
||||
$this->weight_units = $obj->weight_units;
|
||||
$this->length = $obj->length;
|
||||
$this->length_units = $obj->length_units;
|
||||
$this->width = $obj->width;
|
||||
$this->width_units = $obj->width_units;
|
||||
$this->height = $obj->height;
|
||||
$this->height_units = $obj->height_units;
|
||||
$this->finished = $obj->finished;
|
||||
$this->duration = $obj->duration;
|
||||
$this->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1);
|
||||
$this->duration_unit = substr($obj->duration,-1);
|
||||
$this->canvas = $obj->canvas;
|
||||
$this->weight = $obj->weight;
|
||||
$this->weight_units = $obj->weight_units;
|
||||
$this->length = $obj->length;
|
||||
$this->length_units = $obj->length_units;
|
||||
$this->width = $obj->width;
|
||||
$this->width_units = $obj->width_units;
|
||||
$this->height = $obj->height;
|
||||
$this->height_units = $obj->height_units;
|
||||
|
||||
$this->surface = $obj->surface;
|
||||
$this->surface_units = $obj->surface_units;
|
||||
$this->volume = $obj->volume;
|
||||
$this->volume_units = $obj->volume_units;
|
||||
$this->barcode = $obj->barcode;
|
||||
$this->barcode_type = $obj->fk_barcode_type;
|
||||
$this->surface = $obj->surface;
|
||||
$this->surface_units = $obj->surface_units;
|
||||
$this->volume = $obj->volume;
|
||||
$this->volume_units = $obj->volume_units;
|
||||
$this->barcode = $obj->barcode;
|
||||
$this->barcode_type = $obj->fk_barcode_type;
|
||||
|
||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$this->accountancy_code_sell = $obj->accountancy_code_sell;
|
||||
$this->accountancy_code_buy = $obj->accountancy_code_buy;
|
||||
$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->desiredstock = $obj->desiredstock;
|
||||
$this->stock_reel = $obj->stock;
|
||||
$this->pmp = $obj->pmp;
|
||||
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
|
||||
$this->desiredstock = $obj->desiredstock;
|
||||
$this->stock_reel = $obj->stock;
|
||||
$this->pmp = $obj->pmp;
|
||||
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->import_key = $obj->import_key;
|
||||
$this->entity = $obj->entity;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_modification = $obj->tms;
|
||||
$this->import_key = $obj->import_key;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->fk_price_expression = $obj->fk_price_expression;
|
||||
$this->fk_unit = $obj->fk_unit;
|
||||
$this->price_autogen = $obj->price_autogen;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->fk_price_expression = $obj->fk_price_expression;
|
||||
$this->fk_unit = $obj->fk_unit;
|
||||
$this->price_autogen = $obj->price_autogen;
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user