';
@@ -151,7 +154,5 @@ print '';
print '';
-print info_admin($langs->trans("NoNeedForDeliveryReceipts"));
-
llxFooter();
$db->close();
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index d88df512b8c..f839ff3e49d 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
-$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
+$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.ranges, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
@@ -644,7 +644,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok=0;
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors');
}
-
+
// Clean some parameters
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
@@ -1064,7 +1064,7 @@ if ($id)
}
print '
';
print "
";
-
+
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '
';
diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php
index e8664e3166d..37edb6a7239 100644
--- a/htdocs/core/class/html.formaccounting.class.php
+++ b/htdocs/core/class/html.formaccounting.class.php
@@ -64,7 +64,7 @@ class FormAccounting
if (! empty($mysoc->country_id))
{
- $sql = "SELECT c.rowid, c.label as type, c.range";
+ $sql = "SELECT c.rowid, c.label as type, c.ranges";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
$sql.= " WHERE c.active = 1";
$sql.= " AND c.fk_country = ".$mysoc->country_id;
@@ -72,14 +72,14 @@ class FormAccounting
}
else
{
- $sql = "SELECT c.rowid, c.label as type, c.range";
+ $sql = "SELECT c.rowid, c.label as type, c.ranges";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
$sql.= " AND co.code = '".$mysoc->country_code."'";
$sql.= " ORDER BY c.label ASC";
}
- dol_syslog("Form::select_accounting_category", LOG_DEBUG);
+ dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
@@ -96,7 +96,7 @@ class FormAccounting
print '
\n";
}
}
- // Show subproducts of product
+ // Show subproducts of product (not recommanded)
if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0)
{
$product->get_sousproduits_arbo();
@@ -1116,7 +1126,8 @@ if ($action == 'create')
}
if ($subj == 0) // Line not shown yet, we show it
{
- print '
';
+ print '';
+ print '
';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
//$disabled='disabled="disabled"';
@@ -1152,7 +1163,8 @@ if ($action == 'create')
//Display lines extrafields
- if (is_array($extralabelslines) && count($extralabelslines)>0) {
+ if (is_array($extralabelslines) && count($extralabelslines)>0)
+ {
$colspan=5;
$line = new ExpeditionLigne($db);
$line->fetch_optionals($object->id,$extralabelslines);
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 78dfbf95be9..e5dbdeaac4b 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -335,7 +335,7 @@ CREATE TABLE llx_c_accounting_category (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
code varchar(16) NOT NULL,
label varchar(255) NOT NULL,
- range varchar(255) NOT NULL,
+ ranges varchar(255) NOT NULL,
position integer DEFAULT 0,
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
active integer DEFAULT 1
diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.sql b/htdocs/install/mysql/tables/llx_c_accounting_category.sql
index 0e789a6826c..dcb8d25a84a 100644
--- a/htdocs/install/mysql/tables/llx_c_accounting_category.sql
+++ b/htdocs/install/mysql/tables/llx_c_accounting_category.sql
@@ -21,7 +21,7 @@ CREATE TABLE llx_c_accounting_category (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
code varchar(16) NOT NULL,
label varchar(255) NOT NULL,
- range varchar(255) NOT NULL,
+ ranges varchar(255) NOT NULL,
position integer DEFAULT 0,
fk_country integer DEFAULT NULL, -- This category is dedicated to a country
active integer DEFAULT 1
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 33b536d3ab3..4b4031b497d 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -171,6 +171,7 @@ PredefinedProductsAndServicesToSell=Predefined products/services to sell
PredefinedProductsToPurchase=Predefined product to purchase
PredefinedServicesToPurchase=Predefined services to purchase
PredefinedProductsAndServicesToPurchase=Predefined products/services to puchase
+NotPredefinedProducts=Not predefined products/services
GenerateThumb=Generate thumb
ProductCanvasAbility=Use special "canvas" addons
ServiceNb=Service #%s
diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php
index 2e550a74720..789932320e5 100644
--- a/htdocs/margin/productMargins.php
+++ b/htdocs/margin/productMargins.php
@@ -165,16 +165,15 @@ print '';
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
if ($id > 0) $sql.= " d.fk_product,";
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
-$sql.= " sum(d.total_ht) as selling_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
-$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
+$sql.= " SUM(d.total_ht) as selling_price,";
+$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
+$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
-$sql.= ", ".MAIN_DB_PREFIX."product as p";
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
+$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = d.fk_product";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.fk_soc = s.rowid";
-$sql.= " AND d.fk_product = p.rowid";
$sql.= " AND f.fk_statut > 0";
$sql.= " AND d.fk_facture = f.rowid";
if ($id > 0)
@@ -186,8 +185,8 @@ if (!empty($enddate))
$sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql .= " AND d.buy_price_ht <> 0";
-if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
-else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref";
+if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
+else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity";
$sql.=$db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
@@ -260,13 +259,20 @@ if ($result)
}
else {
print '