diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c5230e69..ff918f634 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow. ### Upgrading to 26.11 -Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's database changes (2.7.9 to 3.4.6) in the same pass. Nothing else is required. +Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's database changes (2.7.9 to 3.4.7) in the same pass. Nothing else is required. This is a big release, with sixty database steps in one go, so take a backup before you update. @@ -45,6 +45,8 @@ A contract in force now sets its client's SLAs, hourly rates and net terms, wher Nobody can sign up for the client portal after the update - it is off until you turn it on in Admin > Settings > Client portal and let a client's people do it on its Contacts > Invites (see New Features, Client portal invites and signing up). Inviting people works straight away. Contacts given portal access before are as they were. +Get started, the walk through what is left to set up after installing, isn't shown on an install that is updated - nothing is added to the dashboard and nobody is taken to it on signing in. It is in Admin > Get started for anyone who wants it (see New Features, Get started). + Every account is given a kind - checking, savings, credit card, cash or payment processor - guessed from its name: Visa, Amex or card is a credit card, savings or reserve is savings, cash or petty cash is cash, and Stripe, PayPal, Square or merchant is a payment processor. An account given a liability type back when accounts had types (2023) is a credit card, so what is on it reads as owed. Anything else is checking. Change any that came out wrong with Edit on the Accounts page. An account's balance now leaves out archived payments, income and expenses everywhere, so the Accounts page can show less or more than before (see Bug Fixes). No account is reconciled after the update. The first statement you reconcile on each can start from the bank's balance on the day it starts, bringing everything before it forward as reconciled, or from the account's opening balance (see New Features, Accounts and transactions). Transfers already made out of a cash account count as having taken everything in it up to then to the bank, so the first deposit you make after the update only offers the checks and cash taken in since the last one. Taxes keep their names and rates, now kept to four decimal places. No client has a rate of its own or is tax exempt, and there is no default rate, so new lines start untaxed as before until you pick one in Admin > Taxes. Billed time, trips and expenses stay untaxed until you switch them on there. Discounts now come off before tax on invoices and quotes that are still open, the next time they are edited (see Breaking Changes, Taxes). No expense has tax recorded on it until you add it, so Tax Collected shows no tax paid on purchases for the months before. @@ -1184,6 +1186,18 @@ If you are coming from 26.08 or earlier, the database update still has to be run - The page says the same whatever address is put in - it never says whether someone has an account, or which client a domain belongs to. Someone who signs in already is emailed that they have an account, with a link to set a new password. Nothing is sent for an address at no client that lets people, one whose portal access was turned off, or a domain two such clients have. One email per address every 5 minutes, at most 20 sign-ups from one internet address in 10 minutes, and robots that fill in a hidden field are turned away. Each ask is in the audit log under sign-ins, with why when nothing was sent. - Links to finish signing up last 24 hours. Turning signing up off for a client stops the links already sent for it. The nightly run clears sign-up links nobody used a week after they run out, and invites cancelled more than 90 days ago. - The emails are in Admin > Mail > Previews: Invite to join, from you or from a colleague, Invite accepted, Finish signing up, Signing up with an account already, and Someone signed up. +- **Get started** (new) + - On a new install, the first admin to sign in after setup is taken through what is left to set up, a step at a time: Cron, Email, Backups, Billing, Support, Your team, Starter content and Your first client. Each step is a short form of its own and saves on its own, with Skip for now - It's just me, on Your team. Billing goes with the accounting module and Support with ticketing, so a step whose module is off isn't there. + - A step ticks itself off from the settings themselves, however they were set - here or on the settings page: cron heard from and on, a way to send email and an address to send it as, nightly backups on, an hourly rate, default response times, a second agent, ticket or document templates or canned responses, a client. The steps along the top show which are done, skipped or still to do, and any can be gone back to. + - Cron: the crontab line to copy, whether cron has been heard from - checked every 10 seconds while the step waits, so it ticks itself off once the line is in - and Turn cron on, as it ships off. + - Email: the SMTP server ITFlow sends through and the address and name it sends as, checked as Admin > Mail checks them, with Save and send me a test. Optionally a support mailbox, read into tickets, whose address ticket emails then come from when they had none. Microsoft 365 and Google Workspace are set up in Admin > Mail, and the step keeps them. + - Backups: the backup key, to show and copy, with a tick to say a copy is kept somewhere else before nightly backups are turned on - when they are taken, the database or everything, and how many to keep and for how long. + - Billing: the hourly rate and net terms a new client starts with, a tax rate for new lines when there is no default (made and made the default), invoice and quote numbering, and - if you like - Stripe, with its keys put to Stripe before they are saved. + - Support: business days and hours, the standard response times for each priority as the default SLAs (Urgent answered in 1 business hour and put right in 4, High 2 and 8, Medium 4 and 16, Low 8 and 40 - one with the same hours is used when there is one, and only priorities with none get them), ticket numbering and the client portal on or off. Open tickets are stamped afresh with the hours and response times saved. + - Your team: everyone who signs in, and Add someone - a name, an email and a role. ITFlow makes their password: they are emailed their sign-in details, as Admin > Users does, or, with no email set up yet, it is shown to you once to give them. They change it once signed in. + - Starter content: the packs from Maintenance > Starter Content, each with how much it adds, ticked to add. Your first client: a name, website and contact, made as the Clients page makes one - or the demo data, to look around first. + - The dashboard shows Finish setting up, with how far it has got, a chip for each step and Carry on, to admins until every step is done or skipped. Its × stops it showing there. Admin > Get started opens it any time, with how many steps are done or skipped beside it, and a summary at the end lists every step with where it stands. + - The setup wizard's last step says Get started comes next. ### Bug Fixes @@ -1988,6 +2002,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Contract prepaid hours: database 3.4.4 adds to `contract_templates` and `contracts` `{prefix}_monthly_hours` and `{prefix}_hours_alert` decimal(8,2) (0.00), and `contracts.contract_hours_alerted_at` datetime, plus two tables. `contract_blocks`: `contract_block_contract_id` (ON DELETE CASCADE), `_hours`, `_price` (NULL for none), `_bought`, `_expires` (NULL for never), `_month` (char(7), for a month's included hours - UNIQUE with the contract, so a month is made once), `_invoice_id`, `_note`, `_created_by`, `_created_at`. `contract_block_uses`: `contract_block_use_block_id` (ON DELETE CASCADE), `_ticket_id`, `_hours`, `_full` (on the use that covered the rest of a ticket), `_created_by`, `_created_at`; a use of 0 hours keeps a ticket that was put back out of the draw. New `functions/contract_hours.php`: `contractHoursReady()`, `contractHoursText()`, `contractHoursWords()`, `contractBlocks()`, `contractHoursSummary()`, `contractHoursLeftFor()`, `contractHasHours()`, `contractClientHours()`, `contractHoursEnsureMonthly()`, `contractHoursSync()` (after a save, Make active, Renew or a countersignature that makes a draft active), `contractHoursTicketUses()`, `contractHoursUses()`, `contractHoursDraw()` (one at a time per client, under `GET_LOCK`), `contractHoursDoneOn()`, `contractHoursRecheck()`, `contractHoursPutBack()`, `contractHoursAlertReset()`, `contractHoursAlertCheck()`, `contractHoursAlertSend()`, `contractHoursFromInput()`, `contractHoursAdd()` (the invoice through `billingInvoiceCreate()` and `billingItemSave()`), `contractHoursBlockDelete()`, `contractBlockRow()` and `contractHoursNightly()`. `billingUnbilledSql()` leaves out a ticket with a full use; `billingUnbilledTickets()` adds `worked` (the hours the time logged makes) and `prepaid`, and `hours` is now what is left after them; `billingUnbilledByClient()` adds `prepaid`. `contractFromInput()` takes `monthly_hours` and `hours_alert`, `contractTermsSetSql()` writes them once 3.4.4 has run, and `contractUpdate()` logs them and clears `contract_hours_alerted_at` when the level changes. `contractsNightly()` returns `drawn` too, logged by `cron/nightly_tasks.php`. `ticketDeleteForGood()` deletes the ticket's uses. `CONTRACT_PLACEHOLDERS` adds Monthly Hours, and `contractDocumentHtml()` adds an Included hours row only when there are some, so documents without them hash as before. `agent/post/contract.php` adds `add_contract_hours` and `draw_contract_hours` (POST, with a `contract_id`, a `client_id` or a `ticket_id`) and `delete_contract_block` and `put_back_contract_hours` (GET with the token), all with Sales Modify. New `agent/modals/contract/contract_hours_add.php`. `emailPreviewContractCatalog()` adds `contract_hours_low`. New CSS: `.itflow-contract-hours-left` and `.itflow-hours-bar` (a ``, as the portal's CSP allows no inline styles). - Contract billing and SLAs: database 3.4.5 adds `contracts.contract_recurring_invoice_id` int (0, keyed) and `contract_recurring_stopped_at` datetime, set when the contract pauses its recurring invoice so it does so once, and sets a rate of 0.00 on contracts and templates to NULL (`contractFromInput()` saves 0 as NULL too). New `functions/contract_billing.php`: `contractBillingReady()`, `contractTermsContracts()` (a client's contracts that can be in force, kept for the request), `contractInForceOn()`, `contractTermsOn()` (the one started last that sets a rate, net terms or a priority's SLA), `contractsInForce()`, `contractSlaFor()`, `contractAfterHours()` (from `getSlaSettings()` and `getBusinessHolidays()`), `contractTicketRate()` (source after_hours, contract, client or default, and a note), `contractClientRate()`, `contractNetTerms()`, `contractNetTermsToday()`, `contractRecurringRow()`, `contractForRecurring()`, `contractRecurringChoices()`, `contractRecurringShouldRun()`, `contractRecurringAmountText()`, `contractRecurringStart()` (skips missed runs with `recurringInvoiceCatchUp()`), `contractRecurringStop()`, `contractRecurringFollow()`, `contractRecurringLink()`, `contractRecurringUnlink()`, `contractRecurringFromInput()`, `contractRecurringFirstDate()`, `contractRecurringCreate()` and `contractRecurringNightly()`. `getTicketSlaId()` asks `contractSlaFor()` first, and takes `$with_contract` (false for the client's own - `contractSlaRows()` uses it). `billingUnbilledTickets()` prices each ticket with `contractTicketRate()` and adds `rate_source` and `rate_note`; `billingUnbilledByClient()` adds `rates`, `rate_note` and `rate_source`; `billingTimeInvoice()` with no price bills each ticket at its own rate, and `combine` makes one line per rate. `billingInvoiceCreate()`, `quoteConvert()`, `recurringInvoiceGenerate()`, New Invoice and Copy in `agent/post/invoice.php` take `contractNetTerms()`. `contractsNightly()` returns `paused` too, logged by `cron/nightly_tasks.php`. `agent/post/contract.php` adds `make_contract_recurring` and `link_contract_recurring` (POST) and `unlink_contract_recurring` (GET with the token), all Sales Modify, and Make active, Renew, Cancel and a countersignature that makes a draft active call `contractRecurringFollow()`; deleting a recurring invoice unlinks its contract. New `agent/modals/contract/contract_recurring.php`. The prepaid hours handlers pass the agent's name unescaped, as the history and logs escape it. - Client portal invites and sign-ups: database 3.4.6 adds `portal_invites` - `invite_kind` (invite or signup), `invite_email`, `invite_name`, `invite_billing`, `invite_technical`, `invite_token_hash` (the SHA-256 of the link's token), `invite_expires_at`, `invite_sent_at`, `invite_sent_count`, `invite_created_by` (an agent), `invite_created_by_contact_id` (a primary contact), `invite_created_at`, `invite_accepted_at`, `invite_contact_id`, `invite_cancelled_at` and `invite_client_id` (ON DELETE CASCADE), keyed on the client and address and on the contact - plus `clients.client_portal_signup` and `settings.config_client_portal_signup` tinyint(1) (0). New `functions/portal_invite.php`: `PORTAL_SIGNUP_LINK_HOURS` (24), `PORTAL_INVITE_MAX` (50), `PORTAL_SIGNUP_IP_LIMIT` (20), `portalInvitesReady()` (keeps every page and the nightly job as they were before 3.4.6 has run), `portalInviteParse()`, `portalInviteWho()` (new, contact, member or elsewhere), `portalInviteRow()`, `portalInviteBy()`, `portalInviteState()`, `portalInviteUrl()`, `portalInviteNewToken()`, `portalInviteByLink()` (hash_equals), `portalInviteMail()`, `portalInviteSend()`, `portalInviteResend()`, `portalInviteCancel()`, `portalInvitesWaiting()`, `portalInviteStateLabel()`, `portalContactJoined()`, `portalInviteAccept()` (spends the link with one guarded UPDATE first, so a second press or a race does nothing), `portalMailSignupJoined()`, `portalMailInviteAccepted()`, `portalSignupOn()`, `portalSignupDomains()`, `portalSignupClients()`, `portalSignupOpen()`, `portalSignupClientFor()`, `portalSignupRequest()` (logged as `Client Login` Sign Up Requested, Sign Up Sent and Sign Up Refused), `portalMailSignupExists()`, `portalSignupSet()` and `portalInvitesNightly()`, which `cron/nightly_tasks.php` runs and logs. `portalContactAccess()` and `portalSignInMethods()` move from `client/functions.php` to `functions/portal.php`, as cron and the agent side use them now. `agent/post/contact.php` adds `send_portal_invites` (POST) and `resend_portal_invite` and `cancel_portal_invite` (GET with the token), and `agent/post/client.php` `set_client_portal_signup` (POST), all Client Modify. `agent/modals/contact/contact_invite.php`, an unused stub (Welcome Letter, Big Wig) with no handler, is replaced by the Invite people window. `agent/contacts.php` adds `role=invites`. `client/post.php` adds `portal_invites_send`, `portal_invite_resend` and `portal_invite_cancel` (the primary contact's). New `client/invite.php`, `client/join.php` (`?invite=&token=`, Referrer-Policy no-referrer) and `client/signup.php` (a form token in the session and a hidden field robots fill in). `edit_client_portal_settings` saves `config_client_portal_signup` once 3.4.6 has run. `emailPreviewInviteCatalog()` adds `portal_join_invite`, `portal_join_invite_colleague`, `portal_join_accepted`, `portal_signup`, `portal_signup_exists` and `portal_signup_joined`. `auditLogActionStyle()` adds Invite and the Sign Up actions. New CSS: `.itflow-join-box`. +- Get started: database 3.4.7 adds `settings.config_getting_started` tinyint(1) (1 in db.sql, so a new install has it; the update sets it to 0 for one already running), `config_getting_started_skipped` varchar(255) (the steps skipped, comma separated) and `config_getting_started_opened_at` datetime (when it was first opened - it opens by itself on signing in only until then). New `functions/getting_started.php`: `GETTING_STARTED_STEPS`, `GETTING_STARTED_SLAS`, `gettingStartedReady()` (nothing shows before 3.4.7 has run), `gettingStartedState()`, `gettingStartedUrl()`, `gettingStartedCronCommand()`, `gettingStartedBackupJob()`, `gettingStartedSteps()` (each step's done, skipped and status, from the settings), `gettingStartedProgress()`, `gettingStartedAfter()`, `gettingStartedSkip()`, `gettingStartedOpened()`, `gettingStartedDismiss()`, `gettingStartedFirstVisit()` (login.php takes the first admin there, after MFA enforcement and not instead of a `last_visited` page), `gettingStartedCard()` (the dashboard's card), `gettingStartedBackupSave()` (the backup job's row in `cron_jobs`, seeded from the registry when the dispatcher hasn't yet), `gettingStartedApplySlas()` and `gettingStartedDaysText()`. New `admin/getting_started.php` (a page of its own, in the setup wizard's frame; `?step=`, and `?cron_status=1` answers in JSON), its steps in `admin/getting_started/` and `admin/post/getting_started.php`: `getting_started_cron_on`, `getting_started_mail` (continue or test), `getting_started_backups`, `getting_started_billing`, `getting_started_support`, `getting_started_team`, `getting_started_content`, `getting_started_skip` and `getting_started_dismiss`. The first client posts `add_client` to `agent/post.php` and the demo data `load_demo_data`, both of which return to the step. Admin > Mail's check of a sending or receiving server moves from a closure in `admin/post/settings_mail.php` to `settingsMailServerCheck($server, $before, $post)` in `functions/settings.php`, which both use. New `js/getting_started.js` (`data-gs-reveal`, `data-gs-show`, `data-gs-cron-poll`), and `js/app.js` only starts DataTables where it is loaded, so setup and Get started, which load app.js on its own, no longer log an error to the console. New CSS: `.itflow-gs-*`. ### Library Updates diff --git a/admin/database_updates/3.4.7.php b/admin/database_updates/3.4.7.php new file mode 100644 index 000000000..096489a7f --- /dev/null +++ b/admin/database_updates/3.4.7.php @@ -0,0 +1,36 @@ + 0; + }; + + if (!$itflow_column('config_getting_started')) { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_getting_started` tinyint(1) NOT NULL DEFAULT 1 AFTER `config_client_portal_signup`"); + // An install already running has been set up - it isn't walked through it again + mysqli_query($mysqli, "UPDATE `settings` SET `config_getting_started` = 0"); + } + if (!$itflow_column('config_getting_started_skipped')) { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_getting_started_skipped` varchar(255) NOT NULL DEFAULT '' AFTER `config_getting_started`"); + } + if (!$itflow_column('config_getting_started_opened_at')) { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_getting_started_opened_at` datetime DEFAULT NULL AFTER `config_getting_started_skipped`"); + } + + unset($itflow_column); diff --git a/admin/getting_started.php b/admin/getting_started.php new file mode 100644 index 000000000..d46685470 --- /dev/null +++ b/admin/getting_started.php @@ -0,0 +1,194 @@ + Get started - what to set up once ITFlow is installed, a step at a + * time (functions/getting_started.php): cron, email, backups, billing, + * support, your team, starter content and a first client. ?step= is the step, + * or done for the summary; with none, the first step not done or skipped. + * Each step's page is in getting_started/; what they save is in + * post/getting_started.php - and the first client goes to the same New Client + * handler as the Clients page (agent/post/client.php), the demo data to the + * one on Maintenance > Starter Content. + * + * A page of its own, like setup - no menu, the steps along the top - in the + * agent's light or dark. ?cron_status=1 answers whether cron has been heard + * from, for the Cron step to check while it waits (js/getting_started.js). + */ + +require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/functions.php'; +require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/check_login.php'; +enforceAdminPermission(); + +if (!gettingStartedReady()) { + flashAlert('Get started needs the database update - run it from Maintenance > Update first', 'error'); + redirect('/admin/update.php'); +} + +$gs_steps = gettingStartedSteps(); + +if (isset($_GET['cron_status'])) { + $heard = settingsCurrent(['config_cron_last_dispatch_at'])['config_cron_last_dispatch_at']; + header('Content-Type: application/json; charset=utf-8'); + header('Cache-Control: no-store'); + echo json_encode(['running' => $heard && time() - strtotime($heard) < 300, 'done' => !empty($gs_steps['cron']['done']), 'status' => (string) ($gs_steps['cron']['status'] ?? '')]); + exit; +} + +gettingStartedOpened(); +$gs_progress = gettingStartedProgress($gs_steps); +$gs_state = gettingStartedState(); +$gs_step = (string) ($_GET['step'] ?? ''); +if ($gs_step !== 'done' && !isset($gs_steps[$gs_step])) { + $gs_step = $gs_progress['next'] !== '' ? $gs_progress['next'] : 'done'; +} +$gs_keys = array_keys($gs_steps); +$gs_at = array_search($gs_step, $gs_keys, true); +$gs_prev = $gs_step === 'done' ? (end($gs_keys) ?: '') : ($gs_at > 0 ? $gs_keys[$gs_at - 1] : ''); +$gs_next = $gs_step === 'done' ? '' : gettingStartedAfter($gs_step, $gs_steps); +$gs_info = $gs_steps[$gs_step] ?? null; + +// What was typed, when a save came back with something to put right (settingsRefuse()) +$settings_kept = []; +if (($_SESSION['settings_kept']['page'] ?? '') === "getting_started_$gs_step" && time() - ($_SESSION['settings_kept']['at'] ?? 0) < 300) { + $settings_kept = $_SESSION['settings_kept']; +} +unset($_SESSION['settings_kept']); + +// The message a save left for this page +$gs_alert = ''; +$gs_alert_type = 'info'; +if (!empty($_SESSION['alert_message'])) { + $gs_alert = (string) $_SESSION['alert_message']; + $gs_alert_type = alertStyleClass($_SESSION['alert_type'] ?? 'success'); + unset($_SESSION['alert_message'], $_SESSION['alert_type']); +} + +$gs_company = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT company_name, company_logo FROM companies WHERE company_id = 1")) ?: []; +$gs_title = $gs_step === 'done' ? 'Where it stands' : $gs_info['title']; +define('FROM_GETTING_STARTED', true); + +?> + + + + + + + + + <?= escapeHtml($gs_title) ?> - Get started - <?= escapeHtml($gs_company['company_name'] ?? 'ITFlow') ?> + + + + + + + + + + +
+ +
+ + + + + ITFlow + + Get started + + Go to ITFlow +
+ + + + +
+ + + + +
+ +
+
+

+ + Done + + Skipped for now + +
+

+ +
+ + +
+ +
+ +
+
+ +
+ Get started is in Admin whenever you want it. + + +
+ + +
+ +
+ +
+ + + + + + + + + + diff --git a/admin/getting_started/backups.php b/admin/getting_started/backups.php new file mode 100644 index 000000000..0e4712853 --- /dev/null +++ b/admin/getting_started/backups.php @@ -0,0 +1,67 @@ + Cron, and the same settings as Maintenance > Backup. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +$gs_key = backupEncryptionKey(); +$gs_job = gettingStartedBackupJob(); +$gs_backup = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_backup_cron_type, config_backup_retention_count, config_backup_retention_days FROM settings WHERE company_id = 1")) ?: []; +// Offered on - turning it on is what the step is for +$gs_backup_on = settingsChecked('backup_enabled', true); + +?> + +
+ +
ITFlow couldn't write a backup key to config.php, so it can't make an encrypted backup. Make config.php writable by the web server's user and come back to this page - or add $config_backup_key = '<32 random characters>'; to it yourself.
+
+ +
+
Your backup key
+

Every backup is locked with it, and without it none can be restored - on this server or another. Keep a copy somewhere other than this server, as a password manager.

+
+ + + + +
+
+ + +
+ + + 'gsBackupOn', 'label' => 'Back up every night', 'data' => ['gs-reveal' => 'gsBackupWhen'], + 'disabled' => $gs_key === '', 'help' => 'Cron takes it while no one is about. Old ones are cleared by the same job, never before a new one is made.']) ?> + +
> +
+
+ 'fa-clock', 'type' => 'time', 'label' => 'At', 'required' => true]) ?> +
+
+ 'Everything - the database and your files', 'database' => 'The database only'], ['icon' => 'fa-archive', 'label' => 'What it takes']) ?> +
+
+ 'fa-layer-group', 'type' => 'number', 'label' => 'Keep the last', 'min' => 1, 'max' => 1000, 'required' => true, 'inputmode' => 'numeric', 'suffix' => 'backups']) ?> +
+
+ 'fa-calendar-alt', 'type' => 'number', 'label' => 'For up to', 'min' => 0, 'max' => 3650, 'required' => true, 'inputmode' => 'numeric', 'suffix' => 'days', + 'help' => '0 keeps them however old they are.']) ?> +
+
+ + 'gsBackupKeySaved', 'label' => "I've kept a copy of the backup key somewhere else"]) ?> + +
+ +

Backups are kept in . Copy them somewhere else too - a backup on the same disk goes with it. Maintenance > Backup downloads one, or takes one now.

+ + +
diff --git a/admin/getting_started/billing.php b/admin/getting_started/billing.php new file mode 100644 index 000000000..ae13b5554 --- /dev/null +++ b/admin/getting_started/billing.php @@ -0,0 +1,87 @@ + Defaults, Taxes, Invoices, Quotes and Payment Providers. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +$gs_billing = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_default_hourly_rate, config_default_net_terms, config_invoice_prefix, config_invoice_next_number, + config_quote_prefix, config_quote_next_number FROM settings WHERE company_id = 1")) ?: []; +$gs_rate = floatval($gs_billing['config_default_hourly_rate'] ?? 0); +$gs_tax = taxRow(taxSettings()['default_id']); +$gs_stripe = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT payment_provider_id, payment_provider_active, payment_provider_private_key FROM payment_providers WHERE payment_provider_name = 'Stripe' LIMIT 1")); +$gs_accounts = []; +$gs_sql = mysqli_query($mysqli, "SELECT account_id, account_name FROM accounts WHERE account_archived_at IS NULL ORDER BY account_name ASC"); +while ($gs_row = mysqli_fetch_assoc($gs_sql)) { + $gs_accounts[intval($gs_row['account_id'])] = $gs_row['account_name']; +} +$gs_stripe_on = settingsChecked('stripe_on', false); + +?> +
+ + +

What you charge

+
+
+ 0 ? number_format($gs_rate, 2, '.', '') : '', ['icon' => 'fa-coins', 'type' => 'number', 'label' => 'Hourly rate', 'required' => true, + 'min' => '0.01', 'step' => '0.01', 'inputmode' => 'decimal', 'placeholder' => '125.00', 'suffix' => escapeHtml($session_company_currency) . ' an hour', + 'help' => 'For time on a ticket - a client can have their own.']) ?> +
+
+ 'fa-calendar-check', 'label' => 'Invoices are due', + 'help' => 'A new client starts with these.']) ?> +
+
+ +

Tax

+ +

New lines get . Rates with more than one part, and what is taxed, are in Admin > Taxes.

+ +

The rate new invoice and quote lines get - leave it empty if you don't charge tax. A rate in parts, as GST and PST, is made in Admin > Taxes.

+
+
+ 'fa-receipt', 'label' => 'Name', 'maxlength' => 200, 'placeholder' => 'Sales Tax']) ?> +
+
+ 'fa-calculator', 'type' => 'number', 'label' => 'Rate', 'min' => 0, 'max' => 100, 'step' => '0.0001', 'inputmode' => 'decimal', 'placeholder' => '6', 'suffix' => '%']) ?> +
+
+ + +

Invoice numbers

+
+ +

Quote numbers

+
+ +

Card payments

+ +

Stripe is set up - in Admin > Payment Providers.

+ +
+ 'gsStripeOn', 'label' => 'Let clients pay invoices by card, with Stripe', 'data' => ['gs-reveal' => 'gsStripe'], + 'help' => 'A Pay button on each invoice, and cards clients save for autopay.']) ?> +
> +
The keys are in Stripe's Developers > API keys. Test keys work too, until you are ready to take real cards.
+
+ 'fa-key', 'label' => 'Publishable key', 'maxlength' => 250, 'placeholder' => 'pk_live_...', 'autocomplete' => 'off', 'class' => 'font-monospace']) ?> +
+
+ 'fa-lock', 'type' => 'password', 'label' => 'Secret key', 'maxlength' => 250, 'placeholder' => 'sk_live_...', 'autocomplete' => 'new-password', 'class' => 'font-monospace']) ?> +
+
+ 'No accounts yet - add one in Finance > Accounts'], ['icon' => 'fa-piggy-bank', 'label' => 'Payments go into', + 'help' => 'Fees, and a card limit, are set in Admin > Payment Providers.']) ?> +
+
+
+ + + +
diff --git a/admin/getting_started/client.php b/admin/getting_started/client.php new file mode 100644 index 000000000..37320cee1 --- /dev/null +++ b/admin/getting_started/client.php @@ -0,0 +1,82 @@ + Starter Content). Both come back here. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +defined('FROM_STARTER_CONTENT') || define('FROM_STARTER_CONTENT', true); +require_once dirname(__DIR__) . '/post/demo_data_model.php'; + +$gs_demo = demoDataStatus($mysqli); +$gs_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL ORDER BY client_created_at DESC, client_id DESC LIMIT 3"); +$gs_client_count = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM clients WHERE client_archived_at IS NULL"))[0] ?? 0); +$gs_defaults = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_default_hourly_rate, config_default_net_terms FROM settings WHERE company_id = 1")) ?: []; + +?> + + +

Add another

+ + +
+ + + + + + +
+
+ 'gsClientName', 'icon' => 'fa-user-friends', 'label' => 'Client', 'required' => true, 'maxlength' => 200, 'placeholder' => 'Name or company']) ?> +
+
+ 'gsClientWebsite', 'icon' => 'fa-globe', 'label' => 'Website', 'maxlength' => 200, 'placeholder' => 'example.com']) ?> +
+
+ 'gsClientContact', 'icon' => 'fa-user', 'label' => 'Who you talk to', 'maxlength' => 200, 'placeholder' => 'Their name']) ?> +
+
+ 'gsClientEmail', 'icon' => 'fa-envelope', 'type' => 'email', 'label' => 'Their email', 'maxlength' => 200, 'placeholder' => 'name@example.com']) ?> +
+
+

The website's domain and certificate are added too, to watch for renewals. The rest - their address, phones, rate and SLAs - is on the client once it's made, and Clients > Import brings in a whole list from a CSV.

+ +
+ + + +
+
+
Look around with the demo data first
+
+ + of the demo clients are here. Remove them all in Maintenance > Starter Content once you're done. + + made-up clients, each with contacts, assets, tickets and a year of invoices. They come out again in one go from Maintenance > Starter Content. + +
+
+ +
+ + +
+ +
diff --git a/admin/getting_started/content.php b/admin/getting_started/content.php new file mode 100644 index 000000000..3a5b5d9cd --- /dev/null +++ b/admin/getting_started/content.php @@ -0,0 +1,42 @@ + Starter Content has, + * each with how much it would add, ticked to add (getting_started_content). + * Only what isn't here already is added, so ticking one that is changes + * nothing. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +defined('FROM_STARTER_CONTENT') || define('FROM_STARTER_CONTENT', true); +require_once dirname(__DIR__) . '/post/starter_content_model.php'; + +$gs_packs = starterContentPacks(); +$gs_pack_status = starterContentStatus($mysqli); + +?> +
+ + +
+ $gs_pack) { + $gs_status = $gs_pack_status[$gs_key]; + $gs_all_here = $gs_status['missing'] === 0; ?> + + +
+

Nothing you already have is changed. Each pack can be added later, or brought up to date, in Maintenance > Starter Content.

+ + +
diff --git a/admin/getting_started/cron.php b/admin/getting_started/cron.php new file mode 100644 index 000000000..acd15d3fe --- /dev/null +++ b/admin/getting_started/cron.php @@ -0,0 +1,55 @@ + +
    +
  1. + +
    +
    Add one line to the crontab
    +
    For the user that owns the ITFlow files - crontab -e as them. The install script adds it for you.
    +
    + + +
    +
    + + Cron ran . + + + +
    +
    +
  2. +
  3. + +
    +
    Turn cron on
    +
    It ships off, so a copy of ITFlow never emails clients or charges cards by surprise. Every job stops itself while it is off.
    + +
    On. Each job's schedule is in Maintenance > Cron.
    + +
    + + +
    + +
    +
  4. +
+ +
Nothing is emailed or backed up until cron runs - the other steps can be done meanwhile.
+ diff --git a/admin/getting_started/done.php b/admin/getting_started/done.php new file mode 100644 index 000000000..31876284a --- /dev/null +++ b/admin/getting_started/done.php @@ -0,0 +1,48 @@ + +
+ +

+

+ + Everything is set up. Each of these is in Admin whenever it needs changing. + + What you skipped is here when you want it - in Admin > Get started. + + still to do - each ticks itself off however it's set up. + +

+
+ + + +
+ Go to the dashboard +
diff --git a/admin/getting_started/mail.php b/admin/getting_started/mail.php new file mode 100644 index 000000000..470359a6d --- /dev/null +++ b/admin/getting_started/mail.php @@ -0,0 +1,104 @@ + Mail checks it - + * settingsMailServerCheck()). Microsoft 365 and Google Workspace sign in with + * an app registered with them, so those are set up in Admin > Mail; with one + * in use, this step keeps it and asks only for the address. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +$gs_mail = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_smtp_provider, config_smtp_host, config_smtp_port, config_smtp_encryption, config_smtp_username, config_smtp_password, + config_imap_provider, config_imap_host, config_imap_port, config_imap_encryption, config_imap_username, config_imap_password, + config_mail_from_email, config_mail_from_name, config_ticket_from_email, config_ticket_email_parse FROM settings WHERE company_id = 1")) ?: []; +$gs_mail_oauth = in_array($gs_mail['config_smtp_provider'] ?? '', ['google_oauth', 'microsoft_oauth'], true); +$gs_encryption = function ($starttls_port, $ssl_port) { + return ['tls' => "STARTTLS - usually port $starttls_port", 'ssl' => "SSL/TLS - usually port $ssl_port", '' => 'None']; +}; +$gs_secret = function ($saved, $empty) { + return trim((string) $saved) !== '' ? 'Saved - type a new one to replace it' : $empty; +}; +$gs_parse = intval($gs_mail['config_ticket_email_parse'] ?? 0) === 1; + +?> +
+ + + +
+ +
Email goes out through , set up in Admin > Mail.
+
+ +

Sending

+

Your mail host's SMTP server, as its setup guide gives it. Microsoft 365 or Google Workspace sign in with an app you register with them instead - set that up in Admin > Mail, then come back.

+ +
+
+ 'fa-server', 'label' => 'Server', 'required' => true, 'maxlength' => 200, 'placeholder' => 'smtp.example.com']) ?> +
+
+ 'fa-plug', 'type' => 'number', 'label' => 'Port', 'required' => true, 'min' => 1, 'max' => 65535, 'inputmode' => 'numeric']) ?> +
+
+ 'fa-lock', 'label' => 'Encryption']) ?> +
+
+ 'fa-user', 'label' => 'Username', 'maxlength' => 200, 'placeholder' => "Usually the mailbox's own address", 'autocomplete' => 'off']) ?> +
+
+ 'fa-key', 'type' => 'password', 'label' => 'Password', 'maxlength' => 200, 'autocomplete' => 'new-password', + 'placeholder' => $gs_secret($gs_mail['config_smtp_password'] ?? '', 'Or an app password')]) ?> +
+
+ + +

Sent as

+
+
+ 'fa-envelope', 'type' => 'email', 'label' => 'From address', 'required' => true, 'maxlength' => 200, 'placeholder' => 'help@example.com']) ?> +
+
+ 'fa-signature', 'label' => 'From name', 'maxlength' => 200]) ?> +
+
+

Invoices, quotes and ticket emails come from it too, until you give them their own in Admin > Mail.

+ + +
+ 'gsTicketParse', 'label' => 'Turn email to a support mailbox into tickets', 'data' => ['gs-reveal' => 'gsImap'], + 'help' => 'ITFlow reads the mailbox every minute: a new email is a new ticket, a reply goes on its ticket.' . (trim((string) ($gs_mail['config_ticket_from_email'] ?? '')) === '' ? ' Ticket emails then come from this address.' : '')]) ?> +
> + + +
+ 'fa-server', 'label' => 'IMAP server', 'maxlength' => 200, 'placeholder' => 'imap.example.com']) ?> +
+
+ 'fa-plug', 'type' => 'number', 'label' => 'Port', 'min' => 1, 'max' => 65535, 'inputmode' => 'numeric']) ?> +
+
+ 'fa-lock', 'label' => 'Encryption']) ?> +
+ +
+ 'fa-inbox', 'type' => 'email', 'label' => 'Support mailbox', 'maxlength' => 200, 'placeholder' => 'support@example.com', 'autocomplete' => 'off']) ?> +
+ +
+ 'fa-key', 'type' => 'password', 'label' => 'Its password', 'maxlength' => 200, 'autocomplete' => 'new-password', + 'placeholder' => $gs_secret($gs_mail['config_imap_password'] ?? '', 'Or an app password')]) ?> +
+ +
+
+ + +
+ + +
+
diff --git a/admin/getting_started/support.php b/admin/getting_started/support.php new file mode 100644 index 000000000..dcaa2c186 --- /dev/null +++ b/admin/getting_started/support.php @@ -0,0 +1,89 @@ + SLAs, Tickets and + * Modules. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +$gs_support = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_business_days, config_business_hours_start, config_business_hours_end, config_ticket_prefix, config_ticket_next_number, + config_client_portal_enable FROM settings WHERE company_id = 1")) ?: []; +$gs_days = array_map('intval', explode(',', (string) ($gs_support['config_business_days'] ?? '1,2,3,4,5'))); +if (isset($settings_kept['values']['business_days_kept'])) { + // The days ticked, when a save came back - they are sent as a list, which settingsRefuse() doesn't keep + $gs_days = array_map('intval', array_filter(explode(',', (string) $settings_kept['values']['business_days_kept']))); +} +$gs_day_names = [1 => 'Mon', 2 => 'Tue', 3 => 'Wed', 4 => 'Thu', 5 => 'Fri', 6 => 'Sat', 7 => 'Sun']; +$gs_slas = []; +$gs_sql = mysqli_query($mysqli, "SELECT sla_assignment_priority, sla_name, sla_response_minutes, sla_resolution_minutes FROM sla_assignments + JOIN slas ON sla_id = sla_assignment_sla_id WHERE sla_assignment_client_id = 0 AND sla_archived_at IS NULL"); +while ($gs_row = mysqli_fetch_assoc($gs_sql)) { + $gs_slas[$gs_row['sla_assignment_priority']] = $gs_row; +} +$gs_use_standard = settingsChecked('standard_slas', true); + +?> +
+ + +

Business hours

+

Response times count only these - an urgent ticket on Friday evening is due Monday morning. Holidays are added in Admin > SLAs.

+ ' . implode('', array_map(function ($day) use ($gs_day_names, $gs_days) { + return '' + . ''; + }, array_keys($gs_day_names))) . '', '', 'gsDay1') ?> +
+
+ 'fa-sun', 'type' => 'time', 'label' => 'From', 'required' => true]) ?> +
+
+ 'fa-moon', 'type' => 'time', 'label' => 'To', 'required' => true]) ?> +
+
+ +

Response times

+ +

The response times a ticket gets unless its client has their own - in Admin > SLAs.

+ +

How soon a ticket is answered and put right, by its priority - a client can have their own. Change them, or add more, in Admin > SLAs.

+ +
+ + + + + + + + + + + + + +
PriorityAnswered withinPut right within
- ' . escapeHtml($gs_slas[$gs_priority]['sla_name']) . '' : '' ?>
+
+ +
'gsStandardSlas', 'label' => $gs_slas ? 'Use these for the priorities that have none' : 'Use these', + 'help' => 'Open tickets get them too.']) ?>
+ + +

Ticket numbers

+
+ +

Client portal

+
+ + 'gsPortal', 'label' => 'Clients can sign in to raise and follow tickets', + 'help' => 'And to pay invoices, see quotes and documents - what each contact sees is set on the contact. Invite them from their client\'s Contacts.']) ?> +
+ + +
diff --git a/admin/getting_started/team.php b/admin/getting_started/team.php new file mode 100644 index 000000000..0fa7c78d6 --- /dev/null +++ b/admin/getting_started/team.php @@ -0,0 +1,69 @@ + Users does, or - + * with no email set up yet - shown once for you to give them. Their own copy + * of the vault key is made under it, so they set their own once signed in. + */ + +defined('FROM_GETTING_STARTED') || die("Direct file access is not allowed"); + +$gs_agents = mysqli_query($mysqli, "SELECT user_id, user_name, user_email, role_name, role_is_admin FROM users LEFT JOIN user_roles ON role_id = user_role_id + WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"); +$gs_roles = userRoles(); +// Technician, when there is one - most people added are - or the first role that isn't an admin one +$gs_role_default = ''; +foreach ($gs_roles as $gs_role_id => $gs_role) { + if (!intval($gs_role['role_is_admin']) && ($gs_role_default === '' || strcasecmp($gs_role['role_name'], 'Technician') === 0)) { + $gs_role_default = (string) $gs_role_id; + } +} +$gs_role_options = ''; +foreach ($gs_roles as $gs_role_id => $gs_role) { + $gs_role_options .= ''; +} +$gs_mail_ready = emailReady(); +$gs_limit = agentUserLimitReached(); + +?> + + + +
+ +

Add someone

+
+ +
+
+ 'fa-user', 'label' => 'Name', 'required' => true, 'maxlength' => 200, 'placeholder' => 'Alex Morgan', 'autocomplete' => 'off']) ?> +
+
+ 'fa-envelope', 'type' => 'email', 'label' => 'Email', 'required' => true, 'maxlength' => 200, 'placeholder' => 'alex@example.com', 'autocomplete' => 'off']) ?> +
+
+ 'fa-id-badge', 'label' => 'Role', 'required' => true, 'options_html' => $gs_role_options, + 'help' => 'What they can see and change - roles are in Admin > Roles. A role that isn\'t an admin one sees every client, until you limit them in Admin > Users.']) ?> +
+
+ +

They are emailed their sign-in details, with a password ITFlow makes for them to change.

+ +

Email isn't set up yet, so ITFlow makes their password and shows it to you once - for you to give them, and them to change.

+ + +
+ diff --git a/admin/includes/side_nav.php b/admin/includes/side_nav.php index 37a4966ab..d1d608d38 100644 --- a/admin/includes/side_nav.php +++ b/admin/includes/side_nav.php @@ -12,6 +12,20 @@