extracted objects

This commit is contained in:
2025-12-17 13:02:12 +01:00
commit 7dd4ea08e1
195 changed files with 70591 additions and 0 deletions

195
docs/apex/README.md Normal file
View File

@@ -0,0 +1,195 @@
# APEX Application Documentation
## Application Overview
| Property | Value |
|----------|-------|
| **Application ID** | 112 |
| **Application Name** | APCB Project |
| **Application Alias** | F_110112 |
| **APEX Version** | 21.1.0 |
| **Owner/Schema** | APOLLINARECATERINGPROD |
| **Language** | Italian (it) |
| **Date Format** | DD-MM-YYYY |
| **DateTime Format** | DD-MM-YYYY HH24:MI:SS |
| **Logo Text** | Apollinare Catering & Banqueting - Management Software |
| **Last Updated By** | MONIA |
| **Last Update** | 2025-11-24 14:06:02 |
## Application Statistics
| Component | Count |
|-----------|-------|
| **Pages** | 56 |
| **Items** | 302 |
| **Processes** | 98 |
| **Regions** | 151 |
| **Buttons** | 119 |
| **Dynamic Actions** | 62 |
| **LOVs** | 12 |
| **Authorization Schemes** | 5 |
| **Computations** | 2 |
| **Breadcrumb Entries** | 22 |
| **List Entries** | 2 |
| **Templates** | 64 |
| **Plug-ins** | 2 |
| **Messages** | 464 |
## Navigation Structure
### Desktop Navigation Menu
```
Home (Page 1)
├── Articoli (Page 2)
│ └── Impegni Articoli (Page 39)
├── Categorie (Page 4)
├── Tipi (Page 6)
├── Clienti (Page 17)
├── Location (Page 15)
├── Risorse (Page 31)
├── Permessi (Page 47) [Admin Only]
├── Gestione Dati (Page 45) [Admin Only]
├── Job Schedulati (Page 49)
├── Mail Inviate (Page 50)
└── Mail In Attesa (Page 51)
Eventi
├── Tipi Evento (Page 13) [Admin Only]
├── Nuovo Evento (Page 22) [Admin Only]
├── Schede/Schede Confermate (Page 35)
├── Liste (Page 9) [Admin Only]
├── Calendario Eventi (Page 12)
├── Degustazioni (Page 27)
└── Template Eventi (Page 48) [Admin Only]
Riepiloghi/Report
├── Griglia (Page 16) [Admin Only]
├── Riepilogo Cucina (Page 25)
├── Torte e Costi Extra (Page 28) [Admin Only]
├── Riepilogo Allestimenti (Page 30)
└── Riepilogo Risorse (Page 38)
```
## Page Categories
### Master Data Pages
| Page ID | Name | Description |
|---------|------|-------------|
| 2 | Articoli Rpt | Article list report |
| 3 | Articoli | Article detail form |
| 4 | Categorie Rpt | Categories list report |
| 5 | Categorie | Category detail form |
| 6 | Tipi Rpt | Types list report |
| 7 | Tipi | Type detail form |
| 17 | Clienti Rpt | Clients list report |
| 18 | Clienti | Client detail form |
| 15 | Location Rpt | Locations list report |
| 20 | Location | Location detail form |
| 31 | Risorse | Resources (staff) management |
### Event Management Pages
| Page ID | Name | Description |
|---------|------|-------------|
| 1 | Home | Dashboard |
| 8 | Nuovo Evento Wizard | Event creation wizard |
| 9 | Lista Eventi | Event list |
| 12 | Calendario | Event calendar |
| 13 | Tipi Evento Rpt | Event types list |
| 14 | Tipi Evento | Event type detail form |
| **22** | **Nuovo Evento** | **Main event form (most complex)** |
| 27 | Lista Degustazioni | Tastings list |
| 32 | Degustazione | Tasting detail |
| 35 | Schede/Schede Confermate | Event cards |
| 48 | Template Eventi | Event templates |
### Report Pages
| Page ID | Name | Description |
|---------|------|-------------|
| 16 | Griglia | Grid view |
| 25 | Riepilogo Cucina | Kitchen summary |
| 28 | Torte e Costi Extra | Cakes and extra costs |
| 30 | Riepilogo Allestimenti | Setup summary |
| 38 | Riepilogo Risorse | Resources summary |
| 39 | Impegni Articoli | Article commitments |
### Administration Pages
| Page ID | Name | Description |
|---------|------|-------------|
| 45 | Gestione Dati | Data management |
| 46 | Max Eventi | Max events configuration |
| 47 | Permessi | Permissions management |
| 49 | Job Schedulati | Scheduled jobs |
| 50 | Mail Inviate | Sent emails |
| 51 | Mail In Attesa | Pending emails |
## Page 22 (Nuovo Evento) - Most Complex Page
Page 22 is the main event management page with the highest complexity:
| Component | Count |
|-----------|-------|
| Items | 108 |
| Regions | 33 |
| Buttons | 32 |
| Processes | 32 |
| Dynamic Actions | Multiple |
### Key Features:
- Multiple Interactive Grids (master-detail)
- Guest type management with quantity recalculations
- Resource assignments
- Pick list management with coefficient-based calculations
- Event status workflow management
- Template support
- Versioning system
## Documentation Structure
```
docs/apex/
├── README.md (this file)
├── pages/ # Individual page documentation
├── processes/ # Process documentation
├── lovs/ # List of Values documentation
├── javascript/ # JavaScript libraries
├── authorization/ # Authorization schemes
├── dynamic-actions/ # Dynamic actions
├── items/ # Shared items
├── regions/ # Shared regions
└── navigation/ # Navigation components
```
## Key Files
- [LOVs Documentation](lovs/README.md) - List of Values definitions
- [Processes Documentation](processes/README.md) - PL/SQL processes
- [JavaScript Libraries](javascript/README.md) - Custom JavaScript
- [Authorization Schemes](authorization/README.md) - Security settings
- [Page 22 Documentation](pages/PAGE_022.md) - Main event form
## Event Status Workflow
```
100 (Preventivo/Quote)
↓ [Continue Event]
200 (Scheda/Preparazione)
↓ [Return to Preparazione]
300 (Confermata/Quasi)
↓ [Almost Continue Event]
350 (Quasi Confermato)
↓ [Confirm Event]
400 (Confermato/Confirmed)
↓ [Set Obsoleto]
900 (Superato/Expired)
```
## Authorization Schemes
| Scheme Name | Description |
|-------------|-------------|
| Admin_auth_schema | Full admin access |
| User Read/Write | Controlled by USERS_READONLY table |
| Consuntivi | Financial summaries access |
| Gestori | Manager-level permissions |
| Solo Admins | Highest level (admin, monia only) |

View File

@@ -0,0 +1,296 @@
# Authorization Schemes Documentation
This document describes the 5 authorization schemes used in the APEX application for access control.
## Overview
| Scheme Name | Type | Users/Condition | Error Message |
|-------------|------|-----------------|---------------|
| Admin_auth_schema | NATIVE_EXISTS | Specific user list | Utente non autorizzato |
| User Read/Write | NATIVE_FUNCTION_BODY | USERS_READONLY table | Utente abilitato in sola lettura |
| Consuntivi | NATIVE_EXISTS | GET_CONSUNTIVI_USERS view | Autorizzazione necessaria... |
| Gestori | NATIVE_EXISTS | GET_GESTORI_USERS view | Non possiedi i permessi... |
| Solo Admins | NATIVE_EXISTS | admin, monia only | Non possiedi i permessi... |
---
## Admin_auth_schema
**Type:** NATIVE_EXISTS
**Caching:** BY_USER_BY_PAGE_VIEW
**SQL Query:**
```sql
select 1 from dual
where lower(:APP_USER) in ('admin','monia','andrea','maria','sabrina','nicole','cucina','developer','elia.ballarani');
```
**Authorized Users:**
- admin
- monia
- andrea
- maria
- sabrina
- nicole
- cucina
- developer
- elia.ballarani
**Usage:** General administrative access to most management pages.
---
## User Read/Write
**Type:** NATIVE_FUNCTION_BODY
**Caching:** BY_USER_BY_PAGE_VIEW
**PL/SQL Function:**
```plsql
declare
v_readonly number;
begin
select 1
into v_readonly
from users_readonly
where username = :APP_USER
and flgwrite = 0;
return false;
exception when no_data_found then
return true;
end;
```
**Logic:**
- Checks `USERS_READONLY` table
- If user exists with `FLGWRITE = 0` → Returns FALSE (read-only mode)
- If user not found → Returns TRUE (write access)
**Usage:** Controls whether user can modify data or only view.
---
## Consuntivi
**Type:** NATIVE_EXISTS
**Caching:** BY_USER_BY_PAGE_VIEW
**SQL Query:**
```sql
select 1 from dual
where :APP_USER in (select users from get_consuntivi_users);
```
**Data Source:** `GET_CONSUNTIVI_USERS` view
**Usage:** Access to financial summary pages and cost management.
---
## Gestori
**Type:** NATIVE_EXISTS
**Caching:** BY_USER_BY_PAGE_VIEW
**SQL Query:**
```sql
select 1 from dual
where :APP_USER in (select users from get_gestori_users);
```
**Data Source:** `GET_GESTORI_USERS` view
**Usage:** Manager-level access. Applied to:
- Home page
- Nuovo Evento (Page 22)
- Liste (Page 9)
- Griglia (Page 16)
- Torte e Costi Extra (Page 28)
- Template Eventi (Page 48)
- Tipi Evento (Page 13)
---
## Solo Admins
**Type:** NATIVE_EXISTS
**Caching:** BY_USER_BY_PAGE_VIEW
**SQL Query:**
```sql
select 1 from dual
where lower(:APP_USER) in ('admin', 'monia');
```
**Authorized Users:**
- admin
- monia
**Usage:** Highest level of access. Reserved for:
- Permessi (Page 47)
- Gestione Dati (Page 45)
- Critical configuration pages
---
## Application-Level Processes
### SET_USER_READONLY
**Process Point:** Before Header (runs on every page)
**Sequence:** 1
```plsql
begin
select 1
into :APP_READ_ONLY
from users_readonly
where username = :APP_USER
and flgwrite = 0;
exception when no_data_found then
:APP_READ_ONLY := 0;
end;
```
**Sets:** `APP_READ_ONLY` application item
- Value `1` = Read-only mode
- Value `0` = Full access
This is checked in page processes with condition:
```plsql
:APP_READ_ONLY = 0
```
---
### SET_ITEM_SESSION
**Process Point:** On Demand
**Security:** MUST_NOT_BE_PUBLIC_USER
```plsql
declare
v_itemList varchar2(32000);
begin
v_itemList := APEX_UTIL.TABLE_TO_STRING(APEX_APPLICATION.G_F01);
for c in (
select
(select result from table(STRING_TO_TABLE_ENUM(a.result, 1, '='))) as item,
(select result from table(STRING_TO_TABLE_ENUM(a.result, 2, '='))) as val
from table(STRING_TO_TABLE_ENUM(v_itemList)) a
)
loop
APEX_UTIL.set_session_state(
p_name => c.item,
p_value => c.val
);
end loop;
end;
```
**Usage:** Called by `setSessionState()` JavaScript function to update APEX session state for multiple items.
---
## Application Items
### APP_READ_ONLY
**Protection Level:** Internal
**Escape on HTTP Output:** No
Stores the read-only flag for the current user session.
### APP_VERSION
Application version identifier.
---
## Authorization Hierarchy
```
┌─────────────────────────────────────────────────────────────┐
│ Solo Admins │
│ (admin, monia) │
├─────────────────────────────────────────────────────────────┤
│ Admin_auth_schema │
│ (admin, monia, andrea, maria, sabrina, nicole, │
│ cucina, developer, elia.ballarani) │
├─────────────────────────────────────────────────────────────┤
│ Gestori │
│ (from GET_GESTORI_USERS view) │
├─────────────────────────────────────────────────────────────┤
│ Consuntivi │
│ (from GET_CONSUNTIVI_USERS view) │
├─────────────────────────────────────────────────────────────┤
│ User Read/Write │
│ (based on USERS_READONLY.FLGWRITE flag) │
├─────────────────────────────────────────────────────────────┤
│ Authenticated Users │
│ (basic application access) │
└─────────────────────────────────────────────────────────────┘
```
---
## Database Objects for Authorization
### USERS_READONLY Table
| Column | Type | Description |
|--------|------|-------------|
| USERNAME | VARCHAR2 | APEX username |
| FLGWRITE | NUMBER | 0 = read-only, 1 = write |
### GET_GESTORI_USERS View
Returns list of users with manager permissions.
### GET_CONSUNTIVI_USERS View
Returns list of users with financial access.
---
## Migration Notes
When migrating to .NET + React:
1. **Authentication**
- Implement JWT or cookie-based authentication
- Consider integration with existing Oracle users or migrate to new system
2. **Authorization**
- Map authorization schemes to .NET roles/claims
- Implement policy-based authorization in .NET
3. **Role Mapping**
```csharp
public enum UserRole
{
User, // Basic authenticated user
ReadOnly, // Read-only access
Consuntivi, // Financial access
Gestori, // Manager level
Admin, // Admin_auth_schema equivalent
SuperAdmin // Solo Admins equivalent
}
```
4. **Frontend Authorization**
- Store user roles in JWT/session
- Implement route guards in React
- Conditionally render UI elements based on permissions
5. **Backend Authorization**
```csharp
[Authorize(Policy = "Gestori")]
public class EventController : Controller
{
[Authorize(Policy = "SoloAdmins")]
public IActionResult DeleteEvent(int id) { ... }
}
```

53282
docs/apex/f112.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,330 @@
# JavaScript Libraries Documentation
This document describes the custom JavaScript libraries used in the APEX application.
## Static Application Files
| File Name | Description |
|-----------|-------------|
| ajaxUtils.js | AJAX utilities for dynamic updates and server communication |
| iframeObj.js | Jasper Reports integration wrapper |
---
## ajaxUtils.js
Custom AJAX utility library for managing server-side communication and UI feedback.
### Functions
#### `notifica(pText, pType = null)`
Central dynamic notification function.
**Parameters:**
- `pText` (string): Message text to display
- `pType` (string, optional): Notification type - 'alert', 'success', 'error', 'warning', 'info'
**Behavior:**
- Clears existing errors
- If `pType` is provided, shows error notification at page level
- If `pType` is null, shows success message
**Example:**
```javascript
notifica("Record saved successfully"); // Success message
notifica("Error occurred", "error"); // Error message
```
---
#### `setSessionState(elemList, pCallback = null)`
Sets APEX session state for multiple items.
**Parameters:**
- `elemList` (string): Comma-separated list of item IDs (without P prefix)
- `pCallback` (function, optional): Callback function after session state is set
**How it works:**
1. Splits the element list by comma
2. Gets values for each element using jQuery
3. Creates a dictionary of item-value pairs
4. Calls APEX process `SET_ITEM_SESSION` to update session state
5. Executes callback with data and elements dictionary
**Example:**
```javascript
setSessionState("P22_EVENT_ID,P22_CLIENTE", function(pData, elems) {
console.log("Session state updated");
});
```
---
#### `ajaxExec(pName, clickObj, pParams, pCallback, pConfirm, pLoading, pAsync, pType)`
Generic AJAX execution wrapper for APEX server processes.
**Parameters:**
- `pName` (string): APEX process name to execute
- `clickObj` (jQuery object): Button/element that triggered the action
- `pParams` (object): Parameters to pass to the process
- `pCallback` (function): Callback function on success/error
- `pConfirm` (string): Confirmation message (uses native confirm dialog)
- `pLoading` (boolean): Show loading popup
- `pAsync` (boolean): Execute asynchronously
- `pType` (string): Response data type (default: 'text')
**Features:**
- Prevents page unload during execution
- Shows loading spinner on clicked element
- Handles confirmation dialogs
- Parses response and removes quotes
- Executes callback with parsed data
**Example:**
```javascript
ajaxExec("SAVE_EVENT", clickBtn, {x01: eventId}, function(data, btn, params) {
notifica("Event saved");
}, "Are you sure?", true);
```
---
#### `execProcessAsync(pName, pParams, pPreExec, pCallback, pItems = null, clickObj = null, pConfirm = null, pLoading = null)`
Wrapper for async process execution with optional session state update.
**Parameters:**
- `pName` (string): Process name
- `pParams` (object): Process parameters
- `pPreExec` (function): Function to execute before AJAX call
- `pCallback` (function): Callback after process execution
- `pItems` (string): Items to set in session state first
- `clickObj`: Clicked element
- `pConfirm` (string): Confirmation message
- `pLoading` (boolean): Show loading indicator
**Example:**
```javascript
execProcessAsync("UPDATE_QTY", {x01: itemId}, null, function(data) {
apex.region("LIST_PREL").refresh();
}, "P22_EVENT_ID");
```
---
#### `execQueryAsync(pQuery, pPreExec, pCallback, clickObj = null, pConfirm = null, pItems = null, pLoading = null)`
Executes a SQL query asynchronously.
**Parameters:**
- `pQuery` (string): SQL query to execute
- `pPreExec` (function): Pre-execution function
- `pCallback` (function): Callback with query results
- `clickObj`: Clicked element
- `pConfirm` (string): Confirmation message
- `pItems` (string): Items to set in session state
- `pLoading` (boolean): Show loading indicator
**Note:** Calls the `EXEC_QUERY` APEX process with the query in `x01` parameter.
---
## iframeObj.js
JavaScript wrapper for embedding Jasper Reports in iframes.
### Configuration
```javascript
var j_datasource = "default"; // Jasper datasource name
var j_username = "jasperadmin"; // Jasper server username
var j_password = "jasperadmin"; // Jasper server password
var j_def_outp = "pdf"; // Default output format (HTML, PDF)
```
### Iframe Class
#### Constructor
```javascript
var Iframe = function(parentObj, id, attr) { ... }
```
**Parameters:**
- `parentObj`: Parent DOM element
- `id`: Iframe element ID
- `attr`: Additional attributes
### Methods
#### `setCss(css)`
Sets CSS styles on the iframe.
**Parameters:**
- `css` (object): CSS properties dictionary
**Example:**
```javascript
iframe.setCss({ width: "100%", height: "600px", border: "none" });
```
---
#### `setUrl(Url)`
Sets the iframe source URL.
---
#### `getUrl()`
Returns the current iframe URL.
---
#### `refresh()`
Reloads the iframe content.
---
#### `hide()`
Hides the iframe (display: none).
---
#### `show()`
Shows the iframe (display: block).
---
#### `jasperReport(dir, datasource, params, output, username, password)`
Generates a Jasper Reports URL and loads it in the iframe.
**Parameters:**
- `dir` (string, required): Report path in Jasper server
- `datasource` (string): Data source name (default: "default")
- `params` (object): Report parameters as key-value pairs
- `output` (string): Output format - 'pdf' or 'html' (default: 'pdf')
- `username` (string): Jasper server username
- `password` (string): Jasper server password
**URL Format:**
```
/jri/report?_repName={dir}&_repFormat={output}&_dataSource={datasource}&_repLocale=it_IT&_repTimeZone=Europe/Rome&{params}
```
**Example:**
```javascript
var rptFrame = new Iframe(container, "reportFrame");
rptFrame.jasperReport(
"apcb/scheda_evento_rpt",
"default",
{ P_EVENT_ID: eventId, P_TIPO: "PREVENTIVO" },
"pdf"
);
```
---
## Usage in APEX Pages
### Time Input Masks
The application uses inputmask library for time fields:
```javascript
Inputmask("99:99", {
placeholder: "HH:MM"
}).mask($("#P22_ORA_INI_EVENTO"));
```
### SweetAlert2 Integration
Used for enhanced confirmation dialogs:
```javascript
Swal.fire({
title: 'Conferma',
text: 'Vuoi continuare?',
icon: 'warning',
showCancelButton: true
}).then((result) => {
if (result.isConfirmed) {
// proceed
}
});
```
### Interactive Grid Refresh
```javascript
// Refresh a specific interactive grid
apex.region("LISTA_PRELIEVO").refresh();
// Refresh with callback
apex.region("OSPITI").widget().interactiveGrid("getViews", "grid").model.fetchRecords();
```
---
## Migration Notes
When migrating to React TypeScript:
1. **AJAX Utilities** - Replace with:
- Axios or fetch for HTTP requests
- React Query or SWR for data fetching
- Toast library (react-toastify) for notifications
2. **Session State** - Replace with:
- React Context or Redux for state management
- URL parameters for shareable state
- Session storage for persistence
3. **Jasper Reports** - Options:
- Keep Jasper and embed via iframe
- Migrate to SSRS, Crystal Reports
- Use PDF libraries (QuestPDF, iTextSharp)
- Use React-PDF for client-side PDF generation
4. **Input Masks** - Use:
- react-input-mask
- @react-input/mask
- Material-UI TextField with InputProps
5. **SweetAlert2** - Replace with:
- MUI Dialog components
- react-confirm-alert
- Custom modal component
### Example React Migration
```typescript
// ajaxUtils.js equivalent in React
import { toast } from 'react-toastify';
import axios from 'axios';
export const notifica = (text: string, type?: 'success' | 'error' | 'warning' | 'info') => {
if (type) {
toast[type](text);
} else {
toast.success(text);
}
};
export const executeProcess = async <T>(
processName: string,
params: Record<string, any>
): Promise<T> => {
const response = await axios.post(`/api/processes/${processName}`, params);
return response.data;
};
```

242
docs/apex/lovs/README.md Normal file
View File

@@ -0,0 +1,242 @@
# List of Values (LOVs) Documentation
This document contains all 12 List of Values defined in the APEX application.
## Overview
| LOV Name | Source Type | Description |
|----------|-------------|-------------|
| ARTICOLI | SQL Query | Article selection |
| CATEGORIE | SQL Query | Category selection |
| CLIENTI | SQL Query | Client selection |
| LOCATION | SQL Query | Location selection |
| RISORSE | SQL Query | Resource (staff) selection |
| STATO_EVENTO | Static | Event status values |
| TIPI MAT | SQL Query | Material type selection |
| TIPI RISORSE | SQL Query | Resource type selection |
| TIPO_EVENTO | SQL Query | Event type selection |
| TIPO_OSPITI | SQL Query | Guest type selection |
| TIPO_PASTO | Static | Meal type values |
| USERS | SQL Query | User selection |
---
## ARTICOLI
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select /*a.cod_categ || ' - ' || c.descrizione || ' - ' ||*/ a.DESCRIZIONE as descrizione, a.COD_ARTICOLO
from articoli a
join tb_codici_categ c on a.cod_categ = c.cod_categ
order by 1
```
**Usage:** Selecting articles in pick lists and event details.
---
## CATEGORIE
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
SELECT descrizione as d,
cod_categ as r
FROM tb_codici_categ
ORDER BY 1
```
**Usage:** Filtering articles by category, category selection in forms.
---
## CLIENTI
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select CLIENTE, ID
from clienti
```
**Usage:** Client selection in event forms.
---
## LOCATION
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select location || ' - ' || indirizzo, id
from location
```
**Usage:** Location selection in event forms. Displays location name with address.
---
## RISORSE
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select NOME || ' ' || COGNOME d, id r
from risorse
```
**Usage:** Resource (staff) assignment in events. Displays full name.
---
## STATO_EVENTO
**Source Type:** Static
**Values:**
| Display Value | Return Value | Sequence |
|---------------|--------------|----------|
| Scheda Evento (Preparazione) | 0 | 10 |
| Preventivo | 10 | 20 |
| Confermato | 20 | 30 |
**Note:** The actual status values in the database have been expanded:
- 100 = Preventivo
- 200 = Scheda
- 300 = Confermata
- 350 = Quasi Confermato
- 400 = Confermato
- 900 = Superato
**Usage:** Event status display and selection.
---
## TIPI MAT
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
SELECT descrizione as d,
cod_tipo as r
FROM tb_tipi_mat
ORDER BY 1
```
**Usage:** Material type filtering in pick lists. Controls the step-by-step wizard flow.
---
## TIPI RISORSE
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select descrizione, cod_tipo
from tb_tipi_risorsa
```
**Usage:** Resource type classification (camerieri, cuochi, etc.).
---
## TIPO_EVENTO
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select trim(DESCRIZIONE) || decode(tipo_pasto, 'C', ' - Cena', 'P', ' - Pranzo', null) as d,
COD_TIPO as r
from tb_tipi_evento
```
**Usage:** Event type selection. Displays description with meal type indicator (Pranzo/Cena).
---
## TIPO_OSPITI
**Source Type:** SQL Query (LEGACY_SQL)
**Query:**
```sql
select descrizione as d,
cod_tipo as r
from tb_tipi_ospiti
order by 1
```
**Usage:** Guest type selection in event guest details.
---
## TIPO_PASTO
**Source Type:** Static
**Values:**
| Display Value | Return Value | Sequence |
|---------------|--------------|----------|
| Pranzo | P | 1 |
| Cena | C | 2 |
| Pranzo Buffet | A | 3 |
| Cena Buffet | B | 4 |
**Usage:** Meal type classification for events and event types.
---
## USERS
**Source Type:** SQL Query
**Query:**
```sql
select user_name D, user_name R
from WWV_FLOW_USERS
```
**Return Column:** R
**Display Column:** D
**Usage:** User selection for permissions and assignments.
---
## Migration Notes
When migrating to React TypeScript:
1. **Static LOVs** (STATO_EVENTO, TIPO_PASTO) can be implemented as TypeScript enums or const objects
2. **SQL-based LOVs** should be converted to API endpoints
3. Consider caching strategy for frequently used LOVs (CATEGORIE, TIPI MAT, etc.)
4. TIPO_EVENTO uses Oracle `decode()` function - convert to CASE WHEN or handle in API
### Example TypeScript Implementation
```typescript
// Static LOV - TIPO_PASTO
export const TIPO_PASTO = {
PRANZO: { value: 'P', label: 'Pranzo' },
CENA: { value: 'C', label: 'Cena' },
PRANZO_BUFFET: { value: 'A', label: 'Pranzo Buffet' },
CENA_BUFFET: { value: 'B', label: 'Cena Buffet' },
} as const;
// Dynamic LOV - API endpoint
// GET /api/lovs/articoli
// GET /api/lovs/categorie
// GET /api/lovs/clienti
// etc.
```

View File

@@ -0,0 +1,5 @@
# Page 2 - Articoli Rpt
## Items (1)
- `P2_IMMAGINE`

View File

@@ -0,0 +1,25 @@
# Page 3 - Articoli
## Items (21)
- `P3_COD_ARTICOLO`
- `P3_COD_CATEG`
- `P3_COD_RELATIVO`
- `P3_COEFF`
- `P3_COEFF_A`
- `P3_COEFF_B`
- `P3_COEFF_S`
- `P3_DESCRIZIONE`
- `P3_FLG_CUCINA`
- `P3_IMMAGINE`
- `P3_IMMAGINE_DISPLAY`
- `P3_PERC_IVA`
- `P3_PERC_OSPITI`
- `P3_QTAGIAC`
- `P3_QTAIMP`
- `P3_QTA_STD_A`
- `P3_QTA_STD_B`
- `P3_QTA_STD_S`
- `P3_RANK`
- `P3_ROWID`
- `P3_TIPO_QTA`

View File

@@ -0,0 +1,13 @@
# Page 5 - Categorie
## Items (9)
- `P5_COD_CATEG`
- `P5_COD_TIPO`
- `P5_COEFF_A`
- `P5_COEFF_B`
- `P5_COEFF_S`
- `P5_DESCRIZIONE`
- `P5_ROWID`
- `P5_SHOW_PRINT`
- `P5_TIPO_RIEPILOGO`

View File

@@ -0,0 +1,7 @@
# Page 7 - Tipi
## Items (3)
- `P7_COD_TIPO`
- `P7_DESCRIZIONE`
- `P7_ROWID`

View File

@@ -0,0 +1,39 @@
# Page 8 - Creazione Evento
## Items (35)
- `P8_ALLERGIE`
- `P8_CATEG`
- `P8_CATEG_FILTER`
- `P8_CLIENTE`
- `P8_CLIENTE_DISPLAY`
- `P8_COD_TIPO`
- `P8_COD_TIPO_DISPLAY`
- `P8_COD_TIPO_FILTER`
- `P8_CONFETTATA`
- `P8_DATA`
- `P8_DATA_DISPLAY`
- `P8_DESCRIZIONE`
- `P8_DESCRIZIONE_DISPLAY`
- `P8_EVENT_ID`
- `P8_FLG_TEMPLATE`
- `P8_ID_IMAGE_SHOW`
- `P8_INDIRIZZO`
- `P8_INDIRIZZO_DISPLAY`
- `P8_LOCATION`
- `P8_LOCATION_DISPLAY`
- `P8_MAXSTEP`
- `P8_NOTE`
- `P8_NOTE_DISPLAY`
- `P8_ORA_INI_CER`
- `P8_ORA_INI_EVT`
- `P8_PERC_SEDUTE`
- `P8_STAMPA_MENU`
- `P8_STEP`
- `P8_TAVOLI_NR`
- `P8_TORTA`
- `P8_TORTA_DISPLAY`
- `P8_TOT_ADULTI`
- `P8_TOT_BABY`
- `P8_TOT_KINDER`
- `P8_TOT_OSPITI`

View File

@@ -0,0 +1,6 @@
# Page 10 - Anteprima Immagine
## Items (2)
- `P10_IMMAGINE`
- `P10_ROWID`

View File

@@ -0,0 +1,5 @@
# Page 11 - Stampa Riepilogo
## Items (1)
- `P11_EVENT_ID`

View File

@@ -0,0 +1,9 @@
# Page 14 - Tipi Evento
## Items (5)
- `P14_COD_TIPO`
- `P14_DESCRIZIONE`
- `P14_LIVELLO`
- `P14_ROWID`
- `P14_TIPO_PASTO`

View File

@@ -0,0 +1,5 @@
# Page 16 - Griglia
## Items (1)
- `P16_SETTIMANA`

View File

@@ -0,0 +1,14 @@
# Page 18 - Clienti
## Items (10)
- `P18_CLIENTE`
- `P18_COGNOME_RIF`
- `P18_INDIRIZZO`
- `P18_MAIL`
- `P18_NOME_RIF`
- `P18_PIVA`
- `P18_RAGSOC`
- `P18_ROWID`
- `P18_TEL1`
- `P18_TEL2`

View File

@@ -0,0 +1,20 @@
# Page 19 - Articoli Popup
## Items (16)
- `P19_COD_ARTICOLO`
- `P19_COD_CATEG`
- `P19_COD_RELATIVO`
- `P19_COEFF`
- `P19_COEFF_A`
- `P19_COEFF_B`
- `P19_COEFF_S`
- `P19_DESCRIZIONE`
- `P19_FLG_CUCINA`
- `P19_IMMAGINE`
- `P19_IMMAGINE_DISPLAY`
- `P19_QTA_STD_A`
- `P19_QTA_STD_B`
- `P19_QTA_STD_S`
- `P19_ROWID`
- `P19_TIPO_QTA`

View File

@@ -0,0 +1,11 @@
# Page 20 - Location
## Items (7)
- `P20_ID`
- `P20_INDIRIZZO`
- `P20_LOCATION`
- `P20_NOTE`
- `P20_NOTE2`
- `P20_REFERENTE`
- `P20_ROWID`

View File

@@ -0,0 +1,5 @@
# Page 21 - Costi Articolo
## Items (1)
- `P21_COD_ARTICOLO`

112
docs/apex/pages/PAGE_022.md Normal file
View File

@@ -0,0 +1,112 @@
# Page 22 - Evento
## Items (108)
- `P22_ALLERGIE`
- `P22_ALLEST_BUFF`
- `P22_ALTRO`
- `P22_ALTRO_A`
- `P22_ALTRO_B`
- `P22_ARTICOLO_ADD`
- `P22_ARTICOLO_REMOVE`
- `P22_BICCHIERI`
- `P22_BUFFET_DOLCI_A`
- `P22_BUFFET_DOLCI_B`
- `P22_BUFFET_FINALE`
- `P22_BUFFET_FINALE_DISPLAY`
- `P22_BUFFET_INIZIALE`
- `P22_BUFFET_INIZIALE_DISPLAY`
- `P22_CARICOAPOLL`
- `P22_CARICOSPOSI`
- `P22_CATEG`
- `P22_CATEG_FILTER`
- `P22_CLIENTE`
- `P22_CLIENTE_EMAIL`
- `P22_CLIENTE_TEL`
- `P22_COD_TIPO`
- `P22_COD_TIPO_FILTER`
- `P22_COLOR`
- `P22_CONSUNTIVO_MORE_DETAILS`
- `P22_CONTRATTO_FIRMATO`
- `P22_DATA`
- `P22_DATA_DOC`
- `P22_DATA_SCAD_PREVENTIVO`
- `P22_DATORASCARICO`
- `P22_DATORASCARICO_NOTE`
- `P22_DELETED`
- `P22_DELETED_BY`
- `P22_DELETED_DATE`
- `P22_DESCRIZIONE`
- `P22_DISABLED`
- `P22_DISTANZA_LOCATION`
- `P22_EVENT_ID`
- `P22_EVENT_ID_DISPLAY`
- `P22_EXTRA`
- `P22_EXTRA_COSTI`
- `P22_FLG_SUPERATO`
- `P22_FLG_TEMPLATE`
- `P22_GGSETT`
- `P22_GRAN_BUFFET_A`
- `P22_GRAN_BUFFET_B`
- `P22_ID_EVT_FIGLIO`
- `P22_ID_EVT_PADRE`
- `P22_ID_IMAGE_SHOW`
- `P22_INDIRIZZO`
- `P22_IS_TEMPLATE`
- `P22_LISTA_PRINT`
- `P22_LOCATION`
- `P22_LOCATION_DESCRI`
- `P22_MAIL_ENABLED`
- `P22_MAXSTEP`
- `P22_NEW`
- `P22_NEW_EVENT_ID`
- `P22_NOTE`
- `P22_NOTE_INVIO`
- `P22_NUMALTRI`
- `P22_NUMDEGUSTAZIONI`
- `P22_NUM_LISTA`
- `P22_ORA_CERIMONIA`
- `P22_ORA_EVENTO`
- `P22_ORA_FINE_CERIMONIA`
- `P22_ORA_FINE_EVENTO`
- `P22_ORA_FI_CER`
- `P22_ORA_FI_EVENTO`
- `P22_ORA_INI_CER`
- `P22_ORA_INI_EVENTO`
- `P22_PERC_SEDUTE`
- `P22_PERMES_CONSUNTIVI_REPORT`
- `P22_PIATTI`
- `P22_PIATTINO_PANE`
- `P22_POSATE`
- `P22_PRE_BOUV_A`
- `P22_PRE_BOUV_B`
- `P22_PRIMI`
- `P22_PRIMI_DISPLAY`
- `P22_REFERENTE_TEL`
- `P22_RISORSA_ADD`
- `P22_RISORSA_REMOVE`
- `P22_RUNNER`
- `P22_SCADUTO`
- `P22_SECONDI`
- `P22_SEDIA`
- `P22_SERVIZIO_TAVOLO_A`
- `P22_SERVIZIO_TAVOLO_B`
- `P22_SOTTOPIATTI`
- `P22_STATO`
- `P22_STATUS`
- `P22_STEP`
- `P22_STILE_COLORI`
- `P22_TIPOL_TAV_OSPITI`
- `P22_TIPOL_TAV_SPOSI`
- `P22_TIPORIS_FILTER`
- `P22_TORTA`
- `P22_TORTA_A`
- `P22_TORTA_B`
- `P22_TOT_OSPITI`
- `P22_TOVAGLIA`
- `P22_TOVAGLIOLO`
- `P22_VERSION_DISPLAY`
- `P22_VERS_NUMBER`
- `P22_VERS_TOKEN`
- `P22_VINI`
- `P22_VINI_DISPLAY`

View File

@@ -0,0 +1,6 @@
# Page 24 - Stampa Riepilogo Extra
## Items (2)
- `P24_DATA_FI`
- `P24_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 25 - Cucina
## Items (2)
- `P25_DATA_FI`
- `P25_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 26 - Stampa Riepilogo Cucina
## Items (2)
- `P26_DATA_FI`
- `P26_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 27 - Degustazioni_Lista
## Items (2)
- `P27_DATA_FI`
- `P27_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 28 - Torte e Costi Extra
## Items (2)
- `P28_DATA_FI`
- `P28_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 29 - Stampa Riepilogo Allestimenti
## Items (2)
- `P29_DATA_FI`
- `P29_DATA_IN`

View File

@@ -0,0 +1,6 @@
# Page 30 - Riepilogo Allestimenti
## Items (2)
- `P30_DATA_FI`
- `P30_DATA_IN`

View File

@@ -0,0 +1,18 @@
# Page 32 - Degustazioni
## Items (14)
- `P32_DATA`
- `P32_EMAIL`
- `P32_ID`
- `P32_ID_EVENTO`
- `P32_LOCATION`
- `P32_MENU`
- `P32_NOME`
- `P32_NOTE`
- `P32_N_DEGUSTAZIONE`
- `P32_N_PAGANTI`
- `P32_N_PERSONE`
- `P32_ORA`
- `P32_ROWID`
- `P32_TELEFONO`

View File

@@ -0,0 +1,6 @@
# Page 33 - Stampa Scheda Evento
## Items (2)
- `P33_EVENT_ID`
- `P33_LISTA`

View File

@@ -0,0 +1,6 @@
# Page 35 - Lista Schede Evento
## Items (2)
- `P35_DATEFROM`
- `P35_DATETO`

View File

@@ -0,0 +1,6 @@
# Page 36 - Stampa Riepilogo Degustazioni
## Items (2)
- `P36_DATA_FI`
- `P36_DATA_IN`

View File

@@ -0,0 +1,7 @@
# Page 38 - Riepilogo Risorse
## Items (3)
- `P38_COD_AZIENDA`
- `P38_DATA_FI`
- `P38_DATA_IN`

View File

@@ -0,0 +1,8 @@
# Page 39 - Impegni Articoli
## Items (4)
- `P39_COD_ARTICOLO`
- `P39_DATA_FI`
- `P39_DATA_IN`
- `P39_SHOW_HISTORY`

View File

@@ -0,0 +1,7 @@
# Page 40 - Stampa Riepilogo Risorse
## Items (3)
- `P40_COD_AZIENDA`
- `P40_DATA_FI`
- `P40_DATA_IN`

View File

@@ -0,0 +1,5 @@
# Page 41 - Backup
## Items (1)
- `P41_BCKPASSWORD`

View File

@@ -0,0 +1,12 @@
# Page 42 - Nuovo Allegato Evento
## Items (8)
- `P42_CHARSET`
- `P42_EVENT_ID`
- `P42_FILENAME`
- `P42_FILESIZELIMITKB`
- `P42_ID`
- `P42_LAST_UPDATE`
- `P42_MIME_TYPE`
- `P42_RAW_DATA`

View File

@@ -0,0 +1,5 @@
# Page 43 - Registro Acconti Evento
## Items (1)
- `P43_ID_EVENTO`

View File

@@ -0,0 +1,5 @@
# Page 44 - Registro Altri Costi
## Items (1)
- `P44_ID_EVENTO`

View File

@@ -0,0 +1,8 @@
# Page 45 - GestioneDati
## Items (4)
- `P45_CONSUNTIVI_A`
- `P45_CONSUNTIVI_DA`
- `P45_EVENTI_A`
- `P45_EVENTI_DA`

View File

@@ -0,0 +1,6 @@
# Page 46 - Imposta Blocco Calendario
## Items (2)
- `P46_GIORNO`
- `P46_MAX_EVENTI`

View File

@@ -0,0 +1,6 @@
# Page 47 - Permessi
## Items (2)
- `P47_CONSUNTIVI_USERS`
- `P47_GESTORI_USERS`

View File

@@ -0,0 +1,10 @@
# Page 52 - send_mail_modal
## Items (6)
- `P52_DATA_FROM`
- `P52_DATA_FROM_DISPLAY`
- `P52_DATA_TO`
- `P52_DATA_TO_DISPLAY`
- `P52_MAIL_BODY`
- `P52_MAIL_SUBJECT`

View File

@@ -0,0 +1,11 @@
# Page 53 - COPIA_LISTA_PAGE
## Items (7)
- `P53_COPIA_ACCONTI`
- `P53_COPIA_ALTRICOSTI`
- `P53_COPIA_DEGUSTAZIONI`
- `P53_COPIA_PRELIEVI`
- `P53_COPIA_RISORSE`
- `P53_EVENTO_FROM`
- `P53_EVENTO_TO`

View File

@@ -0,0 +1,6 @@
# Page 101 - Login Page
## Items (2)
- `P101_PASSWORD`
- `P101_USERNAME`

View File

@@ -0,0 +1,7 @@
# Page 999 - Stampa Preventivo
## Items (3)
- `P999_EVENT_ID`
- `P999_MORE_DETAILS`
- `P999_SHOW_ECONOMICS`

View File

@@ -0,0 +1,558 @@
# APEX Processes Documentation
This document contains all 98 processes defined in the APEX application, organized by page.
## Process Overview
| Process Type | Count |
|--------------|-------|
| NATIVE_FORM_INIT | Multiple |
| NATIVE_FORM_DML | Multiple |
| NATIVE_PLSQL | Multiple |
| NATIVE_IG_DML | Multiple |
| NATIVE_SESSION_STATE | Multiple |
---
## Shared (Application-Level) Processes
### SET_USER_READONLY
**Process Point:** Before Header (runs on every page)
**Type:** NATIVE_PLSQL
Sets the `APP_READ_ONLY` application item based on user permissions.
```plsql
begin
if F_USER_IN_ROLE(:APP_USER, 'READONLY') then
:APP_READ_ONLY := 1;
else
:APP_READ_ONLY := 0;
end if;
end;
```
---
## Page 3 - Articoli (Article Form)
### Fetch Row from ARTICOLI
**Process Point:** After Header
**Type:** NATIVE_FORM_INIT
Initializes form with article data.
### Process Row of ARTICOLI
**Process Point:** After Submit
**Type:** NATIVE_FORM_DML
Saves/updates article record.
### Delete Image
**Process Point:** After Submit
**Type:** NATIVE_PLSQL
**Button:** Delete Image
```plsql
begin
update articoli
set
raw_data = null,
last_update = null,
charset = null,
mimetype = null,
filename = null
where rowid = :P3_ROWID;
end;
```
---
## Page 22 - Nuovo Evento (Main Event Form)
Page 22 is the most complex page with 32 processes.
### After Header Processes
#### Get Event Details
**Sequence:** 10
**Type:** NATIVE_FORM_INIT
Fetches event record into form items.
#### Set Ospiti on load
**Sequence:** 20
**Type:** NATIVE_PLSQL
```plsql
begin
EVENTI_AGGIORNA_TOT_OSPITI(:P22_EVENT_ID);
end;
```
#### Default Values
**Sequence:** 40
**Type:** NATIVE_PLSQL
```plsql
begin
select trim(l.location)
into :P22_LOCATION_DESCRI
from eventi e
join location l on l.id = e.id_location
where e.id = :P22_EVENT_ID;
exception when no_data_found then
null;
end;
```
#### Normalizza dati
**Sequence:** 50
**Type:** NATIVE_PLSQL
Formats time values for display:
```plsql
:P22_ORA_INI_CER := to_char(to_date(:P22_ORA_CERIMONIA, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
:P22_ORA_INI_EVENTO := to_char(to_date(:P22_ORA_EVENTO, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
:P22_ORA_FI_CER := to_char(to_date(:ORA_FINE_CERIMONIA, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
:P22_ORA_FI_EVENTO := to_char(to_date(:ORA_FINE_EVENTO, 'DD-MM-YYYY HH24:MI'), 'hh24:mi');
```
#### New Template Default Data
**Sequence:** 60
**Condition:** P22_IS_TEMPLATE is not null
```plsql
:P22_DATA := sysdate;
```
---
### After Submit Processes
#### Set Date Default if Template
**Sequence:** 10
**Condition:** P22_IS_TEMPLATE is not null
```plsql
:P22_DATA := sysdate;
```
#### Delete Template
**Sequence:** 20
**Button:** Delete Template
**Condition:** P22_IS_TEMPLATE is not null
```plsql
delete from eventi where id = :P22_EVENT_ID;
```
#### Genera Evento da Template
**Sequence:** 30
**Button:** Generate from Template
**Condition:** P22_IS_TEMPLATE is not null
```plsql
EVENTI_COPIA
(
ID_EVENTO_OLD => :P22_EVENT_ID,
NUOVA_VERSIONE => 0,
ID_EVENTO_NEW => :P22_EVENT_ID
);
```
#### Formatta Ore Inizio
**Sequence:** 40
Combines date and time for storage:
```plsql
:P22_ORA_EVENTO := :P22_DATA || ' ' || :P22_ORA_INI_EVENTO;
:P22_ORA_CERIMONIA := :P22_DATA || ' ' || :P22_ORA_INI_CER;
```
#### Prepara Acconti Automatici
**Sequence:** 50
**Condition:** REQUEST in ('PREPARA_ACCONTI', 'PRINT_PREVENTIVO')
```plsql
EVENTI_RICALCOLA_ACCONTI(p_event_id => :P22_EVENT_ID);
```
**Comment:** Default 3 deposits: 30%, 50%, 20%
#### Go Forward
**Sequence:** 60
**Button:** NEXT
Navigates to next wizard step:
```plsql
declare
v_step number;
begin
begin
select min(cod_step)
into v_step
from tb_tipi_mat
where cod_step > TO_NUMBER(:P22_STEP);
end;
begin
select cod_tipo
into :P22_COD_TIPO_FILTER
from tb_tipi_mat
where cod_step = v_step;
exception when no_data_found
then raise_application_error(-20001, 'Errore sconosciuto');
end;
:P22_STEP := v_step;
end;
```
#### Go Backward
**Sequence:** 70
**Button:** PREVIOUS
Navigates to previous wizard step.
#### Tipo Ospiti - Save Interactive Grid Data
**Sequence:** 80
**Region:** Guest Types Grid
**Type:** NATIVE_IG_DML
**Condition:** APP_READ_ONLY = 0
Saves guest type records.
#### Tipo Ospiti - Aggiorna Lista Prelievo
**Sequence:** 90
**Type:** NATIVE_PLSQL
**Condition:** APP_READ_ONLY = 0
Recalculates pick list quantities after guest changes:
```plsql
EVENTI_AGGIORNA_QTA_LISTA(
P_ID_EVENTO => :P22_EVENT_ID
);
```
#### Degustazioni - Save Interactive Grid Data
**Sequence:** 100
**Region:** Tastings Grid
**Type:** NATIVE_IG_DML
#### Delete Eventi Childs
**Sequence:** 110
**Button:** DELETE
**Condition:** NEVER (disabled)
```plsql
begin
delete from eventi_det_ospiti
where id_evento = :P22_EVENT_ID;
delete from eventi_det_prel
where id_evento = :P22_EVENT_ID;
delete from eventi_det_ris
where id_evento = :P22_EVENT_ID;
delete from eventi_det_degust
where id_evento = :P22_EVENT_ID;
end;
```
#### Set Obsoleto
**Sequence:** 120
**Button:** Set Obsolete
**Condition:** APP_READ_ONLY = 0
Marks event as expired/cancelled:
```plsql
begin
UPDATE EVENTI
SET FLG_SUPERATO = 1, STATO = 900, MAIL_ENABLED = 0
WHERE ID = :P22_EVENT_ID;
end;
```
#### Salva Evento
**Sequence:** 130
**Condition:** Complex (handles CREATE, SAVE, DELETE)
Main event save process. Full implementation handles:
- All event fields mapping
- Email validation
- Status-based logic
- Versioning support
- Soft delete
Key excerpts:
```plsql
declare
r_eventi eventi%rowtype;
begin
if :REQUEST = 'PREVIOUS' or :REQUEST = 'NEXT'
then
return;
end if;
if(:P22_DATA is null)
then
raise_application_error(-20001, 'Inserire la data evento');
end if;
-- Set all row fields
r_eventi."ID" := :P22_EVENT_ID;
r_eventi.DESCRIZIONE := :P22_DESCRIZIONE;
r_eventi.COD_TIPO := :P22_COD_TIPO;
-- ... (all other fields)
-- Email validation
IF REGEXP_LIKE(:P22_CLIENTE_EMAIL, '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')
OR :P22_CLIENTE_EMAIL IS NULL THEN
r_eventi.CLIENTE_EMAIL := :P22_CLIENTE_EMAIL;
ELSE
RAISE_APPLICATION_ERROR(-20005, 'Formato email cliente non valido');
END IF;
-- Versioning
r_eventi.VERS_NUMBER := nvl(:P22_VERS_NUMBER, 0);
r_eventi.VERS_TOKEN := :P22_VERS_TOKEN;
case :REQUEST
when 'SAVE' then
update eventi set row = r_eventi where id = :P22_EVENT_ID;
when 'CREATE' then
insert into eventi values r_eventi returning id into :P22_EVENT_ID;
when 'DELETE' then
if r_eventi.ID_EVT_FIGLIO is not null or r_eventi.ID_EVT_PADRE is not null
then
raise_application_error(-20001, 'Impossibile eliminare un evento...');
end if;
update eventi
set deleted = 1,
deleted_by = :APP_USER,
deleted_date = sysdate
where id = r_eventi."ID";
else
null;
end case;
end;
```
#### Nuova Versione
**Sequence:** 140
**Button:** New Version
Creates a new version of the event:
```plsql
EVENTI_COPIA
(
ID_EVENTO_OLD => :P22_EVENT_ID,
NUOVA_VERSIONE => 1,
ID_EVENTO_NEW => :P22_NEW_EVENT_ID
);
```
#### Lista Prelievo - Save Interactive Grid Data
**Sequence:** 150
**Type:** NATIVE_IG_DML
**Table:** EVENTI_DET_PREL
Saves pick list records.
#### Continue Event
**Sequence:** 160
**Button:** Continue
Advances event to "Confermata" status (300):
```plsql
declare
v_count number;
v_count_evt number;
begin
-- Check if confirmed event exists for same location/date
select count(*) into v_count
from eventi
where data = (select data from eventi where id = :P22_EVENT_ID)
and stato = 300
and id_location = (select id_location from eventi where id = :P22_EVENT_ID);
if v_count > 0 then
raise_application_error(-20001, 'Esiste un evento Confermato per la location - Impossibile proseguire');
return;
end if;
-- Update status
update eventi
set stato = 300
where id = :P22_EVENT_ID;
-- Check total confirmed events for date
select count(*) into v_count_evt
from eventi
where data = (select data from eventi where id = :P22_EVENT_ID)
and stato = 300;
if v_count_evt > 6 then
RAISE_APPLICATION_ERROR(-20000, 'Ci sono già 6 eventi Confermati per la data');
end if;
end;
```
#### Almost Continue Event
**Sequence:** 170
**Button:** Almost Continue
Sets status to "Quasi Confermato" (350):
```plsql
begin
update eventi
set stato = 350
where id = :P22_EVENT_ID;
end;
```
#### Confirm Event
**Sequence:** 180
**Button:** Confirm
**Condition:** APP_READ_ONLY = 0
Final confirmation (status 400) and cancels competing events:
```plsql
begin
update eventi
set stato = 400
where id = :P22_EVENT_ID;
-- Cancel events with same date and location
p_cancel_same_location_events(
p_good_event_id => :P22_EVENT_ID
);
end;
```
#### Unconfirm Event
**Sequence:** 190
**Button:** Unconfirm
Returns event to initial status (100):
```plsql
begin
update eventi
set stato = 100
where id = :P22_EVENT_ID;
end;
```
#### Reopen Event
**Sequence:** 200
**Button:** Reopen
Clears the expired flag:
```plsql
begin
update eventi
set flg_superato = 0
where id = :P22_EVENT_ID;
end;
```
#### Return to Preparazione
**Sequence:** 210
**Button:** Return to Preparation
Sets status back to preparation (200):
```plsql
begin
update eventi
set stato = 200
where id = :P22_EVENT_ID;
end;
```
#### Risorse - Save Interactive Grid Data
**Sequence:** 220
**Type:** NATIVE_IG_DML
Saves resource assignments.
#### Aggiorna QTA Lista
**Sequence:** 230
**Condition:** APP_READ_ONLY = 0 AND REQUEST = 'AGGIORNA_QTA'
Manual quantity recalculation:
```plsql
EVENTI_AGGIORNA_QTA_LISTA(
P_ID_EVENTO => :P22_EVENT_ID
);
```
#### Restore Deleted Event
**Sequence:** 240
Restores soft-deleted event.
---
## Event Status Workflow Summary
| Status Code | Status Name | Italian | Next Action |
|-------------|-------------|---------|-------------|
| 100 | Preventivo | Quote | Continue Event → 300 |
| 200 | Scheda | Preparation | - |
| 300 | Confermata | Confirmed (Pending) | Almost Continue → 350 |
| 350 | Quasi | Almost Confirmed | Confirm → 400 |
| 400 | Confermato | Confirmed | - |
| 900 | Superato | Expired/Cancelled | Reopen → clears flag |
---
## Common Process Patterns
### Read-Only Check
All write processes include this condition:
```plsql
:APP_READ_ONLY = 0
```
### Error Handling
Standard error pattern:
```plsql
exception when no_data_found then
raise_application_error(-20001, 'Error message in Italian');
```
### Interactive Grid Save
Standard IG DML process:
- Type: NATIVE_IG_DML
- Attributes: REGION_SOURCE, Allow Insert (Y), Allow Update (Y), Allow Delete (Y)
---
## Migration Notes
When migrating these processes to .NET:
1. **Form Initialization** - Use API endpoints to fetch entity data
2. **Form DML** - Implement CRUD endpoints with proper validation
3. **Custom PL/SQL** - Convert to C# methods or stored procedures
4. **IG DML** - Implement batch update endpoints for grid data
5. **Session State** - Use application state management (Redux, Context)
6. **Validation** - Implement in both frontend and backend
7. **Workflow** - Consider state machine pattern for event status