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/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;