2.2 KiB
2.2 KiB
Installation — Scadenzario
1. Database
Run the schema script:
mysql -u <user> -p <database> < public/userarea/scadenzario/sql/1_create_tables.sql
This creates 5 tables:
| Table | Purpose |
|---|---|
scad_deadlines |
Main deadline records |
scad_deadline_employee |
M2M assignment of individual employees |
scad_deadline_attachments |
File attachments |
scad_deadline_histories |
Audit log (created/updated/completed/...) |
scad_deadline_notifications |
Sent-notification log (deduplication) |
Departments are stored as a comma-separated string in scad_deadlines.departments (matching employees.department values). No separate departments table.
2. Filesystem permissions
The attachments/ folder must be writable by the web server:
chmod 755 public/userarea/scadenzario/attachments
chown www-data:www-data public/userarea/scadenzario/attachments
The included .htaccess denies direct web access. Files are served only through the auth-protected ajax/download_attachment.php endpoint.
3. SMTP configuration
Email notifications use the project-wide SMTP settings in .env:
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=465
MAIL_USERNAME=your_user
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=scadenzario@your-domain.com
MAIL_FROM_NAME="Scadenzario"
APP_URL=https://your-domain.com
4. Cron schedule
Add to the system crontab (run as the web user):
0 7 * * * php /var/www/html/public/userarea/scadenzario/cron/send_notifications.php >> /var/log/scadenzario.log 2>&1
This sends notifications daily at 07:00 for:
- Approaching —
due_date <= today + notification_days(per-deadline lead time) - Overdue —
due_date < today
Completed deadlines are skipped. Recipients without an auth_user_id are silently skipped.
5. Linking employees to auth users
For an employee to receive email notifications:
- The corresponding
auth_usersrow must exist with a validemail. - Set
employees.auth_user_idto that user ID:UPDATE employees SET auth_user_id = <user_id> WHERE id = <employee_id>;
Employees without auth_user_id are silently skipped by the cron.