Skip to content

Commit

Permalink
NEW: Add auto generate document when reception is created
Browse files Browse the repository at this point in the history
  • Loading branch information
kkhelifa-opendsi committed Aug 20, 2024
1 parent f613752 commit c561a6e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions htdocs/reception/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,29 @@
if ($ret <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
} else {
// Define output language
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
$outputlangs = $langs;
$newlang = '';
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records

$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
dol_print_error($db, $result);
}
}
}
}
} else {
Expand Down

0 comments on commit c561a6e

Please sign in to comment.