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 dff597c5593..a849d2a2c7a 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 @@ -488,7 +488,7 @@ class doc_generic_order_odt extends ModelePDFCommandes else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); dol_syslog($e->getMessage(), LOG_INFO); return -1; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index f70514b2912..5a19d821653 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -2,7 +2,8 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2018 Ferran Marcet -* + * 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 @@ -354,6 +355,7 @@ class doc_generic_contract_odt extends ModelePDFContract catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -367,8 +369,9 @@ class doc_generic_contract_odt extends ModelePDFContract try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } foreach($tmparray as $key=>$value) @@ -384,8 +387,9 @@ class doc_generic_contract_odt extends ModelePDFContract $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -419,9 +423,11 @@ class doc_generic_contract_odt extends ModelePDFContract } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -445,6 +451,7 @@ class doc_generic_contract_odt extends ModelePDFContract } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -456,7 +463,7 @@ class doc_generic_contract_odt extends ModelePDFContract if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); return -1; } @@ -464,7 +471,7 @@ class doc_generic_contract_odt extends ModelePDFContract else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); return -1; } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 38696cb3cc2..6a1543af4cf 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -4,8 +4,8 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018 Philippe Grand - -* + * 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 @@ -347,6 +347,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -362,6 +363,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Make substitutions into odt of user info @@ -381,8 +383,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Make substitutions into odt of mysoc @@ -402,8 +405,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Make substitutions into odt of thirdparty @@ -421,8 +425,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of object + external modules @@ -446,6 +451,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -478,9 +484,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -488,7 +496,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler->mergeSegment($listlines); } } - catch(OdfException $e) + catch (OdfException $e) { $this->error=$e->getMessage(); dol_syslog($this->error, LOG_WARNING); @@ -502,8 +510,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -515,16 +524,18 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index a823bae2d4b..bfe22b93ae3 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -1,9 +1,10 @@ -* Copyright (C) 2012 Regis Houssin -* Copyright (C) 2014 Marcos García -* Copyright (C) 2016 Charlie Benke -* + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Marcos García + * Copyright (C) 2016 Charlie Benke + * 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 @@ -355,9 +356,10 @@ class doc_generic_invoice_odt extends ModelePDFFactures ) ); } - catch(Exception $e) + catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -371,8 +373,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -410,8 +413,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -444,9 +448,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -470,6 +476,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -483,14 +490,16 @@ class doc_generic_invoice_odt extends ModelePDFFactures $odfHandler->exportAsAttachedPDF($file); }catch (Exception $e){ $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 82b33d35240..979b6fbe7fd 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -1,7 +1,8 @@ * Copyright (C) 2012 Juanjo Menent -* + * 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 @@ -358,16 +359,17 @@ class doc_generic_product_odt extends ModelePDFProduct $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->produit->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } - catch(Exception $e) + catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -382,8 +384,9 @@ class doc_generic_product_odt extends ModelePDFProduct try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -418,8 +421,9 @@ class doc_generic_product_odt extends ModelePDFProduct $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -440,11 +444,13 @@ class doc_generic_product_odt extends ModelePDFProduct { $listlines->setVars($key, $val, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } - catch(SegmentException $e) + catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -452,7 +458,7 @@ class doc_generic_product_odt extends ModelePDFProduct } $odfHandler->mergeSegment($listlines); } - catch(OdfException $e) + catch (OdfException $e) { $this->error=$e->getMessage(); dol_syslog($this->error, LOG_WARNING); @@ -468,6 +474,7 @@ class doc_generic_product_odt extends ModelePDFProduct } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -479,16 +486,18 @@ class doc_generic_product_odt extends ModelePDFProduct if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index bc5da5e306b..d2fa94ceb1e 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Charlie Benke + * 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 @@ -596,10 +597,9 @@ class doc_generic_project_odt extends ModelePDFProjects 'DELIMITER_RIGHT' => '}' ) ); - } - catch(Exception $e) - { + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -641,8 +641,9 @@ class doc_generic_project_odt extends ModelePDFProjects $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -672,9 +673,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -721,9 +724,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlinestaskres->merge(); @@ -768,9 +773,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlinestasktime->merge(); @@ -806,9 +813,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlinestasktime->merge(); @@ -835,11 +844,13 @@ class doc_generic_project_odt extends ModelePDFProjects { $listtasksfiles->setVars($key, $val, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } - catch(SegmentException $e) + catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listtasksfiles->merge(); @@ -881,9 +892,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -938,9 +951,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -958,113 +973,113 @@ class doc_generic_project_odt extends ModelePDFProjects //List of referent $listofreferent = array( - 'propal' => array( - 'title' => "ListProposalsAssociatedProject", - 'class' => 'Propal', - 'table' => 'propal', - 'test' => $conf->propal->enabled && $user->rights->propale->lire - ), - 'order' => array( - 'title' => "ListOrdersAssociatedProject", - 'class' => 'Commande', - 'table' => 'commande', - 'test' => $conf->commande->enabled && $user->rights->commande->lire - ), - 'invoice' => array( - 'title' => "ListInvoicesAssociatedProject", - 'class' => 'Facture', - 'table' => 'facture', - 'test' => $conf->facture->enabled && $user->rights->facture->lire - ), - 'invoice_predefined' => array( - 'title' => "ListPredefinedInvoicesAssociatedProject", - 'class' => 'FactureRec', - 'table' => 'facture_rec', - 'test' => $conf->facture->enabled && $user->rights->facture->lire - ), - 'proposal_supplier' => array( - 'title' => "ListSupplierProposalsAssociatedProject", - 'class' => 'SupplierProposal', - 'table' => 'supplier_proposal', - 'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire - ), - 'order_supplier' => array( - 'title' => "ListSupplierOrdersAssociatedProject", - 'table' => 'commande_fournisseur', - 'class' => 'CommandeFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire - ), - 'invoice_supplier' => array( - 'title' => "ListSupplierInvoicesAssociatedProject", - 'table' => 'facture_fourn', - 'class' => 'FactureFournisseur', - 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire - ), - 'contract' => array( - 'title' => "ListContractAssociatedProject", - 'class' => 'Contrat', - 'table' => 'contrat', - 'test' => $conf->contrat->enabled && $user->rights->contrat->lire - ), - 'intervention' => array( - 'title' => "ListFichinterAssociatedProject", - 'class' => 'Fichinter', - 'table' => 'fichinter', - 'disableamount' => 1, - 'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire - ), - 'shipping' => array( - 'title' => "ListShippingAssociatedProject", - 'class' => 'Expedition', - 'table' => 'expedition', - 'disableamount' => 1, - 'test' => $conf->expedition->enabled && $user->rights->expedition->lire - ), - 'trip' => array( - 'title' => "ListTripAssociatedProject", - 'class' => 'Deplacement', - 'table' => 'deplacement', - 'disableamount' => 1, - 'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire - ), - 'expensereport' => array( - 'title' => "ListExpenseReportsAssociatedProject", - 'class' => 'ExpenseReportLine', - 'table' => 'expensereport_det', - 'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire - ), - 'donation' => array( - 'title' => "ListDonationsAssociatedProject", - 'class' => 'Don', - 'table' => 'don', - 'test' => $conf->don->enabled && $user->rights->don->lire - ), - 'loan' => array( - 'title' => "ListLoanAssociatedProject", - 'class' => 'Loan', - 'table' => 'loan', - 'test' => $conf->loan->enabled && $user->rights->loan->read - ), - 'chargesociales' => array( - 'title' => "ListSocialContributionAssociatedProject", - 'class' => 'ChargeSociales', - 'table' => 'chargesociales', - 'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $id, - 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire - ), - 'stock_mouvement' => array( - 'title' => "ListMouvementStockProject", - 'class' => 'MouvementStock', - 'table' => 'stock_mouvement', - 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) - ), - 'agenda' => array( - 'title' => "ListActionsAssociatedProject", - 'class' => 'ActionComm', - 'table' => 'actioncomm', - 'disableamount' => 1, - 'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire - ) + 'propal' => array( + 'title' => "ListProposalsAssociatedProject", + 'class' => 'Propal', + 'table' => 'propal', + 'test' => $conf->propal->enabled && $user->rights->propale->lire + ), + 'order' => array( + 'title' => "ListOrdersAssociatedProject", + 'class' => 'Commande', + 'table' => 'commande', + 'test' => $conf->commande->enabled && $user->rights->commande->lire + ), + 'invoice' => array( + 'title' => "ListInvoicesAssociatedProject", + 'class' => 'Facture', + 'table' => 'facture', + 'test' => $conf->facture->enabled && $user->rights->facture->lire + ), + 'invoice_predefined' => array( + 'title' => "ListPredefinedInvoicesAssociatedProject", + 'class' => 'FactureRec', + 'table' => 'facture_rec', + 'test' => $conf->facture->enabled && $user->rights->facture->lire + ), + 'proposal_supplier' => array( + 'title' => "ListSupplierProposalsAssociatedProject", + 'class' => 'SupplierProposal', + 'table' => 'supplier_proposal', + 'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire + ), + 'order_supplier' => array( + 'title' => "ListSupplierOrdersAssociatedProject", + 'table' => 'commande_fournisseur', + 'class' => 'CommandeFournisseur', + 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire + ), + 'invoice_supplier' => array( + 'title' => "ListSupplierInvoicesAssociatedProject", + 'table' => 'facture_fourn', + 'class' => 'FactureFournisseur', + 'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire + ), + 'contract' => array( + 'title' => "ListContractAssociatedProject", + 'class' => 'Contrat', + 'table' => 'contrat', + 'test' => $conf->contrat->enabled && $user->rights->contrat->lire + ), + 'intervention' => array( + 'title' => "ListFichinterAssociatedProject", + 'class' => 'Fichinter', + 'table' => 'fichinter', + 'disableamount' => 1, + 'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire + ), + 'shipping' => array( + 'title' => "ListShippingAssociatedProject", + 'class' => 'Expedition', + 'table' => 'expedition', + 'disableamount' => 1, + 'test' => $conf->expedition->enabled && $user->rights->expedition->lire + ), + 'trip' => array( + 'title' => "ListTripAssociatedProject", + 'class' => 'Deplacement', + 'table' => 'deplacement', + 'disableamount' => 1, + 'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire + ), + 'expensereport' => array( + 'title' => "ListExpenseReportsAssociatedProject", + 'class' => 'ExpenseReportLine', + 'table' => 'expensereport_det', + 'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire + ), + 'donation' => array( + 'title' => "ListDonationsAssociatedProject", + 'class' => 'Don', + 'table' => 'don', + 'test' => $conf->don->enabled && $user->rights->don->lire + ), + 'loan' => array( + 'title' => "ListLoanAssociatedProject", + 'class' => 'Loan', + 'table' => 'loan', + 'test' => $conf->loan->enabled && $user->rights->loan->read + ), + 'chargesociales' => array( + 'title' => "ListSocialContributionAssociatedProject", + 'class' => 'ChargeSociales', + 'table' => 'chargesociales', + 'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $id, + 'test' => $conf->tax->enabled && $user->rights->tax->charges->lire + ), + 'stock_mouvement' => array( + 'title' => "ListMouvementStockProject", + 'class' => 'MouvementStock', + 'table' => 'stock_mouvement', + 'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW)) + ), + 'agenda' => array( + 'title' => "ListActionsAssociatedProject", + 'class' => 'ActionComm', + 'table' => 'actioncomm', + 'disableamount' => 1, + 'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire + ), ); //Insert reference @@ -1116,11 +1131,11 @@ class doc_generic_project_odt extends ModelePDFProjects if (!empty($element->total_ht)) { $ref_array['amountht']=$element->total_ht; $ref_array['amountttc']=$element->total_ttc; - }else { + } else { $ref_array['amountht']=0; $ref_array['amountttc']=0; } - }else { + } else { $ref_array['amountht']=''; $ref_array['amountttc']=''; } @@ -1137,9 +1152,11 @@ class doc_generic_project_odt extends ModelePDFProjects } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -1148,9 +1165,7 @@ class doc_generic_project_odt extends ModelePDFProjects } $odfHandler->mergeSegment($listlines); } - } - catch(OdfException $e) - { + } catch(OdfException $e) { $this->error=$e->getMessage(); dol_syslog($this->error, LOG_WARNING); return -1; @@ -1162,9 +1177,8 @@ class doc_generic_project_odt extends ModelePDFProjects { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); - } - catch(OdfException $e) - { + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -1177,16 +1191,16 @@ class doc_generic_project_odt extends ModelePDFProjects if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); return -1; } - } - else { + } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e){ $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 46f0fdacbbb..c8c588d1f4f 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Charlie Benke + * 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 @@ -560,9 +561,8 @@ class doc_generic_task_odt extends ModelePDFTask { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - } - catch(OdfException $e) - { + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -577,15 +577,12 @@ class doc_generic_task_odt extends ModelePDFTask complete_substitutions_array($tmparray, $outputlangs, $object); foreach($tmparray as $key => $val) { - try - { + try { $odfHandler->setVars($key, $val, true, 'UTF-8'); - } - catch(OdfException $e) - { - } - catch(SegmentException $e) - { + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); + } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -623,15 +620,13 @@ class doc_generic_task_odt extends ModelePDFTask foreach($tmparray as $key => $val) { - try - { + try { $listlinestaskres->setVars($key, $val, true, 'UTF-8'); + } catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } - catch(OdfException $e) - { - } - catch(SegmentException $e) - { + catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlinestaskres->merge(); @@ -677,9 +672,11 @@ class doc_generic_task_odt extends ModelePDFTask } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlinestasktime->merge(); @@ -710,9 +707,11 @@ class doc_generic_task_odt extends ModelePDFTask } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listtasksfiles->merge(); @@ -752,9 +751,11 @@ class doc_generic_task_odt extends ModelePDFTask } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -810,9 +811,11 @@ class doc_generic_task_odt extends ModelePDFTask } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -837,16 +840,18 @@ class doc_generic_task_odt extends ModelePDFTask if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e27fc868155..5b87f744466 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -2,7 +2,8 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke -* + * 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 @@ -381,6 +382,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -395,8 +397,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -433,6 +436,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -465,9 +469,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -489,8 +495,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -502,16 +509,18 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index fbd4ac84e05..3650af12b24 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -1,6 +1,8 @@ * Copyright (C) 2016 Charlie Benke + * 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 @@ -276,6 +278,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } //print $odfHandler->__toString()."\n"; @@ -323,9 +326,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -367,9 +372,10 @@ class doc_generic_odt extends ModeleThirdPartyDoc $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { // setVars failed, probably because key not found + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -380,8 +386,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -393,8 +400,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } @@ -413,6 +421,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $odfHandler->saveToDisk($file); }catch (Exception $e){ $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index fb600eee268..c9c4350e050 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Juanjo Menent + * 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 @@ -368,6 +369,7 @@ class doc_generic_stock_odt extends ModelePDFStock catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -382,8 +384,9 @@ class doc_generic_stock_odt extends ModelePDFStock try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -418,8 +421,9 @@ class doc_generic_stock_odt extends ModelePDFStock $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -442,9 +446,11 @@ class doc_generic_stock_odt extends ModelePDFStock } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -468,6 +474,7 @@ class doc_generic_stock_odt extends ModelePDFStock } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -479,16 +486,18 @@ class doc_generic_stock_odt extends ModelePDFStock if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { $odfHandler->saveToDisk($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 3bf35edbe13..05bfe535ac7 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -2,6 +2,7 @@ /* Copyright (C) 2010-2012 Laurent Destailleur * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2016 Charlie Benke + * 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 @@ -367,16 +368,17 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->supplier_proposal->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } - catch(Exception $e) + catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } // After construction $odfHandler->contentXml contains content and @@ -390,8 +392,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } // Define substitution array @@ -424,6 +427,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } // Replace tags of lines @@ -456,9 +460,11 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } catch(SegmentException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } $listlines->merge(); @@ -482,6 +488,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_INFO); } } @@ -493,16 +500,18 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index cacef2dcb55..f8b6e5cdaba 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Juanjo Menent + * 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 @@ -333,16 +334,17 @@ class doc_generic_user_odt extends ModelePDFUser $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->user->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); } catch(Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } @@ -377,6 +379,7 @@ class doc_generic_user_odt extends ModelePDFUser } catch(OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } } @@ -387,8 +390,9 @@ class doc_generic_user_odt extends ModelePDFUser try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } } @@ -400,16 +404,18 @@ class doc_generic_user_odt extends ModelePDFUser if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 161c9abc3a6..1f7678371e5 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -1,6 +1,7 @@ * Copyright (C) 2012 Juanjo Menent + * 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 @@ -355,16 +356,15 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->user->dir_temp, - 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. - 'DELIMITER_LEFT' => '{', - 'DELIMITER_RIGHT' => '}' + 'PATH_TO_TMP' => $conf->user->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' ) ); - } - catch(Exception $e) - { + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } // After construction $odfHandler->contentXml contains content and @@ -378,8 +378,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup try { $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } // Make substitutions into odt @@ -414,8 +415,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $odfHandler->setVars($key, $value, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } } // Replace tags of lines @@ -425,7 +427,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup try { $listlines = $odfHandler->setSegment('lines'); } - catch(OdfException $e) + catch (OdfException $e) { // We may arrive here if tags for lines not present into template $foundtagforlines = 0; @@ -446,15 +448,17 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup { try { - if(!is_array($val)) { + if (!is_array($val)) { $listlines->setVars($key, $val, true, 'UTF-8'); } } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } - catch(SegmentException $e) + catch (SegmentException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } } $listlines->merge(); @@ -471,39 +475,42 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // Replace labels translated $tmparray=$outputlangs->get_translations_for_substitutions(); - foreach($tmparray as $key=>$value) + foreach($tmparray as $key => $value) { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); } - catch(OdfException $e) + catch (OdfException $e) { + dol_syslog($e->getMessage(), LOG_WARNING); } } // Call the beforeODTSave hook - $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); - $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $parameters=array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs); + $reshook=$hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks // Write new file if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); - }catch (Exception $e){ + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } } else { try { - $odfHandler->saveToDisk($file); - }catch (Exception $e){ + $odfHandler->saveToDisk($file); + } catch (Exception $e) { $this->error=$e->getMessage(); + dol_syslog($e->getMessage(), LOG_WARNING); return -1; } } - $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));