Work on ODT generation

This commit is contained in:
Laurent Destailleur 2011-02-20 20:53:26 +00:00
parent 949dbd8dc4
commit 0ebe9c6f01
13 changed files with 39 additions and 25 deletions

View File

@ -34,7 +34,7 @@
class CommonObject
{
var $db;
var $linkedObjectBlock;
var $objectid;
@ -673,8 +673,10 @@ class CommonObject
return -1;
}
$newmodelpdf=dol_trunc($modelpdf,255);
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET model_pdf = '".$modelpdf."'";
$sql.= " SET model_pdf = '".$this->db->escape($newmodelpdf)."'";
$sql.= " WHERE rowid = ".$this->id;
// if ($this->element == 'facture') $sql.= " AND fk_statut < 2";
// if ($this->element == 'propal') $sql.= " AND fk_statut = 0";
@ -1286,7 +1288,7 @@ class CommonObject
$actionfile = 'actions_'.$module.'.class.php';
$daofile = 'dao_'.$module.'.class.php';
$pathroot = '';
// Include actions class (controller)
dol_include_once($path.$actionfile);
@ -1358,7 +1360,7 @@ class CommonObject
global $langs,$bc;
//print 'objecttype='.$objecttype.'<br>';
$this->objectid = $objectid;
$num = sizeof($this->objectid);
@ -1381,7 +1383,7 @@ class CommonObject
}
$this->linkedObjectBlock = new $classname($this->db);
dol_include_once('/'.$tplpath.'/tpl/linkedobjectblock.tpl.php');
return $num;
}
}
@ -1525,7 +1527,7 @@ class CommonObject
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
}
/**
* Return HTML with list of origin lines
*/
@ -1560,7 +1562,7 @@ class CommonObject
function printOriginLine($line,$var)
{
global $langs,$bc;
//var_dump($line);
$date_start=$line->date_debut_prevue;
@ -1627,7 +1629,7 @@ class CommonObject
$this->tpl['price'] = price($line->subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
$this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? $line->remise_percent.'%' : '&nbsp;';
include(DOL_DOCUMENT_ROOT.'/core/tpl/originproductline.tpl.php');
}
}

View File

@ -242,15 +242,15 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
$outputlangs->load("bills");
if ($conf->societe->dir_output)
if ($conf->facture->dir_output)
{
// If $object is id instead of object
if (! is_object($object))
{
$id = $object;
$object = new Societe($this->db);
$object = new Facture($this->db);
$object->fetch($id);
if ($result < 0)
@ -260,8 +260,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
}
$objectref = dol_sanitizeFileName($object->id);
$dir = $conf->societe->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output;
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
@ -285,12 +285,12 @@ class doc_generic_invoice_odt extends ModelePDFFactures
//print "file=".$file;
//print "conf->societe->dir_temp=".$conf->societe->dir_temp;
create_exdir($conf->societe->dir_temp);
create_exdir($conf->facture->dir_temp);
// Open and load template
require_once(DOL_DOCUMENT_ROOT.'/includes/odtphp/odf.php');
$odfHandler = new odf($srctemplatepath, array(
'PATH_TO_TMP' => $conf->societe->dir_temp,
'PATH_TO_TMP' => $conf->facture->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}')

View File

@ -12,6 +12,18 @@
ALTER TABLE llx_c_actioncomm add COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_commande_fournisseur MODIFY model_pdf varchar(255);
ALTER TABLE llx_commande MODIFY model_pdf varchar(255);
ALTER TABLE llx_don MODIFY model_pdf varchar(255);
ALTER TABLE llx_expedition MODIFY model_pdf varchar(255);
ALTER TABLE llx_facture_fourn MODIFY model_pdf varchar(255);
ALTER TABLE llx_facture MODIFY model_pdf varchar(255);
ALTER TABLE llx_fichinter MODIFY model_pdf varchar(255);
ALTER TABLE llx_livraison MODIFY model_pdf varchar(255);
ALTER TABLE llx_projet MODIFY model_pdf varchar(255);
ALTER TABLE llx_propal MODIFY model_pdf varchar(255);
-- Delete old constants
DELETE from llx_const where NAME = 'MAIN_MENU_BARRETOP';
DELETE from llx_const where NAME = 'MAIN_MENUFRONT_BARRETOP';

View File

@ -53,7 +53,7 @@ create table llx_commande
total_ttc double(24,8) default 0,
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
facture tinyint default 0,
fk_cond_reglement integer, -- condition de reglement

View File

@ -49,7 +49,7 @@ create table llx_commande_fournisseur
total_ttc double(24,8) default 0,
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
fk_methode_commande integer default 0
)type=innodb;

View File

@ -45,6 +45,6 @@ create table llx_don
fk_user_valid integer NULL,
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
import_key varchar(14)
)type=innodb;

View File

@ -46,6 +46,6 @@ create table llx_expedition
weight_units integer,
weight integer,
note text,
model_pdf varchar(50)
model_pdf varchar(255)
)type=innodb;

View File

@ -68,7 +68,7 @@ create table llx_facture
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
import_key varchar(14)
)type=innodb;

View File

@ -61,7 +61,7 @@ create table llx_facture_fourn
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
import_key varchar(14)
)type=innodb;

View File

@ -38,6 +38,6 @@ create table llx_fichinter
description text,
note_private text,
note_public text,
model_pdf varchar(50)
model_pdf varchar(255)
)type=innodb;

View File

@ -38,6 +38,6 @@ create table llx_livraison
total_ht double(24,8) DEFAULT 0,
note text,
note_public text,
model_pdf varchar(50)
model_pdf varchar(255)
)type=innodb;

View File

@ -36,5 +36,5 @@ create table llx_projet
fk_statut smallint DEFAULT 0 NOT NULL,
note_private text,
note_public text,
model_pdf varchar(50)
model_pdf varchar(255)
)type=innodb;

View File

@ -57,7 +57,7 @@ create table llx_propal
note text,
note_public text,
model_pdf varchar(50),
model_pdf varchar(255),
date_livraison date DEFAULT NULL, -- delivery date
fk_adresse_livraison integer -- delivery address (deprecated)
)type=innodb;