FIX Compatibility with modules without document generation
Conflicts: htdocs/core/actions_addupdatedelete.inc.php
This commit is contained in:
parent
8bfa6df1a6
commit
69d73ac528
@ -262,7 +262,11 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete))
|
|||||||
// Remove a line
|
// Remove a line
|
||||||
if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd))
|
if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd))
|
||||||
{
|
{
|
||||||
$result = $object->deleteline($user, $lineid);
|
if (method_exists('deleteline', $object)) {
|
||||||
|
$result = $object->deleteline($user, $lineid); // For backward compatibility
|
||||||
|
} else {
|
||||||
|
$result = $object->deleteLine($user, $lineid);
|
||||||
|
}
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
@ -281,8 +285,10 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
|
||||||
@ -304,18 +310,20 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
// Define output language
|
// Define output language
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$outputlangs = $langs;
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$newlang = '';
|
$outputlangs = $langs;
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||||
if (!empty($newlang)) {
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
$outputlangs = new Translate("", $conf);
|
if (!empty($newlang)) {
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs = new Translate("", $conf);
|
||||||
}
|
$outputlangs->setDefaultLang($newlang);
|
||||||
$model = $object->modelpdf;
|
}
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$model = $object->modelpdf;
|
||||||
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -331,20 +339,21 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
{
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
if (!empty($newlang)) {
|
if (!empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$model = $object->modelpdf;
|
$model = $object->modelpdf;
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -374,20 +383,21 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
{
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
|
||||||
if (!empty($newlang)) {
|
if (!empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
$model = $object->modelpdf;
|
$model = $object->modelpdf;
|
||||||
$ret = $object->fetch($id); // Reload to get new records
|
$ret = $object->fetch($id); // Reload to get new records
|
||||||
|
|
||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user