Fix: Error on generating PDF
This commit is contained in:
parent
cd0cd276ea
commit
507d96ec25
@ -511,6 +511,14 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
|
|||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_GET['propalid']);
|
$propal->fetch($_GET['propalid']);
|
||||||
$propal->set_draft($user);
|
$propal->set_draft($user);
|
||||||
|
|
||||||
|
//regénération pdf
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
|
if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
|
||||||
|
|||||||
@ -480,6 +480,17 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
|
|||||||
$commande = new Commande($db);
|
$commande = new Commande($db);
|
||||||
$commande->fetch($_GET['id']);
|
$commande->fetch($_GET['id']);
|
||||||
$commande->set_draft($user);
|
$commande->set_draft($user);
|
||||||
|
|
||||||
|
$result = $commande->set_draft($user);
|
||||||
|
if ($result >= 0)
|
||||||
|
{ //regeneration pdf
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -290,6 +290,13 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->modifier && $conf->glo
|
|||||||
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
|
if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0)
|
||||||
{
|
{
|
||||||
$fac->set_draft($user);
|
$fac->set_draft($user);
|
||||||
|
//regénération PDF
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -73,8 +73,23 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
|
|||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$fichinter->id = $_GET["id"];
|
$fichinter->id = $_GET["id"];
|
||||||
|
$fichinter->fetch($_GET["id"]);
|
||||||
|
|
||||||
$result = $fichinter->valid($user, $conf->fichinter->outputdir);
|
$result = $fichinter->valid($user, $conf->fichinter->outputdir);
|
||||||
if ($result < 0) $mesg='<div class="error">'.$fichinter->error.'</div>';
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
if ($_REQUEST['lang_id'])
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'add')
|
if ($_POST["action"] == 'add')
|
||||||
@ -115,7 +130,7 @@ if ($_POST["action"] == 'update')
|
|||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
|
|
||||||
$fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]));
|
$fichinter->date = dolibarr_mktime($_POST["phour"], $_POST["pmin"] , $_POST["psec"], $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||||
$fichinter->socid = $_POST["socid"];
|
$fichinter->socid = $_POST["socid"];
|
||||||
$fichinter->projet_id = $_POST["projetidp"];
|
$fichinter->projet_id = $_POST["projetidp"];
|
||||||
$fichinter->author = $user->id;
|
$fichinter->author = $user->id;
|
||||||
@ -131,15 +146,16 @@ if ($_POST["action"] == 'update')
|
|||||||
*/
|
*/
|
||||||
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||||
{
|
{
|
||||||
|
$fichinter = new Fichinter($db);
|
||||||
|
$fichinter->fetch($_GET['id']);
|
||||||
|
$fichinter->fetch_lines();
|
||||||
|
|
||||||
if ($_REQUEST['lang_id'])
|
if ($_REQUEST['lang_id'])
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fichinter = new Fichinter($db);
|
|
||||||
$fichinter->fetch($_GET['id']);
|
|
||||||
|
|
||||||
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
|
$result=fichinter_create($db, $fichinter, $_REQUEST['model'], $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -147,7 +147,7 @@ class Fichinter extends CommonObject
|
|||||||
* Insertion dans la base
|
* Insertion dans la base
|
||||||
*/
|
*/
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
|
||||||
$sql .= " datei = ".$this->date;
|
$sql .= " datei = ".$this->db->idate($this->date);
|
||||||
$sql .= ", description = '".addslashes($this->description)."'";
|
$sql .= ", description = '".addslashes($this->description)."'";
|
||||||
$sql .= ", duree = ".$this->duree;
|
$sql .= ", duree = ".$this->duree;
|
||||||
$sql .= ", fk_projet = ".$this->projet_id;
|
$sql .= ", fk_projet = ".$this->projet_id;
|
||||||
@ -219,6 +219,8 @@ class Fichinter extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter";
|
||||||
$sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id;
|
$sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id;
|
||||||
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
$sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0";
|
||||||
@ -234,12 +236,24 @@ class Fichinter extends CommonObject
|
|||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->db->rollback();
|
||||||
dolibarr_syslog("Fichinter::update error ".$this->error,LOG_ERR);
|
$this->error=join(',',$this->errors);
|
||||||
|
dolibarr_syslog("Fichinter::update ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
dolibarr_syslog("Fichinter::update ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,7 +174,8 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
|
dolibarr_syslog("Error ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined"), LOG_ERR);
|
||||||
|
print "Error ".$langs->trans("Error_FICHEINTER_ADDON_PDF_NotDefined");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,6 +189,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
|
|||||||
|
|
||||||
$obj = new $classname($db);
|
$obj = new $classname($db);
|
||||||
|
|
||||||
|
dolibarr_syslog("fichinter_create build PDF", LOG_DEBUG);
|
||||||
if ($obj->write_file($object,$outputlangs) > 0)
|
if ($obj->write_file($object,$outputlangs) > 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -259,7 +259,6 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$pdf->writeHTMLCell(190, 5, 10, $tab_top + 8, dol_htmlentitiesbr($fichinter->description), 0, 'J', 0);
|
$pdf->writeHTMLCell(190, 5, 10, $tab_top + 8, dol_htmlentitiesbr($fichinter->description), 0, 'J', 0);
|
||||||
|
|
||||||
//dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description));
|
//dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description));
|
||||||
$fichinter->fetch_lines();
|
|
||||||
$num = sizeof($fichinter->lignes);
|
$num = sizeof($fichinter->lignes);
|
||||||
$i=0;
|
$i=0;
|
||||||
if ($num)
|
if ($num)
|
||||||
@ -268,12 +267,12 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
{
|
{
|
||||||
$fichinterligne = $fichinter->lignes[$i];
|
$fichinterligne = $fichinter->lignes[$i];
|
||||||
|
|
||||||
$valide = $fichinterligne->fetch($fichinterligne->id);
|
$valide = $fichinterligne->id ? $fichinterligne->fetch($fichinterligne->id) : 0;
|
||||||
if ($valide>0)
|
if ($valide>0)
|
||||||
{
|
{
|
||||||
$pdf->SetXY (20, $tab_top + 16 + $i * 20);
|
$pdf->SetXY (20, $tab_top + 16 + $i * 20);
|
||||||
$pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20,
|
$pdf->writeHTMLCell(190, 8, 20, $tab_top + 16 + $i * 20,
|
||||||
dol_htmlentitiesbr("Date : ".dolibarr_print_date($fichinterligne->datei)." - Durée : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
|
dol_htmlentitiesbr($langs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei)." - ".$langs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration)), 0, 'J', 0);
|
||||||
|
|
||||||
$pdf->SetXY (20, $tab_top + 22 + $i * 20);
|
$pdf->SetXY (20, $tab_top + 22 + $i * 20);
|
||||||
$pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20,
|
$pdf->writeHTMLCell(170, 8, 20, $tab_top + 22 + $i * 20,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user