Work on odt module
This commit is contained in:
parent
b8c3177eb8
commit
e8163945fe
@ -141,7 +141,7 @@ if ($_GET["action"] == 'setdoc')
|
|||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader('',$langs->trans("CompanySetup"),'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers');
|
||||||
|
|
||||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup');
|
print_fiche_titre($langs->trans("CompanySetup"),$linkback,'setup');
|
||||||
@ -159,7 +159,7 @@ print ' <td>'.$langs->trans("Name").'</td>';
|
|||||||
print ' <td>'.$langs->trans("Description").'</td>';
|
print ' <td>'.$langs->trans("Description").'</td>';
|
||||||
print ' <td>'.$langs->trans("Example").'</td>';
|
print ' <td>'.$langs->trans("Example").'</td>';
|
||||||
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
print ' <td align="center">'.$langs->trans("Status").'</td>';
|
||||||
print ' <td align="center" width="30">'.$langs->trans("Infos").'</td>';
|
print ' <td align="center" width="60">'.$langs->trans("Infos").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -226,11 +226,11 @@ print_titre($langs->trans("AccountCodeManager"));
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td>'.$langs->trans("Example").'</td>';
|
print '<td>'.$langs->trans("Example").'</td>';
|
||||||
print '<td align="center">'.$langs->trans("Status").'</td>';
|
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||||
print '<td align="center" width="30"> </td>';
|
print '<td align="center" width="60"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -252,7 +252,7 @@ if ($handle)
|
|||||||
$var = !$var;
|
$var = !$var;
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr '.$bc[$var].'>';
|
||||||
print '<td width="140">'.$modCodeCompta->nom."</td><td>\n";
|
print '<td>'.$modCodeCompta->nom."</td><td>\n";
|
||||||
print $modCodeCompta->info($langs);
|
print $modCodeCompta->info($langs);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td nowrap="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
|
print '<td nowrap="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
|
||||||
@ -310,11 +310,10 @@ else
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Name").'</td>';
|
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||||
print '<td>'.$langs->trans("Description").'</td>';
|
print '<td>'.$langs->trans("Description").'</td>';
|
||||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
print '<td align="center">'.$langs->trans("Status").'</td>';
|
||||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
print '<td align="center" width="60" colspan="2">'.$langs->trans("Infos").'</td>';
|
||||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Infos").'</td>';
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -371,18 +370,6 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defaut
|
|
||||||
print "<td align=\"center\">";
|
|
||||||
if ($conf->global->COMPANY_ADDON_PDF == "$name")
|
|
||||||
{
|
|
||||||
print img_picto($langs->trans("Default"),'on');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php
|
* \file htdocs/includes/modules/societe/doc/doc_generic_odt.modules.php
|
||||||
* \ingroup project
|
* \ingroup societe
|
||||||
* \brief File of class to build ODT documents for third parties
|
* \brief File of class to build ODT documents for third parties
|
||||||
* \author Laurent Destailleur
|
* \author Laurent Destailleur
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
@ -32,8 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class doc_genericodt
|
* \class doc_generic_odt
|
||||||
* \brief Classe permettant de generer les projets au modele Baleine
|
* \brief Class to build documents using ODF templates generator
|
||||||
*/
|
*/
|
||||||
class doc_generic_odt extends ModeleThirdPartyDoc
|
class doc_generic_odt extends ModeleThirdPartyDoc
|
||||||
{
|
{
|
||||||
@ -70,6 +70,66 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple subtitution key => subtitution value
|
||||||
|
*
|
||||||
|
* @param unknown_type $mysoc
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_mysoc($mysoc)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'mycompany_name'=>$mysoc->name,
|
||||||
|
'mycompany_email'=>$mysoc->email,
|
||||||
|
'mycompany_phone'=>$mysoc->phone,
|
||||||
|
'mycompany_fax'=>$mysoc->fax,
|
||||||
|
'mycompany_address'=>$mysoc->address,
|
||||||
|
'mycompany_zip'=>$mysoc->zip,
|
||||||
|
'mycompany_town'=>$mysoc->town,
|
||||||
|
'mycompany_country'=>$mysoc->country,
|
||||||
|
'mycompany_url'=>$mysoc->url,
|
||||||
|
'mycompany_barcode'=>$mysoc->gencode,
|
||||||
|
'mycompany_vat'=>$mysoc->tva_intra,
|
||||||
|
'mycompany_idprof1'=>$mysoc->idprof1,
|
||||||
|
'mycompany_idprof2'=>$mysoc->idprof2,
|
||||||
|
'mycompany_idprof3'=>$mysoc->idprof3,
|
||||||
|
'mycompany_idprof4'=>$mysoc->idprof4,
|
||||||
|
'mycompany_note'=>$mysoc->note,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define array with couple subtitution key => subtitution value
|
||||||
|
*
|
||||||
|
* @param unknown_type $object
|
||||||
|
*/
|
||||||
|
function get_substitutionarray_object($object)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'company_name'=>$object->name,
|
||||||
|
'company_email'=>$object->email,
|
||||||
|
'company_phone'=>$object->phone,
|
||||||
|
'company_fax'=>$object->fax,
|
||||||
|
'company_address'=>$object->address,
|
||||||
|
'company_zip'=>$object->zip,
|
||||||
|
'company_town'=>$object->town,
|
||||||
|
'company_country'=>$object->country,
|
||||||
|
'company_url'=>$object->url,
|
||||||
|
'company_barcode'=>$object->gencode,
|
||||||
|
'company_vat'=>$object->tva_intra,
|
||||||
|
'company_customercode'=>$object->code_client,
|
||||||
|
'company_suppliercode'=>$object->code_fournisseur,
|
||||||
|
'company_customeraccountancycode'=>$object->code_compta,
|
||||||
|
'company_supplieraccountancycode'=>$object->code_compta_fournisseur,
|
||||||
|
'company_idprof1'=>$object->idprof1,
|
||||||
|
'company_idprof2'=>$object->idprof2,
|
||||||
|
'company_idprof3'=>$object->idprof3,
|
||||||
|
'company_idprof4'=>$object->idprof4,
|
||||||
|
'company_note'=>$object->note,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Return description of a module
|
/** \brief Return description of a module
|
||||||
* \return string Description
|
* \return string Description
|
||||||
*/
|
*/
|
||||||
@ -91,7 +151,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
|
|
||||||
// List of directories area
|
// List of directories area
|
||||||
$texte.= '<tr><td>';
|
$texte.= '<tr><td>';
|
||||||
$textbis=$langs->trans("ListOfDirectories");
|
$texttitle=$langs->trans("ListOfDirectories");
|
||||||
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->COMPANY_ADDON_PDF_ODT_PATH)));
|
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->COMPANY_ADDON_PDF_ODT_PATH)));
|
||||||
$listoffiles=array();
|
$listoffiles=array();
|
||||||
foreach($listofdir as $key=>$tmpdir)
|
foreach($listofdir as $key=>$tmpdir)
|
||||||
@ -99,14 +159,36 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
$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)) $textbis.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
|
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
|
||||||
if (sizeof($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
if (sizeof($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$texte.= $form->textwithpicto($textbis,$langs->trans("ListOfDirectoriesForModelGenODT"),1,'help');
|
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||||
|
// Add list of substitution keys
|
||||||
|
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||||
|
$dummy=new Societe($db);
|
||||||
|
$tmparray=$this->get_substitutionarray_mysoc($dummy);
|
||||||
|
$nb=0;
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
$texthelp.='{'.$key.'}<br>';
|
||||||
|
$nb++;
|
||||||
|
if ($nb >= 5) { $texthelp.='...<br>'; break; }
|
||||||
|
}
|
||||||
|
$tmparray=$this->get_substitutionarray_object($dummy);
|
||||||
|
$nb=0;
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
$texthelp.='{'.$key.'}<br>';
|
||||||
|
$nb++;
|
||||||
|
if ($nb >= 5) { $texthelp.='...<br>'; break; }
|
||||||
|
}
|
||||||
|
$texthelp.=$langs->trans("FullListOnOnlineDocumentation");
|
||||||
|
|
||||||
|
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help');
|
||||||
//var_dump($listofdir);
|
//var_dump($listofdir);
|
||||||
|
|
||||||
$texte.= '<textarea class="flat" cols="80" name="value1">';
|
$texte.= '<textarea class="flat" cols="80" name="value1">';
|
||||||
@ -145,7 +227,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
*/
|
*/
|
||||||
function write_file($object,$outputlangs,$srctemplatepath)
|
function write_file($object,$outputlangs,$srctemplatepath)
|
||||||
{
|
{
|
||||||
global $user,$langs,$conf;
|
global $user,$langs,$conf,$mysoc;
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||||
@ -197,20 +279,22 @@ class doc_generic_odt extends ModeleThirdPartyDoc
|
|||||||
|
|
||||||
create_exdir($conf->societe->dir_temp);
|
create_exdir($conf->societe->dir_temp);
|
||||||
|
|
||||||
// Define substitution array
|
// Open and load template
|
||||||
$soc=array('societe'=>'bb','nom'=>'ee','name'=>'tt');
|
|
||||||
|
|
||||||
// Read template
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/odtphp/odf.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/odtphp/odf.php');
|
||||||
$odfHandler = new odf($srctemplatepath, array(
|
$odfHandler = new odf($srctemplatepath, array(
|
||||||
'PATH_TO_TMP' => $conf->societe->dir_temp.'/',
|
'PATH_TO_TMP' => $conf->societe->dir_temp.'/',
|
||||||
'ZIP_PROXY' => 'PhpZipProxy'));
|
'ZIP_PROXY' => 'PhpZipProxy'));
|
||||||
|
|
||||||
// Make substitution
|
// Make substitutions
|
||||||
foreach($soc as $socProperty=>$socPropertyValue){
|
$tmparray=$this->get_substitutionarray_mysoc($mysoc);
|
||||||
try {
|
foreach($tmparray as $key=>$value)
|
||||||
$odfHandler->setVars($socProperty, $socPropertyValue, true, 'UTF-8');
|
{
|
||||||
} catch(OdfException $e) {}
|
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
$tmparray=$this->get_substitutionarray_object($object);
|
||||||
|
foreach($tmparray as $key=>$value)
|
||||||
|
{
|
||||||
|
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write new file
|
// Write new file
|
||||||
|
|||||||
@ -270,7 +270,8 @@ ListOfDirectories=Liste des répertoires de modèles OpenDocument
|
|||||||
ListOfDirectoriesForModelGenODT=Liste des répertoires contenant des documents modèles OpenDocument.<br><br>Indiquer les chemins complets de répertoire.<br>Ajouter un retour à la ligne entre chaque répertoire.<br>Pour indiquer un répertoire du module GED, indiquer<br><b>DOL_DATA_ROOT/ecm/nomdurepertoireged</b><br><br>Les fichiers modèles dans ces répertoires doivent se terminer par <b>.odt</b>.
|
ListOfDirectoriesForModelGenODT=Liste des répertoires contenant des documents modèles OpenDocument.<br><br>Indiquer les chemins complets de répertoire.<br>Ajouter un retour à la ligne entre chaque répertoire.<br>Pour indiquer un répertoire du module GED, indiquer<br><b>DOL_DATA_ROOT/ecm/nomdurepertoireged</b><br><br>Les fichiers modèles dans ces répertoires doivent se terminer par <b>.odt</b>.
|
||||||
NumberOfModelFilesFound=Nombre de fichiers modèles ODT trouvés dans ce(s) répertoire(s)
|
NumberOfModelFilesFound=Nombre de fichiers modèles ODT trouvés dans ce(s) répertoire(s)
|
||||||
ExampleOfDirectoriesForModelGen=Exemples de syntaxe:<br>c:\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir
|
ExampleOfDirectoriesForModelGen=Exemples de syntaxe:<br>c:\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir
|
||||||
|
FollowingSubstitutionKeysCanBeUsed=En plaçant les tags suivant dans le modèle, vous obtiendrez une subsitution avec la valeur personnalisée lors de la génération du document:
|
||||||
|
FullListOnOnlineDocumentation=Liste complète des tags disponibles sur la documentation utilisateur du module Tiers sur le wiki http://wiki.dolibarr.org
|
||||||
# Modules = undefined
|
# Modules = undefined
|
||||||
Module0Name = Utilisateurs & groupes
|
Module0Name = Utilisateurs & groupes
|
||||||
Module0Desc = Gestion des utilisateurs et groupes
|
Module0Desc = Gestion des utilisateurs et groupes
|
||||||
|
|||||||
@ -64,9 +64,12 @@ class Societe extends CommonObject
|
|||||||
var $gencod;
|
var $gencod;
|
||||||
|
|
||||||
// 4 identifiants professionnels (leur utilisation depend du pays)
|
// 4 identifiants professionnels (leur utilisation depend du pays)
|
||||||
var $siren; // IdProf1
|
var $siren; // IdProf1 - Deprecated
|
||||||
var $siret; // IdProf2
|
var $siret; // IdProf2 - Deprecated
|
||||||
var $ape; // IdProf3
|
var $ape; // IdProf3 - Deprecated
|
||||||
|
var $idprof1; // IdProf1
|
||||||
|
var $idprof2; // IdProf2
|
||||||
|
var $idprof3; // IdProf3
|
||||||
var $idprof4; // IdProf4
|
var $idprof4; // IdProf4
|
||||||
|
|
||||||
var $prefix_comm;
|
var $prefix_comm;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user