diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 81becbaa37c..c1c5fe58b45 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -2,6 +2,7 @@ /* Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2011-2018 Philippe Grand * Copyright (C) 2018 Charlene 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 diff --git a/htdocs/cache.manifest b/htdocs/cache.manifest index a3d1b1c554f..ebbf1aab4eb 100644 --- a/htdocs/cache.manifest +++ b/htdocs/cache.manifest @@ -11,7 +11,6 @@ CACHE: theme/dolibarr_logo.png support/ support/index.php -support/online.php support/default.css support/helpcenter.png diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 35ec5842e4b..585d5399771 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * 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 @@ -215,28 +216,28 @@ class Contracts extends DolibarrApi * * @url GET {id}/lines * - * @return int + * @return array */ function getLines($id) { - if(! DolibarrApiAccess::$user->rights->contrat->lire) { - throw new RestException(401); - } + if(! DolibarrApiAccess::$user->rights->contrat->lire) { + throw new RestException(401); + } - $result = $this->contract->fetch($id); - if( ! $result ) { - throw new RestException(404, 'Contract not found'); - } + $result = $this->contract->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Contract not found'); + } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { - throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - $this->contract->getLinesArray(); - $result = array(); - foreach ($this->contract->lines as $line) { - array_push($result,$this->_cleanObjectDatas($line)); - } - return $result; + if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + $this->contract->getLinesArray(); + $result = array(); + foreach ($this->contract->lines as $line) { + array_push($result, $this->_cleanObjectDatas($line)); + } + return $result; } /** @@ -247,7 +248,7 @@ class Contracts extends DolibarrApi * * @url POST {id}/lines * - * @return int + * @return int|bool */ function postLine($id, $request_data = null) { @@ -300,7 +301,7 @@ class Contracts extends DolibarrApi * * @url PUT {id}/lines/{lineid} * - * @return object + * @return array|bool */ function putLine($id, $lineid, $request_data = null) { @@ -360,7 +361,7 @@ class Contracts extends DolibarrApi * * @url PUT {id}/lines/{lineid}/activate * - * @return object + * @return array|bool */ function activateLine($id, $lineid, $datestart, $dateend = null, $comment = null) { @@ -369,7 +370,7 @@ class Contracts extends DolibarrApi } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contrat not found'); } @@ -398,16 +399,16 @@ class Contracts extends DolibarrApi * * @url PUT {id}/lines/{lineid}/unactivate * - * @return object + * @return array|bool */ function unactivateLine($id, $lineid, $datestart, $comment = null) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { + if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contrat not found'); } @@ -443,16 +444,16 @@ class Contracts extends DolibarrApi */ function deleteLine($id, $lineid) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { + if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contrat not found'); } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + if (! DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -478,16 +479,16 @@ class Contracts extends DolibarrApi */ function put($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { + if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contrat not found'); } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + if (! DolibarrApi::_checkAccessToResource('contrat', $this->contract->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach($request_data as $field => $value) { @@ -514,19 +515,19 @@ class Contracts extends DolibarrApi */ function delete($id) { - if(! DolibarrApiAccess::$user->rights->contrat->supprimer) { + if (! DolibarrApiAccess::$user->rights->contrat->supprimer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contract not found'); } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + if (! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( ! $this->contract->delete(DolibarrApiAccess::$user)) { + if (! $this->contract->delete(DolibarrApiAccess::$user)) { throw new RestException(500, 'Error when delete contract : '.$this->contract->error); } @@ -556,15 +557,15 @@ class Contracts extends DolibarrApi */ function validate($id, $notrigger=0) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { + if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contract not found'); } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + if (! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -602,15 +603,15 @@ class Contracts extends DolibarrApi */ function close($id, $notrigger=0) { - if(! DolibarrApiAccess::$user->rights->contrat->creer) { + if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); } $result = $this->contract->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'Contract not found'); } - if( ! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { + if (! DolibarrApi::_checkAccessToResource('contrat',$this->contract->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 42afa4fbfe0..9dc4c162e0f 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -1,5 +1,6 @@ + * 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 @@ -139,10 +140,10 @@ class box_graph_product_distribution extends ModeleBoxes if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire)) { - // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showinvoicenb) { + $langs->load("bills"); include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; $showpointvalue = 1; $nocolor = 0; @@ -202,6 +203,7 @@ class box_graph_product_distribution extends ModeleBoxes // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showpropalnb) { + $langs->load("propal"); include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; $showpointvalue = 1; $nocolor = 0; @@ -258,11 +260,10 @@ class box_graph_product_distribution extends ModeleBoxes if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire)) { - $langs->load("orders"); - // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showordernb) { + $langs->load("orders"); include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; $showpointvalue = 1; $nocolor = 0; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 420b90926dd..fc7f6792274 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -348,32 +348,46 @@ class Conf if (! empty($this->fournisseur)) { $this->fournisseur->commande=new stdClass(); - $this->fournisseur->commande->dir_output=$rootfordata."/fournisseur/commande"; - $this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp"; + $this->fournisseur->commande->multidir_output=array($this->entity => $rootfordata."/fournisseur/commande"); + $this->fournisseur->commande->multidir_temp =array($this->entity => $rootfordata."/fournisseur/commande/temp"); + $this->fournisseur->commande->dir_output=$rootfordata."/fournisseur/commande"; // For backward compatibility + $this->fournisseur->commande->dir_temp =$rootfordata."/fournisseur/commande/temp"; // For backward compatibility $this->fournisseur->facture=new stdClass(); - $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; - $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; + $this->fournisseur->facture->multidir_output=array($this->entity => $rootfordata."/fournisseur/facture"); + $this->fournisseur->facture->multidir_temp =array($this->entity => $rootfordata."/fournisseur/facture/temp"); + $this->fournisseur->facture->dir_output =$rootfordata."/fournisseur/facture"; // For backward compatibility + $this->fournisseur->facture->dir_temp =$rootfordata."/fournisseur/facture/temp"; // For backward compatibility $this->supplierproposal=new stdClass(); - $this->supplierproposal->dir_output=$rootfordata."/supplier_proposal"; - $this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp"; + $this->supplierproposal->multidir_output=array($this->entity => $rootfordata."/supplier_proposal"); + $this->supplierproposal->multidir_temp =array($this->entity => $rootfordata."/supplier_proposal/temp"); + $this->supplierproposal->dir_output=$rootfordata."/supplier_proposal"; // For backward compatibility + $this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp"; // For backward compatibility $this->fournisseur->payment=new stdClass(); - $this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment"; - $this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp"; + $this->fournisseur->payment->multidir_output=array($this->entity => $rootfordata."/fournisseur/payment"); + $this->fournisseur->payment->multidir_temp =array($this->entity => $rootfordata."/fournisseur/payment/temp"); + $this->fournisseur->payment->dir_output =$rootfordata."/fournisseur/payment"; // For backward compatibility + $this->fournisseur->payment->dir_temp =$rootfordata."/fournisseur/payment/temp"; // For backward compatibility // To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties { $this->supplier_order=new stdClass(); $this->supplier_order->enabled=1; - $this->supplier_order->dir_output=$rootfordata."/fournisseur/commande"; - $this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp"; + $this->supplier_order->multidir_output=array($this->entity => $rootfordata."/fournisseur/commande"); + $this->supplier_order->multidir_temp =array($this->entity => $rootfordata."/fournisseur/commande/temp"); + $this->supplier_order->dir_output=$rootfordata."/fournisseur/commande"; // For backward compatibility + $this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp"; // For backward compatibility $this->supplier_invoice=new stdClass(); $this->supplier_invoice->enabled=1; - $this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture"; - $this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp"; + $this->supplier_invoice->multidir_output=array($this->entity => $rootfordata."/fournisseur/facture"); + $this->supplier_invoice->multidir_temp =array($this->entity => $rootfordata."/fournisseur/facture/temp"); + $this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture"; // For backward compatibility + $this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp"; // For backward compatibility $this->supplierproposal=new stdClass(); - $this->supplierproposal->dir_output=$rootfordata."/supplier_proposal"; - $this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp"; + $this->supplierproposal->multidir_output=array($this->entity => $rootfordata."/supplier_proposal"); + $this->supplierproposal->multidir_temp =array($this->entity => $rootfordata."/supplier_proposal/temp"); + $this->supplierproposal->dir_output=$rootfordata."/supplier_proposal"; // For backward compatibility + $this->supplierproposal->dir_temp=$rootfordata."/supplier_proposal/temp"; // For backward compatibility } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c30dcec6e01..70ffa6ea006 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3283,17 +3283,17 @@ class Form if ($empty && empty($arraytypes['code'])) continue; if ($format == 0) print ''; } @@ -3806,18 +3806,18 @@ class Form { $more.=''.$input['label'].''."\n"; } - else if ($input['type'] == 'password') + elseif ($input['type'] == 'password') { $more.=''.$input['label'].''."\n"; } - else if ($input['type'] == 'select') + elseif ($input['type'] == 'select') { $more.=''; if (! empty($input['label'])) $more.=$input['label'].''; $more.=$this->selectarray($input['name'],$input['values'],$input['default'],1,0,0,$moreattr,0,0,0,'',$morecss); $more.=''."\n"; } - else if ($input['type'] == 'checkbox') + elseif ($input['type'] == 'checkbox') { $more.=''; $more.=''.$input['label'].' '; @@ -3828,7 +3828,7 @@ class Form $more.=' />'; $more.=''."\n"; } - else if ($input['type'] == 'radio') + elseif ($input['type'] == 'radio') { $i=0; foreach($input['values'] as $selkey => $selval) @@ -3844,7 +3844,7 @@ class Form $i++; } } - else if ($input['type'] == 'date') + elseif ($input['type'] == 'date') { $more.=''.$input['label'].''; $more.=''; @@ -3856,7 +3856,7 @@ class Form $formquestion[] = array('name'=>$input['name'].'hour'); $formquestion[] = array('name'=>$input['name'].'min'); } - else if ($input['type'] == 'other') + elseif ($input['type'] == 'other') { $more.=''; if (! empty($input['label'])) $more.=$input['label'].''; @@ -3864,7 +3864,7 @@ class Form $more.=''."\n"; } - else if ($input['type'] == 'onecolumn') + elseif ($input['type'] == 'onecolumn') { $more.=''; $more.=$input['value']; @@ -4589,6 +4589,7 @@ class Form * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list + * @deprecated * @return void */ function select_currency($selected='',$htmlname='currency_id') @@ -4976,7 +4977,7 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @return string|null Nothing or string if nooutput is 1 + * @return string|void Nothing or string if nooutput is 1 * @deprecated * @see form_date, select_month, select_year, select_dayofweek */ @@ -5374,7 +5375,7 @@ class Form * if 'textselect' input hour is in text and input min is a combo * @param integer $minunderhours If 1, show minutes selection under the hours * @param int $nooutput Do not output html string but return it - * @return string|null + * @return string|void */ function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 34f0b9ab750..5824d2ca5ec 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -884,15 +884,13 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); + $entity = 1; // Without multicompany + // Get object entity - if (empty($conf->multicompany->enabled)) - { - $entity = $conf->entity; - } - else + if (! empty($conf->multicompany->enabled)) { preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir,'/').'$/', $filedir, $regs); - $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); + $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default } // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files and get only generated files) 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/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index d98801ab7e2..ec03a2cef8e 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -278,7 +278,7 @@ class pdf_standard extends ModeleExpenseReport $pagenb=0; $pdf->SetDrawColor(128,128,128); - $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref_number)); + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("Trips")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); 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)); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 603d521f5ec..88d4d16b6f9 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4425,50 +4425,50 @@ function migrate_rename_directories($db,$langs,$conf,$oldname,$newname) */ function migrate_delete_old_files($db,$langs,$conf) { - $result=true; + $result=true; - dolibarr_install_syslog("upgrade2::migrate_delete_old_files"); + dolibarr_install_syslog("upgrade2::migrate_delete_old_files"); - // List of files to delete - $filetodeletearray=array( - DOL_DOCUMENT_ROOT.'/core/triggers/interface_demo.class.php', - DOL_DOCUMENT_ROOT.'/core/menus/barre_left/default.php', - DOL_DOCUMENT_ROOT.'/core/menus/barre_top/default.php', - DOL_DOCUMENT_ROOT.'/core/modules/modComptabiliteExpert.class.php', - DOL_DOCUMENT_ROOT.'/core/modules/modCommercial.class.php', - DOL_DOCUMENT_ROOT.'/core/modules/modProduit.class.php', - DOL_DOCUMENT_ROOT.'/core/modules/modSkype.class.php', - DOL_DOCUMENT_ROOT.'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php', - DOL_DOCUMENT_ROOT.'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php', - DOL_DOCUMENT_ROOT.'/core/triggers/interface_modWebcalendar_Webcalsynchro.class.php', - DOL_DOCUMENT_ROOT.'/core/triggers/interface_modCommande_Ecotax.class.php', - DOL_DOCUMENT_ROOT.'/core/triggers/interface_modCommande_fraisport.class.php', - DOL_DOCUMENT_ROOT.'/core/triggers/interface_modPropale_PropalWorkflow.class.php', - DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone.lib.php', - DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_backoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_frontoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php', - DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_frontoffice.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts2.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts3.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts4.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/framboise.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/dolibarr_services_expired.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/peche.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/poire.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/mailings/kiwi.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_crabe.modules.php', - DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_oursin.modules.php', - - DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php', - DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php', - DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php', - DOL_DOCUMENT_ROOT.'/product/class/api_product.class.php', - DOL_DOCUMENT_ROOT.'/societe/class/api_contact.class.php', - DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparty.class.php' + // List of files to delete + $filetodeletearray=array( + DOL_DOCUMENT_ROOT.'/core/triggers/interface_demo.class.php', + DOL_DOCUMENT_ROOT.'/core/menus/barre_left/default.php', + DOL_DOCUMENT_ROOT.'/core/menus/barre_top/default.php', + DOL_DOCUMENT_ROOT.'/core/modules/modComptabiliteExpert.class.php', + DOL_DOCUMENT_ROOT.'/core/modules/modCommercial.class.php', + DOL_DOCUMENT_ROOT.'/core/modules/modProduit.class.php', + DOL_DOCUMENT_ROOT.'/core/modules/modSkype.class.php', + DOL_DOCUMENT_ROOT.'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php', + DOL_DOCUMENT_ROOT.'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php', + DOL_DOCUMENT_ROOT.'/core/triggers/interface_modWebcalendar_Webcalsynchro.class.php', + DOL_DOCUMENT_ROOT.'/core/triggers/interface_modCommande_Ecotax.class.php', + DOL_DOCUMENT_ROOT.'/core/triggers/interface_modCommande_fraisport.class.php', + DOL_DOCUMENT_ROOT.'/core/triggers/interface_modPropale_PropalWorkflow.class.php', + DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone.lib.php', + DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/smartphone/iphone_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_backoffice.php', + DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy_frontoffice.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts2.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts3.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/contacts4.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/framboise.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/dolibarr_services_expired.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/peche.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/poire.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/mailings/kiwi.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_crabe.modules.php', + DOL_DOCUMENT_ROOT.'/core/modules/facture/pdf_oursin.modules.php', + DOL_DOCUMENT_ROOT.'/compta/facture/class/api_invoice.class.php', + DOL_DOCUMENT_ROOT.'/commande/class/api_commande.class.php', + DOL_DOCUMENT_ROOT.'/user/class/api_user.class.php', + DOL_DOCUMENT_ROOT.'/product/class/api_product.class.php', + DOL_DOCUMENT_ROOT.'/societe/class/api_contact.class.php', + DOL_DOCUMENT_ROOT.'/societe/class/api_thirdparty.class.php', + DOL_DOCUMENT_ROOT.'/support/online.php' ); foreach ($filetodeletearray as $filetodelete) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ab47079c9d0..514abd4c5ec 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -565,11 +565,11 @@ class Project extends CommonObject if ($type == 'agenda') { - $sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project IN (". $ids .")"; + $sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project IN (". $ids .") AND entity IN (".getEntity('agenda').")"; } elseif ($type == 'expensereport') { - $sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND ed.fk_projet IN (". $ids .")"; + $sql = "SELECT ed.rowid FROM " . MAIN_DB_PREFIX . "expensereport as e, " . MAIN_DB_PREFIX . "expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND e.entity IN (".getEntity('expensereport').") AND ed.fk_projet IN (". $ids .")"; } elseif ($type == 'project_task') { @@ -581,11 +581,11 @@ class Project extends CommonObject } elseif ($type == 'stock_mouvement') { - $sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM ' . MAIN_DB_PREFIX . "stock_mouvement as ms WHERE ms.origintype = 'project' AND ms.fk_origin IN (". $ids .") AND ms.type_mouvement = 1"; + $sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM ' . MAIN_DB_PREFIX . "stock_mouvement as ms, " . MAIN_DB_PREFIX . "entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin IN (". $ids .") AND ms.type_mouvement = 1"; } else { - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE ".$projectkey." IN (". $ids .")"; + $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $tablename." WHERE ".$projectkey." IN (". $ids .") AND entity IN (".getEntity($type).")"; } if ($dates > 0) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 7c44fb9850b..b8017b45048 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -905,16 +905,16 @@ foreach ($listofreferent as $key => $value) $element_doc = $element->element; $filename=dol_sanitizeFileName($element->ref); - $filedir=$conf->{$element_doc}->dir_output . '/' . dol_sanitizeFileName($element->ref); + $filedir=$conf->{$element_doc}->multidir_output[$element->entity] . '/' . dol_sanitizeFileName($element->ref); if ($element_doc === 'order_supplier') { $element_doc='commande_fournisseur'; - $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($element->ref); + $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); } else if ($element_doc === 'invoice_supplier') { $element_doc='facture_fournisseur'; $filename = get_exdir($element->id,2,0,0,$element,'product').dol_sanitizeFileName($element->ref); - $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($element->id,2,0,0,$element,'invoice_supplier').dol_sanitizeFileName($element->ref); + $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.get_exdir($element->id,2,0,0,$element,'invoice_supplier').dol_sanitizeFileName($element->ref); } print '
'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'
'; diff --git a/htdocs/support/online.php b/htdocs/support/online.php deleted file mode 100644 index 01b2cb4dbd1..00000000000 --- a/htdocs/support/online.php +++ /dev/null @@ -1,163 +0,0 @@ - - * - * 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 . - */ - -/** - * \file htdocs/support/online.php - * \ingroup install - * \brief Provide an Online Help support - */ - -error_reporting(0); - -include_once 'inc.php'; -$uri=preg_replace('/^http(s?):\/\//i','',$dolibarr_main_url_root); -$pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine -if ($pos == '/') $pos = ''; // si $pos vaut /, on le met a '' -define('DOL_URL_ROOT', $pos); // URL racine relative - - -$langs->loadLangs(array("other", "help")); - -/* - * View - */ - -pHeader($langs->trans("DolibarrHelpCenter"),$_SERVER["PHP_SELF"]); - -$urlsparkengels='http://www.spark-angels.com'; -$titlesparkangels='Spark-Angels'; - -//print '
'; - -print $langs->trans("ToGetHelpGoOnSparkAngels1",$titlesparkangels).'
'; - -print '

'; - - -// List of predefined coaches -// We list here the 4 most active coaches on Dolibarr projects (according to number of commits -// found in page http://www.nltechno.com/stats/dolibarr/cvschangelogbuilder_dolibarr.html -$limit=4; -$arrayofwidgets=array( -// Widget for Laurent Destailleur -array('name'=>'Laurent Destailleur', // id user 4702 - 'sort'=>1, - 'logo'=>'logoUrl='.urlencode('http://www.nltechno.com/images/logo_nltechno_long.jpg'), // Put your own logo - 'id'=>'4256,4255', // Put of list of sparkangels widget id (for each language) - 'lang'=>'fr,en'), // Put list of language code of widgets (always english at end) -// Widget for Auguria -array('name'=>'Auguria', - 'sort'=>2, - //'logo'=>'logoUrl='.urlencode('http://www.cap-networks.com/images/logo_small.jpg'), - 'id'=>'7196', - 'lang'=>'fr'), -//Widget for Open-Concept -array('name'=>'Open-Concept.pro', - 'sort'=>2, - 'logo'=>'logoUrl='.urlencode('http://www.open-concept.pro/CMS/images/Logo/logosimplecomplet.png'), - 'id'=>'9340', - 'lang'=>'fr') -); -$arrayofwidgets=dol_sort_array($arrayofwidgets,'sort','asc',0,0); - -$found=0; -print '* '.$langs->trans("LinkToGoldMember",$langs->defaultlang).'

'; -print ''; -foreach ($arrayofwidgets as $arraywidget) // Loop on each user -{ - if ($found >= $limit) break; - $listofwidgets=explode(',',$arraywidget['id']); - $listoflangs=explode(',',$arraywidget['lang']); - $pos=0; - foreach($listoflangs as $langcode) // Loop on each lang of user - { - $pos++; - if (preg_match('/'.$langcode.'/i',$langs->defaultlang) || $langcode == 'en') // If lang qualified - { - print ''; - $found++; - break; - } - } -} -if (! $found) print ''; -print '
'; - print $arraywidget['name'].'
'; - print $langs->trans("PossibleLanguages").': '; - // All languages of user are shown - foreach ($listoflangs as $langcode2) - { - if (empty($widgetid)) $widgetid=$listoflangs[$pos-1]; - if (! preg_match('/'.$langcode.'/i',$langs->defaultlang) && $langcode2 != 'en') continue; // Show only english - print $langcode2.' '; - } - print '
'; - - // Only first language found is used for widget - $widgetid=$listofwidgets[$pos-1]; - - // Widget V3 - print ''; - - print '
'.$langs->trans("SorryNoHelpForYourLanguage").'
'; - -print '

'; - -// List of coaches -$sparkangellangcode=substr($langs->defaultlang,0,2); -if (! in_array($sparkangellangcode,array('fr','en','sp'))) $sparkangellangcode='en'; -print '
'; -print '* '.$langs->trans("ToGetHelpGoOnSparkAngels3",$urlsparkengels); -print '
'."\n"; -print '
'."\n"; -print ' '."\n"; -print ' '."\n"; -print ' '."\n"; -print ' '."\n"; -print ' '."\n"; -print ' '."\n"; -print ''."\n"; -print '
'."\n"; -print '
'."\n"; - -print '
'; -//print ''; -//print 'SparkAngels web site'; -//print $titlesparkangels; -//print ''; -print '
'; -//print $langs->trans("ToGetHelpGoOnSparkAngels2",$titlesparkangels).'
'; - - -// Otherwise, go back to help center home -print '

'; -print '* '.$langs->trans("BackToHelpCenter",'index.php'); -print '

'; - - - -pFooter();