mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-16 22:41:30 +01:00
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:
@@ -482,7 +482,8 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
|||||||
}
|
}
|
||||||
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
|
// Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email
|
||||||
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
//if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
facture_pdf_create($db, $invoice, $invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
|
$invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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);
|
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);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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 {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
@@ -475,7 +475,7 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
|
||||||
@@ -676,7 +676,7 @@ if ($action == 'modif' && $user->rights->propal->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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']);
|
unset($_POST ['prod_entry_mode']);
|
||||||
@@ -1018,7 +1018,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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']);
|
unset($_POST ['qty']);
|
||||||
@@ -1060,7 +1060,7 @@ else if ($action == 'builddoc' && $user->rights->propal->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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) {
|
if ($result <= 0) {
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
@@ -1146,7 +1146,7 @@ else if ($action == 'up' && $user->rights->propal->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||||
@@ -1165,7 +1165,7 @@ else if ($action == 'down' && $user->rights->propal->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$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'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||||
@@ -2338,7 +2338,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file)) {
|
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) {
|
if ($result <= 0) {
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1746,7 +1747,7 @@ class Propal extends CommonObject
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
//$ret=$object->fetch($id); // Reload to get new records
|
//$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
|
// Call trigger
|
||||||
@@ -1768,7 +1769,7 @@ class Propal extends CommonObject
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
//$ret=$object->fetch($id); // Reload to get new records
|
//$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
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
commande_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);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
@@ -491,7 +491,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -722,7 +722,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST ['prod_entry_mode']);
|
unset($_POST ['prod_entry_mode']);
|
||||||
@@ -847,7 +847,7 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && GETPOST('
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST ['qty']);
|
unset($_POST ['qty']);
|
||||||
@@ -911,8 +911,9 @@ else if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->co
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -958,7 +959,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1023,8 +1024,9 @@ else if ($action == 'up' && $user->rights->commande->creer) {
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
commande_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 . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
@@ -1044,8 +1046,9 @@ else if ($action == 'down' && $user->rights->commande->creer) {
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
commande_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 . '#' . GETPOST('rowid'));
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
||||||
exit();
|
exit();
|
||||||
@@ -1073,7 +1076,7 @@ else if ($action == 'builddoc') // In get or post
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result = commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
if ($result <= 0) {
|
if ($result <= 0) {
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
@@ -2462,7 +2465,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
|||||||
|
|
||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file)) {
|
if (! $file || ! is_readable($file)) {
|
||||||
$result = commande_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) {
|
if ($result <= 0) {
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -3011,6 +3012,40 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk accordign to template module.
|
||||||
|
*
|
||||||
|
* @param string $modele Force le mnodele a utiliser ('' to not force)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @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,$hookmanager;
|
||||||
|
|
||||||
|
$langs->load("orders");
|
||||||
|
|
||||||
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->COMMANDE_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->COMMANDE_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'einstein';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/commande/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
$result = facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id);
|
||||||
@@ -417,7 +417,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->factu
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
||||||
@@ -495,7 +495,7 @@ else if ($action == 'confirm_modif' && ((empty($conf->global->MAIN_USE_ADVANCED_
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1305,7 +1305,7 @@ else if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST ['prod_entry_mode']);
|
unset($_POST ['prod_entry_mode']);
|
||||||
@@ -1436,7 +1436,7 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
@@ -1479,8 +1479,9 @@ else if ($action == 'up' && $user->rights->facture->creer) {
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||||
exit();
|
exit();
|
||||||
@@ -1501,8 +1502,9 @@ else if ($action == 'down' && $user->rights->facture->creer) {
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||||
exit();
|
exit();
|
||||||
@@ -1725,7 +1727,7 @@ else if ($action == 'builddoc') // En get ou en post
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result = facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
@@ -3727,7 +3729,7 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file)) {
|
if (! $file || ! is_readable($file)) {
|
||||||
$result = facture_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) {
|
if ($result <= 0) {
|
||||||
dol_print_error($db, $result);
|
dol_print_error($db, $result);
|
||||||
exit();
|
exit();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
@@ -3222,6 +3222,42 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template module.
|
||||||
|
*
|
||||||
|
* @param string $modele Force template to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @param int $hidedetails Hide details of lines
|
||||||
|
* @param int $hidedesc Hide description
|
||||||
|
* @param int $hideref Hide ref
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
// Positionne le modele sur le nom du modele a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->FACTURE_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->FACTURE_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'crabe';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/facture/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,9 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
$fac->generateDocument($fac->modelpdf, $outputlangs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
|
|||||||
@@ -98,7 +98,9 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
$fac->generateDocument($fac->modelpdf, $outputlangs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: card.php?id='.$paiement->id);
|
header('Location: card.php?id='.$paiement->id);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -2339,6 +2340,39 @@ class ContratLigne extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a contract document on disk using template defined into CONTRACT_ADDON_PDF
|
||||||
|
*
|
||||||
|
* @param string $modele force le modele a utiliser ('' par defaut)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @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,$langs,$user,$hookmanager;
|
||||||
|
|
||||||
|
$langs->load("contracts");
|
||||||
|
|
||||||
|
// Positionne modele sur le nom du modele de contrat a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->CONTRACT_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->CONTRACT_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'strato';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/contract/doc/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3505,4 +3505,96 @@ abstract class CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common function for all objects extending CommonObject for generating documents
|
||||||
|
*
|
||||||
|
* @param string $modelspath Relative folder where models are placed
|
||||||
|
* @param string $modele Model to use
|
||||||
|
* @param Translate $outputlangs Language to use
|
||||||
|
* @param int $hidedetails 1 to hide details. 0 by default
|
||||||
|
* @param int $hidedesc 1 to hide product description. 0 by default
|
||||||
|
* @param int $hideref 1 to hide product reference. 0 by default
|
||||||
|
* @return int 1 if OK -1 if not OK
|
||||||
|
*/
|
||||||
|
protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$srctemplatepath='';
|
||||||
|
|
||||||
|
// Increase limit for PDF build
|
||||||
|
$err=error_reporting();
|
||||||
|
error_reporting(0);
|
||||||
|
@set_time_limit(120);
|
||||||
|
error_reporting($err);
|
||||||
|
|
||||||
|
// If selected modele is a filename template (then $modele="modelname:filename")
|
||||||
|
$tmp=explode(':',$modele,2);
|
||||||
|
if (! empty($tmp[1]))
|
||||||
|
{
|
||||||
|
$modele=$tmp[0];
|
||||||
|
$srctemplatepath=$tmp[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search template files
|
||||||
|
$file=''; $classname=''; $filefound=0;
|
||||||
|
$dirmodels=array('/');
|
||||||
|
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
||||||
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
|
foreach(array('doc','pdf') as $prefix)
|
||||||
|
{
|
||||||
|
$file = $prefix."_".$modele.".modules.php";
|
||||||
|
|
||||||
|
// On verifie l'emplacement du modele
|
||||||
|
$file=dol_buildpath($reldir.$modelspath.$file,0);
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
$filefound=1;
|
||||||
|
$classname=$prefix.'_'.$modele;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($filefound) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Charge le modele
|
||||||
|
if ($filefound)
|
||||||
|
{
|
||||||
|
require_once $file;
|
||||||
|
|
||||||
|
$obj = new $classname($this->db);
|
||||||
|
//$obj->message = $message;
|
||||||
|
|
||||||
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
|
// output format that does not support UTF8.
|
||||||
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
|
if ($obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
||||||
|
{
|
||||||
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
|
|
||||||
|
// We delete old preview
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
dol_delete_preview($this);
|
||||||
|
|
||||||
|
// Success in building document. We build meta file.
|
||||||
|
dol_meta_create($this);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
|
dol_print_error($this->db,"Error generating document for ".__CLASS__.". Error: ".$obj->error);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
|
|||||||
if ($regenerate || ! dol_is_file($filename))
|
if ($regenerate || ! dol_is_file($filename))
|
||||||
{
|
{
|
||||||
if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n";
|
if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n";
|
||||||
$result=facture_pdf_create($db, $fac, $regenerate?$regenerate:$fac->modelpdf, $outputlangs);
|
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
|
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -159,94 +160,9 @@ abstract class ModeleNumRefCommandes
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Commande class
|
||||||
*/
|
*/
|
||||||
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function commande_pdf_create(DoliDB $db, Commande $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs,$hookmanager;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$langs->load("orders");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->COMMANDE_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->COMMANDE_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'einstein';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/commande/doc/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
//$obj->message = $message;
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// We delete old preview
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"order_pdf_create Error: ".$obj->error);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -154,92 +155,9 @@ class ModelNumRefContracts
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Contrat class
|
||||||
*/
|
*/
|
||||||
function contract_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function contract_pdf_create(DoliDB $db, Contrat $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$hookmanager;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$langs->load("contracts");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne modele sur le nom du modele de contrat a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->CONTRACT_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->CONTRACT_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'strato';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/contract/doc/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// We delete old preview
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"contract_pdf_create Error: ".$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -149,100 +150,9 @@ abstract class ModelNumRefExpedition
|
|||||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||||
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Expedition class
|
||||||
*/
|
*/
|
||||||
function expedition_pdf_create($db, $object, $modele, $outputlangs)
|
function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
return $object->generateDocument($modele, $outputlangs);
|
||||||
|
|
||||||
$langs->load("sendings");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Sets the model on the model name to use
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->EXPEDITION_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'rouget';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected model is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// We check the model location
|
|
||||||
$file=dol_buildpath($reldir."core/modules/expedition/doc/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the model
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
$result=$object->fetch_origin();
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
//require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
//dol_delete_preview($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_syslog("Erreur dans expedition_pdf_create");
|
|
||||||
dol_print_error($db,$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $conf->global->EXPEDITION_ADDON_PDF)
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_PDF_NotDefined");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -154,101 +155,10 @@ abstract class ModeleNumRefFactures
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Facture class
|
||||||
*/
|
*/
|
||||||
function facture_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function facture_pdf_create(DoliDB $db, Facture $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
$langs->load("bills");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
// Increase limit for PDF build
|
|
||||||
$err=error_reporting();
|
|
||||||
error_reporting(0);
|
|
||||||
@set_time_limit(120);
|
|
||||||
error_reporting($err);
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne le modele sur le nom du modele a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->FACTURE_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->FACTURE_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'crabe';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/facture/doc/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// We delete old preview
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"facture_pdf_create Error: ".$obj->error);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2006-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -154,92 +155,10 @@ abstract class ModeleNumRefDeliveryOrder
|
|||||||
* @param string $modele force le modele a utiliser ('' to not force)
|
* @param string $modele force le modele a utiliser ('' to not force)
|
||||||
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Livraison class
|
||||||
*/
|
*/
|
||||||
function delivery_order_pdf_create($db, $object, $modele, $outputlangs='')
|
function delivery_order_pdf_create(DoliDB $db, Livraison $object, $modele, $outputlangs='')
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
return $object->generateDocument($modele, $outputlangs);
|
||||||
|
|
||||||
$langs->load("deliveries");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne modele sur le nom du modele de bon de livraison a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->LIVRAISON_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->LIVRAISON_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'typhon';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/livraison/pdf/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object,$outputlangs) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_syslog("Erreur dans delivery_order_pdf_create");
|
|
||||||
dol_print_error($db,$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -151,93 +152,10 @@ abstract class ModeleNumRefProjects
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Project class
|
||||||
*/
|
*/
|
||||||
function project_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function project_pdf_create(DoliDB $db, Project $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$langs->load("projects");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne modele sur le nom du modele de projet a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->PROJECT_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->PROJECT_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele='baleine';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/project/pdf/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"project_pdf_create Error: ".$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010 Florian Henry <florian.henry<àopen-concept.pro>
|
* Copyright (C) 2010 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -152,92 +153,10 @@ abstract class ModeleNumRefTask
|
|||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @param HookManager $hookmanager Hook manager instance
|
* @param HookManager $hookmanager Hook manager instance
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Task class
|
||||||
*/
|
*/
|
||||||
function task_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
|
function task_pdf_create(DoliDB $db, Task $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager);
|
||||||
$langs->load("projects");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Positionne modele sur le nom du modele de projet a utiliser
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->PROJECT_TASK_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->PROJECT_TASK_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele='nodefault';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/project/task/pdf/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $hookmanager) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"task_pdf_create Error: ".$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -155,95 +156,10 @@ abstract class ModeleNumRefPropales
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Propal class
|
||||||
*/
|
*/
|
||||||
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$langs->load("propale");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// 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';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// On verifie l'emplacement du modele
|
|
||||||
$file=dol_buildpath($reldir."core/modules/propale/doc/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Charge le modele
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db);
|
|
||||||
//$obj->message = $message;
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// We delete old preview
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
// Success in building document. We build meta file.
|
|
||||||
dol_meta_create($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_print_error($db,"propal_pdf_create Error: ".$obj->error);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
/* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -143,105 +144,10 @@ abstract class ModeleNumRefSuppliersInvoices
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function supplier_invoice_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
|
||||||
$langs->load("suppliers");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
// Increase limit for PDF build
|
|
||||||
$err=error_reporting();
|
|
||||||
error_reporting(0);
|
|
||||||
@set_time_limit(120);
|
|
||||||
error_reporting($err);
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Set the model on the model name to use
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->INVOICE_SUPPLIER_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'canelle';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected modele is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// We checked the location of the model
|
|
||||||
$file=dol_buildpath($reldir."core/modules/supplier_invoice/pdf/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the model
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db,$object);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_syslog("Erreur dans supplier_invoice_pdf_create");
|
|
||||||
dol_print_error($db,$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $conf->global->INVOICE_SUPPLIER_ADDON_PDF)
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_INVOICE_SUPPLIER_ADDON_PDF_NotDefined");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param Object $object Supplier invoice
|
|
||||||
*/
|
*/
|
||||||
function __construct($db,$object)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$mysoc;
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
@@ -91,12 +90,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
|
|
||||||
$this->franchise=!$mysoc->tva_assuj;
|
$this->franchise=!$mysoc->tva_assuj;
|
||||||
|
|
||||||
// Get source company
|
|
||||||
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
|
||||||
if (! is_object($object->thirdparty)) $object->thirdparty=$mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
|
|
||||||
$this->emetteur=$object->thirdparty;
|
|
||||||
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
|
||||||
|
|
||||||
// Defini position des colonnes
|
// Defini position des colonnes
|
||||||
$this->posxdesc=$this->marge_gauche+1;
|
$this->posxdesc=$this->marge_gauche+1;
|
||||||
$this->posxtva=112;
|
$this->posxtva=112;
|
||||||
@@ -139,6 +132,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
{
|
{
|
||||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||||
|
|
||||||
|
// Get source company
|
||||||
|
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
|
||||||
|
if (! is_object($object->thirdparty)) $object->thirdparty=$mysoc; // If fetch_thirdparty fails, object has no socid (specimen)
|
||||||
|
$this->emetteur=$object->thirdparty;
|
||||||
|
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||||
|
|
||||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -149,104 +150,10 @@ abstract class ModeleNumRefSuppliersOrders
|
|||||||
* @param int $hidedesc Hide description
|
* @param int $hidedesc Hide description
|
||||||
* @param int $hideref Hide ref
|
* @param int $hideref Hide ref
|
||||||
* @return int 0 if KO, 1 if OK
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of CommandeFournisseur class
|
||||||
*/
|
*/
|
||||||
function supplier_order_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
function supplier_order_pdf_create(DoliDB $db, CommandeFournisseur $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
$langs->load("suppliers");
|
|
||||||
|
|
||||||
$error=0;
|
|
||||||
|
|
||||||
// Increase limit for PDF build
|
|
||||||
$err=error_reporting();
|
|
||||||
error_reporting(0);
|
|
||||||
@set_time_limit(120);
|
|
||||||
error_reporting($err);
|
|
||||||
|
|
||||||
$srctemplatepath='';
|
|
||||||
|
|
||||||
// Sets the model on the model name to use
|
|
||||||
if (! dol_strlen($modele))
|
|
||||||
{
|
|
||||||
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
|
|
||||||
{
|
|
||||||
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$modele = 'muscadet';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If selected model is a filename template (then $modele="modelname:filename")
|
|
||||||
$tmp=explode(':',$modele,2);
|
|
||||||
if (! empty($tmp[1]))
|
|
||||||
{
|
|
||||||
$modele=$tmp[0];
|
|
||||||
$srctemplatepath=$tmp[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search template files
|
|
||||||
$file=''; $classname=''; $filefound=0;
|
|
||||||
$dirmodels=array('/');
|
|
||||||
if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']);
|
|
||||||
foreach($dirmodels as $reldir)
|
|
||||||
{
|
|
||||||
foreach(array('doc','pdf') as $prefix)
|
|
||||||
{
|
|
||||||
$file = $prefix."_".$modele.".modules.php";
|
|
||||||
|
|
||||||
// We check the model location
|
|
||||||
$file=dol_buildpath($reldir."core/modules/supplier_order/pdf/".$file,0);
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
|
||||||
$filefound=1;
|
|
||||||
$classname=$prefix.'_'.$modele;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($filefound) break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load the model
|
|
||||||
if ($filefound)
|
|
||||||
{
|
|
||||||
require_once $file;
|
|
||||||
|
|
||||||
$obj = new $classname($db,$object);
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
|
||||||
// output format that does not support UTF8.
|
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
|
||||||
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
|
|
||||||
// we delete preview files
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
||||||
dol_delete_preview($object);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
|
||||||
dol_syslog("Erreur dans supplier_order_pdf_create");
|
|
||||||
dol_print_error($db,$obj->error);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (! $conf->global->COMMANDE_SUPPLIER_ADDON_PDF)
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_SUPPLIER_ADDON_PDF_NotDefined");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,9 +61,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param Object $object Supplier order
|
|
||||||
*/
|
*/
|
||||||
function __construct($db,$object)
|
function __construct($db)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$mysoc;
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($id); // Reload to get new records
|
$ret=$object->fetch($id); // Reload to get new records
|
||||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@@ -362,7 +362,7 @@ else if ($action == 'builddoc') // En get ou en post
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -1598,7 +1598,7 @@ else if ($id || $ref)
|
|||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file))
|
if (! $file || ! is_readable($file))
|
||||||
{
|
{
|
||||||
$result=expedition_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)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1532,6 +1533,39 @@ class Expedition extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cree un bon d'expedition sur disque
|
||||||
|
*
|
||||||
|
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||||
|
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||||
|
* @return int <=0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs)
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("sendings");
|
||||||
|
|
||||||
|
// Sets the model on the model name to use
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->EXPEDITION_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'rouget';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/expedition/doc/";
|
||||||
|
|
||||||
|
$this->fetch_origin();
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
*
|
*
|
||||||
@@ -2005,6 +2005,42 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template model.
|
||||||
|
*
|
||||||
|
* @param string $modele Force template to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object lang to use for traduction
|
||||||
|
* @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("suppliers");
|
||||||
|
|
||||||
|
// Sets the model on the model name to use
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'muscadet';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/supplier_order/pdf/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1670,4 +1671,38 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template model.
|
||||||
|
*
|
||||||
|
* @param string $modele Force template to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object lang a utiliser pour traduction
|
||||||
|
* @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("suppliers");
|
||||||
|
|
||||||
|
// Set the model on the model name to use
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->INVOICE_SUPPLIER_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'canelle';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/supplier_invoice/pdf/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_POST ['prod_entry_mode']);
|
unset($_POST ['prod_entry_mode']);
|
||||||
@@ -448,7 +448,7 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($object->id); // Reload to get new records
|
$ret=$object->fetch($object->id); // Reload to get new records
|
||||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -473,7 +473,7 @@ else if ($action == 'confirm_deleteproductline' && $confirm == 'yes' && $user->r
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($object->id); // Reload to get new records
|
$ret=$object->fetch($object->id); // Reload to get new records
|
||||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -504,7 +504,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->fourn
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($object->id); // Reload to get new records
|
$ret=$object->fetch($object->id); // Reload to get new records
|
||||||
supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -550,7 +550,7 @@ else if ($action == 'confirm_approve' && $confirm == 'yes' && $user->rights->fou
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
supplier_order_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);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
@@ -582,7 +582,7 @@ else if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fo
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
supplier_order_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);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
@@ -689,7 +689,9 @@ else if ($action == 'up' && $user->rights->fournisseur->commande->creer)
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -703,7 +705,9 @@ else if ($action == 'down' && $user->rights->fournisseur->commande->creer)
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_order_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -721,7 +725,7 @@ else if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) /
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||||
}
|
}
|
||||||
$result=supplier_order_pdf_create($db, $object,$object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result= $object->generateDocument($object->modelpdf,$outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -2033,7 +2037,7 @@ elseif (! empty($object->id))
|
|||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file))
|
if (! $file || ! is_readable($file))
|
||||||
{
|
{
|
||||||
$result=supplier_order_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)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ elseif ($action == 'add' && $user->rights->fournisseur->facture->creer)
|
|||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -699,7 +699,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
|||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -776,7 +776,7 @@ elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer)
|
|||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -1016,7 +1016,7 @@ elseif ($action == 'builddoc')
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$result=supplier_invoice_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
@@ -2348,7 +2348,7 @@ else
|
|||||||
// Build document if it not exists
|
// Build document if it not exists
|
||||||
if (! $file || ! is_readable($file))
|
if (! $file || ! is_readable($file))
|
||||||
{
|
{
|
||||||
$result=supplier_invoice_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)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($id); // Reload to get new records
|
$ret=$object->fetch($id); // Reload to get new records
|
||||||
$result=delivery_order_pdf_create($db, $object,$_REQUEST['model'],$outputlangs);
|
$result= $object->generateDocument($_REQUEST['model'],$outputlangs);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,7 @@ if ($action == 'builddoc') // En get ou en post
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$ret=$object->fetch($id); // Reload to get new records
|
$ret=$object->fetch($id); // Reload to get new records
|
||||||
$result=delivery_order_pdf_create($db, $object, $object->modelpdf, $outputlangs);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||||
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -926,6 +927,37 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object on disk
|
||||||
|
*
|
||||||
|
* @param string $modele force le modele a utiliser ('' to not force)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @return int 0 if KO, 1 if OK
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs='')
|
||||||
|
{
|
||||||
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
|
$langs->load("deliveries");
|
||||||
|
|
||||||
|
// Positionne modele sur le nom du modele de bon de livraison a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->LIVRAISON_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->LIVRAISON_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele = 'typhon';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/livraison/pdf/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ if (empty($reshook))
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||||
}
|
}
|
||||||
$result=project_pdf_create($db, $object, $object->modelpdf, $outputlangs);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1339,5 +1340,40 @@ class Project extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an intervention document on disk using template defined into PROJECT_ADDON_PDF
|
||||||
|
*
|
||||||
|
* @param string $modele force le modele a utiliser ('' par defaut)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @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,$langs;
|
||||||
|
|
||||||
|
$langs->load("projects");
|
||||||
|
|
||||||
|
// Positionne modele sur le nom du modele de projet a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PROJECT_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->PROJECT_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele='baleine';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/project/pdf/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -1312,4 +1313,39 @@ class Task extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an intervention document on disk using template defined into PROJECT_TASK_ADDON_PDF
|
||||||
|
*
|
||||||
|
* @param string $modele force le modele a utiliser ('' par defaut)
|
||||||
|
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||||
|
* @param int $hidedetails Hide details of lines
|
||||||
|
* @param int $hidedesc Hide description
|
||||||
|
* @param int $hideref Hide ref
|
||||||
|
* @param HookManager $hookmanager Hook manager instance
|
||||||
|
* @return int 0 if KO, 1 if OK
|
||||||
|
*/
|
||||||
|
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $hookmanager=false)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load("projects");
|
||||||
|
|
||||||
|
// Positionne modele sur le nom du modele de projet a utiliser
|
||||||
|
if (! dol_strlen($modele))
|
||||||
|
{
|
||||||
|
if (! empty($conf->global->PROJECT_TASK_ADDON_PDF))
|
||||||
|
{
|
||||||
|
$modele = $conf->global->PROJECT_TASK_ADDON_PDF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$modele='nodefault';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modelpath = "core/modules/project/task/pdf/";
|
||||||
|
|
||||||
|
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ if ($action == 'builddoc' && $user->rights->projet->creer)
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
$outputlangs->setDefaultLang(GETPOST('lang_id'));
|
||||||
}
|
}
|
||||||
$result=task_pdf_create($db, $object, $object->modelpdf, $outputlangs);
|
$result= $object->generateDocument($object->modelpdf, $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
dol_print_error($db,$result);
|
||||||
|
|||||||
@@ -755,7 +755,7 @@ function validOrder($authentication,$id='')
|
|||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
commande_pdf_create($db, $order, $order->modelpdf, $outputlangs, 0, 0, 0);
|
$order->generateDocument($order->modelpdf, $outputlangs);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Crabe (english)
|
// Crabe (english)
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result = $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs1=new Translate("",$conf);
|
$newlangs1=new Translate("",$conf);
|
||||||
$newlangs1->setDefaultLang('ja_JP');
|
$newlangs1->setDefaultLang('ja_JP');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs1);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs1);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs2a=new Translate("",$conf);
|
$newlangs2a=new Translate("",$conf);
|
||||||
$newlangs2a->setDefaultLang('sa_SA');
|
$newlangs2a->setDefaultLang('sa_SA');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs2a);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs2a);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs2b=new Translate("",$conf);
|
$newlangs2b=new Translate("",$conf);
|
||||||
$newlangs2b->setDefaultLang('en_SA');
|
$newlangs2b->setDefaultLang('en_SA');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs2b);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs2b);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs3=new Translate("",$conf);
|
$newlangs3=new Translate("",$conf);
|
||||||
$newlangs3->setDefaultLang('el_GR');
|
$newlangs3->setDefaultLang('el_GR');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs3);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs3);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs4=new Translate("",$conf);
|
$newlangs4=new Translate("",$conf);
|
||||||
$newlangs4->setDefaultLang('zh_CN');
|
$newlangs4->setDefaultLang('zh_CN');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs4);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs4);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
$newlangs5=new Translate("",$conf);
|
$newlangs5=new Translate("",$conf);
|
||||||
$newlangs5->setDefaultLang('ru_RU');
|
$newlangs5->setDefaultLang('ru_RU');
|
||||||
$localobject->modelpdf='crabe';
|
$localobject->modelpdf='crabe';
|
||||||
$result=facture_pdf_create($db, $localobject, $localobject->modelpdf, $newlangs5);
|
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs5);
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
@@ -247,7 +247,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Canelle
|
// Canelle
|
||||||
$localobject->modelpdf='canelle';
|
$localobject->modelpdf='canelle';
|
||||||
$result=supplier_invoice_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result = $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -274,7 +274,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Einstein
|
// Einstein
|
||||||
$localobject->modelpdf='einstein';
|
$localobject->modelpdf='einstein';
|
||||||
$result=commande_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result = $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -302,7 +302,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Muscadet
|
// Muscadet
|
||||||
$localobject->modelpdf='muscadet';
|
$localobject->modelpdf='muscadet';
|
||||||
$result=supplier_order_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result= $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -329,7 +329,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Azur
|
// Azur
|
||||||
$localobject->modelpdf='azur';
|
$localobject->modelpdf='azur';
|
||||||
$result=propale_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result = $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -355,7 +355,7 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Baleine
|
// Baleine
|
||||||
$localobject->modelpdf='baleine';
|
$localobject->modelpdf='baleine';
|
||||||
$result=project_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result = $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
@@ -409,14 +409,14 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
// Merou
|
// Merou
|
||||||
$localobject->modelpdf='merou';
|
$localobject->modelpdf='merou';
|
||||||
$result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result= $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|
||||||
// Rouget
|
// Rouget
|
||||||
$localobject->modelpdf='rouget';
|
$localobject->modelpdf='rouget';
|
||||||
$result=expedition_pdf_create($db, $localobject, $localobject->modelpdf, $langs);
|
$result= $localobject->generateDocument($localobject->modelpdf, $langs);
|
||||||
|
|
||||||
$this->assertLessThan($result, 0);
|
$this->assertLessThan($result, 0);
|
||||||
print __METHOD__." result=".$result."\n";
|
print __METHOD__." result=".$result."\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user