Skip to content

Commit

Permalink
Work on odt generation
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jun 15, 2010
1 parent b38d352 commit f74d4d6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
34 changes: 26 additions & 8 deletions htdocs/admin/facture.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
/*
* Actions
*/

if ($_POST["action"] == 'updateMask')
{
$maskconstinvoice=$_POST['maskconstinvoice'];
Expand Down Expand Up @@ -91,6 +92,20 @@
}
}

// 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';
Expand Down Expand Up @@ -395,19 +410,20 @@
{
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
Expand Down Expand Up @@ -489,9 +505,10 @@
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;
Expand Down Expand Up @@ -639,6 +656,7 @@
print "</table>\n";


dol_fiche_end();


$db->close();
Expand Down
5 changes: 5 additions & 0 deletions htdocs/includes/modules/modFacture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ function init()
*/
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ function doc_generic_odt($db)
$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
Expand Down

0 comments on commit f74d4d6

Please sign in to comment.