FIX : tms on update current timestamp + wrong links

This commit is contained in:
Gauthier PC portable 024 2021-08-03 16:36:27 +02:00
parent 1d2527b991
commit ee52fc162c
4 changed files with 14 additions and 11 deletions

View File

@ -54,7 +54,7 @@ CREATE TABLE llx_stocktransfer_stocktransfer(
description text,
note_public text,
note_private text,
tms timestamp,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
date_creation datetime NOT NULL,
date_prevue_depart date DEFAULT NULL,
date_reelle_depart date DEFAULT NULL,

View File

@ -27,7 +27,7 @@ CREATE TABLE llx_stocktransfer_stocktransfer(
description text,
note_public text,
note_private text,
tms timestamp,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
date_creation datetime NOT NULL,
date_prevue_depart date DEFAULT NULL,
date_reelle_depart date DEFAULT NULL,

View File

@ -466,6 +466,7 @@ class StockTransfer extends CommonObject
*/
public function update(User $user, $notrigger = false)
{
$this->tms = ''; // Will be done automatically because tms field is on update cascade
$res = $this->updateCommon($user, $notrigger);
if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) $this->fetch_thirdparty();
if (empty($this->socid) && empty($this->fk_soc)) unset($this->thirdparty);

View File

@ -145,12 +145,12 @@ if (empty($reshook))
{
$error = 0;
$backurlforlist = dol_buildpath('/stocktransfer/stocktransfer_list.php', 1);
$backurlforlist = dol_buildpath('/product/stock/stocktransfer/stocktransfer_list.php', 1);
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
$triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record
@ -207,12 +207,12 @@ if (empty($reshook))
{
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData", $prod->ref), null, 'errors');
setEventMessages($langs->transnoentities("ErrorTryToMakeMoveOnProductRequiringBatchData", $prod->ref), null, 'errors');
}
} else {
if(!empty($batch)) {
$error++;
setEventMessages($langs->trans('StockTransferNoBatchForProduct', $prod->getNomUrl()), '', 'errors');
setEventMessages($langs->transnoentities('StockTransferNoBatchForProduct', $prod->getNomUrl()), '', 'errors');
}
}
@ -508,7 +508,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteStockTransfer'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Delete'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
@ -570,7 +570,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'valid' && $permissiontoadd) {
$nextref=$object->getNextNumRef();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $langs->trans('ConfirmValidateStockTransfer', $nextref), 'confirm_validate', $formquestion, 0, 2);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $langs->transnoentities('ConfirmValidateStockTransfer', $nextref), 'confirm_validate', $formquestion, 0, 2);
}
// Call Hook formConfirm
@ -585,7 +585,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/stocktransfer/stocktransfer_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.dol_buildpath('/product/stock/stocktransfer/stocktransfer_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
@ -726,6 +726,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$param = '';
$conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE=true; // Full display needed to see all column title details
print '<tr class="liste_titre">';
print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone ');
if ($conf->productbatch->enabled) {
@ -738,7 +740,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print getTitleFieldOfList($langs->trans('Unit'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone ');
}
print getTitleFieldOfList($langs->trans('AverageUnitPricePMPShort'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone ');
print getTitleFieldOfList($langs->trans('PMPValue'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone ');
print getTitleFieldOfList($langs->trans('EstimatedStockValueShort'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone ');
if(empty($object->status)) {
print getTitleFieldOfList('', 0);
print getTitleFieldOfList('', 0);
@ -1071,7 +1073,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/stocktransfer/stocktransfer_agenda.php', 1).'?id='.$object->id.'">';
$morehtmlright = '<a href="'.dol_buildpath('/product/stock/stocktransfer/stocktransfer_agenda.php', 1).'?id='.$object->id.'">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';