<?php
/**
 * phpaga
 *
 * Global definitions.
 *
 * This file contains global definitions.
 *
 * @author Florian Lanthaler <florian@phpaga.net>
 * @version $Id: globals.php 875 2007-10-21 19:31:31Z florian $
 *
 * Copyright (c) 2002, Florian Lanthaler <florian@phpaga.net>
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in
 *      the documentation and/or other materials provided with the
 *      distribution.
 *
 *    * Neither the name of Florian Lanthaler nor the names of his
 *      contributors may be used to endorse or promote products derived
 *      from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

 define("PHPAGA_VERSION", "0.2rc1");

 /* decimals */
 $phpaga_decimals_options = array();
 for ($i = 0; $i <= 4; $i++)
 {
    $phpaga_decimals_options[$i] = $i;
 }

$phpaga_error = array();

define("USER_AUTHENTICATED",             100);

/* user privileges (bitmasks) */

define("USR_NORMAL", 0);
define("USR_ADMIN", 1);

/* sort order parameters */

define("ORDER_OP_TIMESTAMP_START_ASC",     1);
define("ORDER_OP_TIMESTAMP_START_DESC",    2);
define("ORDER_OP_PE_ASC",                  3);
define("ORDER_OP_PE_DESC",                 4);
define("ORDER_OP_PR_ASC",                  5);
define("ORDER_OP_PR_DESC",                 6);
define("ORDER_OP_OPCAT_ASC",               7);
define("ORDER_OP_OPCAT_DESC",              8);
define("ORDER_OP_DURATION_ASC",            9);
define("ORDER_OP_DURATION_DESC",          10);

define("ORDER_PRJ_PR_ASC",                 11);
define("ORDER_PRJ_PR_DESC",                12);
define("ORDER_PRJ_PRJSTATUS_ASC",          13);
define("ORDER_PRJ_PRJSTATUS_DESC",         14);
define("ORDER_PRJ_CUSTOMER_ASC",           15);
define("ORDER_PRJ_CUSTOMER_DESC",          16);
define("ORDER_PRJ_STARTDATE_ASC",          17);
define("ORDER_PRJ_STARTDATE_DESC",         18);
define("ORDER_PRJ_PROJENDDATE_ASC",        19);
define("ORDER_PRJ_PROJENDDATE_DESC",       20);
define("ORDER_PRJ_PRJCAT_ASC",             21);
define("ORDER_PRJ_PRJCAT_DESC",            22);
define("ORDER_PRJ_DURATION_ASC",           23);
define("ORDER_PRJ_DURATION_DESC",          24);
define("ORDER_PRJ_PROJDEADLINE_ASC",       25);
define("ORDER_PRJ_PROJDEADLINE_DESC",      26);
define("ORDER_PRJ_PRIORITY_ASC",           27);
define("ORDER_PRJ_PRIORITY_DESC",          28);

define("ORDER_PE_NAME_ASC",                31);
define("ORDER_PE_NAME_DESC",               32);
define("ORDER_PE_ADDRESS_ASC",             33);
define("ORDER_PE_ADDRESS_DESC",            34);
define("ORDER_PE_CITY_ASC",                35);
define("ORDER_PE_CITY_DESC",               36);
define("ORDER_PE_COUNTRY_ASC",             37);
define("ORDER_PE_COUNTRY_DESC",            38);
define("ORDER_PE_COMPANY_ASC",             39);
define("ORDER_PE_COMPANY_DESC",            40);
define("ORDER_PE_EMAIL_ASC",               41);
define("ORDER_PE_EMAIL_DESC",              42);

define("ORDER_CPN_NAME_ASC",               51);
define("ORDER_CPN_NAME_DESC",              52);
define("ORDER_CPN_ADDRESS_ASC",            53);
define("ORDER_CPN_ADDRESS_DESC",           54);
define("ORDER_CPN_CITY_ASC",               55);
define("ORDER_CPN_CITY_DESC",              56);
define("ORDER_CPN_COUNTRY_ASC",            57);
define("ORDER_CPN_COUNTRY_DESC",           58);
define("ORDER_CPN_CCAT_ASC",               59);
define("ORDER_CPN_CCAT_DESC",              60);
define("ORDER_CPN_EMAIL_ASC",              61);
define("ORDER_CPN_EMAIL_DESC",             62);

/* define some actions */

define("ACTION_NONE",                      0);
define("ACTION_OP_VIEW",                   1);
define("ACTION_OP_REMOVE",                 3);
define("ACTION_BILL_MAKEIT",               4);
define("ACTION_ADD",                       5);
define("ACTION_DELETE",                    6);
define("ACTION_DELETE_ASK",                7);
define("ACTION_UPDATE",                    8);
define("ACTION_QUOTATION_MAKEIT",          9);
define("ACTION_BILL_WITHOPERATIONS",      10);
define("ACTION_PE_VIEW",                  11);
define("ACTION_PE_REMOVE_ASK",            12);
define("ACTION_PE_REMOVE",                13);
define("ACTION_PRJ_MEMBER_ADD_ASK",       14);
define("ACTION_PRJ_MEMBER_ADD",           15);
define("ACTION_PRJ_MEMBER_REMOVE_ASK",    16);
define("ACTION_PRJ_MEMBER_REMOVE",        17);
define("ACTION_SAVECONFIG",               18);
define("ACTION_OKMSG",                    19);
define("ACTION_PRJ_REMOVE",               20);
define("ACTION_VIEW",                     21);
define("ACTION_REMOVE_ASK",               22);
define("ACTION_PRJ_REMOVE_FORCE",         23);
define("ACTION_CLONE",                    24);
define("ACTION_FROMQUOTATION",            25);
define("ACTION_REMOVE",                   26);
define("ACTION_CREATEDBSTRUCT",           27);
define("ACTION_UPDATE_OK",                28);
define("ACTION_BILL_ADDLINEITEMS",        29);
define("ACTION_BILL_RECALC",              30);
define("ACTION_BILL_MAKEOPITEMS",         31);
define("ACTION_BILL_MAKESINGLEOPITEM",    32);
define("ACTION_ENABLE",                   33);
define("ACTION_DISABLE",                  34);
define("ACTION_SERVICE_PAYTERM",          35);  // Do not modify this value, it is hardcoded in htdocs/js/billing.js
define("ACTION_SERVICE_MEMBERPARM",       36);
define("ACTION_SERVICE_OPDETAILS",        37);  // Do not modify this value, it is hardcoded in htdocs/js/taskdetails.js
define("ACTION_FILE_REMOVE",              39);
define("ACTION_SERVICE_PRODINFO",         40);  // Do not modify this value, it is hardcoded in htdocs/js/billing.js and htdocs/js/material.js
define("ACTION_MATERIAL_REMOVE",          41);
define("ACTION_BILL_FROMPROJECT",         42);
define("ACTION_SERVICE_MATDETAILS",       43);  // Do not modify this value, it is hardcoded in htdocs/js/materialdetails.js
define("ACTION_EDIT",                     44);
define("ACTION_BILL_MAKEOPITEMSPERPRJ",   45);
define("ACTION_SERVICE_GETADDTASK",       46);  // Do not modify this value, it is hardcoded in htdocs/js/taskdetails.js
define("ACTION_SERVICE_ADDTASK",          47);
define("ACTION_SERVICE_GETEMPLOYEES",     48);  // Do not modify this value, it is hardcoded in htdocs/js/billing.js
define("ACTION_SERVICE_GETCURRTIME",      49);  // Do not modify this value, it is hardcoded in htdocs/js/core.js
define("ACTION_GENERATE",                 50);

/* header status */

define("HEADER_FULL",                      0);
define("HEADER_ONLY",                      1);

define("JSCALENDAR", true);

/* other definitions */

define("PHPAGA_PROJECTSTATUS_ALL",         0);
define("PHPAGA_PROJECTSTATUS_OPEN",        1);
define("PHPAGA_PROJECTSTATUS_CLOSED",      2);
define("PHPAGA_PROJECTSTATUS_OVERDUE",     3);

/* graph styles */

define("PHPAGA_GRAPH_OPCAT_STYLE_PIE2D",   2);
define("PHPAGA_GRAPH_OPCAT_STYLE_PIE3D",   3);

/* operation billed/not billed */

define("PHPAGA_BILL_NOTBILLED",            2);
define("PHPAGA_BILL_BILLED",               1);

/* invoice paid/not paid */

define("PHPAGA_BILL_NOTPAID",              2);
define("PHPAGA_BILL_PAID",                 1);

/* invoice sent/not sent */

define("PHPAGA_BILL_NOTSENT",              2);
define("PHPAGA_BILL_SENT",                 1);

/* quotation sent/not sent */

define("PHPAGA_QUOTATION_NOTSENT",         2);
define("PHPAGA_QUOTATION_SENT",            1);

define("PHPAGA_NO",                        0);
define("PHPAGA_YES",                       1);

define("PHPAGA_SEPARATOR",                 1);

/* how to group the manhours / display type */

/* show all days of a month */
define("PHPAGA_MANHOURS_DISPLAY_MONTH",    2);

/* show all calendar weeks of a year */
define("PHPAGA_MANHOURS_DISPLAY_YEAR",     4);

/* large or small graph */

define("PHPAGA_MANHOURS_GRAPH_LARGE",      2);
define("PHPAGA_MANHOURS_GRAPH_SMALL",      3);

define("PHPAGA_OPTION_ALL",                2);
define("PHPAGA_OPTION_SELECT",             3);
define("PHPAGA_OPTION_NONE",               0);
define("PHPAGA_OPTION_NEW",                1);

define("PHPAGA_FORCE",                  true);

define("PHPAGA_OPCGRP_PROJECT",             1);
define("PHPAGA_OPCGRP_PERSON",              2);

define("PHPAGA_BILLABLETYPE_YES",           0);
define("PHPAGA_BILLABLETYPE_NO",           10);
define("PHPAGA_BILLABLETYPE_EXTRA",        20);

define("PHPAGA_BILL_TASKASSOC_LOCKED",     10);

$phpaga_projects_billabletype = array(PHPAGA_BILLABLETYPE_YES => _("Yes"),
                                      PHPAGA_BILLABLETYPE_NO => _("No"));

$phpaga_operations_billabletype = array(PHPAGA_BILLABLETYPE_YES => _("Yes"),
                                        PHPAGA_BILLABLETYPE_NO => _("No"),
                                        PHPAGA_BILLABLETYPE_EXTRA => _("Extra"));

define("PHPAGA_GROUPBY_PROJECT",            1);
define("PHPAGA_GROUPBY_CUSTOMER",           2);

$phpaga_groupby = array(PHPAGA_GROUPBY_PROJECT => _("Project"),
                        PHPAGA_GROUPBY_CUSTOMER => _("Customer"));

define("PHPAGA_TYPE_INVOICE", 1);
define("PHPAGA_TYPE_QUOTATION", 2);

define("PHPAGA_LOG_ERR", 3);
define("PHPAGA_LOG_INFO", 6);

$phpaga_logpriorities = array(PHPAGA_LOG_ERR => "ERR",
                              PHPAGA_LOG_INFO => "INFO");

define("PHPAGA_RELTYPE_PROJECT",   10);
define("PHPAGA_RELTYPE_PLANTASK",  20);
define("PHPAGA_RELTYPE_EXPENSE",   30);
define("PHPAGA_RELTYPE_TRACKTASK", 40);
define("PHPAGA_RELTYPE_PERSON",    50);
define("PHPAGA_RELTYPE_COMPANY",   60);

$phpaga_preview_types = array('image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'application/pdf', 'application/postscript');
$phpaga_preview_types_tojpg = array('application/pdf', 'application/postscript');
$phpaga_preview_types_firstpage = array('application/pdf', 'application/postscript');

define("PHPAGA_RBILL_TYPE_NONE", 0);
define("PHPAGA_RBILL_TYPE_WEEKLY", 10);
define("PHPAGA_RBILL_TYPE_MONTHLY", 20);
define("PHPAGA_RBILL_TYPE_ANNUAL", 30);

$phpaga_rbill_types = array(PHPAGA_RBILL_TYPE_NONE => _('Non-recurring'),
                            PHPAGA_RBILL_TYPE_WEEKLY => _('Weekly'),
                            PHPAGA_RBILL_TYPE_MONTHLY => _('Monthly'),
                            PHPAGA_RBILL_TYPE_ANNUAL => _('Annual'));

$phpaga_rbill_intervals = array(PHPAGA_RBILL_TYPE_WEEKLY => '1 week',
                                PHPAGA_RBILL_TYPE_MONTHLY => '1 month',
                                PHPAGA_RBILL_TYPE_ANNUAL => '1 year');

define('PHPAGA_RBILL_STATUS_ENABLED', 0);
define('PHPAGA_RBILL_STATUS_DISABLED', 10);

?>