Merge pull request #780 from FHenry/develop
Add information on Project ODT into ODT project
This commit is contained in:
commit
f27f601a73
@ -20,17 +20,30 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
|
* \file htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
|
||||||
* \ingroup commande
|
* \ingroup project
|
||||||
* \brief File of class to build ODT documents for third parties
|
* \brief File of class to build ODT documents for third parties
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||||
|
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
|
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
|
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
|
||||||
|
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
|
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||||
|
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||||
|
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||||
|
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||||
|
if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php';
|
||||||
|
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,7 +111,7 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
function get_substitutionarray_object($object,$outputlangs)
|
function get_substitutionarray_object($object,$outputlangs)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
dol_syslog(get_class($this)."::get_substitutionarray_object object=".var_export($object,true), LOG_DEBUG);
|
|
||||||
return array(
|
return array(
|
||||||
'object_id'=>$object->id,
|
'object_id'=>$object->id,
|
||||||
'object_ref'=>$object->ref,
|
'object_ref'=>$object->ref,
|
||||||
@ -111,37 +124,102 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
'object_note_private'=>$object->note_private,
|
'object_note_private'=>$object->note_private,
|
||||||
'object_note_public'=>$object->note_public,
|
'object_note_public'=>$object->note_public,
|
||||||
'object_public'=>$object->public,
|
'object_public'=>$object->public,
|
||||||
'object_statut'=>$object->getLibStatut()
|
'object_statut'=>html_entity_decode($object->getLibStatut())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define array with couple substitution key => substitution value
|
* Define array with couple substitution key => substitution value
|
||||||
*
|
*
|
||||||
* @param array $line Array of lines
|
* @param array $task Task Object
|
||||||
* @param Translate $outputlangs Lang object to use for output
|
* @param Translate $outputlangs Lang object to use for output
|
||||||
* @return array Return a substitution array
|
* @return array Return a substitution array
|
||||||
*/
|
*/
|
||||||
function get_substitutionarray_lines($line,$outputlangs)
|
function get_substitutionarray_tasks($task,$outputlangs)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'line_ref'=>$line->ref,
|
'task_ref'=>$task->ref,
|
||||||
'line_fk_project'=>$line->fk_project,
|
'task_fk_project'=>$task->fk_project,
|
||||||
'line_projectref'=>$line->projectref,
|
'task_projectref'=>$task->projectref,
|
||||||
'line_projectlabel'=>$line->projectlabel,
|
'task_projectlabel'=>$task->projectlabel,
|
||||||
'line_label'=>$line->label,
|
'task_label'=>$task->label,
|
||||||
'line_description'=>$line->description,
|
'task_description'=>$task->description,
|
||||||
'line_fk_parent'=>$line->fk_parent,
|
'task_fk_parent'=>$task->fk_parent,
|
||||||
'line_duration'=>$line->duration,
|
'task_duration'=>$task->duration,
|
||||||
'line_progress'=>$line->progress,
|
'task_progress'=>$task->progress,
|
||||||
'line_public'=>$line->public,
|
'task_public'=>$task->public,
|
||||||
'line_date_start'=>dol_print_date($line->date_start,'day'),
|
'task_date_start'=>dol_print_date($task->date_start,'day'),
|
||||||
'line_date_end'=>dol_print_date($line->date_end,'day')
|
'task_date_end'=>dol_print_date($task->date_end,'day')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple substitution key => substitution value
|
||||||
|
*
|
||||||
|
* @param array $contact Contact array
|
||||||
|
* @param Translate $outputlangs Lang object to use for output
|
||||||
|
* @return array Return a substitution array
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_project_contacts($contact,$outputlangs)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'projcontacts_id'=>$contact['id'],
|
||||||
|
'projcontacts_rowid'=>$contact['rowid'],
|
||||||
|
'projcontacts_role'=>$contact['libelle'],
|
||||||
|
'projcontacts_lastname'=>$contact['lastname'],
|
||||||
|
'projcontacts_firstname'=>$contact['firstname'],
|
||||||
|
'projcontacts_fullcivname'=>$contact['fullname'],
|
||||||
|
'projcontacts_socname'=>$contact['socname'],
|
||||||
|
'projcontacts_email'=>$contact['email']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple substitution key => substitution value
|
||||||
|
*
|
||||||
|
* @param array $file file array
|
||||||
|
* @param Translate $outputlangs Lang object to use for output
|
||||||
|
* @return array Return a substitution array
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_project_file($file,$outputlangs)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'projfile_name'=>$file['name'],
|
||||||
|
'projfile_date'=>dol_print_date($file['date'],'day'),
|
||||||
|
'projfile_size'=>$file['size']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple substitution key => substitution value
|
||||||
|
*
|
||||||
|
* @param array $refdetail Reference array
|
||||||
|
* @param Translate $outputlangs Lang object to use for output
|
||||||
|
* @return array Return a substitution array
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_project_reference($refdetail,$outputlangs)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
return array(
|
||||||
|
'projref_type'=>$refdetail['type'],
|
||||||
|
'projref_ref'=>$refdetail['ref'],
|
||||||
|
'projref_date'=>dol_print_date($refdetail['date'],'day'),
|
||||||
|
'projref_socname'=>$refdetail['socname'],
|
||||||
|
'projref_amountht'=>price($refdetail['amountht'],0,$outputlangs),
|
||||||
|
'projref_amountttc'=>price($refdetail['amountttc'],0,$outputlangs),
|
||||||
|
'projref_status'=>$refdetail['status']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return description of a module
|
* Return description of a module
|
||||||
*
|
*
|
||||||
@ -173,7 +251,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
{
|
{
|
||||||
$tmpdir=trim($tmpdir);
|
$tmpdir=trim($tmpdir);
|
||||||
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||||
if (! $tmpdir) { unset($listofdir[$key]); continue; }
|
if (! $tmpdir) {
|
||||||
|
unset($listofdir[$key]); continue;
|
||||||
|
}
|
||||||
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -294,16 +374,6 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
|
|
||||||
dol_mkdir($conf->projet->dir_temp);
|
dol_mkdir($conf->projet->dir_temp);
|
||||||
|
|
||||||
|
|
||||||
// List of all contact
|
|
||||||
$usecontact=false;
|
|
||||||
$arrayidcontact=$object->liste_contact(-1,'internal');
|
|
||||||
if (count($arrayidcontact) > 0)
|
|
||||||
{
|
|
||||||
$usecontact=true;
|
|
||||||
$result=$object->fetch_contact($arrayidcontact[0]['id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$socobject=$object->thirdparty;
|
$socobject=$object->thirdparty;
|
||||||
|
|
||||||
// Make substitution
|
// Make substitution
|
||||||
@ -330,6 +400,9 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
//print html_entity_decode($odfHandler->__toString());
|
//print html_entity_decode($odfHandler->__toString());
|
||||||
//print exit;
|
//print exit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Make substitutions into odt of user info
|
// Make substitutions into odt of user info
|
||||||
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
|
$tmparray=$this->get_substitutionarray_user($user,$outputlangs);
|
||||||
//var_dump($tmparray); exit;
|
//var_dump($tmparray); exit;
|
||||||
@ -414,10 +487,10 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace tags of lines
|
// Replace tags of lines for tasks
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$listlines = $odfHandler->setSegment('lines');
|
$listlines = $odfHandler->setSegment('tasks');
|
||||||
|
|
||||||
$taskstatic = new Task($this->db);
|
$taskstatic = new Task($this->db);
|
||||||
|
|
||||||
@ -427,10 +500,12 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
|
|
||||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
|
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $socid, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($tasksarray as $task)
|
foreach ($tasksarray as $task)
|
||||||
{
|
{
|
||||||
$tmparray=$this->get_substitutionarray_lines($task,$outputlangs);
|
$tmparray=$this->get_substitutionarray_tasks($task,$outputlangs);
|
||||||
complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines");
|
//complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines");
|
||||||
foreach($tmparray as $key => $val)
|
foreach($tmparray as $key => $val)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -455,6 +530,241 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace tags of project files
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines = $odfHandler->setSegment('projectfiles');
|
||||||
|
|
||||||
|
$upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$','name',SORT_ASC,1);
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($filearray as $filedetail)
|
||||||
|
{
|
||||||
|
//dol_syslog(get_class($this).'::ee $filedetail'.var_export($filedetail,true));
|
||||||
|
$tmparray=$this->get_substitutionarray_project_file($filedetail,$outputlangs);
|
||||||
|
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(SegmentException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace tags of lines for contacts
|
||||||
|
$sourcearray=array('internal','external');
|
||||||
|
$contact_arrray=array();
|
||||||
|
foreach ($sourcearray as $source) {
|
||||||
|
$contact_temp=$object->liste_contact(-1,$source);
|
||||||
|
if ((is_array($contact_temp) && count($contact_temp) > 0))
|
||||||
|
{
|
||||||
|
$contact_arrray=array_merge($contact_arrray,$contact_temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((is_array($contact_arrray) && count($contact_arrray) > 0))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines = $odfHandler->setSegment('projectcontacts');
|
||||||
|
|
||||||
|
foreach ($contact_arrray as $contact)
|
||||||
|
{
|
||||||
|
if ($contact['source']=='internal') {
|
||||||
|
$objectdetail=new User($this->db);
|
||||||
|
$objectdetail->fetch($contact['id']);
|
||||||
|
$contact['socname']=$mysoc->name;
|
||||||
|
} elseif ($contact['source']=='external') {
|
||||||
|
$objectdetail=new Contact($this->db);
|
||||||
|
$objectdetail->fetch($contact['id']);
|
||||||
|
|
||||||
|
$soc=new Societe($this->db);
|
||||||
|
$soc->fetch($contact['socid']);
|
||||||
|
$contact['socname']=$soc->name;
|
||||||
|
}
|
||||||
|
$contact['fullname']=$objectdetail->getFullName($outputlangs,1);
|
||||||
|
|
||||||
|
$tmparray=$this->get_substitutionarray_project_contacts($contact,$outputlangs);
|
||||||
|
complete_substitutions_array($tmparray, $outputlangs, $contact, $contact, "completesubstitutionarray_lines");
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(SegmentException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//List of referent
|
||||||
|
|
||||||
|
$listofreferent=array(
|
||||||
|
'propal'=>array(
|
||||||
|
'title'=>"ListProposalsAssociatedProject",
|
||||||
|
'class'=>'Propal',
|
||||||
|
'test'=>$conf->propal->enabled),
|
||||||
|
'order'=>array(
|
||||||
|
'title'=>"ListOrdersAssociatedProject",
|
||||||
|
'class'=>'Commande',
|
||||||
|
'test'=>$conf->commande->enabled),
|
||||||
|
'invoice'=>array(
|
||||||
|
'title'=>"ListInvoicesAssociatedProject",
|
||||||
|
'class'=>'Facture',
|
||||||
|
'test'=>$conf->facture->enabled),
|
||||||
|
'invoice_predefined'=>array(
|
||||||
|
'title'=>"ListPredefinedInvoicesAssociatedProject",
|
||||||
|
'class'=>'FactureRec',
|
||||||
|
'test'=>$conf->facture->enabled),
|
||||||
|
'order_supplier'=>array(
|
||||||
|
'title'=>"ListSupplierOrdersAssociatedProject",
|
||||||
|
'class'=>'CommandeFournisseur',
|
||||||
|
'test'=>$conf->fournisseur->enabled),
|
||||||
|
'invoice_supplier'=>array(
|
||||||
|
'title'=>"ListSupplierInvoicesAssociatedProject",
|
||||||
|
'class'=>'FactureFournisseur',
|
||||||
|
'test'=>$conf->fournisseur->enabled),
|
||||||
|
'contract'=>array(
|
||||||
|
'title'=>"ListContractAssociatedProject",
|
||||||
|
'class'=>'Contrat',
|
||||||
|
'test'=>$conf->contrat->enabled),
|
||||||
|
'intervention'=>array(
|
||||||
|
'title'=>"ListFichinterAssociatedProject",
|
||||||
|
'class'=>'Fichinter',
|
||||||
|
'disableamount'=>1,
|
||||||
|
'test'=>$conf->ficheinter->enabled),
|
||||||
|
'trip'=>array(
|
||||||
|
'title'=>"ListTripAssociatedProject",
|
||||||
|
'class'=>'Deplacement',
|
||||||
|
'disableamount'=>1,
|
||||||
|
'test'=>$conf->deplacement->enabled),
|
||||||
|
'agenda'=>array(
|
||||||
|
'title'=>"ListActionsAssociatedProject",
|
||||||
|
'class'=>'ActionComm',
|
||||||
|
'disableamount'=>1,
|
||||||
|
'test'=>$conf->agenda->enabled)
|
||||||
|
);
|
||||||
|
|
||||||
|
//Inser refenrence
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines = $odfHandler->setSegment('projectrefs');
|
||||||
|
|
||||||
|
foreach ($listofreferent as $keyref => $valueref)
|
||||||
|
{
|
||||||
|
$title=$valueref['title'];
|
||||||
|
$classname=$valueref['class'];
|
||||||
|
$qualified=$valueref['test'];
|
||||||
|
if ($qualified)
|
||||||
|
{
|
||||||
|
$elementarray = $object->get_element_list($keyref);
|
||||||
|
if (count($elementarray)>0 && is_array($elementarray))
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
$total_ht = 0;
|
||||||
|
$total_ttc = 0;
|
||||||
|
$num=count($elementarray);
|
||||||
|
for ($i = 0; $i < $num; $i++)
|
||||||
|
{
|
||||||
|
$ref_array=array();
|
||||||
|
$ref_array['type']=$langs->trans($classname);
|
||||||
|
|
||||||
|
$element = new $classname($this->db);
|
||||||
|
$element->fetch($elementarray[$i]);
|
||||||
|
$element->fetch_thirdparty();
|
||||||
|
|
||||||
|
//Ref object
|
||||||
|
$ref_array['ref']=$element->ref;
|
||||||
|
|
||||||
|
//Date object
|
||||||
|
$dateref=$element->date;
|
||||||
|
if (empty($dateref)) $dateref=$element->datep;
|
||||||
|
if (empty($dateref)) $dateref=$element->date_contrat;
|
||||||
|
$ref_array['date']=$dateref;
|
||||||
|
|
||||||
|
//Soc object
|
||||||
|
if (is_object($element->thirdparty)) {
|
||||||
|
$ref_array['socname']=$element->thirdparty->name;
|
||||||
|
} else {
|
||||||
|
$ref_array['socname']='';
|
||||||
|
}
|
||||||
|
|
||||||
|
//Amount object
|
||||||
|
if (empty($valueref['disableamount'])) {
|
||||||
|
if (!empty($element->total_ht)) {
|
||||||
|
$ref_array['amountht']=$element->total_ht;
|
||||||
|
$ref_array['amountttc']=$element->total_ttc;
|
||||||
|
}else {
|
||||||
|
$ref_array['amountht']=0;
|
||||||
|
$ref_array['amountttc']=0;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$ref_array['amountht']='';
|
||||||
|
$ref_array['amountttc']='';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ref_array['status']=html_entity_decode($element->getLibStatut(0));
|
||||||
|
|
||||||
|
$tmparray=$this->get_substitutionarray_project_reference($ref_array,$outputlangs);
|
||||||
|
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(SegmentException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Write new file
|
// Write new file
|
||||||
//$result=$odfHandler->exportAsAttachedFile('toto');
|
//$result=$odfHandler->exportAsAttachedFile('toto');
|
||||||
$odfHandler->saveToDisk($file);
|
$odfHandler->saveToDisk($file);
|
||||||
@ -477,5 +787,4 @@ class doc_generic_project_odt extends ModelePDFProjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Binary file not shown.
@ -400,7 +400,7 @@ if (! $error && $db->connected && $action == "set")
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
$srcroot=$main_dir.'/install/doctemplates';
|
$srcroot=$main_dir.'/install/doctemplates';
|
||||||
$destroot=$main_data_dir.'/doctemplates';
|
$destroot=$main_data_dir.'/doctemplates';
|
||||||
$docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice');
|
$docs=array('thirdparties' => 'thirdparty', 'proposals' => 'proposal', 'orders' => 'order', 'invoices' => 'invoice', 'projects' => 'project');
|
||||||
foreach($docs as $cursordir => $cursorfile)
|
foreach($docs as $cursordir => $cursorfile)
|
||||||
{
|
{
|
||||||
$src=$srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt';
|
$src=$srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user