Work on odt generation

This commit is contained in:
Laurent Destailleur
2010-06-15 21:52:41 +00:00
parent b38d352c4b
commit f74d4d645f
3 changed files with 33 additions and 8 deletions

View File

@@ -46,6 +46,7 @@ $dir = DOL_DOCUMENT_ROOT."/includes/modules/facture/";
/*
* Actions
*/
if ($_POST["action"] == 'updateMask')
{
$maskconstinvoice=$_POST['maskconstinvoice'];
@@ -91,6 +92,20 @@ if ($_GET["action"] == 'specimen')
}
}
// define constants for models generator that need parameters
if ($_POST["action"] == 'setModuleOptions')
{
for($i=0;$i < count($_POST);$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=$_POST["param".$i];
$value=$_POST["value".$i];
if ($param) dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
}
}
}
if ($_GET["action"] == 'set')
{
$type='invoice';
@@ -395,19 +410,20 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$var = !$var;
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
print '<tr '.$bc[$var].'><td width="100">';
echo "$name";
print "</td><td>\n";
require_once($dir.$file);
$module = new $classname($db);
print $module->description;
print '<tr '.$bc[$var].'><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module,'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
@@ -489,9 +505,10 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
$var=True;
print '<input type="hidden" name="action" value="setribchq">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("PaymentMode").'</td>';
print '<td>';
print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=!$var;
@@ -639,6 +656,7 @@ print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")
print "</table>\n";
dol_fiche_end();
$db->close();

View File

@@ -235,6 +235,11 @@ class modFacture extends DolibarrModules
*/
function remove()
{
require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$dirodt=DOL_DATA_ROOT.'/doctemplates/invoices';
create_exdir($dirodt);
dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt',$dirodt.'/template_invoice.odt',0,0);
$sql = array();
return $this->_remove($sql);

View File

@@ -68,6 +68,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$this->marge_haute=0;
$this->marge_basse=0;
$this->option_logo = 1; // Affiche logo
// Recupere emmetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'etait pas defini