From 6c85fbbc303d33c3fc19c18a56dc9864a983cc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 18 Oct 2018 21:47:10 +0200 Subject: [PATCH] add log and comment --- .../core/class/commondocgenerator.class.php | 5 +++ .../doc/doc_generic_order_odt.modules.php | 45 +++++++++++-------- .../modules/commande/modules_commande.php | 4 -- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index f75ced719a1..9c23badcf02 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -38,6 +38,11 @@ abstract class CommonDocGenerator */ public $error=''; + /** + * @var string[] Array of error strings + */ + public $errors = array(); + /** * @var DoliDB Database handler. */ diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 3839edb85c1..dff597c5593 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -4,21 +4,22 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018 Philippe Grand -* -* 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 -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* or see http://www.gnu.org/ -*/ + * Copyright (C) 2018 Frédéric France + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ /** * \file htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -46,7 +47,7 @@ class doc_generic_order_odt extends ModelePDFCommandes public $emetteur; /** - * @var array() Minimum version of PHP required by module. + * @var array Minimum version of PHP required by module. * e.g.: PHP ≥ 5.4 = array(5, 4) */ public $phpmin = array(5, 4); @@ -351,6 +352,7 @@ class doc_generic_order_odt extends ModelePDFCommandes catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -366,6 +368,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -402,6 +405,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -434,9 +438,11 @@ class doc_generic_order_odt extends ModelePDFCommandes } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -460,6 +466,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -473,7 +480,8 @@ class doc_generic_order_odt extends ModelePDFCommandes try { $odfHandler->exportAsAttachedPDF($file); }catch (Exception $e){ - $this->error=$e->getMessage(); + $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } @@ -481,7 +489,8 @@ class doc_generic_order_odt extends ModelePDFCommandes try { $odfHandler->saveToDisk($file); }catch (Exception $e){ - $this->error=$e->getMessage(); + $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 1a4b732246d..7a1ffea8792 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -39,10 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; */ abstract class ModelePDFCommandes extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error=''; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /**