diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index ae5a1190c49..9c1f1ae2973 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -433,7 +433,7 @@ else if ($action == 'addline' && $user->rights->contrat->creer) $desc = $prod->description; $desc.= $prod->description && GETPOST('desc') ? "\n" : ""; - $desc.= GETPOST('desc'); + $desc.= GETPOST('np_desc'); } else { @@ -871,10 +871,10 @@ if ($action == 'create') print ''.$langs->trans("NotePublic").''; - + $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, 70); print $doleditor->Create(1); - + if (! $user->societe_id) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 93b17930cfe..ab41e5aaec7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -612,7 +612,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m if ($maskraz > 0) // A reset is required { if ($maskraz == 99) { - $maskraz = date('m'); + $maskraz = date('m'); $resetEveryMonth = true; } if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth'; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 0495a318d42..ac1da0a399e 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Marcos García * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2013 Raphaël Doursenaud + * Copyright (C) 2013 Jean Heimburger * * 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 @@ -131,19 +132,39 @@ else $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; +// multilang + if ($conf->global->MAIN_MULTILANGS) // si l'option est active + { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; + } $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($sall) { // For natural search $scrit = explode(' ', $sall); - foreach ($scrit as $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)) - { - $sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'"; - } - $sql.= ')'; - } + // multilang + if ($conf->global->MAIN_MULTILANGS) // si l'option est active + { + foreach ($scrit as $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)."%' OR pl.description LIKE '%".$db->escape($sall)."%' OR pl.note LIKE '%".$db->escape($sall)."%'"; + if (! empty($conf->barcode->enabled)) + { + $sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'"; + } + $sql.= ')'; + } + } + else + { + foreach ($scrit as $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)) + { + $sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'"; + } + $sql.= ')'; + } + } } // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) @@ -153,7 +174,15 @@ else } if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'"; if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'"; - if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; + if ($snom) + { + // multilang + if ($conf->global->MAIN_MULTILANGS) // si l'option est active + { + $sql.= " AND (p.label LIKE '%".$db->escape($snom)."%' OR (pl.label IS NOT null AND pl.label LIKE '%".$db->escape($snom)."%'))"; + } + else $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; +} if (isset($tosell) && dol_strlen($tosell) > 0) $sql.= " AND p.tosell = ".$db->escape($tosell); if (isset($tobuy) && dol_strlen($tobuy) > 0) $sql.= " AND p.tobuy = ".$db->escape($tobuy); if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'";