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,9 +285,11 @@ 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)) {
|
||||||
|
if (method_exists($object, 'generateDocument')) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
|
setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs');
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
@ -304,6 +310,7 @@ 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))
|
||||||
{
|
{
|
||||||
|
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');
|
||||||
@ -318,6 +325,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -331,8 +339,8 @@ 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');
|
||||||
@ -347,6 +355,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -374,8 +383,8 @@ 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');
|
||||||
@ -390,6 +399,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd)
|
|||||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user