Download the PHP package rjdeliveryomaha/courierinvoice without Composer

On this page you can find all versions of the php package rjdeliveryomaha/courierinvoice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package courierinvoice

CourierInvoice

A set of classes for the Courier Invoice API

Instalation

composer require "rjdeliveryomaha/courierinvoice"

Or add "rjdeliveryomaha/courierinvoice":"^2.0.0" to composer.json

Classes

extras


SecureSessionHandler

Extends PHPs SessionHandler class.

Provides static functions for session management.

Throws exception on error.

Properties settable in $config

These properties are described in extras/includes.

Public Methods:

This function will try to use ini_set() to apply the following settings:

If these settings fail an exception will be thrown.

If a valid session name is not provided an exception will be thrown.

If a domain name is not provided $_SERVER['SERVER_NAME'] will be used.

If $config['alternateHijackingTest'] is false the users IP address and user agent will be stored in the session and compared to the values provided by the server upon each validation call which is done every time SecureSessionHandler::start_session() is called. It is not recommended that this value be set to true however, it may be necessary in situations where a users IP address is frequently changed due to network instability or service provider issues.

$_SESSION['formKey'] is set to a value generated by bin2hex(random_bytes(32)). Validation will compare this value to $_POST['formKey'] on every POST request then iterate the value. An exception with the message "Session Error" will be thrown if these values don't match.

Returns the current value of $_SESSION['formKey'].

Sets and returns a new value for $_SESSION['formKey'].

If there is no active session an attempt will be made to create one.


CommonFunctions

Utility class with functions used throughout the project.

Throws exception on error.

Usage:

Properties settable in $data

Public Methods:

Returns a value if the property exists.

Returns false if the property does not exist.

Sets property to new value.

Returns true on success.

Returns false if the property does not exist.

Adds $value to property.

Returns true on success.

Returns false if the property does not exists.

Returns false if $value or the property is not numeric.

Subtract $value from the property.

Returns true on success.

Returns false if the property does not exists.

Returns false if $value or the property is not numeric.

Returns false if property does not exist in both objects.

Returns true if the properties hold equal values.

$strict compares type as well as value.

Returns true is properties hold identical values.

Pretty print properties and values.

Return the last error.


Query

Extends CommonFunctions

This class handles the creation and execution of calls to the API.

Throws exception on error.

Usage:

Properties settable in $data:

Public Methods

Processes the queryParams property into a query string then returns itself so that it can be chained with the call method.

Uses the cURL library to execute the query string. Returns the result of the query or throws Exception on error. Ex:


LoginHandler

Extends CommonFunctions

Processes login credentials.

Populates $_SESSION with user data.

Returns string; either '/clients' or '/drivers'.

Throws exception on error.

Usage

Properties settable in $data:

Public Methods

Sets the following session values:

This associative array contains resources from the config endpoint as well as all Client 0 resources except Password, AdminPassword, and Deleted.

If true this Boolean value indicates that the user logged in from a portal located at ../mobileLogin that passed the LoginHandler class a dataset that included the key "mobile" and will redirect there instead of / upon log out.

Describes the type of user logged in:

All resources from the end point corresponding to the client, organization, driver, or dispatcher except Deleted and passwords.

Dispatchers have $_SESSION['CanDispatch'] set to a value of 2.

Clients, Dispatchers, and Drivers with dispatch privileges have $_SESSION['config']['ContractDiscount'] and $_SESSION['config']['GeneralDiscount'] set. These are associative arrays with keys being Client IDs (preceded with the letter 't' for non-repeat clients) and the values being the discount values for each (or current) client.

Clients and organizations will have $_SESSION['pwWarning'] set.

Integer

These values are used to notify the user that the password should be changed.

Organizations have $_SESSION['members'] set. This is an associative array with the keys being client IDs (preceded by the letter 't' for non-repeat clients) and the values being an associative array containing the data stored at the clients end point for each client associated with the organization.


Ticket

Extends CommonFunctions

Processes and displays tickets individually or batched

Usage:

Properties settable in $data:

A list of standard properties can be found in the API Documentation

The step property is used by $ticket->updateStep().

The action property is used by $ticket->cancelTicket().

The special property multiTicket can contain an array of ticket data sets for batch creation or updating. Ex: Update two tickets; one is being delivered the other returned to the same address.

Public Methods:

Display single ticket for client review or for dispatch.

If coordinates are available for pick up, delivery, or return step the will be displayed in a span with the class coordinates.

Display single ticket for drivers.

Addresses are displayed as a.addressLink that by default will open Google Maps searching the address in a new window.

Display groups of tickets with common pick up or drop off location and time.

Addresses are displayed as a.addressLink that by default will open Google Maps searching the address in a new window.

Check database for tickets that have not been dispatched.

Has 4 states based on $data passed to Ticket.

1 initial: Generates an empty ticket entry form.

This form is followed by <div class="mapContainer" id="map"></div> for use with a javascript map api.

This div is only generated on this step.

2 edit: Generates a ticket entry form populated with provided $data.

3 confirmation: Generates a read-only form for validation.

TicketPrice is solved here.

4 process: Submit ticket to the server.

TicketNumber is set here.

Generates a simplified ticket form that only accepts 2 addresses, charge, and dry ice weight.

The data from this form should be passed to $ticket->calculateRunPrice().

This form is followed by <div class="mapContainer" id="map2"></div> for use with a javascript map api.

Note: The private method self::getTicketBase() is called here as well as when creating on call tickets and contract tickets that have a PriceOverride value of 0. This method uses geocoder-php to get the coordinates of the pick up and delivery locations. It expects that the properties $ticket->pAddress2 and $ticket->dAddress2 will be in the format Locality/City, State/Province Zip/Postal Code. This format is important as the function tests the value between the first comma and the final whitespace in the string (the one prior to Zip/Postal Code) against values returned by the geocoder to determine if accurate data has been received.

Returns a json encoded array with the following properties:

Checks for tickets for a given client on the current date.

Returns the results of $ticket->regenTicket() for each ticket found, false if none exist.

Note: This does not display a map when calculating TicketPrice. Consult geocoder providers for limitations.

Process tickets generated by the Route class:

Returns true on success, false, and optionally logs an error, on failure.

Processes and submits a change of charge from 5 to 6 using the value stored in TicketBase.

Updates values in $ticket->updateTicketDatabaseKeys if provided.

Sets the time stamp and submits that, notes and other values for the given step for a single ticket or multiTicket array.

Sends confirmation email if indicated.

Returns a string on success and error.

On error the string will contain the word 'error'.

Valid values:

Processes the given action for a single ticket or multiTicket array.

Valid values:


Route

Extends CommonFunctions

Creates contract tickets for a driver as defined on the Manage Runs page.

Checks for and displays contract tickets.

Updates LastSeen resource.

Checks for and displays on call tickets.

Checks for and displays transferred tickets.

Usage:

Properties settable in $data:

All properties of this class are set by the session.

Public Methods:

Checks drivers LastSeen resource. If it is not the current date a call is made to check for cancelations and rescheduling then tickets defined on the Manage Runs page are created. The LastSeen resource is then updated.

Note: The above order is overriding. Canceling a run on a given date supersedes rescheduling that run to the same date. Rescheduling a run supersedes its date, pick up time, delivery time, and return time defined on the Manage Runs page.

A call is made to fetch incomplete routine and round trip contract tickets. If this result is empty a call is made to check if any contract tickets were created for the driver on the current day.

Multiple tickets with the same location and scheduled step time will be grouped together.

Soft delete (setting the 'Deleted' property to 1) of contract runs, contract run schedules, rescheduling events, cancelations, and route schedules is respected.

Soft delete of contract locations that are associated with active contract runs is not respected.

A span.timing element is added to each div.sortable for use by javascript to order tickets based on their ReadyDate and step.

Returns HTML content.

Checks for incomplete on call tickets that have been dispatched to the current driver in the past 7 days.

Returns HTML content.

Checks for tickets that have been transferred to or by the current driver.

Returns HTML content.


Scheduling

Static Class with tools for interpreting scheduling codes, literals, and indices.

Public methods

Returns the schedule code ([a-g][1-9] or h5 - h28) associated with a given schedule_index (1-87).

Returns the schedule literal (Every Day, Every Last Thursday, Every 22nd) associated with a given schedule_index (1-87).

Returns the schedule_index (1-87) associated with a given schedule code ([a-g][1-9] or h5 - h28).

Returns the schedule literal (Every Day, Every Last Thursday, Every 22nd) associated with a schedule code ([a-g][1-9] or h5 - h28).

Returns the schedule_index (1-87) associated with a given schedule literal (Every Day, Every Last Thursday, Every 22nd).

Returns the schedule code ([a-g][1-9] or h5 - h28) associated with a given schedule literal (Every Day, Every Last Thursday, Every 22nd).

Compares two objects to determine if the scheduled interval has elapsed.

Returns .

Note: For 'Every Other' schedules with day names, if the start date does not land on the named day, perhaps because the schedule changed, the date will be tested against the day of the scheduled name in the same Sunday through Saturday week as the start date.

For example if an Every Other Saturday schedule starting on 01 JUL 2017 were changed to an Every Other Tuesday schedule the current date would be tested against the Tuesday in the same week as 01 JUL 2017 which is 27 JUN 2017.


Invoice

Extends CommonFunctions

Displays invoices for review.

By default canceled thickets are not displayed. This behavior can be adjusted on a per client basis in the config file located at extras/includes.

By default contract tickets are consolidated by run number. This behavior can be adjusted on a per client basis in the config file located at extras/includes.

Usage:

Properties settable in $data:

A list of standard properties can be found in the API Documentation

The invoiceQueryResult property is an indexed array of invoice datasets used for receiving data from the SearchHandler class.

Public Methods:

Uses the data provided in invoiceQueryResult to display an invoice.

If dompdf is detected a button will be added to display/download the invoice as a pdf.

If multiple datasets are provided a form will be returned to select which invoice to recreate by invoice number.

Soft delete (setting the 'Deleted' property to 1) will result in a discreet message being displayed at the top of the invoice indicating that it has been flagged for deletion.

Creates a query form for admin and organization clients. The parameters provided by this form are processed by the SearchHandler class.


SearchHandler

Extends CommonFunctions

Accepts input from ticket and invoice query forms.

Returns html result of datasets processed by those respective classes.

Usage:

Properties settable in $data:

Public Methods:

$handler->ticketLookup() ;

Uses a ticket number to get ticket timing information.

Returns a JSON encoded string.

The object will have the property queryError if there was a problem with the query or if the tickets Charge property is 0 (canceled).

If no error and Charge does not equal 0 the object will have the following properties:

$handler->handleSearch();

Returns the html content generated by the indicated class; Ticket, Invoice, TicketChart, or InvoiceChart.


TicketChart

Extends CommonFunctions

Receives a dataset of tickets grouped by month from the SearchHandler class.

Displays a table containing the number of each type of ticket over a given period.

Displays a simple bar chart depicting the number of each type of ticket over a given period.

Contract and On Call are always displayed.

With Ice and Without Ice are always displayed.

All other values are only displayed if they are not zero.

example

If dompdf is detected a button will be added to display/download the chart as a pdf.

Properties settable in $config can be found here

Usage:

Properties settable in $data:

Public Methods:

Returns html content or false on error.


InvoiceChart

Extends CommonFunctions

Receives a dataset of tickets grouped by month from the SearchHandler class.

Displays a table containing the expense of each type of ticket over a given period.

Displays a simple bar chart depicting the expense of each type of ticket over a given period.

Only non-zero values are displayed.

example

If dompdf is detected a button will be added to display/download the chart as a pdf.

Properties settable in $config can be found here

Usage:

Properties settable in $data:

Boolean

Indicates if the query if for an organization (true) or an individual client (false)

Array or Integer

If organizationFlag is true this is an indexed array of members to be queried.

If organizationFlag is false this is the ID of the current client.

Boolean

Indicates if dataset is two months compared or a series of months.

Boolean

Indicates if members are being compared of displayed separately.

Public Methods:

Returns html content or false on error.


Client

Extends CommonFunctions

Manages information for clients, drivers, and dispatchers.

Usage:

Properties settable in $data:

A list of standard properties can be found in the API Documentation

Public methods:

Returns array of client information.

echos message and returns false on error.

Requires current password to be submitted.

Validates submitted current password against database stored hash.

Tests that newPw1 meets criteria

Compares newPw1 and newPw2 for confirmation.

Ensures that admin and daily user passwords do not match.

Hashes the new password using PASSWORD_DEFAULT algorithm and a cost of 12.

echos message and returns false on error.

If $client->same is equal to 1 billing information is set equal to shipping information.

Phone numbers are validated preg_match('/(\d{3})-(\d{3})-(\d{4})x(\d+)/i', $val) || preg_match('/(\d{3})-(\d{3})-(\d{4})/', $val);. These patters are slated for update.

Returns a password update form with admin user values set.

Returns a password update form with daily user values set.

Returns a password update form with organization user values set.

Returns a password update form with driver values set.

Returns a password update form with dispatch values set.

Only available to admin user level.

Returns an contact information update form.


InvoiceCron

Extends CommonFunctions

Automatically creates invoices with a cron job run on the day following the end of a monthly billing cycle.

Updates tickets with new invoice number.

Can be configured to ignore clients and non-repeat clients.

Checks for past due invoices according to the terms defined per invoice.

Respects soft delete (setting the 'Deleted' property to 1) when checking for past due invoices.

Usage:


extras

This is an extendable drop-in implementation of this set of classes using vanilla javascript.

Functionality is enclosed in a global variable: rjdci.

The Fetch API is used extensively and a template is provided. This will retry a call failing due to network issues 20 times waiting n * 250 milliseconds between calls where n is the retry count. If a FormData instance is sent the headers Content-Type and Content-Length will be tested for and removed to prevent conflicts. If the postData property is not empty and the Content-Type header is set as www-form-urlencoded the post body will be encoded. If the Content-Type header is not defined and the postData property has a length greater than 0 the Content-Type will be set to "application/json". As a result the PHP $_POST super global is not populated; data must be read from the stream.

Ex:

The function is setTimeout turned into a promise.

Usage:

A place holder for a map function is provided and should be redefined if a map api is implemented.

Signature Pad v2.3.2 is preconfigured with extras/public_html/app_js/sigPad.js to collect signatures in conjunction with the functions $ticket->displaySingleTicket() and $ticket->displayMultiTicket().

The method rjdci.toast(msg, options) is available. It creates and deletes a toast-like div to show messages to the user.

Usage:

The method rjdci.getSpinner() can be called to return a copy of the loading icon.

Features

Uses ticket information from database to populate datalist elements to assist form completion.

Single page design navigated by either swipe or menu. Offers unique features based upon user type. Once each page has been loaded a window event rjdci_loaded is triggered.

Swipe is used for navigation. Public methods can be accessed via the rjdci.Swipe instance.

At the end of the transition between pages scroll(0,0) is called and a window event rjdci_pageChange is triggered.

Setting the order of menu items as well as adding custom menu items (with or without matching pages), and javascript files is handled in the config file located at extras/includes.

Drivers

If the user agent supports both the permissions and geolocation APIs an attempt will be made to get the coordinates when a ticket is picked up, delivered, returned, declined, or marked as a dead run. The above described function rjdci.toast is used to create notifications with the class deliveryLocation to inform the user of the status of updating the delivery location.

Dispatchers

Clients

Organizations


All versions of courierinvoice with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-curl Version *
phpmailer/phpmailer Version ^6.1.6
geocoder-php/chain-provider Version ^4.0
guzzlehttp/guzzle Version ^7.0
php-http/guzzle7-adapter Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rjdeliveryomaha/courierinvoice contains the following files

Loading the files please wait ....