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 01/21] 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 02/21] 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 03/21] 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 04/21] 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 05/21] 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 f98838616e372c47caef688d99de729c87a0beb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Thu, 19 Dec 2013 15:55:02 +0100 Subject: [PATCH 06/21] Do not forget the thumbs directory when returning the images paths --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4fa56c35a55..748388ff99c 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2946,7 +2946,7 @@ class Product extends CommonObject // Objet $obj=array(); $obj['photo']=$photo; - if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$photo_vignette; + if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) $obj['photo_vignette']=$dirthumb . $photo_vignette; else $obj['photo_vignette']=""; $tabobj[$nbphoto-1]=$obj; From 0a0ef548ef0eb26805d187149e9550d2c91deb70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Thu, 19 Dec 2013 15:57:11 +0100 Subject: [PATCH 07/21] Solved some bugs in order creation and validation --- htdocs/webservices/server_order.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 8b3d4569dbf..f77af335e2e 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -637,7 +637,7 @@ function createOrder($authentication,$order) $newobject->date_lim_reglement=dol_stringtotime($order['date_due'],'dayrfc'); $newobject->note_private=$order['note_private']; $newobject->note_public=$order['note_public']; - $newobject->statut=$order['status']; + $newobject->statut=0; $newobject->facturee=$order['facturee']; $newobject->fk_project=$order['project_id']; $newobject->cond_reglement_id=$order['cond_reglement_id']; @@ -669,30 +669,36 @@ function createOrder($authentication,$order) $db->begin(); - - $result=$newobject->create($fuser,0,0); + dol_syslog("Webservice server_order:: order creation start", LOG_DEBUG); + $result=$newobject->create($fuser); + dol_syslog('Webservice server_order:: order creation done with $result='.$result, LOG_DEBUG); if ($result < 0) { + dol_syslog("Webservice server_order:: order creation failed", LOG_ERR); $error++; } - if ($newobject->statut == 1) // We want order validated + if ($order['status'] == 1) // We want order validated { - $result=$newobject->validate($fuser); + dol_syslog("Webservice server_order:: order validation start", LOG_DEBUG); + $result=$newobject->valid($fuser); if ($result < 0) { + dol_syslog("Webservice server_order:: order validation failed", LOG_ERR); $error++; } } - if (! $error) + if ($result >= 0) { + dol_syslog("Webservice server_order:: order creation & validation succeeded, commit", LOG_DEBUG); $db->commit(); $objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''),'id'=>$newobject->id,'ref'=>$newobject->ref); } else { + dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR); $db->rollback(); $error++; $errorcode='KO'; From 168412a2d612dac4c788092cd1b35216f8edd811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Thu, 19 Dec 2013 16:01:06 +0100 Subject: [PATCH 08/21] Wrong parameters order in the function call --- htdocs/webservices/server_other.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 81a15e5b771..193e01de2f2 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -224,7 +224,7 @@ function getDocument($authentication, $modulepart, $file, $refname='') if (empty($refname)) $refname=basename(dirname($original_file)."/"); // Security check - $check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity,$refname,$fuser); + $check_access = dol_check_secure_access_document($modulepart,$original_file,$conf->entity,$fuser,$refname); $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $original_file = $check_access['original_file']; From 2bc579324d48eb8e7feb455086c819e9b0090124 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Sep 2013 21:26:06 +0200 Subject: [PATCH 09/21] 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 18b163c6db9edcbc8eb9e93b8398c95bd6c20af0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Fri, 20 Dec 2013 17:03:24 +0100 Subject: [PATCH 10/21] allow the webservice to create a private individual --- htdocs/societe/class/societe.class.php | 19 +++++++++++++++++++ htdocs/societe/soc.php | 22 ++-------------------- htdocs/webservices/server_thirdparty.php | 6 ++++++ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d0d28bf2cee..f2f737cdbdb 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -297,6 +297,25 @@ class Societe extends CommonObject } } + function create_individual($user) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $contact=new Contact($this->db); + + $contact->name = $this->name_bis; + $contact->firstname = $this->firstname; + $contact->socid = $this->id; // fk_soc + $contact->statut = 1; + $contact->priv = 0; + $result = $contact->create($user); + if ($result < 0) { + $this->error = $contact->error; + $this->errors = $contact->errors; + dol_syslog("Societe::create_individual ERROR:" . $this->error, LOG_ERR); + } + + return $result; + } + /** * Check properties of third party are ok (like name, third party codes, ...) * diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 881fce7b2b5..864b42b86a9 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -255,28 +255,10 @@ if (empty($reshook)) if ($object->particulier) { dol_syslog("This thirdparty is a personal people",LOG_DEBUG); - $contact=new Contact($db); - - $contact->civilite_id = $object->civilite_id; - $contact->name = $object->name_bis; - $contact->firstname = $object->firstname; - $contact->address = $object->address; - $contact->zip = $object->zip; - $contact->town = $object->town; - $contact->state_id = $object->state_id; - $contact->country_id = $object->country_id; - $contact->socid = $object->id; // fk_soc - $contact->statut = 1; - $contact->email = $object->email; - $contact->skype = $object->skype; - $contact->phone_pro = $object->phone; - $contact->fax = $object->fax; - $contact->priv = 0; - - $result=$contact->create($user); + $result=$object->create_individual($user); if (! $result >= 0) { - $error=$contact->error; $errors=$contact->errors; + $error=$object->error; $errors=$object->errors; } } diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 152a28053fa..ccc05902dca 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -443,6 +443,7 @@ function createThirdParty($authentication,$thirdparty) $newobject->tva_intra=$thirdparty['vat_number']; $newobject->canvas=$thirdparty['canvas']; + $newobject->particulier=$thirdparty['individual']; //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels @@ -457,6 +458,11 @@ function createThirdParty($authentication,$thirdparty) $db->begin(); $result=$newobject->create($fuser); + if ($newobject->particulier && $result > 0) { + $newobject->firstname = $thirdparty['firstname']; + $newobject->name_bis = $thirdparty['ref']; + $result = $newobject->create_individual($fuser); + } if ($result <= 0) { $error++; From d9c7dc86973c20c60cbf0c7c1149e1478488af68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Dec 2013 12:04:39 +0100 Subject: [PATCH 11/21] Fix: Add protection to not delete a root directory when deleting a company. --- htdocs/societe/class/societe.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d0d28bf2cee..89a9be049ed 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -994,6 +994,8 @@ class Societe extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $entity=isset($this->entity)?$this->entity:$conf->entity; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $error = 0; @@ -1122,12 +1124,15 @@ class Societe extends CommonObject $this->db->commit(); // Delete directory - $docdir = $conf->societe->multidir_output[$this->entity] . "/" . $id; - if (file_exists($docdir)) + if (! empty($conf->societe->multidir_output[$entity])) { - dol_delete_dir_recursive($docdir); + $docdir = $conf->societe->multidir_output[$entity] . "/" . $id; + if (dol_is_dir($docdir)) + { + dol_delete_dir_recursive($docdir); + } } - + return 1; } else From 11353786a1d7fcabd720b2d13955179485265a04 Mon Sep 17 00:00:00 2001 From: simnandez Date: Mon, 23 Dec 2013 10:46:19 +0100 Subject: [PATCH 12/21] Fix: Unable to make a withdrawal with two or more invocies --- htdocs/compta/prelevement/class/bonprelevement.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0cae3d545f7..a4606d669c2 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -795,7 +795,6 @@ class BonPrelevement extends CommonObject { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $soc = new Societe($this->db); - $bac = new CompanyBankAccount($this->db); // Check RIB $i = 0; @@ -810,6 +809,7 @@ class BonPrelevement extends CommonObject { if ($soc->fetch($fact->socid) >= 0) { + $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$soc->id); if ($bac->verif() >= 1) { From e971e4dfffba03e2f515849c14c7b7032149233a Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Mon, 23 Dec 2013 11:05:14 +0100 Subject: [PATCH 13/21] 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 14/21] 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 d6b2f96c19b1f88a439084764bbff3f5a066d76f Mon Sep 17 00:00:00 2001 From: simnandez Date: Mon, 23 Dec 2013 16:38:38 +0100 Subject: [PATCH 15/21] Fix: Some config data are shared between suppliers orders and suppliers invoices --- ChangeLog | 1 + htdocs/admin/supplier_invoice.php | 4 ++-- htdocs/admin/supplierinvoice_extrafields.php | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31c029f2a1c..2b58a038c46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,7 @@ For users: - Fix: [ bug #1022 ] correct margin calculation for credit notes. - Fix: Better management of using ajax for upload form (to solve problem when enabling ajax jquery multifile upload in some cases). - Fix: Lost stats filters into year selection. +- Fix: Some config data are shared between suppliers orders and suppliers invoices New experimental module: - New: [ task #157 ] Add a Skype button (adherents / third parties / contacts) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index c9e07ae6f27..5800ccc3a9b 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -458,10 +458,10 @@ print "\n"; print '
'; print ''; -print ''; +print ''; print ''; print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')
'; -print ''; +print ''; print ''; print ''; print "\n"; diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 02bedad307d..fdf9e95af56 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2012 Florian Henry * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013 Juanjo Menent * * 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 @@ -49,7 +50,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); $action=GETPOST('action', 'alpha'); $attrname=GETPOST('attrname', 'alpha'); -$elementtype='commande_fournisseur'; //Must be the $table_element of the class that manage extrafield +$elementtype='facture_fourn'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); From 8c9d14575924139d2ea6b32e9f61a7c5b19ea805 Mon Sep 17 00:00:00 2001 From: simnandez Date: Tue, 24 Dec 2013 13:39:58 +0100 Subject: [PATCH 16/21] Fix: Bad url destination into category remove --- htdocs/categories/categorie.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 6aa063a9b4e..1750097b120 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -379,7 +379,7 @@ else if ($id || $ref) dol_fiche_end(); - formCategory($db,$product,0,($user->rights->produit->creer || $user->rights->service->creer)); + formCategory($db,$product,0,$socid,($user->rights->produit->creer || $user->rights->service->creer)); } if ($type == 3) @@ -604,7 +604,7 @@ else if ($id || $ref) dol_fiche_end(); - formCategory($db,$object,4,$user->rights->societe->creer); + formCategory($db,$object,4,$socid, $user->rights->societe->creer); } } From ec1aef019104a91daf9213572d1bc805def7a0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Dec 2013 15:55:35 +0100 Subject: [PATCH 17/21] 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++; From 76e4ba06a42e68ce5b0a5ad05bee8645235715d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Dec 2013 17:36:37 +0100 Subject: [PATCH 18/21] Fix: Calulcation of oustanding amount must not include abandonned invoices. --- htdocs/societe/class/societe.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ba48e3fb2df..664be4b9a05 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2886,7 +2886,9 @@ class Societe extends CommonObject $sql = "SELECT sum(total) as amount FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE fk_soc = ". $this->id; $sql .= " AND paye = 0"; - $sql .= " AND fk_statut <> 0"; + $sql .= " AND fk_statut <> 0"; // Not a draft + //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason + $sql .= " AND fk_statut <> 3"; // Not abandonned dol_syslog("get_OutstandingBill sql=".$sql); $resql=$this->db->query($sql); From 22412443fe7e501fbc126dec576f5045cfc33919 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Dec 2013 18:12:13 +0100 Subject: [PATCH 19/21] Fix: Overwrite bad value of limit payment date only if payment date is defined. --- htdocs/fourn/facture/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 396e5155818..7402272fe73 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -221,7 +221,7 @@ elseif ($action == 'setdatef' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); $object->date=dol_mktime(12,0,0,$_POST['datefmonth'],$_POST['datefday'],$_POST['datefyear']); - if ($object->date_echeance < $object->date) $object->date_echeance=$object->date; + if ($object->date_echeance && $object->date_echeance < $object->date) $object->date_echeance=$object->date; $result=$object->update($user); if ($result < 0) dol_print_error($db,$object->error); } From 91b104aeb85be3572eb290550bbe73f95598c1a9 Mon Sep 17 00:00:00 2001 From: simnandez Date: Thu, 26 Dec 2013 11:32:13 +0100 Subject: [PATCH 20/21] Fix: setup not saving changes --- htdocs/admin/prelevement.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 798eadc04c8..f79dc389268 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -77,10 +77,12 @@ if ($action == "set") if (! $error) { + $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { + $db->rollback(); setEventMessage($langs->trans("Error"),'errors'); } } From fce34301f998a2c86466b64794b604e1d8b23130 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Dec 2013 19:39:29 +0100 Subject: [PATCH 21/21] More test to avoid errors when env is not complete. --- build/makepack-dolibarr.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index aa1fd92f4d6..21785733d38 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -63,6 +63,15 @@ if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"}) { print "Error: Missing environment variables.\n"; print "You must define the environment variable DESTIBETARC and DESTISTABLE to point to the\ndirectories where you want to save the generated packages.\n"; + print "Example: DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild'\n"; + print "Example: DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable'\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} +if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"}) +{ + print "Error: Directory of environment variable DESTIBETARC or DESTISTABLE does not exist.\n"; print "$PROG.$Extension aborted.\n"; sleep 2; exit 1; @@ -391,6 +400,7 @@ if ($nboftargetok) { if ($target eq 'TGZ') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } print "Remove target $FILENAMETGZ.tgz...\n"; @@ -417,6 +427,7 @@ if ($nboftargetok) { if ($target eq 'XZ') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } print "Remove target $FILENAMEXZ.xz...\n"; @@ -447,6 +458,7 @@ if ($nboftargetok) { if ($target eq 'ZIP') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } print "Remove target $FILENAMEZIP.zip...\n"; @@ -481,6 +493,7 @@ if ($nboftargetok) { if ($target =~ /FEDO/i) { $subdir="package_rpm_redhat-fedora"; } if ($target =~ /MAND/i) { $subdir="package_rpm_mandriva"; } if ($target =~ /OPEN/i) { $subdir="package_rpm_opensuse"; } + mkdir($DESTI.'/'.$subdir); if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; } $ARCH='noarch'; @@ -577,6 +590,7 @@ if ($nboftargetok) { if ($target eq 'DEB') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/package_debian-ubuntu'); if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; } $olddir=getcwd(); @@ -731,6 +745,7 @@ if ($nboftargetok) { if ($target eq 'APS') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/package_aps'); if (-d $DESTI.'/package_aps') { $NEWDESTI=$DESTI.'/package_aps'; } $newbuild = $BUILD; @@ -815,6 +830,7 @@ if ($nboftargetok) { if ($target eq 'EXEDOLIWAMP') { $NEWDESTI=$DESTI; + mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } print "Remove target $FILENAMEEXEDOLIWAMP.exe...\n";