diff --git a/public/userarea/apply_routine.php b/public/userarea/apply_routine.php index d9dbc20b..c9d90f16 100644 --- a/public/userarea/apply_routine.php +++ b/public/userarea/apply_routine.php @@ -35,6 +35,12 @@ try { $stmt = $pdo->prepare("SELECT idroutine, name, filename, engine FROM routine WHERE idroutine = :id LIMIT 1"); $stmt->execute([':id' => $idroutine]); } else { + // Il matching per filename รจ ambiguo per le routine a motore: tutte + // condividono _engine.php. Senza idroutine non possiamo sapere quale + // routine engine applicare -> meglio fermarsi che eseguire quella sbagliata. + if ($filename === '_engine.php') { + throw new Exception("Routine a motore senza idroutine: impossibile determinare quale routine applicare. Verifica che il template inoltri routine_data.idroutine."); + } $stmt = $pdo->prepare("SELECT idroutine, name, filename, engine FROM routine WHERE filename = :fn LIMIT 1"); $stmt->execute([':fn' => $filename]); } diff --git a/public/userarea/process_import_xls2.php b/public/userarea/process_import_xls2.php index 5a79ba0e..d42d8438 100644 --- a/public/userarea/process_import_xls2.php +++ b/public/userarea/process_import_xls2.php @@ -506,6 +506,7 @@ try { if ($routineData) { $response['apply_routine'] = true; $response['routine_data'] = [ + 'idroutine' => (int)$routineData['idroutine'], 'name' => $routineData['name'] ?? 'Routine Sconosciuta', 'instruction' => $routineData['instruction'] ?? 'Nessuna descrizione disponibile', 'filename' => $routineData['filename'] ?? '',