From 95a45e8f87d2d592511dd19fc5b8fed7ba7a23fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 22 Mar 2016 17:35:58 +0100 Subject: [PATCH] Prepare code to be able to download ODT templates --- .../doc/doc_generic_order_odt.modules.php | 20 ++++++++++++++++++- .../doc/doc_generic_shipment_odt.modules.php | 19 +++++++++++++++++- .../doc/doc_generic_invoice_odt.modules.php | 19 +++++++++++++++++- .../doc/doc_generic_project_odt.modules.php | 20 ++++++++++++++++++- .../task/doc/doc_generic_task_odt.modules.php | 20 ++++++++++++++++++- .../doc/doc_generic_proposal_odt.modules.php | 19 ++++++++++++++++-- .../societe/doc/doc_generic_odt.modules.php | 20 ++++++++++++++++++- ..._generic_supplier_proposal_odt.modules.php | 19 ++++++++++++++++-- 8 files changed, 146 insertions(+), 10 deletions(-) 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 ceccfdc5765..5529a25ce10 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 @@ -144,8 +144,26 @@ class doc_generic_order_odt extends ModelePDFCommandes $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->COMMANDE_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=count($listoffiles); + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } + $texte.= '</td>'; $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; 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 969fda5e072..9681e1a6d3e 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 @@ -145,7 +145,24 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->EXPEDITION_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=count($listoffiles); + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } $texte.= '</td>'; 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 657688cb20e..34d1bcf0b2e 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 @@ -144,7 +144,24 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->FACTURE_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=count($listoffiles); + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } $texte.= '</td>'; 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 b80eded4bd9..c18b6a17e8d 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 @@ -357,7 +357,25 @@ class doc_generic_project_odt extends ModelePDFProjects $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->PROJECT_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=$nbofiles; + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } $texte.= '</td>'; 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 19dbe2f5ad2..e9dbc1d2adc 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 @@ -358,7 +358,25 @@ class doc_generic_task_odt extends ModelePDFTask $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=$nbofiles; + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } $texte.= '</td>'; 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 e2272ba6ffb..4ca44452c8a 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 @@ -149,10 +149,25 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) + $nbofiles=count($listoffiles); + if (! empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) { - $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=count($listoffiles); + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { // Model for creation 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 548e72b5675..63dbc12cf5b 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -131,8 +131,26 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte.= '</table>'; // Scan directories - if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $nbofiles=count($listoffiles); + if (! empty($conf->global->COMPANY_ADDON_PDF_ODT_PATH)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=$nbofiles; + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; + } + $texte.= '</td>'; $texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">'; 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 0a468681edc..a820265571c 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 @@ -149,9 +149,24 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte.= '<br></div></div>'; // Scan directories - if (count($listofdir)) + $nbofiles=count($listoffiles); + if (! empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)) { - $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>'; + $texte.=$langs->trans("NumberOfModelFilesFound").': <b>'; + //$texte.=$nbofiles?'<a id="a_'.get_class($this).'" href="#">':''; + $texte.=count($listoffiles); + //$texte.=$nbofiles?'</a>':''; + $texte.='</b>'; + } + + if ($nbofiles) + { + $texte.='<div id="div_'.get_class($this).'" class="hidden">'; + foreach($listoffiles as $file) + { + $texte.=$file['name'].'<br>'; + } + $texte.='<div id="div_'.get_class($this).'">'; if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { -- GitLab