Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0f685853c4
@ -373,7 +373,7 @@ if ($conf->product->enabled) {
|
||||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
|
||||
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
|
||||
@ -1239,7 +1239,6 @@ class Setup extends DolibarrApi
|
||||
{
|
||||
$list = array();
|
||||
|
||||
//TODO link with multicurrency module
|
||||
$sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_units as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
@ -1279,6 +1278,68 @@ class Setup extends DolibarrApi
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of legal form of business.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param string $country To filter on country
|
||||
* @param int $active Lega form is active or not {@min 0} {@max 1}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of legal form
|
||||
*
|
||||
* @url GET dictionary/legal_form
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = '', $active = 1, $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT t.rowid, t.code, t.fk_pays, t.libelle, t.isvatexempted, t.active, t.module, t.position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_forme_juridique as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
if ($country) {
|
||||
$sql .= " AND t.fk_pays = '".$this->db->escape($country)."'";
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of legal form: '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of social networks.
|
||||
*
|
||||
|
||||
@ -68,7 +68,7 @@ class box_members_by_type extends ModeleBoxes
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
$this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -67,7 +67,7 @@ class box_members_last_modified extends ModeleBoxes
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
$this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -67,7 +67,7 @@ class box_members_last_subscriptions extends ModeleBoxes
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
$this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -67,7 +67,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
|
||||
$this->enabled = 0; // disabled for external users
|
||||
}
|
||||
|
||||
$this->hidden = !($user->rights->adherent->lire);
|
||||
$this->hidden = !(!empty($conf->adherent->enabled) && $user->rights->adherent->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -59,7 +59,10 @@ if (empty($font_loc)) {
|
||||
if (defined('PHP-BARCODE_PATH_COMMAND')) {
|
||||
$genbarcode_loc = constant('PHP-BARCODE_PATH_COMMAND');
|
||||
} else {
|
||||
$genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
|
||||
$genbarcode_loc = '';
|
||||
if (!empty($conf->global->GENBARCODE_LOCATION)) {
|
||||
$genbarcode_loc = $conf->global->GENBARCODE_LOCATION;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -281,6 +281,9 @@ class modSociete extends DolibarrModules
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
$this->export_fields_array[$r]['s.price_level'] = 'PriceLevel';
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
$this->export_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
|
||||
}
|
||||
// Add multicompany field
|
||||
if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) {
|
||||
$nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1
|
||||
@ -317,7 +320,8 @@ class modSociete extends DolibarrModules
|
||||
'payterm.libelle'=>'Text', 'paymode.libelle'=>'Text',
|
||||
's.outstanding_limit'=>'Numeric', 'pbacc.ref'=>'Text', 'incoterm.code'=>'Text',
|
||||
'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text',
|
||||
's.entity'=>'Numeric', 's.price_level'=>'Numeric'
|
||||
's.entity'=>'Numeric', 's.price_level'=>'Numeric',
|
||||
's.accountancy_code_sell'=>'Text', 's.accountancy_code_buy'=>'Text'
|
||||
);
|
||||
|
||||
$this->export_entities_array[$r] = array('u.login'=>'user', 'u.firstname'=>'user', 'u.lastname'=>'user'); // We define here only fields that use another picto
|
||||
@ -488,6 +492,9 @@ class modSociete extends DolibarrModules
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
$this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
$this->import_fields_array[$r] += array('s.accountancy_code_sell'=>'ProductAccountancySellCode', 's.accountancy_code_buy'=>'ProductAccountancyBuyCode');
|
||||
}
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
@ -621,7 +628,9 @@ class modSociete extends DolibarrModules
|
||||
's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule",
|
||||
's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
||||
's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)',
|
||||
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"'
|
||||
's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"',
|
||||
's.accountancy_code_sell' => '707',
|
||||
's.accountancy_code_buy' => '607',
|
||||
);
|
||||
$this->import_updatekeys_array[$r] = array(
|
||||
's.nom' => 'Name',
|
||||
|
||||
@ -112,6 +112,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
public $socid;
|
||||
public $fourn_id;
|
||||
public $date;
|
||||
public $date_creation;
|
||||
public $date_valid;
|
||||
public $date_approve;
|
||||
public $date_approve2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set
|
||||
@ -375,11 +376,16 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->total_localtax1 = $obj->localtax1;
|
||||
$this->total_localtax2 = $obj->localtax2;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
$this->date = $this->db->jdate($obj->date_creation);
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_valid = $this->db->jdate($obj->date_valid);
|
||||
$this->date_approve = $this->db->jdate($obj->date_approve);
|
||||
$this->date_approve2 = $this->db->jdate($obj->date_approve2);
|
||||
$this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier
|
||||
if (isset($obj->date_commande)) {
|
||||
$this->date = $this->date_commande;
|
||||
} else {
|
||||
$this->date = $this->date_creation;
|
||||
}
|
||||
$this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated
|
||||
$this->delivery_date = $this->db->jdate($obj->delivery_date);
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
@ -3295,7 +3301,6 @@ class CommandeFournisseur extends CommonOrder
|
||||
$keysinwishednotindelivered = array_diff(array_keys($qtywished), array_keys($qtydelivered)); // To check we also have same number of keys
|
||||
$keysindeliverednotinwished = array_diff(array_keys($qtydelivered), array_keys($qtywished)); // To check we also have same number of keys
|
||||
/*var_dump(array_keys($qtydelivered));
|
||||
|
||||
var_dump(array_keys($qtywished));
|
||||
var_dump($diff_array);
|
||||
var_dump($keysinwishednotindelivered);
|
||||
|
||||
@ -103,6 +103,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine
|
||||
public $batch;
|
||||
public $eatby = '';
|
||||
public $sellby = '';
|
||||
public $cost_price = 0;
|
||||
|
||||
|
||||
|
||||
@ -189,7 +190,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine
|
||||
$sql .= "batch,";
|
||||
$sql .= "eatby,";
|
||||
$sql .= "sellby,";
|
||||
$sql .= "fk_reception";
|
||||
$sql .= "fk_reception,";
|
||||
$sql .= "cost_price";
|
||||
|
||||
|
||||
$sql .= ") VALUES (";
|
||||
@ -205,7 +207,8 @@ class CommandeFournisseurDispatch extends CommonObjectLine
|
||||
$sql .= " ".(!isset($this->batch) ? 'NULL' : "'".$this->db->escape($this->batch)."'").",";
|
||||
$sql .= " ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'".$this->db->idate($this->eatby)."'").",";
|
||||
$sql .= " ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'".$this->db->idate($this->sellby)."'").",";
|
||||
$sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'")."";
|
||||
$sql .= " ".(!isset($this->fk_reception) ? 'NULL' : "'".$this->db->escape($this->fk_reception)."'").",";
|
||||
$sql .= " ".(!isset($this->cost_price) ? '0' : "'".$this->db->escape($this->cost_price)."'")."";
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -356,3 +356,16 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1306','S
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1307','Société en participation');
|
||||
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (13, '1308','Groupe de sociétés');
|
||||
|
||||
-- Sweden (id country=20)
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
|
||||
|
||||
@ -133,3 +133,19 @@ ALTER TABLE llx_product_lot ADD COLUMN barcode varchar(180) DEFAULT NULL;
|
||||
ALTER TABLE llx_product_lot ADD COLUMN fk_barcode_type integer DEFAULT NULL;
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN max_attendees integer DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN cost_price double(24,8) DEFAULT 0;
|
||||
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2001', 'Aktiebolag');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2002', 'Publikt aktiebolag (AB publ)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2003', 'Ekonomisk förening (ek. för.)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2004', 'Bostadsrättsförening (BRF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2005', 'Hyresrättsförening (HRF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2006', 'Kooperativ');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2007', 'Enskild firma (EF)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2008', 'Handelsbolag (HB)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2009', 'Kommanditbolag (KB)');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2010', 'Enkelt bolag');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2011', 'Ideell förening');
|
||||
INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (20, '2012', 'Stiftelse');
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
create table llx_categorie_knowledgemanagement
|
||||
create table llx_categorie_knowledgemanagement(
|
||||
fk_categorie integer NOT NULL,
|
||||
fk_knowledgemanagement integer NOT NULL,
|
||||
import_key varchar(14)
|
||||
|
||||
@ -36,5 +36,6 @@ create table llx_commande_fournisseur_dispatch
|
||||
sellby date DEFAULT NULL,
|
||||
status integer,
|
||||
datec datetime,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
cost_price double(24,8) DEFAULT 0
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -104,8 +104,7 @@ create table llx_product
|
||||
fk_unit integer DEFAULT NULL,
|
||||
price_autogen tinyint DEFAULT 0,
|
||||
fk_project integer DEFAULT NULL, -- Used when product was generated by a project or is specifif to a project
|
||||
mandatory_period tinyint DEFAULT 0 -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
|
||||
mandatory_period tinyint DEFAULT 0, -- is used to signal to the user that the start and end dates are mandatory for this type of product the fk_product_type == 1 (service) (non-blocking action)
|
||||
|
||||
fk_default_bom integer DEFAULT NULL,
|
||||
fk_project integer DEFAULT NULL -- Used when the product was generated by a project or is specific to a project
|
||||
fk_default_bom integer DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -45,3 +45,4 @@ ReceptionsNumberingModules=Numbering module for receptions
|
||||
ReceptionsReceiptModel=Document templates for receptions
|
||||
NoMorePredefinedProductToDispatch=No more predefined products to dispatch
|
||||
ReceptionExist=A reception exists
|
||||
ByingPrice=Bying price
|
||||
|
||||
@ -45,3 +45,4 @@ ReceptionsNumberingModules=Module de numérotation pour les réceptions
|
||||
ReceptionsReceiptModel=Modèles de document pour les réceptions
|
||||
NoMorePredefinedProductToDispatch=Plus de produits prédéfinis à expédier
|
||||
ReceptionExist=Une réception existe
|
||||
ByingPrice=Prix d'achat
|
||||
|
||||
@ -340,6 +340,7 @@ if (empty($reshook)) {
|
||||
$eatby = "dlc".$i;
|
||||
$sellby = "dluo".$i;
|
||||
$batch = "batch".$i;
|
||||
$cost_price = "cost_price".$i;
|
||||
|
||||
if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->RECEPTION_GETS_ALL_ORDER_PRODUCTS)) {
|
||||
$ent = "entl".$i;
|
||||
@ -364,8 +365,11 @@ if (empty($reshook)) {
|
||||
$sellby = GETPOST($sellby, 'alpha');
|
||||
$eatbydate = str_replace('/', '-', $eatby);
|
||||
$sellbydate = str_replace('/', '-', $sellby);
|
||||
|
||||
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'));
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'), price2num(GETPOST($cost_price, 'double'), 'MU'));
|
||||
} else {
|
||||
$ret = $object->addline($entrepot_id, GETPOST($idl, 'int'), GETPOST($qty, 'int'), $array_options[$i], GETPOST($comment, 'alpha'), strtotime($eatbydate), strtotime($sellbydate), GETPOST($batch, 'alpha'));
|
||||
}
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
@ -989,6 +993,9 @@ if ($action == 'create') {
|
||||
print '<td class="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td class="center">'.$langs->trans("QtyReceived").'</td>';
|
||||
print '<td class="center">'.$langs->trans("QtyToReceive");
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
print '<td>'.$langs->trans("ByingPrice").'</td>';
|
||||
}
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
|
||||
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
|
||||
@ -1118,6 +1125,7 @@ if ($action == 'create') {
|
||||
|
||||
$stock = + $product->stock_warehouse[$dispatchLines[$indiceAsked]['ent']]->real; // Convert to number
|
||||
$deliverableQty = $dispatchLines[$indiceAsked]['qty'];
|
||||
$cost_price = $dispatchLines[$indiceAsked]['pu'];
|
||||
|
||||
// Quantity to send
|
||||
print '<td class="center">';
|
||||
@ -1132,6 +1140,12 @@ if ($action == 'create') {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
print '<td>';
|
||||
print '<input name="cost_price'.$indiceAsked.'" id="cost_price'.$indiceAsked.'" value="'.$cost_price.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Stock
|
||||
if (!empty($conf->stock->enabled)) {
|
||||
print '<td class="left">';
|
||||
|
||||
@ -561,7 +561,8 @@ class Reception extends CommonObject
|
||||
// TODO in future, reception lines may not be linked to order line
|
||||
$sql = "SELECT cd.fk_product, cd.subprice,";
|
||||
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
|
||||
$sql .= " ed.eatby, ed.sellby, ed.batch";
|
||||
$sql .= " ed.eatby, ed.sellby, ed.batch,";
|
||||
$sql .= " ed.cost_price";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed";
|
||||
$sql .= " WHERE ed.fk_reception = ".((int) $this->id);
|
||||
@ -589,7 +590,11 @@ class Reception extends CommonObject
|
||||
// line without batch detail
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref));
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref));
|
||||
} else {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref));
|
||||
}
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
@ -601,7 +606,11 @@ class Reception extends CommonObject
|
||||
|
||||
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
|
||||
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION || $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
|
||||
} else {
|
||||
$result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch);
|
||||
}
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors[] = $mouvS->error;
|
||||
@ -704,9 +713,10 @@ class Reception extends CommonObject
|
||||
* @param integer $eatby eat-by date
|
||||
* @param integer $sellby sell-by date
|
||||
* @param string $batch Lot number
|
||||
* @param double $cost_price Line cost
|
||||
* @return int <0 if KO, index of line if OK
|
||||
*/
|
||||
public function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '')
|
||||
public function addline($entrepot_id, $id, $qty, $array_options = 0, $comment = '', $eatby = '', $sellby = '', $batch = '', $cost_price = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
@ -746,8 +756,8 @@ class Reception extends CommonObject
|
||||
$line->eatby = $eatby;
|
||||
$line->sellby = $sellby;
|
||||
$line->status = 1;
|
||||
$line->cost_price = $cost_price;
|
||||
$line->fk_reception = $this->id;
|
||||
|
||||
$this->lines[$num] = $line;
|
||||
|
||||
return $num;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user