NEW Accountancy - Add confirmation message with link after transaction validation (#37383)

* NEW Accountancy - Add confirmation message with link after transaction validation & hidden redirect constant

* FIX wrong piece_num obtainded

* FIX Phan
This commit is contained in:
Alexandre SPANGARO
2026-03-05 01:17:13 +01:00
committed by GitHub
parent 2a6d7739ba
commit e596db45e8
3 changed files with 21 additions and 1 deletions

View File

@@ -450,7 +450,19 @@ if (empty($reshook)) {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
header("Location: " . $backtopage . "?sortfield=t.piece_num&sortorder=asc" . ($type ? '&type='.$type : ''));
// Retrieve the actual final part number (not the temporary number)
$piece_num = $object->piece_num;
$linkEntry = '<a href="'.$_SERVER["PHP_SELF"].'?piece_num='.(int) $piece_num.'">'.$langs->trans('NumMvts').': '.(int) $piece_num.'</a>';
setEventMessages($langs->trans('RecordSaved').' - '.$linkEntry, null, 'mesgs', '', 1);
if (getDolGlobalInt('ACCOUNTANCY_VALID_REDIRECT_TO_CARD')) {
// Redirection to the validated entry record
header("Location: ".$_SERVER["PHP_SELF"]."?piece_num=".(int) $piece_num);
} else {
// Default behavior: return on journal view
header("Location: ".$backtopage."?sortfield=t.piece_num&sortorder=asc".($type ? '&type='.$type : ''));
}
exit;
}
}

View File

@@ -2258,6 +2258,9 @@ class BookKeeping extends CommonObject
$error++;
}
// Store the new piece_num so caller can use it after transformTransaction()
$this->piece_num = $next_piecenum;
if (!$error) {
// Delete if there is an empty line
$sql = 'DELETE FROM '.$this->db->prefix().$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0";

View File

@@ -132,6 +132,11 @@ class BookkeepingTemplateLine extends CommonObject
*/
public $subledger_label;
/**
* @var ?string label operation
*/
public $operation_label;
/**
* @var string Debit amount (stored as string for precision)
*/