';
+ // Type
+ if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
+ $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
+ print '| ';
+ print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
+ print ' | ';
+ print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
+ print ' |
';
+ }
+
// Cost price. Can be used for margin module for option "calculate margin on explicit cost price
print '';
$textdesc = $langs->trans("CostPriceDescription");
$textdesc .= " ".$langs->trans("CostPriceUsage");
$text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', '');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
- print ' | ';
+ print ' | ';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print ' |
';
@@ -425,7 +435,7 @@ if ($id > 0 || $ref) {
// Best buying Price
print '| '.$langs->trans("BuyingPriceMin").' | ';
- print '';
+ print ' | ';
$product_fourn = new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) {
if ($product_fourn->product_fourn_price_id > 0) {
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index bb46839e588..03867bb65e9 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -717,8 +717,18 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_
$soc->id = $socid;
$soc->fetch($socid);
+ // Type
+ if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
+ $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
+ print ' |
| ';
+ print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
+ print ' | ';
+ print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
+ print ' |
';
+ }
+
// Selling price
- print '| ';
+ print ' |
| ';
print $langs->trans("SellingPrice");
print ' | ';
print '';
@@ -791,13 +801,33 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_
}
} else {
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
+ // Type
+ if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
+ $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
+ print ' |
| ';
+ print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
+ print ' | ';
+ print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
+ print ' |
';
+ }
+
// We show only vat for level 1
- print '| '.$langs->trans("DefaultTaxRate").' | ';
+ print '
| '.$langs->trans("DefaultTaxRate").' | ';
print ''.vatrate($object->multiprices_tva_tx[1], true).' | ';
print '
';
} else {
+ // Type
+ if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
+ $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
+ print '| ';
+ print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
+ print ' | ';
+ print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
+ print ' |
';
+ }
+
// TVA
- print '| '.$langs->trans("DefaultTaxRate").' | ';
+ print ' |
| '.$langs->trans("DefaultTaxRate").' | ';
$positiverates = '';
if (price2num($object->tva_tx)) {
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index a00feb194a0..7fcee8f59cd 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -77,6 +77,7 @@ $batchnumber = GETPOST('batch_number', 'san_alpha');
if (!empty($batchnumber)) {
$batchnumber = trim($batchnumber);
}
+$cost_price = GETPOST('cost_price', 'alpha');
// Security check
if ($user->socid) {
@@ -113,6 +114,9 @@ $hookmanager->initHooks(array('stockproductcard', 'globalcard'));
$error = 0;
+$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire));
+$usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer));
+
if ($object->id > 0) {
if ($object->type == $object::TYPE_PRODUCT) {
restrictedArea($user, 'produit', $object->id, 'product&product', '', '');
@@ -139,6 +143,21 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
+if ($action == 'setcost_price') {
+ if ($id) {
+ $result = $object->fetch($id);
+ $object->cost_price = price2num($cost_price);
+ $result = $object->update($object->id, $user);
+ if ($result > 0) {
+ setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
+ $action = '';
+ } else {
+ $error++;
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+}
+
if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer)) {
$seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$desiredstock = GETPOST('desiredstock');
@@ -600,9 +619,9 @@ if ($id > 0 || $ref) {
if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) {
$typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service");
print ' |
| ';
- print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type');
+ print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type');
print ' | ';
- print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat);
+ print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat);
print ' |
';
}
@@ -618,7 +637,7 @@ if ($id > 0 || $ref) {
$textdesc .= "
".$langs->trans("CostPriceUsage");
$text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', '');
print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
- print '';
+ print ' | ';
print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6');
print ' | ';
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index e384007262f..0f4ac71fd54 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -647,6 +647,9 @@ textarea.centpercent {
.large {
font-size: 125%;
}
+.double {
+ font-size: 2em;
+}
.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small {
font-size: 65%;
diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php
index 4802755608f..34f6db8d044 100644
--- a/htdocs/website/samples/wrapper.php
+++ b/htdocs/website/samples/wrapper.php
@@ -226,9 +226,9 @@ if ($rss) {
// Find the subdirectory name as the reference
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
- $accessallowed = $check_access['accessallowed'];
- $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
- $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
+ $accessallowed = empty($check_access['accessallowed']) ? '' : $check_access['accessallowed'];
+ $sqlprotectagainstexternals = empty($check_access['sqlprotectagainstexternals']) ? '' : $check_access['sqlprotectagainstexternals'];
+ $fullpath_original_file = empty($check_access['original_file']) ? '' : $check_access['original_file']; // $fullpath_original_file is now a full path name
if ($hashp) {
$accessallowed = 1; // When using hashp, link is public so we force $accessallowed
$sqlprotectagainstexternals = '';