From d65374bb0227836bba45b04db817bf13263d707f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sun, 15 Dec 2013 18:44:53 +0100 Subject: [PATCH 1/9] 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 --- ChangeLog | 1 + htdocs/cashdesk/facturation.php | 17 ++++++++++++++- htdocs/product/liste.php | 38 +++++++++++++++++++++++++++++---- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2fcf861008b..d9891d05ab7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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: fix unsubscribe URL into mailing when sending manually (not by script) 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 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 1636246e536..47152524c4d 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2008 Jeremie Ollivier * Copyright (C) 2008-2011 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2013 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 @@ -37,7 +38,21 @@ if ( GETPOST('filtre') ) { $sql.= " AND p.tosell = 1"; 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'))."%'"; - 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.= ")"; $sql.= " ORDER BY label"; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 5c312886313..25dc8a26122 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2006 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2013 Marcos García * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2013 Raphaël Doursenaud * Copyright (C) 2013 Jean Heimburger @@ -150,7 +150,16 @@ 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)."%'"; if (! empty($conf->barcode->enabled)) { - $sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'"; + //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.= ')'; } @@ -161,7 +170,16 @@ 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)."%'"; if (! empty($conf->barcode->enabled)) { - $sql.= " OR p.barcode LIKE '%".$db->escape($crit)."%'"; + //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.= ')'; } @@ -174,7 +192,19 @@ else else $sql.= " AND p.fk_product_type <> '1'"; } 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) { // multilang From 290b810bb80c99ccfbe882252d5b140cd0293792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sun, 15 Dec 2013 18:49:55 +0100 Subject: [PATCH 2/9] Little refactor in product/liste.php --- htdocs/product/liste.php | 67 ++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 25dc8a26122..7fdbacea781 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -143,47 +143,32 @@ else { // For natural search $scrit = explode(' ', $sall); - // 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)) - { - //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.= ')'; - } - } - 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)) - { - //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.= ')'; - } - } + + 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)."%'"; + + // multilang + if ($conf->global->MAIN_MULTILANGS) { + $sql .= " OR pl.description LIKE '%".$db->escape($sall)."%' OR pl.note LIKE '%".$db->escape($sall)."%'"; + } + + 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_barcode = substr($crit, 0, 12); + } else { + $crit_barcode = $crit; + } + + $sql .= " OR p.barcode LIKE '%".$db->escape($crit_barcode)."%'"; + } + $sql.= ')'; + } } // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) From 9c6df4faf4b85aad9bdbdb07bc8d742a02cdc2bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Mon, 16 Dec 2013 22:56:59 +0100 Subject: [PATCH 3/9] Corrected Copyright info for PR #1350 --- htdocs/cashdesk/facturation.php | 2 +- htdocs/product/liste.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 47152524c4d..4d8f0264e5f 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -3,6 +3,7 @@ * Copyright (C) 2008-2011 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2013 Marcos García + * Copyright (C) 2013 Adolfo Segura * * 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 @@ -45,7 +46,6 @@ if ( 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)."%')"; diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index 7fdbacea781..f602ec6509b 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2013 Raphaël Doursenaud * Copyright (C) 2013 Jean Heimburger + * Copyright (C) 2013 Adolfo segura * * 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 @@ -158,7 +159,6 @@ else //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_barcode = substr($crit, 0, 12); } else { From 49ea174d06ecd276f60255909917f95c09335043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Mon, 16 Dec 2013 22:59:17 +0100 Subject: [PATCH 4/9] Added to the COPYRIGHT file too --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index 4272219f80b..a6ae7bf4917 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -60,6 +60,7 @@ Copyright (C) 2013 - Regis Houssin - Maxime Kohlhaas - Juanjo Menent +- Adolfo Segura Copyright (C) 2012 - Christophe Battarel From 11e0fb8f7a678614e22291b87d879518795681f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Dec 2013 09:11:36 +0100 Subject: [PATCH 5/9] Fix: Missing ref field into export. --- htdocs/core/modules/modFournisseur.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index d9f13e3fa68..4643b951bac 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -256,10 +256,10 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product'); $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; @@ -275,10 +275,10 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et reglements'; $this->export_icon[$r]='bill'; $this->export_permission[$r]=array(array("fournisseur","facture","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'p.rowid'=>'PaymentId','pf.amount'=>'AmountPayment','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber'); //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); + $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number'); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment'); $this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_sql_start[$r]='SELECT DISTINCT '; From 2bc579324d48eb8e7feb455086c819e9b0090124 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 21:26:06 +0200 Subject: [PATCH 6/9] Fix: Opening agenda for a specific day Fix: No picto of thirdparty of contact if link is broken --- htdocs/comm/action/fiche.php | 4 +++- htdocs/comm/action/index.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 77b88c49715..b9770c8c1a3 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -73,8 +73,10 @@ $hookmanager->initHooks(array('actioncard')); /* - * Action creation de l'action + * Actions */ + +// Add action if ($action == 'add_action') { $error=0; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e52615f6e59..cb683dea35e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -78,7 +78,7 @@ $type=GETPOST("type"); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=="0"?'':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); -if (GETPOST('viewcal')) { +if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { $action='show_month'; $day=''; } // View by month if (GETPOST('viewweek')) { @@ -1134,7 +1134,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cachethirdparties[$event->societe->id]=$thirdparty; } else $thirdparty=$cachethirdparties[$event->societe->id]; - $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); + if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); } if (! empty($event->contact->id) && $event->contact->id > 0) { @@ -1146,7 +1146,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else $contact=$cachecontacts[$event->contact->id]; if ($linerelatedto) $linerelatedto.=' / '; - $linerelatedto.=$contact->getNomUrl(1,'',$length); + if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length); } if ($linerelatedto) print '
'.$linerelatedto; } From e971e4dfffba03e2f515849c14c7b7032149233a Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 23 Dec 2013 11:05:14 +0100 Subject: [PATCH 7/9] Fix [ bug #1202 ] Wrong amount in deposit % invoice from proposal --- ChangeLog | 1 + htdocs/compta/facture.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d9891d05ab7..3d7ebf3875c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ Fix: [ bug #1171 ] Documents lost in interventions after validating Fix: fix unsubscribe URL into mailing when sending manually (not by script) Fix: [ bug #1182 ] ODT company_country tag is htmlencoded Fix: [ bug #1196 ] Product barcode search does not expect 13th digit on EAN13 type +Fix: [ bug #1202 ] Wrong amount in deposit % invoice from proposal ***** ChangeLog for 3.4.1 compared to 3.4.0 ***** Fix: Display buying price on line edit when no supplier price is defined diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f1423681e4b..d225574d37e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -900,7 +900,7 @@ else if ($action == 'add' && $user->rights->facture->creer) $numlines=count($lines); for ($i=0; $i<$numlines; $i++) { - $totalamount += $lines[$i]->subprice; + $totalamount += $lines[$i]->total_ht; } if ($totalamount!=0) From 331341bf5a1c948ccd0be55a1a631f030ff03d71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Dec 2013 12:05:32 +0100 Subject: [PATCH 8/9] Fix: Bad picto --- htdocs/societe/class/societe.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f37d7c25fa0..1685b2d7572 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1513,22 +1513,22 @@ class Societe extends CommonObject } if ($mode == 2) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 3) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8'); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5'); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4'); } if ($mode == 4) { - if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut8').' '.$langs->trans("ActivityCeased"); + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5').' '.$langs->trans("ActivityCeased"); if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4').' '.$langs->trans("InActivity"); } if ($mode == 5) { - if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut8'); + if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5'); if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4'); } } From ec1aef019104a91daf9213572d1bc805def7a0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Dec 2013 15:55:35 +0100 Subject: [PATCH 9/9] Fix: Can import contacts not linked to any thirdparties. --- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/modSociete.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index dea0334dc13..e0741c26cef 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -404,7 +404,7 @@ class ImportCsv extends ModeleImports //print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. '; if ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeid' || $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromref') { - if (! is_numeric($newval)) // If value into input import file is not a numeric, we apply the function defined into descriptor + if (! is_numeric($newval) && $newval != '') // If value into input import file is not a numeric, we apply the function defined into descriptor { $file=$objimport->array_import_convertvalue[0][$val]['classfile']; $class=$objimport->array_import_convertvalue[0][$val]['class']; diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index fd804edaca8..1cee6509094 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -400,7 +400,7 @@ class modSociete extends DolibarrModules $this->import_icon[$r]='contact'; $this->import_entities_array[$r]=array('s.fk_soc'=>'company'); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('s'=>MAIN_DB_PREFIX.'socpeople','extra'=>MAIN_DB_PREFIX.'socpeople_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName*','s.civilite'=>'UserTitle','s.lastname'=>"Name*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation"); + $this->import_fields_array[$r]=array('s.fk_soc'=>'ThirdPartyName','s.civilite'=>'UserTitle','s.lastname'=>"Lastname*",'s.firstname'=>"Firstname",'s.address'=>"Address",'s.zip'=>"Zip",'s.town'=>"Town",'s.fk_pays'=>"CountryCode",'s.birthday'=>"BirthdayDate",'s.poste'=>"Role",'s.phone'=>"Phone",'s.phone_perso'=>"PhonePerso",'s.phone_mobile'=>"PhoneMobile",'s.fax'=>"Fax",'s.email'=>"Email",'s.note_private'=>"Note",'s.note_public'=>"Note",'s.datec'=>"DateCreation"); // Add extra fields $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity = ".$conf->entity; $resql=$this->db->query($sql); @@ -421,7 +421,7 @@ class modSociete extends DolibarrModules ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); $this->import_regex_array[$r]=array('s.birthday'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.name'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.zip'=>'75000','s.town'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note_private'=>"My private note",'s.note_public'=>"My public note"); + $this->import_examplevalues_array[$r]=array('s.fk_soc'=>'MyBigCompany','s.civilite'=>"MR",'s.lastname'=>"Smith",'s.firstname'=>'John','s.address'=>'61 jump street','s.zip'=>'75000','s.town'=>'Bigtown','s.fk_pays'=>'US, FR, DE...','s.datec'=>'1972-10-10','s.poste'=>"Director",'s.phone'=>"5551122",'s.phone_perso'=>"5551133",'s.phone_mobile'=>"5551144",'s.fax'=>"5551155",'s.email'=>"johnsmith@email.com",'s.note_private'=>"My private note",'s.note_public'=>"My public note"); // Import Bank Accounts $r++;