Fix: Generate donation document
This commit is contained in:
parent
f9e2fe0440
commit
b315bf3e3a
@ -174,31 +174,31 @@ function don_create($db, $id, $message, $modele, $outputlangs)
|
|||||||
$file = $modele.".modules.php";
|
$file = $modele.".modules.php";
|
||||||
if (file_exists($dir.$file))
|
if (file_exists($dir.$file))
|
||||||
{
|
{
|
||||||
$classname = $modele;
|
$object=new Don($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
|
|
||||||
require_once($dir.$file);
|
require_once($dir.$file);
|
||||||
|
$classname = $modele;
|
||||||
$obj = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
$obj->message = $message;
|
|
||||||
|
|
||||||
// We save charset_output to restore it because write_file can change it if needed for
|
// We save charset_output to restore it because write_file can change it if needed for
|
||||||
// output format that does not support UTF8.
|
// output format that does not support UTF8.
|
||||||
$sav_charset_output=$outputlangs->charset_output;
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
if ($obj->write_file($id,$outputlangs) > 0)
|
if ($module->write_file($object,$outputlangs) > 0)
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
|
|
||||||
// we delete preview files
|
// we delete preview files
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||||
dol_delete_preview($obj);
|
dol_delete_preview($object);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$outputlangs->charset_output=$sav_charset_output;
|
$outputlangs->charset_output=$sav_charset_output;
|
||||||
dol_syslog("Erreur dans don_create");
|
dol_syslog("Erreur dans don_create");
|
||||||
dol_print_error($db,$obj->error);
|
dol_print_error($db,$module->error);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user