diff --git a/ChangeLog b/ChangeLog
index a7e647fcc99..a5b8e442b9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,7 +43,7 @@ For users:
- New: [ task #498 ] Improvement of the block to add products/services lines.
- New: ECM autodir works also for files joined to products and services.
- New: Add a selection module for emailing to enter a recipient from gui.
-- New: Allow to search product from barcodes directly from the permanent mini search left box
+- New: Allow to search thirds and products from barcodes directly from the permanent mini search left box
- New: Allow to search product from barcodes directly from invoices, proposals... through AJAX
New experimental modules:
- New: Add margin and commissions management module.
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 4af811aeb7c..5c28db87dbf 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3758,14 +3758,18 @@ class Form
{
global $conf;
+ //Check if barcode is filled in the card
if (empty($object->barcode)) return '';
// Complete object if not complete
if (empty($object->barcode_type_code) || empty($object->barcode_type_coder))
{
- $object->fetch_barcode();
+ $result = $object->fetch_barcode();
}
+ //Check if fetch_barcode() failed
+ if ($result < 1) return '';
+
// Barcode image
$url=DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
$out ='';
diff --git a/htdocs/langs/en_US/commissions.lang b/htdocs/langs/en_US/commissions.lang
new file mode 100644
index 00000000000..c7690318142
--- /dev/null
+++ b/htdocs/langs/en_US/commissions.lang
@@ -0,0 +1,41 @@
+# Dolibarr language file - fr_FR - commissions
+CHARSET=UTF-8
+
+Module60000Desc=Commissions management
+commissionsSetup=Commissions management setup
+
+ProductCommissionRate=Commission rate on products
+ServiceCommissionRate=Commission rate on services
+
+ProductCommissionRateDetails=Commission rate on product sales
+ServiceCommissionRateDetails=Commission rate on service sales
+
+Commissions=Commissions
+CommissionDetails=Commissions details
+
+IncludeUnpayedInvoices=Include overdue invoices
+TotalCommission=Commissions subtotal
+
+ProductMargin=Margin / products
+ServiceMargin=Margin / services
+
+CommissionRate=Commission rate
+
+ProductCommission=Commission / produics
+ServiceCommission=Commission / services
+
+CommissionBase=Commissions base
+CommissionBasedOnTurnover=Commissions based on turnover
+CommissionBasedOnMargins=Commissions based on margins
+CommissionBaseDetails=Define calculation method for commissions
+CommissionBasedOnMarginsDetails=Commissions based on margins needs margin module activation.
+
+TurnoverTotal = Total turrnover
+ProductTurnover=Product turnover
+ServiceTurnover=Service turnover
+
+CommercialAgent=Commercial agent
+
+StartDate=Start date
+EndDate=End date
+Launch=Start
\ No newline at end of file
diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang
new file mode 100644
index 00000000000..09775869a45
--- /dev/null
+++ b/htdocs/langs/en_US/margins.lang
@@ -0,0 +1,49 @@
+# Dolibarr language file - en_US - marges
+CHARSET=UTF-8
+
+Module59000Name=Margins
+Module59000Desc=Profit margins management
+Margin=Margin
+Margins=Margins
+TotalMargin=Total Margin
+MarginOnProducts=Margin / Products
+MarginOnServices=Margin / Services
+MarginRate=Margin rate
+MarkRate=Mark rate
+DisplayMarginRates=Display margin rates
+DisplayMarkRates=Display mark rates
+InputPrice=Input price
+
+margin=Profit margins management
+margesSetup=Profit margins management setup
+
+MarginDetails=Margin details
+
+ProductMargins=Product margins
+CustomerMargins=Customer margins
+AgentMargins=Agent margins
+
+ProductService=Product or Service
+AllProducts=All products and services
+ChooseProduct/Service=Choose product or service
+CommercialAgent=Commercial agent
+
+StartDate=Start date
+EndDate=End date
+Launch=Start
+
+ForceBuyingPriceIfNull=Force buying price if null
+ForceBuyingPriceIfNullDetails=if "ON", margin will be zero on line (buying price = selling price), otherwise ("OFF"), marge will be equal to selling price (buying price = 0)
+MARGIN_METHODE_FOR_DISCOUNT=Margin method for global discounts
+UseDiscountAsProduct=As a product
+UseDiscountAsService=As a service
+UseDiscountOnTotal=On subtotal
+MARGIN_METHODE_FOR_DISCOUNT_DETAILS=Defines if a global discount is treated as a product, a service, or only on subtotal for margin calculation.
+
+MARGIN_TYPE=Margin type
+MargeBrute=Raw margin
+MargeNette=Net margin
+MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price
Net margin : Selling price - Cost price
+
+BuyingCost=Cost price
+UnitCharges=Unit charges
\ No newline at end of file
diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php
index 06c5ad9793d..4913d6c7521 100644
--- a/htdocs/societe/societe.php
+++ b/htdocs/societe/societe.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2012 Marcos GarcĂa
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -81,6 +82,12 @@ if ($mode == 'search')
$sql.= " OR s.code_client LIKE '%".$db->escape($socname)."%'";
$sql.= " OR s.email LIKE '%".$db->escape($socname)."%'";
$sql.= " OR s.url LIKE '%".$db->escape($socname)."%'";
+
+ if (!empty($conf->barcode->enabled))
+ {
+ $sql.= "OR s.barcode LIKE '".$db->escape($socname)."'";
+ }
+
$sql.= ")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;