Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4086 [Cards] fix: use saturne for lock and archive #4087

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions view/accidentinvestigation/accidentinvestigation_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
require_once __DIR__ . '/../../../saturne/core/tpl/documents/saturne_manual_pdf_generation_action.tpl.php';

// Action confirm_lock, confirm_archive.
require_once __DIR__ . '/../../../saturne/core/tpl/signature/signature_action_workflow.tpl.php';
require_once __DIR__ . '/../../../saturne/core/tpl/actions/object_workflow_actions.tpl.php';

// Actions to send emails.
$triggersendname = strtoupper($object->element) . '_SENTBYMAIL';
Expand Down Expand Up @@ -300,7 +300,7 @@
}
// Archive confirmation
if (($action == 'set_archive' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
$formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id, $langs->trans('ArchiveObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmArchiveObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_archive', '', 'yes', 'actionButtonArchive', 350, 600);
$formConfirm .= $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . '&forcebuilddoc=true', $langs->trans('ArchiveObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmArchiveObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_archive', '', 'yes', 'actionButtonArchive', 350, 600);
}
// Clone confirmation
if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile))) || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
Expand Down
43 changes: 4 additions & 39 deletions view/firepermit/firepermit_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,43 +547,8 @@
}
}

// Action to set status STATUS_LOCKED
if ($action == 'confirm_setLocked') {
$object->fetch($id);
if ( ! $error) {
$result = $object->setLocked($user, false);
if ($result > 0) {
// Set locked OK
$urltogo = str_replace('__ID__', $result, $backtopage);
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: " . $urltogo);
exit;
} else {
// Set locked KO
if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
}

// Action to set status STATUS_ARCHIVED
if ($action == 'setArchived') {
$object->fetch($id);
if ( ! $error) {
$result = $object->setArchived($user, false);
if ($result > 0) {
// Set Archived OK
$urltogo = str_replace('__ID__', $result, $backtopage);
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: " . $urltogo);
exit;
} else {
// Set Archived KO
if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
}
// Action confirm_lock, confirm_archive.
require_once __DIR__ . '/../../../saturne/core/tpl/actions/object_workflow_actions.tpl.php';

// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') {
Expand Down Expand Up @@ -921,7 +886,7 @@
// SetLocked confirmation
if (($action == 'setLocked' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
|| ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_setLocked', '', 'yes', 'actionButtonLock', 350, 600);
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_lock', '', 'yes', 'actionButtonLock', 350, 600);
}

// setPendingSignature confirmation
Expand Down Expand Up @@ -1140,7 +1105,7 @@
// Archive
$displayButton = $onPhone ? '<i class="fas fa-archive fa-2x"></i>' : '<i class="fas fa-archive"></i>' . ' ' . $langs->trans('Archive');
if ($object->status == $object::STATUS_LOCKED) {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setArchived&token=' . newToken() . '">' . $displayButton . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=confirm_archive&forcebuilddoc=true&token=' . newToken() . '">' . $displayButton . '</a>';
} else {
print '<span class="butActionRefused classfortooltip" title="' . dol_escape_htmltag($langs->trans('ObjectMustBeLockedToArchive', ucfirst($langs->transnoentities('The' . ucfirst($object->element))))) . '">' . $displayButton . '</span>';
}
Expand Down
43 changes: 4 additions & 39 deletions view/preventionplan/preventionplan_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,43 +554,8 @@
}
}

// Action to set status STATUS_LOCKED
if ($action == 'confirm_setLocked') {
$object->fetch($id);
if ( ! $error) {
$result = $object->setLocked($user, false);
if ($result > 0) {
// Set locked OK
$urltogo = str_replace('__ID__', $result, $backtopage);
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: " . $urltogo);
exit;
} else {
// Set locked KO
if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
}

// Action to set status STATUS_ARCHIVED
if ($action == 'setArchived') {
$object->fetch($id);
if ( ! $error) {
$result = $object->setArchived($user, false);
if ($result > 0) {
// Set Archived OK
$urltogo = str_replace('__ID__', $result, $backtopage);
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: " . $urltogo);
exit;
} else {
// Set Archived KO
if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
else setEventMessages($object->error, null, 'errors');
}
}
}
// Action confirm_lock, confirm_archive.
require_once __DIR__ . '/../../../saturne/core/tpl/actions/object_workflow_actions.tpl.php';

// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes') {
Expand Down Expand Up @@ -963,7 +928,7 @@
// SetLocked confirmation
if (($action == 'setLocked' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js
|| ( ! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) { // Always output when not jmobile nor js
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_setLocked', '', 'yes', 'actionButtonLock', 350, 600);
$formconfirm .= $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('LockObject', $langs->transnoentities('The' . ucfirst($object->element))), $langs->trans('ConfirmLockObject', $langs->transnoentities('The' . ucfirst($object->element))), 'confirm_lock', '', 'yes', 'actionButtonLock', 350, 600);
}

// setPendingSignature confirmation
Expand Down Expand Up @@ -1210,7 +1175,7 @@
// Archive
$displayButton = $onPhone ? '<i class="fas fa-archive fa-2x"></i>' : '<i class="fas fa-archive"></i>' . ' ' . $langs->trans('Archive');
if ($object->status == $object::STATUS_LOCKED) {
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setArchived&token=' . newToken() . '">' . $displayButton . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=confirm_archive&forcebuilddoc=true&token=' . newToken() . '">' . $displayButton . '</a>';
} else {
print '<span class="butActionRefused classfortooltip" title="' . dol_escape_htmltag($langs->trans('ObjectMustBeLockedToArchive', ucfirst($langs->transnoentities('The' . ucfirst($object->element))))) . '">' . $displayButton . '</span>';
}
Expand Down