Skip to content

Commit

Permalink
Merge pull request #1035 from Easya-Solutions/2024_rc_new_autogen_doc…
Browse files Browse the repository at this point in the history
…_on_create_reception

CORE reception: Add auto generate document when reception is created
  • Loading branch information
kkhelifa-opendsi authored Aug 30, 2024
2 parents 4158c1e + f47f30e commit 812f52a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions htdocs/reception/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
// avec info diverses + qte a livrer

if ($object->origin == "supplierorder") {
$object->origin = "order_supplier";
$classname = 'CommandeFournisseur';
} else {
$classname = ucfirst($object->origin);
Expand Down Expand Up @@ -436,6 +437,30 @@
if ($ret <= 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
} else {
// Define output language
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
$object->fetch_thirdparty();
$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($object->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 812f52a

Please sign in to comment.