added fkag clone parts note
This commit is contained in:
@@ -10,6 +10,9 @@ $data = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
$sourceIddatadb = isset($data['source_iddatadb']) ? (int)$data['source_iddatadb'] : 0;
|
||||
$targetList = $data['target_iddatadb_list'] ?? [];
|
||||
// Default true: se il client non manda il parametro, cloniamo comunque le note
|
||||
// (comportamento di default richiesto, coerente con la checkbox pre-spuntata)
|
||||
$cloneNotes = array_key_exists('clone_notes', $data) ? !empty($data['clone_notes']) : true;
|
||||
$cloneAnalyses = !empty($data['clone_analyses']);
|
||||
|
||||
$targetIds = array_values(array_unique(array_filter(array_map('intval', (array)$targetList), function ($v) use ($sourceIddatadb) {
|
||||
@@ -102,7 +105,7 @@ try {
|
||||
':part_description' => $part['part_description'],
|
||||
':mix' => $part['mix'] ?? 'N',
|
||||
':idmatrice' => $part['idmatrice'] !== '' ? $part['idmatrice'] : null,
|
||||
':note' => $part['note'] ?? null,
|
||||
':note' => $cloneNotes ? ($part['note'] ?? null) : null,
|
||||
':dateexpiry' => $part['dateexpiry'] ?? null,
|
||||
]);
|
||||
|
||||
|
||||
@@ -199,6 +199,12 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="clone-confirm-message mb-3"></p>
|
||||
<div class="form-check mb-2">
|
||||
<input class="form-check-input" type="checkbox" id="cloneNotesCheckbox" checked>
|
||||
<label class="form-check-label" for="cloneNotesCheckbox">
|
||||
Duplica note
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="cloneAnalysesCheckbox">
|
||||
<label class="form-check-label" for="cloneAnalysesCheckbox">
|
||||
|
||||
@@ -2379,6 +2379,7 @@ $(document).ready(function () {
|
||||
.text(
|
||||
`Confermi il clone delle parti del record ${sourceIddatadb} negli altri ${targetIds.length} record visibili?`,
|
||||
);
|
||||
$("#cloneNotesCheckbox").prop("checked", true);
|
||||
$("#cloneAnalysesCheckbox").prop("checked", false);
|
||||
|
||||
const modalInstance = new bootstrap.Modal(
|
||||
@@ -2393,6 +2394,7 @@ $(document).ready(function () {
|
||||
|
||||
const sourceIddatadb = $("#cloneConfirmModal").data("source-iddatadb");
|
||||
const targetIds = $("#cloneConfirmModal").data("target-ids") || [];
|
||||
const cloneNotes = $("#cloneNotesCheckbox").is(":checked");
|
||||
const cloneAnalyses = $("#cloneAnalysesCheckbox").is(":checked");
|
||||
|
||||
if (!sourceIddatadb || !targetIds.length) {
|
||||
@@ -2420,6 +2422,7 @@ $(document).ready(function () {
|
||||
data: JSON.stringify({
|
||||
source_iddatadb: sourceIddatadb,
|
||||
target_iddatadb_list: targetIds,
|
||||
clone_notes: cloneNotes,
|
||||
clone_analyses: cloneAnalyses,
|
||||
}),
|
||||
success: function (response) {
|
||||
|
||||
Reference in New Issue
Block a user