forked from Wavyzz/dolibarr
Merge branch 'oop-pdf' of github.com:marcosgdf/dolibarr into
marcosgdf-oop-pdf Conflicts: htdocs/projet/class/project.class.php
This commit is contained in:
@@ -156,7 +156,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
@@ -176,7 +176,7 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->pr
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
@@ -475,7 +475,7 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||
@@ -676,7 +676,7 @@ if ($action == 'modif' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,7 +890,7 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['prod_entry_mode']);
|
||||
@@ -1018,7 +1018,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
unset($_POST ['qty']);
|
||||
@@ -1060,7 +1060,7 @@ else if ($action == 'builddoc' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$result = propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
@@ -1146,7 +1146,7 @@ else if ($action == 'up' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||
@@ -1165,7 +1165,7 @@ else if ($action == 'down' && $user->rights->propal->creer) {
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||
@@ -2338,7 +2338,7 @@ if ($action == 'create')
|
||||
|
||||
// Build document if it not exists
|
||||
if (! $file || ! is_readable($file)) {
|
||||
$result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $result);
|
||||
exit();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -1746,7 +1747,7 @@ class Propal extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
@@ -1768,7 +1769,7 @@ class Propal extends CommonObject
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
$this->generateDocument($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
@@ -2673,6 +2674,41 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a document onto disk according to template module.
|
||||
*
|
||||
* @param string $modele Force model to use ('' to not force)
|
||||
* @param Translate $outputlangs Object langs to use for output
|
||||
* @param int $hidedetails Hide details of lines
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $hideref Hide ref
|
||||
* @return int 0 if KO, 1 if OK
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$langs->load("propale");
|
||||
|
||||
// Positionne le modele sur le nom du modele a utiliser
|
||||
if (! dol_strlen($modele))
|
||||
{
|
||||
if (! empty($conf->global->PROPALE_ADDON_PDF))
|
||||
{
|
||||
$modele = $conf->global->PROPALE_ADDON_PDF;
|
||||
}
|
||||
else
|
||||
{
|
||||
$modele = 'azur';
|
||||
}
|
||||
}
|
||||
|
||||
$modelpath = "core/modules/propale/doc/";
|
||||
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user