2
0
forked from Wavyzz/dolibarr

Search thirds from barcode directly from the mini search box

Also added a check when generating barcode image
This commit is contained in:
Marcos García
2012-09-11 14:27:41 +02:00
parent c291ea2ec2
commit 85064abdad
3 changed files with 13 additions and 2 deletions

View File

@@ -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.

View File

@@ -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 ='<!-- url barcode = '.$url.' -->';

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
*
* 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;