Fix: Error on generating PDF
This commit is contained in:
parent
cd0cd276ea
commit
507d96ec25
@ -26,7 +26,7 @@
|
|||||||
\ingroup propale
|
\ingroup propale
|
||||||
\brief Page liste des propales (vision commercial)
|
\brief Page liste des propales (vision commercial)
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||||
@ -95,7 +95,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
|||||||
* Supprime une ligne produit AVEC OU SANS confirmation
|
* Supprime une ligne produit AVEC OU SANS confirmation
|
||||||
*/
|
*/
|
||||||
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||||
{
|
{
|
||||||
if ($user->rights->propale->creer)
|
if ($user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
@ -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)
|
||||||
@ -777,8 +785,8 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page
|
* Affichage page
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans('Proposal'),'Proposition');
|
llxHeader('',$langs->trans('Proposal'),'Proposition');
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
\ingroup commande
|
\ingroup commande
|
||||||
\brief Fiche commande client
|
\brief Fiche commande client
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('./pre.inc.php');
|
require('./pre.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||||
@ -92,7 +92,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
|||||||
* Supprime une ligne produit AVEC ou SANS confirmation
|
* Supprime une ligne produit AVEC ou SANS confirmation
|
||||||
*/
|
*/
|
||||||
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
if (($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
|| ($_GET['action'] == 'deleteline' && !$conf->global->PRODUIT_CONFIRM_DELETE_LINE))
|
||||||
{
|
{
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
@ -480,11 +480,22 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ordonnancement des lignes
|
* Ordonnancement des lignes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET['action'] == 'up' && $user->rights->commande->creer)
|
if ($_GET['action'] == 'up' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
@ -760,8 +771,8 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans('Order'),'Commande');
|
llxHeader('',$langs->trans('Order'),'Commande');
|
||||||
|
|
||||||
@ -769,10 +780,10 @@ $html = new Form($db);
|
|||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
*
|
*
|
||||||
* Mode creation
|
* Mode creation
|
||||||
*
|
*
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
print_titre($langs->trans('CreateOrder'));
|
print_titre($langs->trans('CreateOrder'));
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
\brief Fichier fiche intervention
|
\brief Fichier fiche intervention
|
||||||
\ingroup ficheinter
|
\ingroup ficheinter
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
|
||||||
@ -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"];
|
||||||
$result=$fichinter->valid($user, $conf->fichinter->outputdir);
|
$fichinter->fetch($_GET["id"]);
|
||||||
if ($result < 0) $mesg='<div class="error">'.$fichinter->error.'</div>';
|
|
||||||
|
$result = $fichinter->valid($user, $conf->fichinter->outputdir);
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
@ -499,8 +515,8 @@ elseif ($_GET["id"] > 0)
|
|||||||
dolibarr_fiche_head($head, 'card', $langs->trans("InterventionCard"));
|
dolibarr_fiche_head($head, 'card', $langs->trans("InterventionCard"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression de la fiche d'intervention
|
* Confirmation de la suppression de la fiche d'intervention
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'delete')
|
if ($_GET['action'] == 'delete')
|
||||||
{
|
{
|
||||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete');
|
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('DeleteIntervention'), $langs->trans('ConfirmDeleteIntervention'), 'confirm_delete');
|
||||||
@ -508,8 +524,8 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la validation de la fiche d'intervention
|
* Confirmation de la validation de la fiche d'intervention
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'validate')
|
if ($_GET['action'] == 'validate')
|
||||||
{
|
{
|
||||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate');
|
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id, $langs->trans('ValidateIntervention'), $langs->trans('ConfirmValidateIntervention'), 'confirm_validate');
|
||||||
@ -517,8 +533,8 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression d'une ligne d'intervention
|
* Confirmation de la suppression d'une ligne d'intervention
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
if ($_GET['action'] == 'ask_deleteline' && $conf->global->PRODUIT_CONFIRM_DELETE_LINE)
|
||||||
{
|
{
|
||||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline');
|
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$fichinter->id.'&ligne='.$_GET["ligne"], $langs->trans('DeleteInterventionLine'), $langs->trans('ConfirmDeleteInterventionLine'), 'confirm_deleteline');
|
||||||
|
|||||||
@ -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