added routine functionalites to template
This commit is contained in:
@@ -18,9 +18,9 @@ try {
|
||||
$target_table = trim($_POST['target_table']);
|
||||
$idclient = intval($_POST['client_id'] ?? 0); // Usa client_id dal form
|
||||
$clientname = trim($_POST['client_name'] ?? ''); // Usa client_name dal form
|
||||
$client_specific_fields = trim($_POST['client_specific_fields'] ?? '{}'); // Recupera il JSON dei campi specifici
|
||||
$idschema = intval($_POST['idschema'] ?? 0); // Nuovo campo
|
||||
$schemamaname = trim($_POST['schemamaname'] ?? ''); // Nuovo campo
|
||||
$schemaname = trim($_POST['schemaname'] ?? ''); // Corretto da schemamaname
|
||||
$idroutine = isset($_POST['idroutine']) && $_POST['idroutine'] !== '' ? intval($_POST['idroutine']) : null; // Aggiunto idroutine
|
||||
|
||||
// Controllo sui campi obbligatori
|
||||
if (empty($id) || empty($name) || empty($header_row) || empty($start_column) || empty($target_table) || $idschema <= 0) {
|
||||
@@ -32,20 +32,14 @@ try {
|
||||
throw new Exception("Please select a valid client.");
|
||||
}
|
||||
|
||||
// Validazione opzionale del JSON (per sicurezza)
|
||||
$decoded_fields = json_decode($client_specific_fields, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE && $client_specific_fields !== '{}') {
|
||||
throw new Exception("Invalid JSON format for client-specific fields.");
|
||||
}
|
||||
|
||||
// Connessione al database
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
// Aggiorna il database, includendo idschema e schemaname
|
||||
// Aggiorna il database, includendo idschema, schemaname e idroutine
|
||||
$stmt = $pdo->prepare("UPDATE excel_templates
|
||||
SET name = ?, header_row = ?, start_column = ?, description = ?, target_table = ?,
|
||||
idclient = ?, clientname = ?, client_specific_fields = ?, schemaname = ?, idschema = ?, updated_at = NOW()
|
||||
idclient = ?, clientname = ?, schemaname = ?, idschema = ?, idroutine = ?, updated_at = NOW()
|
||||
WHERE id = ?");
|
||||
$stmt->execute([
|
||||
$name,
|
||||
@@ -55,9 +49,9 @@ try {
|
||||
$target_table,
|
||||
$idclient,
|
||||
$clientname,
|
||||
$client_specific_fields,
|
||||
$schemamaname,
|
||||
$schemaname,
|
||||
$idschema,
|
||||
$idroutine,
|
||||
$id
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user