Fix: Error on generating PDF
This commit is contained in:
parent
cd0cd276ea
commit
507d96ec25
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,11 +19,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/fichinter/fiche.php
|
\file htdocs/fichinter/fiche.php
|
||||||
\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");
|
||||||
@ -71,16 +71,31 @@ if ($_REQUEST["action"] != 'create' && $_REQUEST["action"] != 'add' && ! $_REQUE
|
|||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes')
|
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')
|
||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
|
|
||||||
$fichinter->date = dolibarr_mktime($_POST["phour"], $_POST["pmin"] , $_POST["psec"], $_POST["pmonth"], $_POST["pday"], $_POST["pyear"]);
|
$fichinter->date = dolibarr_mktime($_POST["phour"], $_POST["pmin"] , $_POST["psec"], $_POST["pmonth"], $_POST["pday"], $_POST["pyear"]);
|
||||||
$fichinter->socid = $_POST["socid"];
|
$fichinter->socid = $_POST["socid"];
|
||||||
$fichinter->duree = $_POST["duree"];
|
$fichinter->duree = $_POST["duree"];
|
||||||
@ -106,24 +121,24 @@ if ($_POST["action"] == 'add')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'</div>';
|
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("ThirdParty")).'</div>';
|
||||||
$_GET["action"] = 'create';
|
$_GET["action"] = 'create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'update')
|
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;
|
||||||
$fichinter->description = $_POST["description"];
|
$fichinter->description = $_POST["description"];
|
||||||
$fichinter->ref = $_POST["ref"];
|
$fichinter->ref = $_POST["ref"];
|
||||||
|
|
||||||
$fichinter->update($_POST["id"]);
|
$fichinter->update($_POST["id"]);
|
||||||
$_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre cr<63><72>e
|
$_GET["id"]=$_POST["id"]; // Force raffraichissement sur fiche venant d'etre cr<63><72>e
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -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)
|
||||||
{
|
{
|
||||||
@ -153,21 +169,21 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
|||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'classin')
|
if ($_POST['action'] == 'classin')
|
||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$fichinter->fetch($_GET['id']);
|
$fichinter->fetch($_GET['id']);
|
||||||
$fichinter->set_project($user, $_POST['projetidp']);
|
$fichinter->set_project($user, $_POST['projetidp']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
if ($user->rights->ficheinter->supprimer)
|
if ($user->rights->ficheinter->supprimer)
|
||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$fichinter->fetch($_GET['id']);
|
$fichinter->fetch($_GET['id']);
|
||||||
$fichinter->delete($user);
|
$fichinter->delete($user);
|
||||||
}
|
}
|
||||||
Header('Location: index.php?leftmenu=ficheinter');
|
Header('Location: index.php?leftmenu=ficheinter');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST['action'] == 'setdate_delivery')
|
if ($_POST['action'] == 'setdate_delivery')
|
||||||
@ -195,16 +211,16 @@ if ($_POST['action'] == "addligne" && $user->rights->ficheinter->creer)
|
|||||||
{
|
{
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$ret=$fichinter->fetch($_POST['fichinterid']);
|
$ret=$fichinter->fetch($_POST['fichinterid']);
|
||||||
|
|
||||||
$desc=$_POST['np_desc'];
|
$desc=$_POST['np_desc'];
|
||||||
$date_intervention = $db->idate(mktime(12, 1 , 1, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]));
|
$date_intervention = $db->idate(mktime(12, 1 , 1, $_POST["dimonth"], $_POST["diday"], $_POST["diyear"]));
|
||||||
$duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']);
|
$duration = ConvertTime2Seconds($_POST['durationhour'],$_POST['durationmin']);
|
||||||
|
|
||||||
$fichinter->addline(
|
$fichinter->addline(
|
||||||
$_POST['fichinterid'],
|
$_POST['fichinterid'],
|
||||||
$desc,
|
$desc,
|
||||||
$date_intervention,
|
$date_intervention,
|
||||||
$duration
|
$duration
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($_REQUEST['lang_id'])
|
if ($_REQUEST['lang_id'])
|
||||||
@ -247,8 +263,8 @@ if ($_POST['action'] == 'updateligne' && $user->rights->ficheinter->creer && $_P
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -282,30 +298,30 @@ if ($_GET['action'] == 'deleteline' && $user->rights->ficheinter->creer && !$con
|
|||||||
*/
|
*/
|
||||||
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)
|
||||||
{
|
{
|
||||||
if ($user->rights->ficheinter->creer)
|
if ($user->rights->ficheinter->creer)
|
||||||
{
|
{
|
||||||
$fichinterline = new FichinterLigne($db);
|
$fichinterline = new FichinterLigne($db);
|
||||||
if ($fichinterline->fetch($_GET['ligne']) <= 0)
|
if ($fichinterline->fetch($_GET['ligne']) <= 0)
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$result=$fichinterline->delete_line();
|
$result=$fichinterline->delete_line();
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
|
if ($fichinter->fetch($fichinterline->fk_fichinter) <= 0)
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
dolibarr_print_error($db);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
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_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
||||||
}
|
}
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -337,7 +353,7 @@ if ($_GET['action'] == 'down' && $user->rights->ficheinter->creer)
|
|||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
}
|
}
|
||||||
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
fichinter_create($db, $fichinter, $fichinter->modelpdf, $outputlangs);
|
||||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
|
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -360,14 +376,14 @@ if ($_GET["action"] == 'create')
|
|||||||
*/
|
*/
|
||||||
if ($_GET["socid"] > 0)
|
if ($_GET["socid"] > 0)
|
||||||
{
|
{
|
||||||
$societe=new Societe($db);
|
$societe=new Societe($db);
|
||||||
$societe->fetch($_GET["socid"]);
|
$societe->fetch($_GET["socid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_titre($langs->trans("AddIntervention"));
|
print_titre($langs->trans("AddIntervention"));
|
||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
if (! $conf->global->FICHEINTER_ADDON)
|
if (! $conf->global->FICHEINTER_ADDON)
|
||||||
{
|
{
|
||||||
dolibarr_print_error($db,$langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined"));
|
dolibarr_print_error($db,$langs->trans("Error")." ".$langs->trans("Error_FICHEINTER_ADDON_NotDefined"));
|
||||||
@ -386,81 +402,81 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
if ($_GET["socid"])
|
if ($_GET["socid"])
|
||||||
{
|
{
|
||||||
print "<form name='fichinter' action=\"fiche.php\" method=\"post\">";
|
print "<form name='fichinter' action=\"fiche.php\" method=\"post\">";
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print '<input type="hidden" name="socid" value='.$_GET["socid"].'>';
|
print '<input type="hidden" name="socid" value='.$_GET["socid"].'>';
|
||||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$societe->getNomUrl(1)."</td></tr>";
|
print "<tr><td>".$langs->trans("Company")."</td><td>".$societe->getNomUrl(1)."</td></tr>";
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Date")."</td><td>";
|
|
||||||
$html->select_date(time(),"p",'','','','fichinter');
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
print "<tr><td>".$langs->trans("Date")."</td><td>";
|
||||||
|
$html->select_date(time(),"p",'','','','fichinter');
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
print "<tr><td>".$langs->trans("Ref")."</td>";
|
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||||
print "<td><input name=\"ref\" value=\"$numpr\"></td></tr>\n";
|
|
||||||
|
|
||||||
if ($conf->projet->enabled)
|
print "<tr><td>".$langs->trans("Ref")."</td>";
|
||||||
{
|
print "<td><input name=\"ref\" value=\"$numpr\"></td></tr>\n";
|
||||||
// Projet associe
|
|
||||||
$langs->load("project");
|
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
|
if ($conf->projet->enabled)
|
||||||
|
|
||||||
if ($_GET["socid"]) $numprojet = $societe->has_projects();
|
|
||||||
|
|
||||||
if (!$numprojet)
|
|
||||||
{
|
{
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
// Projet associe
|
||||||
print '<tr><td width="130">'.$langs->trans("NoProject").'</td>';
|
$langs->load("project");
|
||||||
|
|
||||||
if ($user->rights->projet->creer)
|
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>';
|
||||||
|
|
||||||
|
if ($_GET["socid"]) $numprojet = $societe->has_projects();
|
||||||
|
|
||||||
|
if (!$numprojet)
|
||||||
{
|
{
|
||||||
print '<td><a href='.DOL_URL_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create>'.$langs->trans("Add").'</a></td>';
|
print '<table class="nobordernopadding" width="100%">';
|
||||||
|
print '<tr><td width="130">'.$langs->trans("NoProject").'</td>';
|
||||||
|
|
||||||
|
if ($user->rights->projet->creer)
|
||||||
|
{
|
||||||
|
print '<td><a href='.DOL_URL_ROOT.'/projet/fiche.php?socid='.$societe->id.'&action=create>'.$langs->trans("Add").'</a></td>';
|
||||||
|
}
|
||||||
|
print '</tr></table>';
|
||||||
}
|
}
|
||||||
print '</tr></table>';
|
else
|
||||||
|
{
|
||||||
|
select_projects($societe->id,'','projetidp');
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Model
|
||||||
|
print '<tr>';
|
||||||
|
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||||
|
print '<td colspan="2">';
|
||||||
|
$model=new ModelePDFFicheinter();
|
||||||
|
$liste=$model->liste_modeles($db);
|
||||||
|
$html->select_array('model',$liste,$conf->global->FICHEINTER_ADDON_PDF);
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
||||||
|
print "<td>";
|
||||||
|
|
||||||
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
|
||||||
|
{
|
||||||
|
// Editeur wysiwyg
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
|
$doleditor=new DolEditor('description','',280,'dolibarr_notes','In',true);
|
||||||
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
select_projects($societe->id,'','projetidp');
|
print '<textarea name="description" wrap="soft" cols="70" rows="12"></textarea>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
|
||||||
|
|
||||||
// Model
|
print '<tr><td colspan="2" align="center">';
|
||||||
print '<tr>';
|
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
||||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
print '</td></tr>';
|
||||||
print '<td colspan="2">';
|
|
||||||
$model=new ModelePDFFicheinter();
|
|
||||||
$liste=$model->liste_modeles($db);
|
|
||||||
$html->select_array('model',$liste,$conf->global->FICHEINTER_ADDON_PDF);
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td>';
|
print '</table>';
|
||||||
print "<td>";
|
print '</form>';
|
||||||
|
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_SOCIETE)
|
|
||||||
{
|
|
||||||
// Editeur wysiwyg
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
|
||||||
$doleditor=new DolEditor('description','',280,'dolibarr_notes','In',true);
|
|
||||||
$doleditor->Create();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<textarea name="description" wrap="soft" cols="70" rows="12"></textarea>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center">';
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -481,8 +497,8 @@ if ($_GET["action"] == 'create')
|
|||||||
elseif ($_GET["id"] > 0)
|
elseif ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Affichage en mode visu
|
* Affichage en mode visu
|
||||||
*/
|
*/
|
||||||
$fichinter = new Fichinter($db);
|
$fichinter = new Fichinter($db);
|
||||||
$result=$fichinter->fetch($_GET["id"]);
|
$result=$fichinter->fetch($_GET["id"]);
|
||||||
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');
|
||||||
@ -612,10 +628,10 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td><td>'.ConvertSecondToTime($fichinter->duree).'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalDuration").'</td><td>'.ConvertSecondToTime($fichinter->duree).'</td></tr>';
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
@ -648,15 +664,15 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$fichinter->getLibStatut(4).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$fichinter->getLibStatut(4).'</td></tr>';
|
||||||
|
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lignes d'intervention
|
* Lignes d'intervention
|
||||||
*/
|
*/
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang';
|
$sql = 'SELECT ft.rowid, ft.description, ft.fk_fichinter, ft.duree, ft.rang';
|
||||||
@ -692,7 +708,7 @@ elseif ($_GET["id"] > 0)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||||
print nl2br($objp->description);
|
print nl2br($objp->description);
|
||||||
|
|
||||||
print '<td width="150">'.dolibarr_print_date($objp->date_intervention,'day').'</td>';
|
print '<td width="150">'.dolibarr_print_date($objp->date_intervention,'day').'</td>';
|
||||||
print '<td width="150">'.ConvertSecondToTime($objp->duree).'</td>';
|
print '<td width="150">'.ConvertSecondToTime($objp->duree).'</td>';
|
||||||
|
|
||||||
@ -777,12 +793,12 @@ elseif ($_GET["id"] > 0)
|
|||||||
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
print '<textarea name="desc" cols="70" class="flat" rows="'.ROWS_2.'">'.dol_htmlentitiesbr_decode($objp->description).'</textarea>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Date d'intervention
|
// Date d'intervention
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date($objp->date_intervention,'di',0,0,0,"date_intervention");
|
$html->select_date($objp->date_intervention,'di',0,0,0,"date_intervention");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_duree('duration',$objp->duree);
|
$html->select_duree('duration',$objp->duree);
|
||||||
@ -806,8 +822,8 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajouter une ligne
|
* Ajouter une ligne
|
||||||
*/
|
*/
|
||||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline')
|
if ($fichinter->statut == 0 && $user->rights->ficheinter->creer && $_GET["action"] <> 'editline')
|
||||||
{
|
{
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -841,12 +857,12 @@ elseif ($_GET["id"] > 0)
|
|||||||
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
print '<textarea class="flat" cols="70" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Date d'intervention
|
// Date d'intervention
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_date(time(),'di',0,0,0,"addinter");
|
$html->select_date(time(),'di',0,0,0,"addinter");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Dur<75>e
|
// Dur<75>e
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$html->select_duree('duration');
|
$html->select_duree('duration');
|
||||||
@ -865,9 +881,9 @@ elseif ($_GET["id"] > 0)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Barre d'actions
|
* Barre d'actions
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
if ($user->societe_id == 0)
|
if ($user->societe_id == 0)
|
||||||
@ -887,7 +903,7 @@ elseif ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
print '>'.$langs->trans("Valid").'</a>';
|
print '>'.$langs->trans("Valid").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($fichinter->statut == 0 && $user->rights->ficheinter->supprimer)
|
if ($fichinter->statut == 0 && $user->rights->ficheinter->supprimer)
|
||||||
{
|
{
|
||||||
@ -904,13 +920,13 @@ elseif ($_GET["id"] > 0)
|
|||||||
print '>'.$langs->trans('Delete').'</a>';
|
print '>'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
/*
|
/*
|
||||||
* Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s
|
* Documents g<EFBFBD>n<EFBFBD>r<EFBFBD>s
|
||||||
*/
|
*/
|
||||||
$filename=sanitize_string($fichinter->ref);
|
$filename=sanitize_string($fichinter->ref);
|
||||||
$filedir=$conf->fichinter->dir_output . "/".$fichinter->ref;
|
$filedir=$conf->fichinter->dir_output . "/".$fichinter->ref;
|
||||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
|
$urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id;
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
return 1;
|
if (! $error)
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=join(',',$this->errors);
|
||||||
|
dolibarr_syslog("Fichinter::update ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->db->rollback();
|
||||||
dolibarr_syslog("Fichinter::update error ".$this->error,LOG_ERR);
|
$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
|
||||||
@ -87,7 +87,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
$outputlangs->load("dict");
|
$outputlangs->load("dict");
|
||||||
$outputlangs->load("companies");
|
$outputlangs->load("companies");
|
||||||
$outputlangs->load("interventions");
|
$outputlangs->load("interventions");
|
||||||
|
|
||||||
$outputlangs->setPhpLang();
|
$outputlangs->setPhpLang();
|
||||||
|
|
||||||
if ($conf->fichinter->dir_output)
|
if ($conf->fichinter->dir_output)
|
||||||
@ -117,7 +117,7 @@ class pdf_soleil extends ModelePDFFicheinter
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
@ -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