diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c92f96255a5..1d71f5f27e6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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.'
'; - + $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 ''.$langs->trans('Qty').''; print ''.$langs->trans('ReductionShort').''; } - + /** * 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 : ' '; $this->tpl['remise_percent'] = (($line->info_bits & 2) != 2) ? $line->remise_percent.'%' : ' '; - + include(DOL_DOCUMENT_ROOT.'/core/tpl/originproductline.tpl.php'); } } diff --git a/htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php index c6809ac57b5..ba97b03ee0c 100644 --- a/htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -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' => '}') diff --git a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql index 00e52b04d23..0939ed2d94f 100755 --- a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql +++ b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql @@ -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'; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index da21c574d22..dff9aa5e390 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -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 diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index 5d185aded25..b2e07c7d0c4 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_don.sql b/htdocs/install/mysql/tables/llx_don.sql index 5cb04fe4312..90af3d1cdd2 100644 --- a/htdocs/install/mysql/tables/llx_don.sql +++ b/htdocs/install/mysql/tables/llx_don.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_expedition.sql b/htdocs/install/mysql/tables/llx_expedition.sql index 2599379bb66..be36be795b4 100644 --- a/htdocs/install/mysql/tables/llx_expedition.sql +++ b/htdocs/install/mysql/tables/llx_expedition.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index f6129431c89..a6c438ba3f0 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 0815c6b6f93..9dfb28c164e 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index 284d9b1a555..887db35ae10 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_livraison.sql index 912407b8d67..908480447d1 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_livraison.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 60fcccba875..24efed56de4 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -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; diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 787be3bdf21..f412eefcaa0 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -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;