Fixed bug #1196: Product barcode search does not expect 13th digit on EAN13 type
Some code written by "hipnosapo" forum user in http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/3891-ean13-buscador-codigo-barras-13-digitos#3891
This commit is contained in:
parent
db9ef992eb
commit
d65374bb02
@ -21,6 +21,7 @@ Fix: [ bug #1075 ] POS module doesn't decrement stock of products in delayed pay
|
|||||||
Fix: [ bug #1171 ] Documents lost in interventions after validating
|
Fix: [ bug #1171 ] Documents lost in interventions after validating
|
||||||
Fix: fix unsubscribe URL into mailing when sending manually (not by script)
|
Fix: fix unsubscribe URL into mailing when sending manually (not by script)
|
||||||
Fix: [ bug #1182 ] ODT company_country tag is htmlencoded
|
Fix: [ bug #1182 ] ODT company_country tag is htmlencoded
|
||||||
|
Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type
|
||||||
|
|
||||||
***** ChangeLog for 3.4.1 compared to 3.4.0 *****
|
***** ChangeLog for 3.4.1 compared to 3.4.0 *****
|
||||||
Fix: Display buying price on line edit when no supplier price is defined
|
Fix: Display buying price on line edit when no supplier price is defined
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
|
||||||
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.sourceforge.net>
|
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -37,7 +38,21 @@ if ( GETPOST('filtre') ) {
|
|||||||
$sql.= " AND p.tosell = 1";
|
$sql.= " AND p.tosell = 1";
|
||||||
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
if(!$conf->global->CASHDESK_SERVICES) $sql.= " AND p.fk_product_type = 0";
|
||||||
$sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
$sql.= " AND (p.ref LIKE '%".$db->escape(GETPOST('filtre'))."%' OR p.label LIKE '%".$db->escape(GETPOST('filtre'))."%'";
|
||||||
if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '%".$db->escape(GETPOST('filtre'))."%')";
|
if (! empty($conf->barcode->enabled)) {
|
||||||
|
|
||||||
|
$filtre = GETPOST('filtre');
|
||||||
|
|
||||||
|
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||||
|
//then whe look for the 12-digit too
|
||||||
|
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
||||||
|
//Some code written by "hipnosapo" forum user in http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/3891-ean13-buscador-codigo-barras-13-digitos#3891
|
||||||
|
if (strlen($filtre) == 13) {
|
||||||
|
$crit_12digit = substr($filtre, 0, 12);
|
||||||
|
$sql .= " OR p.barcode LIKE '%".$db->escape($crit_12digit)."%')";
|
||||||
|
} else {
|
||||||
|
$sql.= " OR p.barcode LIKE '%".$db->escape($filtre)."%')";
|
||||||
|
}
|
||||||
|
}
|
||||||
else $sql.= ")";
|
else $sql.= ")";
|
||||||
$sql.= " ORDER BY label";
|
$sql.= " ORDER BY label";
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2013 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2013 Jean Heimburger <jean@tiaris.info>
|
||||||
@ -150,8 +150,17 @@ else
|
|||||||
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pl.description LIKE '%".$db->escape($sall)."%' OR pl.note LIKE '%".$db->escape($sall)."%'";
|
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pl.description LIKE '%".$db->escape($sall)."%' OR pl.note LIKE '%".$db->escape($sall)."%'";
|
||||||
if (! empty($conf->barcode->enabled))
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
|
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||||
|
//then whe look for the 12-digit too
|
||||||
|
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
||||||
|
//Some code written by "hipnosapo" forum user in http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/3891-ean13-buscador-codigo-barras-13-digitos#3891
|
||||||
|
if (strlen($crit) == 13) {
|
||||||
|
$crit_12digit = substr($crit, 0, 12);
|
||||||
|
$sql .= "OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
|
||||||
|
} else {
|
||||||
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,8 +170,17 @@ else
|
|||||||
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%'";
|
$sql.= " AND (p.ref LIKE '%".$db->escape($crit)."%' OR p.label LIKE '%".$db->escape($crit)."%' OR p.description LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%'";
|
||||||
if (! empty($conf->barcode->enabled))
|
if (! empty($conf->barcode->enabled))
|
||||||
{
|
{
|
||||||
|
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||||
|
//then whe look for the 12-digit too
|
||||||
|
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
||||||
|
//Some code written by "hipnosapo" forum user in http://www.dolibarr.es/index.php/foro/7-bugs-versiones-estables/3891-ean13-buscador-codigo-barras-13-digitos#3891
|
||||||
|
if (strlen($crit) == 13) {
|
||||||
|
$crit_12digit = substr($crit, 0, 12);
|
||||||
|
$sql .= "OR p.barcode LIKE '%".$db->escape($crit_12digit)."%'";
|
||||||
|
} else {
|
||||||
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
$sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +192,19 @@ else
|
|||||||
else $sql.= " AND p.fk_product_type <> '1'";
|
else $sql.= " AND p.fk_product_type <> '1'";
|
||||||
}
|
}
|
||||||
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'";
|
||||||
if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
if ($sbarcode) {
|
||||||
|
|
||||||
|
//If the barcode looks like an EAN13 format and the last digit is included in it,
|
||||||
|
//then whe look for the 12-digit too
|
||||||
|
//As the twelve-digit string will also hit the 13-digit code, we only look for this one
|
||||||
|
if (strlen($sbarcode) == 13) {
|
||||||
|
$sbarcode_12digit = substr($sbarcode, 0, 12);
|
||||||
|
$sql .= "AND p.barcode LIKE '%".$sbarcode_12digit."%'";
|
||||||
|
} else {
|
||||||
|
$sql.= " AND p.barcode LIKE '%".$sbarcode."%'";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if ($snom)
|
if ($snom)
|
||||||
{
|
{
|
||||||
// multilang
|
// multilang
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user