diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c6d2ab46ff6..6b482f8f7ee 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1494,6 +1494,7 @@ class Propal extends CommonObject $this->fk_project = $obj->fk_project; $this->project = null; // Clear if another value was already set by fetch_projet + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; $this->note = $obj->note_private; // TODO deprecated diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a30d04fd761..7deccba7401 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1824,6 +1824,7 @@ class Commande extends CommonOrder $this->note = $obj->note_private; // deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; $this->mode_reglement_id = $obj->fk_mode_reglement; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 50b84840901..b5e3e61a18f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1581,6 +1581,7 @@ class Facture extends CommonInvoice $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; $this->user_valid = $obj->fk_user_valid; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->last_main_doc = $obj->last_main_doc; $this->situation_cycle_ref = $obj->situation_cycle_ref; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ab94e73b58c..03dd6883011 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -726,6 +726,7 @@ class Contrat extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->fk_projet = $obj->fk_project; // deprecated diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4ccabb364b7..46fb7141a12 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -314,7 +314,7 @@ abstract class CommonObject * @var string * @see SetDocModel() */ - public $modelpdf; + public $model_pdf; /** * @var string @@ -2375,7 +2375,8 @@ abstract class CommonObject $resql = $this->db->query($sql); if ($resql) { - $this->modelpdf = $modelpdf; + $this->model_pdf = $modelpdf; + $this->modelpdf = $modelpdf; // For bakward compatibility return 1; } else { dol_print_error($this->db); @@ -4538,7 +4539,7 @@ abstract class CommonObject * Common function for all objects extending CommonObject for generating documents * * @param string $modelspath Relative folder where generators are placed - * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf','alpha') for example. + * @param string $modele Generator to use. Caller must set it to obj->model_pdf or GETPOST('model_pdf','alpha') for example. * @param Translate $outputlangs Output language to use * @param int $hidedetails 1 to hide details. 0 by default * @param int $hidedesc 1 to hide product description. 0 by default diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 11c8b8ef1c6..478197d2c2b 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -50,8 +50,7 @@ class doc_generic_stock_odt extends ModelePDFStock public $phpmin = array(5, 6); /** - * Dolibarr version of the loaded document - * @var string + * @var string Dolibarr version of the loaded document */ public $version = 'dolibarr'; @@ -116,16 +115,10 @@ class doc_generic_stock_odt extends ModelePDFStock $form = new Form($this->db); $texte = $this->description.".
\n"; - $texte .= '
'; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) - { - $texte .= ''; - $texte .= ''; - $texte .= ''; - } $texte .= ''; // List of directories area @@ -161,35 +154,30 @@ class doc_generic_stock_odt extends ModelePDFStock $texte .= '
'; // Scan directories - if (count($listofdir)) + $nbofiles = count($listoffiles); + if (!empty($conf->global->STOCK_ADDON_PDF_ODT_PATH)) { - $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - - /*if ($conf->global->MAIN_STOCK_CHOOSE_ODT_DOCUMENT > 0) - { - // Model for creation - $liste=ModelePDFStock::liste_modeles($this->db); - $texte.= '
'; - $texte.= ''; - $texte.= ''; - $texte.= '"; - - $texte.= ''; - $texte.= ''; - $texte.= '"; - $texte.= ''; - - $texte.= ''; - $texte.= '"; - $texte.= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte.= $form->selectarray('value2',$liste,$conf->global->STOCK_ADDON_PDF_ODT_DEFAULT); - $texte.= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte.= $form->selectarray('value3',$liste,$conf->global->STOCK_ADDON_PDF_ODT_TOBILL); - $texte.= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte.= $form->selectarray('value4',$liste,$conf->global->STOCK_ADDON_PDF_ODT_CLOSED); - $texte.= "
'; - }*/ + $texte .= $langs->trans("NumberOfModelFilesFound").': '; + //$texte.=$nbofiles?'':''; + $texte .= count($listoffiles); + //$texte.=$nbofiles?'':''; + $texte .= ''; } + + if ($nbofiles) + { + $texte .= ''; + } + // Add input to upload a new template file. + $texte .= '
'.$langs->trans("UploadNewTemplate").' '; + $texte .= ''; + $texte .= ''; + $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index aad9b063861..babb1dc5009 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -510,7 +510,7 @@ class pdf_standard extends ModelePDFStock $nexY += 2; $curY = $nexY; - if (! $object->specimen) { + if ($nblines > 0) { $pdf->SetLineStyle(array('dash'=>'0', 'color'=>array(200, 200, 200))); $pdf->line($this->marge_gauche, $curY - 1, $this->page_largeur - $this->marge_droite, $curY - 1); $pdf->SetLineStyle(array('dash'=>0)); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 6b6cbb3d36e..d69d53f8486 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -686,6 +686,7 @@ class Don extends CommonObject $this->amount = $obj->amount; $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; // Retreive all extrafield diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e6dbf827fce..46d964756ff 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -570,6 +570,7 @@ class Expedition extends CommonObject $this->date_shipping = $this->db->jdate($obj->date_expedition); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->fk_delivery_address = $obj->fk_address; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->shipping_method_id = $obj->fk_shipping_method; $this->shipping_method = $obj->shipping_method; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 754fc8dd507..c6c5fd587e6 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -448,7 +448,8 @@ class Fichinter extends CommonObject $this->fk_project = $obj->fk_project; $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; - $this->modelpdf = $obj->model_pdf; + $this->model_pdf = $obj->model_pdf; + $this->modelpdf = $obj->model_pdf; $this->fk_contrat = $obj->fk_contrat; $this->user_creation = $obj->fk_user_author; diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 66475f83edf..183f3609c40 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -280,6 +280,7 @@ class FichinterRec extends Fichinter $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->rang = $obj->rang; $this->special_code = $obj->special_code; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f6d506a28be..4657b49899d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -392,6 +392,7 @@ class CommandeFournisseur extends CommonOrder $this->note = $obj->note_private; // deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; //Incoterms diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 04525afa04d..456866b78cb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -710,7 +710,7 @@ class FactureFournisseur extends CommonInvoice $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->model_pdf = $obj->model_pdf; - $this->modelpdf = $obj->model_pdf; + $this->modelpdf = $obj->model_pdf; $this->import_key = $obj->import_key; //Incoterms diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 1429e39be8e..b308c2a5d5a 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -314,6 +314,7 @@ class Livraison extends CommonObject $this->note = $obj->note_private; //TODO deprecated $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->origin = $obj->origin; // May be 'shipping' $this->origin_id = $obj->origin_id; // May be id of shipping diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 5f234aaf46a..bb961611b3d 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -790,20 +790,20 @@ $modulepart = 'stock'; if ($action != 'create' && $action != 'edit' && $action != 'delete') { - print '
'; + print '
'; print '
'; print ''; // ancre // Documents $objectref = dol_sanitizeFileName($object->ref); - $relativepath = $comref.'/'.$objectref.'.pdf'; + $relativepath = $object->ref.'/'.$objectref.'.pdf'; $filedir = $conf->stock->dir_output.'/'.$objectref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $usercanread; $delallowed = $usercancreate; $modulepart = 'stock'; - print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; print '
'; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 5904df5e7e7..36d4fe4b62b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -451,8 +451,8 @@ class Entrepot extends CommonObject return -1; } - $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax"; - $sql .= ", entity"; + $sql = "SELECT rowid, entity, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id, phone, fax,"; + $sql .= " model_pdf, import_key"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; if ($id) { @@ -482,8 +482,11 @@ class Entrepot extends CommonObject $this->zip = $obj->zip; $this->town = $obj->town; $this->country_id = $obj->country_id; - $this->phone = $obj->phone; - $this->fax = $obj->fax; + $this->phone = $obj->phone; + $this->fax = $obj->fax; + + $this->model_pdf = $obj->model_pdf; + $this->import_key = $obj->import_key; // Retreive all extrafield // fetch optionals attributes and labels diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 5d2eb217031..cc340600131 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -521,6 +521,7 @@ class Project extends CommonObject $this->opp_amount = $obj->opp_amount; $this->opp_percent = $obj->opp_percent; $this->budget_amount = $obj->budget_amount; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->usage_opportunity = (int) $obj->usage_opportunity; $this->usage_task = (int) $obj->usage_task; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index f4cbb08ee9e..41ce49ad988 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -400,6 +400,7 @@ class Reception extends CommonObject $this->date_reception = $this->db->jdate($obj->date_reception); // Date real $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->fk_delivery_address = $obj->fk_address; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->shipping_method_id = $obj->fk_shipping_method; $this->tracking_number = $obj->tracking_number; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f65daf470e8..a1b339ec297 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1636,6 +1636,7 @@ class Societe extends CommonObject $this->note = $obj->note_private; // TODO Deprecated for backward comtability $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->default_lang = $obj->default_lang; $this->logo = $obj->logo; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 44d5e3bbd1a..0f0142312b1 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1244,6 +1244,7 @@ class SupplierProposal extends CommonObject $this->total_ttc = $obj->total; $this->socid = $obj->fk_soc; $this->fk_project = $obj->fk_project; + $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; $this->note = $obj->note_private; // TODO deprecated $this->note_private = $obj->note_private;