Example #1
0
 public function note_recipient()
 {
     $oldy = $this->backend->GetY();
     $recipient = '<b>' . trans('Note recipient:') . '</b><br>';
     $recipient .= $this->data['name'] . '<br>';
     $recipient .= $this->data['address'] . '<br>';
     $recipient .= $this->data['zip'] . ' ' . $this->data['city'] . '<br>';
     if ($this->data['ten']) {
         $recipient .= trans('TEN') . ': ' . $this->data['ten'] . '<br>';
     } elseif ($this->data['ssn']) {
         $recipient .= trans('SSN') . ': ' . $this->data['ssn'] . '<br>';
     }
     $this->backend->SetFont('arial', '', 10);
     $this->backend->writeHTMLCell(80, '', 125, 50, $recipient, 0, 1, 0, true, 'L');
     $y = $this->backend->GetY();
     if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_bankaccount', true))) {
         $bankaccount = trans('Bank account:') . ' <b>' . format_bankaccount(bankaccount($this->data['customerid'], $this->data['account'])) . '</b>';
         $this->backend->SetFont('arial', 'B', 8);
         $this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy - 8) / 2), $bankaccount, 0, 1, 0, true, 'L');
     }
     if (ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.customer_credentials', true))) {
         $pin = '<b>' . trans('Customer ID: $a', sprintf('%04d', $this->data['customerid'])) . '</b><br>';
         $pin .= '<b>PIN: ' . sprintf('%04d', $this->data['customerpin']) . '</b><br>';
         $this->backend->SetFont('arial', 'B', 8);
         $this->backend->writeHTMLCell('', '', 125, $oldy + round(($y - $oldy) / 2), $pin, 0, 1, 0, true, 'L');
     }
     $this->backend->SetY($y);
 }
Example #2
0
 /**
  * Returns singleton database handler.
  * 
  * @return \LMSDBInterface
  */
 public static function getInstance()
 {
     if (self::$db === null) {
         $_DBTYPE = LMSConfig::getIniConfig()->getSection('database')->getVariable('type')->getValue();
         $_DBHOST = LMSConfig::getIniConfig()->getSection('database')->getVariable('host')->getValue();
         $_DBUSER = LMSConfig::getIniConfig()->getSection('database')->getVariable('user')->getValue();
         $_DBPASS = LMSConfig::getIniConfig()->getSection('database')->getVariable('password')->getValue();
         $_DBNAME = LMSConfig::getIniConfig()->getSection('database')->getVariable('database')->getValue();
         $_DBDEBUG = false;
         if (LMSConfig::getIniConfig()->getSection('database')->hasVariable('debug')) {
             $_DBDEBUG = ConfigHelper::checkValue(LMSConfig::getIniConfig()->getSection('database')->getVariable('debug')->getValue());
         }
         self::$db = self::getDB($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME, $_DBDEBUG);
     }
     return self::$db;
 }
Example #3
0
			}

			$mailfrom = $user['email'] ? $user['email'] : $queue['email'];

	        $headers['From'] = $mailfname.' <'.$mailfrom.'>';
			$headers['Subject'] = sprintf("[RT#%06d] %s", $note['ticketid'], $DB->GetOne('SELECT subject FROM rttickets WHERE id = ?', array($note['ticketid'])));
			$headers['Reply-To'] = $headers['From'];

            $sms_body = $headers['Subject']."\n".$note['body'];
			$body = $note['body']."\n\nhttp"
				.(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'
				.$_SERVER['HTTP_HOST']
				.substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1)
				.'?m=rtticketview&id='.$note['ticketid'];

			if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.helpdesk_customerinfo', false)) 
				&& ($cid = $DB->GetOne('SELECT customerid FROM rttickets WHERE id = ?', array($note['ticketid']))))
			{
				$info = $DB->GetRow('SELECT id, '.$DB->Concat('UPPER(lastname)',"' '",'name').' AS customername,
						email, address, zip, city, (SELECT phone FROM customercontacts 
							WHERE customerid = customers.id ORDER BY id LIMIT 1) AS phone
						FROM customers WHERE id = ?', array($cid));

				$body .= "\n\n-- \n";
				$body .= trans('Customer:').' '.$info['customername']."\n";
				$body .= trans('Address:').' '.$info['address'].', '.$info['zip'].' '.$info['city']."\n";
				$body .= trans('Phone:').' '.$info['phone']."\n";
				$body .= trans('E-mail:').' '.$info['email'];

				$sms_body .= "\n";
                $sms_body .= trans('Customer:').' '.$info['customername'];
Example #4
0
         $a['at'] = $d . '/' . $m;
     } else {
         list($d, $m) = explode('/', $a['at']);
     }
     if (!$error) {
         if ($d > 30 || $d < 1 || $d > 28 && $m == 2) {
             $error['at'] = trans('This month doesn\'t contain specified number of days');
         }
         if ($m > 6 || $m < 1) {
             $error['at'] = trans('Incorrect month number (max.6)!');
         }
         $at = ($m - 1) * 100 + $d;
     }
     break;
 case YEARLY:
     if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.use_current_payday', false)) && !$a['at']) {
         $d = date('j', time());
         $m = date('n', time());
         $a['at'] = $d . '/' . $m;
     } elseif (!preg_match('/^[0-9]{2}\\/[0-9]{2}$/', $a['at'])) {
         $error['at'] = trans('Incorrect date format! Enter date in DD/MM format!');
     } else {
         list($d, $m) = explode('/', $a['at']);
     }
     if (!$error) {
         if ($d > 30 || $d < 1 || $d > 28 && $m == 2) {
             $error['at'] = trans('This month doesn\'t contain specified number of days');
         }
         if ($m > 12 || $m < 1) {
             $error['at'] = trans('Incorrect month number');
         }
Example #5
0
    $customeradd['zip'] = $default_zip;
}
if (!isset($customeradd['city']) && $default_city) {
    $customeradd['city'] = $default_city;
}
if (!isset($customeradd['address']) && $default_address) {
    $customeradd['address'] = $default_address;
}
if (!isset($customeradd['default_stateid']) && $default_stateid) {
    $customeradd['stateid'] = $default_stateid;
}
if (!isset($customeradd['default_countryid']) && $default_countryid) {
    $customeradd['countryid'] = $default_countryid;
}
if (!isset($customeradd['default_status']) && $default_status) {
    $customeradd['status'] = $default_status;
}
$layout['pagetitle'] = trans('New Customer');
$LMS->InitXajax();
$hook_data = $LMS->executeHook('customeradd_before_display', array('customeradd' => $customeradd, 'smarty' => $SMARTY));
$customeradd = $hook_data['customeradd'];
$SMARTY->assign('xajax', $LMS->RunXajax());
$SMARTY->assign('cstateslist', $LMS->GetCountryStates());
$SMARTY->assign('countrieslist', $LMS->GetCountries());
$SMARTY->assign('divisions', $DB->GetAll('SELECT id, shortname, status FROM divisions ORDER BY shortname'));
$SMARTY->assign('customeradd', $customeradd);
if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.add_customer_group_required', false))) {
    $SMARTY->assign('groups', $DB->GetAll('SELECT id,name FROM customergroups ORDER BY id'));
}
$SMARTY->assign('error', $error);
$SMARTY->display('customer/customeradd.html');
Example #6
0
if (sizeof($_POST['marks'])) {
    foreach ($_POST['marks'] as $id => $mark) {
        $ilm[$id] = $mark;
    }
}
if (sizeof($ilm)) {
    foreach ($ilm as $mark) {
        $ids[] = $mark;
    }
}
if (sizeof($ids)) {
    foreach ($ids as $invoiceid) {
        list($cid, $closed) = array_values($DB->GetRow('SELECT customerid, closed FROM documents
			WHERE id = ?', array($invoiceid)));
        // add payment
        if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.invoice_check_payment', false)) && $cid && !$closed) {
            $value = $DB->GetOne('SELECT CASE reference WHEN 0 THEN SUM(a.value*a.count)
				ELSE SUM((a.value+b.value)*(a.count+b.count)) - SUM(b.value*b.count) END
				FROM documents d
				JOIN invoicecontents a ON (a.docid = d.id)
				LEFT JOIN invoicecontents b ON (d.reference = b.docid AND a.itemid = b.itemid)
				WHERE d.id = ? GROUP BY d.reference', array($invoiceid));
            if ($value != 0) {
                $LMS->AddBalance(array('type' => 1, 'time' => time(), 'value' => $value, 'customerid' => $cid, 'comment' => trans('Accounted')));
            }
        }
        if ($SYSLOG) {
            $args = array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_DOC] => $invoiceid, $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST] => $cid, 'closed' => intval(!$closed));
            $SYSLOG->AddMessage(SYSLOG_RES_DOC, SYSLOG_OPER_UPDATE, $args, array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_DOC], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST]));
        }
        $DB->Execute('UPDATE documents SET closed = 
Example #7
0
        $reply = $LMS->GetMessage($_GET['id']);
        if ($reply['replyto']) {
            $message['destination'] = preg_replace('/^.* <(.+@.+)>/', '\\1', $reply['replyto']);
        } else {
            $message['destination'] = preg_replace('/^.* <(.+@.+)>/', '\\1', $reply['mailfrom']);
        }
        if (!$message['destination'] && !$reply['userid']) {
            $message['destination'] = $LMS->GetCustomerEmail($message['customerid']);
            if (!empty($message['destination'])) {
                $message['destination'] = implode(',', $message['destination']);
            }
        }
        $message['subject'] = 'Re: ' . $reply['subject'];
        $message['inreplyto'] = $reply['id'];
        $message['references'] = $reply['messageid'];
        if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.helpdesk_reply_body', false))) {
            $body = explode("\n", textwrap(strip_tags($reply['body']), 74));
            foreach ($body as $line) {
                $message['body'] .= '> ' . $line . "\n";
            }
        }
        if (!preg_match('/\\[RT#[0-9]{6}\\]/i', $message['subject'])) {
            $message['subject'] .= sprintf(' [RT#%06d]', $message['ticketid']);
        }
    }
}
$layout['pagetitle'] = trans('New Message');
$SESSION->save('backto', $_SERVER['QUERY_STRING']);
$SMARTY->assign('message', $message);
$SMARTY->assign('error', $error);
$SMARTY->display('rt/rtmessageadd.html');
    /**
     * Returns customer nodes
     * 
     * @param int $id Customer id
     * @param int $count Limit
     * @return array Nodes
     */
    public function getCustomerNodes($id, $count = null)
    {
        if ($result = $this->db->GetAll('SELECT n.id, n.name, mac, ipaddr,
				inet_ntoa(ipaddr) AS ip, ipaddr_pub,
				inet_ntoa(ipaddr_pub) AS ip_pub, passwd, access,
				warning, info, ownerid, lastonline, location,
				(SELECT COUNT(*) FROM nodegroupassignments
					WHERE nodeid = n.id) AS gcount,
				n.netid, net.name AS netname
				FROM vnodes n
				JOIN networks net ON net.id = n.netid
				WHERE ownerid = ?
				ORDER BY n.name ASC ' . ($count ? 'LIMIT ' . $count : ''), array($id))) {
            // assign network(s) to node record
            $network_manager = new LMSNetworkManager($this->db, $this->auth, $this->cache);
            $networks = (array) $network_manager->GetNetworks();
            foreach ($result as $idx => $node) {
                $ids[$node['id']] = $idx;
                $result[$idx]['lastonlinedate'] = lastonline_date($node['lastonline']);
                //foreach ($networks as $net)
                //	if (isipin($node['ip'], $net['address'], $net['mask'])) {
                //		$result[$idx]['network'] = $net;
                //		break;
                //	}
                if ($node['ipaddr_pub']) {
                    foreach ($networks as $net) {
                        if (isipin($node['ip_pub'], $net['address'], $net['mask'])) {
                            $result[$idx]['network_pub'] = $net;
                            break;
                        }
                    }
                }
            }
            // get EtherWerX channels
            if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
                $channels = $this->db->GetAllByKey('SELECT nodeid, channelid, c.name, c.id, cid,
				        nc.upceil, nc.downceil
					FROM ewx_stm_nodes
					JOIN ewx_stm_channels nc ON (channelid = nc.id)
					LEFT JOIN ewx_channels c ON (c.id = nc.cid)
					WHERE nodeid IN (' . implode(',', array_keys($ids)) . ')', 'nodeid');
                if ($channels) {
                    foreach ($channels as $channel) {
                        $idx = $ids[$channel['nodeid']];
                        $result[$idx]['channelid'] = $channel['id'] ? $channel['id'] : $channel['channelid'];
                        $result[$idx]['channelname'] = $channel['name'];
                        $result[$idx]['cid'] = $channel['cid'];
                        $result[$idx]['downceil'] = $channel['downceil'];
                        $result[$idx]['upceil'] = $channel['upceil'];
                    }
                }
            }
        }
        return $result;
    }
Example #9
0
        $ilm[$id] = $mark;
    }
}
if (sizeof($ilm)) {
    foreach ($ilm as $mark) {
        $ids[] = intval($mark);
    }
}
if (sizeof($ids)) {
    foreach ($ids as $noteid) {
        list($cid, $value, $closed) = array_values($DB->GetRow('SELECT customerid, 
			(SELECT SUM(value) FROM debitnotecontents
				WHERE docid = d.id) AS value, closed
			FROM documents
			WHERE id = ?', array($noteid)));
        // add payment
        if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.note_check_payment', false)) && !$closed) {
            if ($value != 0) {
                $LMS->AddBalance(array('type' => 1, 'time' => time(), 'value' => $value, 'customerid' => $cid, 'comment' => trans('Accounted')));
            }
        }
        if ($SYSLOG) {
            $args = array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_DOC] => $noteid, $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST] => $cid, 'closed' => intval(!$closed));
            $SYSLOG->AddMessage(SYSLOG_RES_DOC, SYSLOG_OPER_UPDATE, $args, array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_DOC], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST]));
        }
        $DB->Execute('UPDATE documents SET closed = 
			(CASE closed WHEN 0 THEN 1 ELSE 0 END)
			WHERE id = ?', array($noteid));
    }
}
$SESSION->redirect('?' . $SESSION->get('backto'));
Example #10
0
    public function GetNoteContent($id)
    {
        if ($result = $this->db->GetRow('SELECT d.id, d.number, d.name, d.customerid,
				d.userid, d.address, d.zip, d.city, d.countryid, cn.name AS country,
				d.ten, d.ssn, d.cdate, d.numberplanid, d.closed, d.divisionid, d.paytime, 
				(SELECT name FROM users WHERE id = d.userid) AS user, n.template,
				d.div_name AS division_name, d.div_shortname AS division_shortname,
				d.div_address AS division_address, d.div_zip AS division_zip,
				d.div_city AS division_city, d.div_countryid AS division_countryid, 
				d.div_ten AS division_ten, d.div_regon AS division_regon, d.div_account AS account,
				d.div_inv_header AS division_header, d.div_inv_footer AS division_footer,
				d.div_inv_author AS division_author, d.div_inv_cplace AS division_cplace,
				c.pin AS customerpin, c.divisionid AS current_divisionid,
				c.street, c.building, c.apartment,
				c.post_street, c.post_building, c.post_apartment,
				c.post_name, c.post_address, c.post_zip, c.post_city, c.post_countryid
				FROM documents d
				JOIN customeraddressview c ON (c.id = d.customerid)
				LEFT JOIN countries cn ON (cn.id = d.countryid)
				LEFT JOIN numberplans n ON (d.numberplanid = n.id)
				WHERE d.id = ? AND d.type = ?', array($id, DOC_DNOTE))) {
            $result['bankaccounts'] = $this->db->GetCol('SELECT contact FROM customercontacts
				WHERE customerid = ? AND (type & ?) = ?', array($result['customerid'], CONTACT_BANKACCOUNT | CONTACT_INVOICES | CONTACT_DISABLED, CONTACT_BANKACCOUNT | CONTACT_INVOICES));
            if (empty($result['bankaccounts'])) {
                $result['bankaccounts'] = array();
            }
            $result['value'] = 0;
            if (!$result['division_header']) {
                $location_manager = new LMSLocationManager($this->db, $this->auth, $this->cache, $this->syslog);
                $result['division_header'] = $result['division_name'] . "\n" . $result['division_address'] . "\n" . $result['division_zip'] . ' ' . $result['division_city'] . ($result['division_countryid'] && $result['countryid'] && $result['division_countryid'] != $result['countryid'] ? "\n" . trans($location_manager->GetCountryName($result['division_countryid'])) : '') . ($result['division_ten'] != '' ? "\n" . trans('TEN') . ' ' . $result['division_ten'] : '');
            }
            if ($result['content'] = $this->db->GetAll('SELECT
				value, itemid, description 
				FROM debitnotecontents 
				WHERE docid=? 
				ORDER BY itemid', array($id))) {
                foreach ($result['content'] as $idx => $row) {
                    $result['content'][$idx]['value'] = $row['value'];
                    $result['value'] += $row['value'];
                }
            }
            $result['valuep'] = round(($result['value'] - floor($result['value'])) * 100);
            $result['pdate'] = $result['cdate'] + $result['paytime'] * 86400;
            // NOTE: don't waste CPU/mem when printing history is not set:
            if (ConfigHelper::checkValue(ConfigHelper::getConfig('notes.print_balance', false))) {
                if (ConfigHelper::checkValue(ConfigHelper::getConfig('notes.print_balance_history', false))) {
                    $result['customerbalancelist'] = $LMS->GetCustomerBalanceList($result['customerid'], $result['cdate']);
                } else {
                    $result['customerbalancelist'] = $LMS->GetCustomerBalanceList($result['customerid']);
                }
                $result['customerbalancelistlimit'] = ConfigHelper::getConfig('notes.print_balance_history_limit');
            }
            // for backward compatibility
            if ($result['post_name'] || $result['post_address']) {
                $result['serviceaddr'] = $result['post_name'];
                if ($result['post_address']) {
                    $result['serviceaddr'] .= "\n" . $result['post_address'];
                }
                if ($result['post_zip'] && $result['post_city']) {
                    $result['serviceaddr'] .= "\n" . $result['post_zip'] . ' ' . $result['post_city'];
                }
            }
            return $result;
        } else {
            return FALSE;
        }
    }
Example #11
0
    public function VerifyUser()
    {
        $this->islogged = false;
        if ($user = $this->DB->GetRow('SELECT id, name, passwd, hosts, lastlogindate, lastloginip, 
			passwdexpiration, passwdlastchange, access, accessfrom, accessto, swekey_id
			FROM users WHERE login=? AND deleted=0', array($this->login))) {
            $this->logname = $user['name'];
            $this->id = $user['id'];
            $this->last = $user['lastlogindate'];
            $this->lastip = $user['lastloginip'];
            $this->passwdexpiration = $user['passwdexpiration'];
            $this->passwdlastchange = $user['passwdlastchange'];
            $this->swekeyid = $user['swekey_id'];
            $this->passverified = $this->VerifyPassword($user['passwd']);
            $this->hostverified = $this->VerifyHost($user['hosts']);
            $this->access = $this->VerifyAccess($user['access']);
            $this->accessfrom = $this->VerifyAccessFrom($user['accessfrom']);
            $this->accessto = $this->VerifyAccessTo($user['accessto']);
            $this->islogged = $this->passverified && $this->hostverified && $this->access && $this->accessfrom && $this->accessto;
            if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.use_swekey', false))) {
                require_once LIB_DIR . DIRECTORY_SEPARATOR . 'swekey' . DIRECTORY_SEPARATOR . 'swekey_integration.php';
                $SWEKEY = new SwekeyIntegration();
                $this->swekeyauthenticated = $SWEKEY->IsSwekeyAuthenticated($this->swekeyid);
                if (!$this->swekeyauthenticated && $this->swekeyid) {
                    $this->error = trans('You must login with your Swekey');
                    $this->islogged = false;
                    $SWEKEY->DestroySession();
                }
            }
            if ($this->islogged && $this->passwdexpiration && (time() - $this->passwdlastchange) / 86400 >= $user['passwdexpiration']) {
                $this->SESSION->save('session_passwdrequiredchange', TRUE);
            }
        } else {
            $this->error = trans('Wrong password or login.');
        }
        return $this->islogged;
    }
Example #12
0
// Call any of upgrade process before anything else
require_once LIB_DIR . '/upgradedb.php';
// test for proper version of Smarty
if (defined('Smarty::SMARTY_VERSION')) {
    $ver_chunks = preg_split('/[- ]/', Smarty::SMARTY_VERSION);
} else {
    $ver_chunks = NULL;
}
if (count($ver_chunks) != 2 || version_compare('3.0', $ver_chunks[1]) > 0) {
    die('<B>Wrong version of Smarty engine! We support only Smarty-3.x greater than 3.0.</B>');
}
define('SMARTY_VERSION', $ver_chunks[1]);
// system localization
require_once LIB_DIR . '/language.php';
// Redirect to SSL
$_FORCE_SSL = ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.force_ssl', false));
if ($_FORCE_SSL && $_SERVER['HTTPS'] != 'on') {
    header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    exit(0);
}
// EXPERIMENTAL CODE! USE WITH CAUTION ;-)
$_LMSDIR = dirname(__FILE__);
$ExecStack = new ExecStack($_LMSDIR . '/modules/', isset($_GET['m']) ? $_GET['m'] : NULL, isset($_GET['a']) ? $_GET['a'] : NULL);
// don't use foreach() below, because privileges checking action
// will probably need to remove some actions from stack
// Note: that action should be executed first
while (list(, $execute) = each($ExecStack->_EXECSTACK['actions'])) {
    // do include once, because testing that language for executed module has been already loaded
    // will take some time, so let's PHP decide if we already loaded it or what...
    @(include_once $_LMSDIR . '/modules/' . $execute['module'] . '/lang/' . $_language . '.php');
    @(include_once $_LMSDIR . '/modules/' . $execute['module'] . '/modinit.php');
Example #13
0
function invoice_body_ft0100()
{
    global $pdf, $invoice;
    $page = $pdf->ezStartPageNumbers($pdf->ez['pageWidth'] / 2 + 10, $pdf->ez['pageHeight'] - 30, 8, '', trans('Page $a of $b', '{PAGENUM}', '{TOTALPAGENUM}'), 1);
    $top = $pdf->ez['pageHeight'] - 50;
    invoice_dates(500, $top);
    invoice_address_box(400, 700);
    $top = invoice_title(30, $top);
    $top = $top - 10;
    $top = invoice_seller(30, $top);
    $top = $top - 10;
    $top = invoice_buyer(30, $top);
    $top = $top - 10;
    invoice_footnote(470, $top, 90, 8);
    $return = new_invoice_data(30, $top, 430, 6, 1);
    $top = $return[2] - 10;
    $return[1] += 5;
    invoice_expositor(30, $return[1]);
    invoice_to_pay(30, $top);
    check_page_length($top, 200);
    if ($invoice['customerbalance'] < 0 || ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.always_show_form', true))) {
        invoice_main_form_fill(187, 3, 0.4);
        invoice_simple_form_fill(14, 3, 0.4);
    }
    $page = $pdf->ezStopPageNumbers(1, 1, $page);
}
Example #14
0
if ($invoice_filetype != 'pdf' || $dnote_filetype != 'pdf') {
    // Set some template and layout variables
    $SMARTY->setTemplateDir(null);
    $custom_templates_dir = ConfigHelper::getConfig('phpui.custom_templates_dir');
    if (!empty($custom_templates_dir) && file_exists(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir) && !is_file(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir)) {
        $SMARTY->AddTemplateDir(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . $custom_templates_dir);
    }
    $SMARTY->AddTemplateDir(array(SMARTY_TEMPLATES_DIR . DIRECTORY_SEPARATOR . 'default', SMARTY_TEMPLATES_DIR));
    $SMARTY->setCompileDir(SMARTY_COMPILE_DIR);
    $SMARTY->assignByRef('layout', $layout);
    $SMARTY->assignByRef('LANGDEFS', $LANGDEFS);
    $SMARTY->assignByRef('_ui_language', $LMS->ui_lang);
    $SMARTY->assignByRef('_language', $LMS->lang);
}
// now it's time for script settings
$smtp_options = array('host' => ConfigHelper::getConfig('sendinvoices.smtp_host'), 'port' => ConfigHelper::getConfig('sendinvoices.smtp_port'), 'user' => ConfigHelper::getConfig('sendinvoices.smtp_user'), 'pass' => ConfigHelper::getConfig('sendinvoices.smtp_pass'), 'auth' => ConfigHelper::getConfig('sendinvoices.smtp_auth'), 'ssl_verify_peer' => ConfigHelper::checkValue(ConfigHelper::getConfig('sendinvoices.smtp_ssl_verify_peer', true)), 'ssl_verify_peer_name' => ConfigHelper::checkValue(ConfigHelper::getConfig('sendinvoices.smtp_ssl_verify_peer_name', true)), 'ssl_allow_self_signed' => ConfigHelper::checkConfig('sendinvoices.smtp_ssl_allow_self_signed'));
$debug_email = ConfigHelper::getConfig('sendinvoices.debug_email', '', true);
$sender_name = ConfigHelper::getConfig('sendinvoices.sender_name', '', true);
$sender_email = ConfigHelper::getConfig('sendinvoices.sender_email', '', true);
$mail_subject = ConfigHelper::getConfig('sendinvoices.mail_subject', 'Invoice No. %invoice');
$mail_body = ConfigHelper::getConfig('sendinvoices.mail_body', ConfigHelper::getConfig('mail.sendinvoice_mail_body'));
$invoice_filename = ConfigHelper::getConfig('sendinvoices.invoice_filename', 'invoice_%docid');
$dnote_filename = ConfigHelper::getConfig('sendinvoices.debitnote_filename', 'dnote_%docid');
$notify_email = ConfigHelper::getConfig('sendinvoices.notify_email', '', true);
$reply_email = ConfigHelper::getConfig('sendinvoices.reply_email', '', true);
$add_message = ConfigHelper::checkConfig('sendinvoices.add_message');
$dsn_email = ConfigHelper::getConfig('sendinvoices.dsn_email', '', true);
$mdn_email = ConfigHelper::getConfig('sendinvoices.mdn_email', '', true);
$count_limit = intval(ConfigHelper::getConfig('sendinvoices.limit', '0'));
if (empty($sender_email)) {
    die("Fatal error: sender_email unset! Can't continue, exiting." . PHP_EOL);
Example #15
0
    protected function customerNodesProvider($customer_id, $type = '', $count = null)
    {
        $type = strtolower($type);
        switch ($type) {
            case 'netdev':
                $type = 'nd.ownerid = ?';
                break;
            default:
                $type = 'n.ownerid = ?';
        }
        $result = $this->db->GetAll("SELECT\n                                        n.id, n.name, mac, ipaddr, inet_ntoa(ipaddr) AS ip, nd.name as netdev_name,\n                                        ipaddr_pub, n.authtype, inet_ntoa(ipaddr_pub) AS ip_pub,\n                                        passwd, access, warning, info, n.ownerid, lastonline, n.location,\n                                        (SELECT COUNT(*)\n                                        FROM nodegroupassignments\n                                        WHERE nodeid = n.id) AS gcount,\n                                        n.netid, net.name AS netname\n                                     FROM\n                                        vnodes n\n                                        JOIN networks net ON net.id = n.netid\n                                        LEFT JOIN netdevices nd ON n.netdev = nd.id\n                                     WHERE\n                                        " . $type . "\n                                     ORDER BY\n                                        n.name ASC " . ($count ? 'LIMIT ' . $count : ''), array($customer_id));
        if ($result) {
            // assign network(s) to node record
            $network_manager = new LMSNetworkManager($this->db, $this->auth, $this->cache);
            $networks = (array) $network_manager->GetNetworks();
            foreach ($result as $idx => $node) {
                $ids[$node['id']] = $idx;
                $result[$idx]['lastonlinedate'] = lastonline_date($node['lastonline']);
                if ($node['ipaddr_pub']) {
                    foreach ($networks as $net) {
                        if (isipin($node['ip_pub'], $net['address'], $net['mask'])) {
                            $result[$idx]['network_pub'] = $net;
                            break;
                        }
                    }
                }
            }
            // get EtherWerX channels
            if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
                $channels = $this->db->GetAllByKey('SELECT nodeid, channelid, c.name, c.id, cid,
				        nc.upceil, nc.downceil
			 		FROM ewx_stm_nodes
					JOIN ewx_stm_channels nc ON (channelid = nc.id)
					LEFT JOIN ewx_channels c ON (c.id = nc.cid)
					WHERE nodeid IN (' . implode(',', array_keys($ids)) . ')', 'nodeid');
                if ($channels) {
                    foreach ($channels as $channel) {
                        $idx = $ids[$channel['nodeid']];
                        $result[$idx]['channelid'] = $channel['id'] ? $channel['id'] : $channel['channelid'];
                        $result[$idx]['channelname'] = $channel['name'];
                        $result[$idx]['cid'] = $channel['cid'];
                        $result[$idx]['downceil'] = $channel['downceil'];
                        $result[$idx]['upceil'] = $channel['upceil'];
                    }
                }
            }
        }
        return $result;
    }
Example #16
0
        if (empty($customers[$id])) {
            $error[$id] = trans('Customer not selected!');
            unset($marks[$idx]);
        } else {
            $marks[$idx] = intval($id);
        }
    }
    if (!empty($marks)) {
        $imports = $DB->GetAll('SELECT i.*, f.idate
			FROM cashimport i
			LEFT JOIN sourcefiles f ON (f.id = i.sourcefileid)
			WHERE i.id IN (' . implode(',', $marks) . ')');
    }
    if (!empty($imports)) {
        $idate = ConfigHelper::checkValue(ConfigHelper::getConfig('finances.cashimport_use_idate', false));
        $icheck = ConfigHelper::checkValue(ConfigHelper::getConfig('finances.cashimport_checkinvoices', false));
        foreach ($imports as $import) {
            // do not insert if the record is already closed (prevent multiple inserts of the same record)
            if ($import['closed'] == 1) {
                continue;
            }
            $DB->BeginTrans();
            $balance['time'] = $idate ? $import['idate'] : $import['date'];
            $balance['type'] = 1;
            $balance['value'] = $import['value'];
            $balance['customerid'] = $customers[$import['id']];
            $balance['comment'] = $import['description'];
            $balance['importid'] = $import['id'];
            $balance['sourceid'] = $import['sourceid'];
            if ($import['value'] > 0 && $icheck) {
                if ($invoices = $DB->GetAll('SELECT d.id,
Example #17
0
    $SESSION->restore('ilo', $o);
}
$SESSION->save('ilo', $o);
if (isset($_POST['cat'])) {
    $c = $_POST['cat'];
} else {
    $SESSION->restore('ilc', $c);
}
if (!isset($c)) {
    $c = "month";
}
$SESSION->save('ilc', $c);
if (isset($_POST['search'])) {
    $h = isset($_POST['hideclosed']) ? true : false;
} elseif (($h = $SESSION->get('ilh')) === NULL) {
    $h = ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.hide_closed', false));
}
$SESSION->save('ilh', $h);
if (isset($_POST['group'])) {
    $g = $_POST['group'];
    $ge = isset($_POST['groupexclude']) ? $_POST['groupexclude'] : NULL;
} else {
    $SESSION->restore('ilg', $g);
    $SESSION->restore('ilge', $ge);
}
$SESSION->save('ilg', $g);
$SESSION->save('ilge', $ge);
if ($c == 'cdate' && $s && preg_match('/^[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}$/', $s)) {
    list($year, $month, $day) = explode('/', $s);
    $s = mktime(0, 0, 0, $month, $day, $year);
} elseif ($c == 'month' && $s && preg_match('/^[0-9]{4}\\/[0-9]{2}$/', $s)) {
Example #18
0
    public function NetDevAdd($data)
    {
        $args = array('name' => $data['name'], 'location' => trim($data['location']), 'location_city' => $data['location_city'] ? trim($data['location_city']) : null, 'location_street' => $data['location_street'] ? trim($data['location_street']) : null, 'location_house' => $data['location_house'] ? trim($data['location_house']) : null, 'location_flat' => $data['location_flat'] ? trim($data['location_flat']) : null, 'description' => $data['description'], 'producer' => $data['producer'], 'model' => $data['model'], 'serialnumber' => $data['serialnumber'], 'ports' => $data['ports'], 'purchasetime' => $data['purchasetime'], 'guaranteeperiod' => $data['guaranteeperiod'], 'shortname' => $data['shortname'], 'nastype' => $data['nastype'], 'clients' => $data['clients'], 'secret' => $data['secret'], 'community' => $data['community'], 'channelid' => !empty($data['channelid']) ? $data['channelid'] : NULL, 'longitude' => !empty($data['longitude']) ? str_replace(',', '.', $data['longitude']) : NULL, 'latitude' => !empty($data['latitude']) ? str_replace(',', '.', $data['latitude']) : NULL, 'invprojectid' => $data['invprojectid'], 'netnodeid' => $data['netnodeid'], 'status' => $data['status'], 'netdevicemodelid' => !empty($data['netdevicemodelid']) ? $data['netdevicemodelid'] : null, 'ownerid' => empty($data['ownerid']) ? NULL : $data['ownerid']);
        if ($this->db->Execute('INSERT INTO netdevices (name, location,
				location_city, location_street, location_house, location_flat,
				description, producer, model, serialnumber,
				ports, purchasetime, guaranteeperiod, shortname,
				nastype, clients, secret, community, channelid,
				longitude, latitude, invprojectid, netnodeid, status, netdevicemodelid, ownerid)
				VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($args))) {
            $id = $this->db->GetLastInsertID('netdevices');
            // EtherWerX support (devices have some limits)
            // We must to replace big ID with smaller (first free)
            if ($id > 99999 && ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
                $this->db->BeginTrans();
                $this->db->LockTables('ewx_channels');
                if ($newid = $this->db->GetOne('SELECT n.id + 1 FROM ewx_channels n 
						LEFT OUTER JOIN ewx_channels n2 ON n.id + 1 = n2.id
						WHERE n2.id IS NULL AND n.id <= 99999
						ORDER BY n.id ASC LIMIT 1')) {
                    $this->db->Execute('UPDATE ewx_channels SET id = ? WHERE id = ?', array($newid, $id));
                    $id = $newid;
                }
                $this->db->UnLockTables();
                $this->db->CommitTrans();
            }
            if ($this->syslog) {
                $args[SYSLOG::RES_NETDEV] = $id;
                $this->syslog->AddMessage(SYSLOG::RES_NETDEV, SYSLOG::OPER_ADD, $args);
            }
            return $id;
        } else {
            return FALSE;
        }
    }
Example #19
0
            if (!empty($helpdesk_sender_name)) {
                $mailfname = $helpdesk_sender_name;
                if ($mailfname == 'queue') {
                    $mailfname = $queue['name'];
                } elseif ($mailfname == 'user') {
                    $mailfname = $user['name'];
                }
                $mailfname = '"' . $mailfname . '"';
            }
            $mailfrom = $user['email'] ? $user['email'] : $queue['email'];
            $headers['From'] = $mailfname . ' <' . $mailfrom . '>';
            $headers['Subject'] = sprintf("[RT#%06d] %s", $note['ticketid'], $DB->GetOne('SELECT subject FROM rttickets WHERE id = ?', array($note['ticketid'])));
            $headers['Reply-To'] = $headers['From'];
            $sms_body = $headers['Subject'] . "\n" . $note['body'];
            $body = $note['body'] . "\n\nhttp" . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1) . '?m=rtticketview&id=' . $note['ticketid'];
            if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.helpdesk_customerinfo', false)) && ($cid = $DB->GetOne('SELECT customerid FROM rttickets WHERE id = ?', array($note['ticketid'])))) {
                $info = $DB->GetRow('SELECT id, pin, ' . $DB->Concat('UPPER(lastname)', "' '", 'name') . ' AS customername,
						address, zip, city FROM customers WHERE id = ?', array($cid));
                $info['contacts'] = $DB->GetAll('SELECT contact, name, type FROM customercontacts
					WHERE customerid = ?', array($cid));
                $emails = array();
                $phones = array();
                if (!empty($info['contacts'])) {
                    foreach ($info['contacts'] as $contact) {
                        $target = $contact['contact'] . (strlen($contact['name']) ? ' (' . $contact['name'] . ')' : '');
                        if ($contact['type'] & CONTACT_EMAIL) {
                            $emails[] = $target;
                        } else {
                            $phones[] = $target;
                        }
                    }
Example #20
0
 public function CleanupInvprojects()
 {
     if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.auto_remove_investment_project', true))) {
         $this->DB->Execute("DELETE FROM invprojects WHERE type <> ? AND id NOT IN\n\t\t\t\t(SELECT DISTINCT invprojectid FROM netdevices WHERE invprojectid IS NOT NULL\n\t\t\t\t\tUNION SELECT DISTINCT invprojectid FROM vnodes WHERE invprojectid IS NOT NULL\n\t\t\t\t\tUNION SELECT DISTINCT invprojectid FROM netnodes WHERE invprojectid IS NOT NULL)", array(INV_PROJECT_SYSTEM));
     }
 }
Example #21
0
}
// Include required files (including sequence is important)
require_once LIB_DIR . DIRECTORY_SEPARATOR . 'common.php';
require_once LIB_DIR . DIRECTORY_SEPARATOR . 'language.php';
include_once LIB_DIR . DIRECTORY_SEPARATOR . 'definitions.php';
require_once LIB_DIR . DIRECTORY_SEPARATOR . 'unstrip.php';
// Initialize Session, Auth and LMS classes
$stdout = array_key_exists('stdout', $options);
$cashimport_server = ConfigHelper::getConfig('cashimport.server');
$cashimport_username = ConfigHelper::getConfig('cashimport.username');
$cashimport_password = ConfigHelper::getConfig('cashimport.password');
$cashimport_filename_pattern = ConfigHelper::getConfig('cashimport.filename_pattern', '', true);
if (empty($cashimport_server) || empty($cashimport_username) || empty($cashimport_password)) {
    die("Fatal error: mailbox credentials are not set!" . PHP_EOL);
}
$cashimport_use_seen_flag = ConfigHelper::checkValue(ConfigHelper::getConfig('cashimport.use_seen_flag', true));
$ih = @imap_open("{" . $cashimport_server . "}INBOX", $cashimport_username, $cashimport_password);
if (!$ih) {
    die("Cannot connect to mail server!" . PHP_EOL);
}
$posts = imap_search($ih, $cashimport_use_seen_flag ? 'UNSEEN' : 'ALL');
if (empty($posts)) {
    imap_close($ih);
    die;
}
foreach ($posts as $postid) {
    $files = array();
    $post = imap_fetchstructure($ih, $postid);
    //print_r($post);
    if ($post->type == 1) {
        $parts = $post->parts;
Example #22
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 * USA.
 *
 * $Id$
 */
$menu = array('admin' => array('name' => trans('Administration'), 'img' => 'users.gif', 'link' => '?m=welcome', 'tip' => trans('System information and management'), 'accesskey' => 'i', 'prio' => 0, 'submenu' => array(array('name' => trans('Info'), 'link' => '?m=welcome', 'tip' => trans('Basic system information'), 'prio' => 10), array('name' => trans('Users'), 'link' => '?m=userlist', 'tip' => trans('User list'), 'prio' => 20), array('name' => trans('New User'), 'link' => '?m=useradd', 'tip' => trans('New User'), 'prio' => 30), array('name' => trans('Backups'), 'link' => '?m=dblist', 'tip' => trans('Allows you to manage database backups'), 'prio' => 40), array('name' => trans('Copyrights'), 'link' => '?m=copyrights', 'tip' => trans('Copyrights, authors, etc.'), 'prio' => 50), array('name' => trans('User groups'), 'link' => '?m=usergrouplist', 'tip' => trans('User groups'), 'prio' => 60), array('name' => trans('New Group'), 'link' => '?m=usergroupadd', 'tip' => trans('Allows you to add new group'), 'prio' => 70))), 'customers' => array('name' => trans('Customers'), 'img' => 'customer.gif', 'link' => '?m=customerlist', 'tip' => trans('Customers Management'), 'accesskey' => 'u', 'prio' => 5, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=customerlist', 'tip' => trans('List of Customers'), 'prio' => 10), array('name' => trans('New Customer'), 'link' => '?m=customeradd', 'tip' => trans('Allows you to add new customer'), 'prio' => 20), array('name' => trans('Search'), 'link' => '?m=customersearch', 'tip' => trans('Allows you to find customer'), 'prio' => 30), array('name' => trans('Groups'), 'link' => '?m=customergrouplist', 'tip' => trans('List of Customers Groups'), 'prio' => 40), array('name' => trans('New Group'), 'link' => '?m=customergroupadd', 'tip' => trans('Allows you to add new group'), 'prio' => 50), array('name' => trans('Notices'), 'link' => '?m=customerwarn', 'tip' => trans('Allows you to send notices to customers'), 'prio' => 60), array('name' => trans('Reports'), 'link' => '?m=customerprint', 'tip' => trans('Lists and reports printing'), 'prio' => 70))), 'nodes' => array('name' => trans('Nodes'), 'img' => 'node.gif', 'link' => '?m=nodelist', 'tip' => trans('Nodes Management'), 'accesskey' => 'k', 'prio' => 10, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=nodelist', 'tip' => trans('List of nodes'), 'prio' => 10), array('name' => trans('New Node'), 'link' => '?m=nodeadd', 'tip' => trans('Allows you to add new node'), 'prio' => 20), array('name' => trans('Search'), 'link' => '?m=nodesearch', 'tip' => trans('Allows you to search node'), 'prio' => 30), array('name' => trans('Groups'), 'link' => '?m=nodegrouplist', 'tip' => trans('List of Nodes Groups'), 'prio' => 40), array('name' => trans('New Group'), 'link' => '?m=nodegroupadd', 'tip' => trans('Allows you to add new group'), 'prio' => 50), array('name' => trans('Notices'), 'link' => '?m=nodewarn', 'tip' => trans('Allows you to send notices to customers'), 'prio' => 60), array('name' => trans('Reports'), 'link' => '?m=nodeprint', 'tip' => trans('Lists and reports printing'), 'prio' => 70))), 'VoIP' => array('name' => trans('VoIP'), 'img' => 'voip.gif', 'tip' => trans('VoIP Management'), 'accesskey' => 'v', 'prio' => 11, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=voipaccountlist', 'tip' => trans('List of Accounts'), 'prio' => 10), array('name' => trans('New Account'), 'link' => '?m=voipaccountadd', 'tip' => trans('Allows you to add the new VoIP account'), 'prio' => 20), array('name' => trans('Search'), 'link' => '?m=voipaccountsearch', 'tip' => trans('Allows you to search VoIP account'), 'prio' => 30))), 'netdevices' => array('name' => trans('Net Devices'), 'img' => 'netdev.gif', 'link' => '?m=netdevlist', 'tip' => trans('Network Devices Management'), 'accesskey' => 'o', 'prio' => 15, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=netdevlist', 'tip' => trans('Network devices list'), 'prio' => 10), array('name' => trans('New Device'), 'link' => '?m=netdevadd', 'tip' => trans('Add new device'), 'prio' => 20), array('name' => trans('Search'), 'link' => '?m=netdevsearch', 'tip' => trans('Allows you to search device'), 'prio' => 30), array('name' => trans('Nodes list'), 'link' => '?m=netnodelist', 'tip' => trans('Network device nodes list'), 'prio' => 40), array('name' => trans('New node'), 'link' => '?m=netnodeadd', 'tip' => trans('Add new network device node'), 'prio' => 50), array('name' => trans('Producers and models'), 'link' => '?m=netdevmodels', 'tip' => trans('Network device producers and models management'), 'prio' => 60), array('name' => trans('Map'), 'link' => '?m=netdevmap', 'tip' => trans('Network map display'), 'prio' => 70), array('name' => trans('Reports'), 'link' => '?m=netdevprint', 'tip' => trans('Lists and reports printing'), 'prio' => 80))), 'networks' => array('name' => trans('IP Networks'), 'img' => 'network.gif', 'link' => '?m=netlist', 'tip' => trans('IP Address Pools Management'), 'accesskey' => 't', 'prio' => 20, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=netlist', 'tip' => trans('List of IP pools'), 'prio' => 10), array('name' => trans('New Network'), 'link' => '?m=netadd', 'tip' => trans('Add new address pool'), 'prio' => 20))), 'finances' => array('name' => trans('Finances'), 'img' => 'money.gif', 'link' => '?m=tarifflist', 'tip' => trans('Subscriptions and Network Finances Management'), 'accesskey' => 'f', 'prio' => 25, 'submenu' => array(array('name' => trans('Subscriptions List'), 'link' => '?m=tarifflist', 'tip' => trans('List of subscription fees'), 'prio' => 10), array('name' => trans('New Subscription'), 'link' => '?m=tariffadd', 'tip' => trans('Add new subscription fee'), 'prio' => 20), array('name' => trans('Payments List'), 'link' => '?m=paymentlist', 'tip' => trans('List of standing payments'), 'prio' => 30), array('name' => trans('New Payment'), 'link' => '?m=paymentadd', 'tip' => trans('Add new standing payment'), 'prio' => 40), array('name' => trans('Balance Sheet'), 'link' => '?m=balancelist', 'tip' => trans('Table of financial operations'), 'prio' => 50), array('name' => trans('New Balance'), 'link' => '?m=balancenew', 'tip' => trans('Add new financial operation'), 'prio' => 60), array('name' => trans('Invoices List'), 'link' => '?m=invoicelist', 'tip' => trans('List of invoices'), 'prio' => 70), array('name' => trans('New Invoice'), 'link' => '?m=invoicenew&action=init', 'tip' => trans('Generate invoice'), 'prio' => 75), array('name' => trans('Debit Notes List'), 'link' => '?m=notelist', 'tip' => trans('List of debit notes'), 'prio' => 80), array('name' => trans('New Debit Note'), 'link' => '?m=noteadd&action=init', 'tip' => trans('Generate debit note'), 'prio' => 85), array('name' => trans('Cash Registry'), 'link' => '?m=cashreglist', 'tip' => trans('List of cash registries'), 'prio' => 90), array('name' => trans('New Cash Receipt'), 'link' => '?m=receiptadd&action=init', 'tip' => trans('Generate cash receipt'), 'prio' => 100), array('name' => trans('Import'), 'link' => '?m=cashimport', 'tip' => trans('Import cash operations'), 'prio' => 110), array('name' => trans('Export'), 'link' => '?m=export', 'tip' => trans('Financial data export to external systems'), 'prio' => 120), array('name' => trans('Reports'), 'link' => '?m=print', 'tip' => trans('Lists and reports printing'), 'prio' => 130))), 'documents' => array('name' => trans('Documents'), 'img' => 'docum.gif', 'link' => '?m=documentlist', 'tip' => trans('Documents Management'), 'accesskey' => '', 'prio' => 26, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=documentlist&init=1', 'tip' => trans('List of documents'), 'prio' => 10), array('name' => trans('New Document'), 'link' => '?m=documentadd', 'tip' => trans('Allows you to add new document'), 'prio' => 20), array('name' => trans('Generator'), 'link' => '?m=documentgen', 'tip' => trans('Documents mass creation'), 'prio' => 40), array('name' => trans('Access rights'), 'link' => '?m=documenttypes', 'tip' => trans('Users access rights to documents by type'), 'prio' => 50))), 'hosting' => array('name' => trans('Hosting'), 'img' => 'account.gif', 'link' => '?m=accountlist', 'tip' => trans('Hosting Services Management'), 'accesskey' => 'a', 'prio' => 30, 'submenu' => array(array('name' => trans('Accounts'), 'link' => '?m=accountlist', 'tip' => trans('List of accounts'), 'prio' => 10), array('name' => trans('New Account'), 'link' => '?m=accountadd', 'tip' => trans('Add new account'), 'prio' => 20), array('name' => trans('Aliases'), 'link' => '?m=aliaslist', 'tip' => trans('List of aliases'), 'prio' => 30), array('name' => trans('New Alias'), 'link' => '?m=aliasadd', 'tip' => trans('Add new alias'), 'prio' => 40), array('name' => trans('Domains'), 'link' => '?m=domainlist', 'tip' => trans('List of domains'), 'prio' => 50), array('name' => trans('New Domain'), 'link' => '?m=domainadd', 'tip' => trans('Add new domain'), 'prio' => 60), array('name' => trans('Search'), 'link' => '?m=accountsearch', 'tip' => trans('Allows you to search for account, alias, domain'), 'prio' => 70))), 'messages' => array('name' => trans('Messages'), 'img' => 'mailsms.gif', 'link' => '?m=messageadd', 'tip' => trans('Customers Messaging'), 'accesskey' => 'm', 'prio' => 35, 'submenu' => array(array('name' => trans('List'), 'link' => '?m=messagelist', 'tip' => trans('List of sent messages'), 'prio' => 10), array('name' => trans('New Message'), 'link' => '?m=messageadd', 'tip' => trans('Allows you to send messages to customers'), 'prio' => 20))), 'reload' => array('name' => trans('Reload'), 'img' => 'reload.gif', 'link' => '?m=reload', 'tip' => trans(''), 'accesskey' => 'r', 'prio' => 40), 'stats' => array('name' => trans('Stats'), 'img' => 'traffic.gif', 'link' => '?m=traffic', 'tip' => trans('Statistics of Internet Link Usage'), 'accesskey' => 'x', 'prio' => 45, 'submenu' => array(array('name' => trans('Filter'), 'link' => '?m=traffic', 'tip' => trans('User-defined stats'), 'prio' => 10), array('name' => trans('Last Hour'), 'link' => '?m=traffic&bar=hour', 'tip' => trans('Last hour stats for all networks'), 'prio' => 20), array('name' => trans('Last Day'), 'link' => '?m=traffic&bar=day', 'tip' => trans('Last day stats for all networks'), 'prio' => 30), array('name' => trans('Last 30 Days'), 'link' => '?m=traffic&bar=month', 'tip' => trans('Last month stats for all networks'), 'prio' => 40), array('name' => trans('Last Year'), 'link' => '?m=traffic&bar=year', 'tip' => trans('Last year stats for all networks'), 'prio' => 50), array('name' => trans('Compacting'), 'link' => '?m=trafficdbcompact', 'tip' => trans('Compacting Database'), 'prio' => 60), array('name' => trans('Reports'), 'link' => '?m=trafficprint', 'tip' => trans('Lists and reports printing'), 'prio' => 70))), 'helpdesk' => array('name' => trans('Helpdesk'), 'img' => 'ticket.gif', 'link' => '?m=rtqueuelist', 'tip' => trans('Requests Tracking'), 'accesskey' => 'h', 'prio' => 50, 'submenu' => array(array('name' => trans('Queues List'), 'link' => '?m=rtqueuelist', 'tip' => trans('List of queues'), 'prio' => 10), array('name' => trans('New Queue'), 'link' => '?m=rtqueueadd', 'tip' => trans('Add new queue'), 'prio' => 20), array('name' => trans('Categories List'), 'link' => '?m=rtcategorylist', 'tip' => trans('List of categories'), 'prio' => 30), array('name' => trans('New Category'), 'link' => '?m=rtcategoryadd', 'tip' => trans('Add new category'), 'prio' => 40), array('name' => trans('Search'), 'link' => '?m=rtsearch', 'tip' => trans('Tickets searching'), 'prio' => 50), array('name' => trans('New Ticket'), 'link' => '?m=rtticketadd', 'tip' => trans('Add new ticket'), 'prio' => 60), array('name' => trans('Reports'), 'link' => '?m=rtprint', 'tip' => trans('Lists and reports printing'), 'prio' => 70))), 'timetable' => array('name' => trans('Timetable'), 'img' => 'calendar.gif', 'link' => '?m=eventlist', 'tip' => trans('Events Tracking'), 'accesskey' => 'v', 'prio' => 55, 'submenu' => array(array('name' => trans('Timetable'), 'link' => '?m=eventlist', 'tip' => trans('Timetable'), 'prio' => 10), array('name' => trans('New Event'), 'link' => '?m=eventadd', 'tip' => trans('New Event Addition'), 'prio' => 20), array('name' => trans('Search'), 'link' => '?m=eventsearch', 'tip' => trans('Searching of Events in Timetable'), 'prio' => 30))), 'password' => array('name' => trans('Password'), 'img' => 'pass.gif', 'link' => '?m=chpasswd', 'tip' => trans('Allows you to change your password'), 'accesskey' => 'p', 'prio' => 65), 'config' => array('name' => trans('Configuration'), 'img' => 'settings.gif', 'link' => '?m=configlist', 'tip' => trans('System Configuration'), 'accesskey' => 'o', 'prio' => 60, 'submenu' => array(array('name' => trans('User Interface'), 'link' => '?m=configlist', 'tip' => trans('Allows you to configure UI'), 'prio' => 10), array('name' => trans('Tax Rates'), 'link' => '?m=taxratelist', 'tip' => trans('Tax Rates Definitions'), 'prio' => 20), array('name' => trans('Numbering Plans'), 'link' => '?m=numberplanlist', 'tip' => trans('Numbering Plans Definitions'), 'prio' => 30), array('name' => trans('States'), 'link' => '?m=statelist', 'tip' => trans('Country States Definitions'), 'prio' => 40), array('name' => trans('Divisions'), 'link' => '?m=divisionlist', 'tip' => trans('Company Divisions Definitions'), 'prio' => 50), array('name' => trans('Hosts'), 'link' => '?m=hostlist', 'tip' => trans('List of Hosts'), 'prio' => 60), array('name' => trans('Daemon'), 'link' => '?m=daemoninstancelist', 'tip' => trans('Daemon(s) Configuration'), 'prio' => 70), array('name' => trans('Import Sources'), 'link' => '?m=cashsourcelist', 'tip' => trans('List of Cash Import Sources'), 'prio' => 80), array('name' => trans('Promotions'), 'link' => '?m=promotionlist', 'tip' => trans('List of promotions'), 'prio' => 90), array('name' => trans('Plugins'), 'link' => '?m=pluginlist', 'tip' => trans('Plugin Management'), 'prio' => 100))), 'documentation' => array('name' => trans('Documentation'), 'img' => 'doc.gif', 'link' => is_dir('doc' . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . $LMS->ui_lang) ? 'doc' . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . $LMS->ui_lang . DIRECTORY_SEPARATOR : 'doc' . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'en' . DIRECTORY_SEPARATOR, 'tip' => trans('Documentation'), 'accesskey' => 'h', 'prio' => 70, 'windowopen' => TRUE));
// menu item for EtherWerX STM channels management
if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
    $menu['netdevices']['submenu'][] = array('name' => trans('Channels List'), 'link' => '?m=ewxchlist', 'tip' => trans('List of STM channels'), 'prio' => 80);
    $menu['netdevices']['submenu'][] = array('name' => trans('New Channel'), 'link' => '?m=ewxchadd', 'tip' => trans('Add new STM channel'), 'prio' => 81);
}
if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.logging', false))) {
    $menu['log'] = array('name' => trans('Transaction Log'), 'img' => 'recover.gif', 'link' => '?m=archiveview', 'tip' => trans('Transaction Log Management'), 'accesskey' => 't', 'prio' => 3, 'submenu' => array(array('name' => trans('View'), 'link' => '?m=archiveview', 'tip' => trans('Allows you to view transaction log'), 'prio' => 10)));
}
// Adding Userpanel menu items
$userpanel_dir = ConfigHelper::getConfig('directories.userpanel_dir');
if (!empty($userpanel_dir)) {
    // be sure that Userpanel exists
    if (file_exists($userpanel_dir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'LMS.menu.php')) {
        require_once $userpanel_dir . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'LMS.menu.php';
    }
}
// Adding user-defined menu items
$custom_menu = ConfigHelper::getConfig('phpui.custom_menu');
if (!empty($custom_menu)) {
    // be sure that file exists
    if (file_exists($custom_menu)) {
Example #23
0
    public function NodeAdd($nodedata)
    {
        global $SYSLOG_RESOURCE_KEYS;
        $args = array('name' => strtoupper($nodedata['name']), 'ipaddr' => $nodedata['ipaddr'], 'ipaddr_pub' => $nodedata['ipaddr_pub'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST] => $nodedata['ownerid'], 'passwd' => $nodedata['passwd'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_USER] => $this->auth->id, 'access' => $nodedata['access'], 'warning' => $nodedata['warning'], 'info' => $nodedata['info'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NETDEV] => $nodedata['netdev'], 'location' => $nodedata['location'], 'location_city' => $nodedata['location_city'] ? $nodedata['location_city'] : null, 'location_street' => $nodedata['location_street'] ? $nodedata['location_street'] : null, 'location_house' => $nodedata['location_house'] ? $nodedata['location_house'] : null, 'location_flat' => $nodedata['location_flat'] ? $nodedata['location_flat'] : null, 'linktype' => isset($nodedata['linktype']) ? intval($nodedata['linktype']) : 0, 'linkradiosector' => isset($nodedata['linktype']) && intval($nodedata['linktype']) == 1 ? isset($nodedata['radiosector']) && intval($nodedata['radiosector']) ? intval($nodedata['radiosector']) : null : null, 'linktechnology' => isset($nodedata['linktechnology']) ? intval($nodedata['linktechnology']) : 0, 'linkspeed' => isset($nodedata['linkspeed']) ? intval($nodedata['linkspeed']) : 100000, 'port' => isset($nodedata['port']) && $nodedata['netdev'] ? intval($nodedata['port']) : 0, 'chkmac' => $nodedata['chkmac'], 'halfduplex' => $nodedata['halfduplex'], 'nas' => isset($nodedata['nas']) ? $nodedata['nas'] : 0, 'longitude' => !empty($nodedata['longitude']) ? str_replace(',', '.', $nodedata['longitude']) : null, 'latitude' => !empty($nodedata['latitude']) ? str_replace(',', '.', $nodedata['latitude']) : null, $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NETWORK] => $nodedata['netid'], 'invprojectid' => $nodedata['invprojectid'], 'authtype' => $nodedata['authtype']);
        if ($this->db->Execute('INSERT INTO nodes (name, ipaddr, ipaddr_pub, ownerid,
			passwd, creatorid, creationdate, access, warning, info, netdev,
			location, location_city, location_street, location_house, location_flat,
			linktype, linkradiosector, linktechnology, linkspeed, port, chkmac, halfduplex, nas,
			longitude, latitude, netid, invprojectid, authtype)
			VALUES (?, inet_aton(?), inet_aton(?), ?, ?, ?,
			?NOW?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array_values($args))) {
            $id = $this->db->GetLastInsertID('nodes');
            // EtherWerX support (devices have some limits)
            // We must to replace big ID with smaller (first free)
            if ($id > 99999 && ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
                $this->db->BeginTrans();
                $this->db->LockTables('nodes');
                if ($newid = $this->db->GetOne('SELECT n.id + 1 FROM nodes n 
						LEFT OUTER JOIN nodes n2 ON n.id + 1 = n2.id
						WHERE n2.id IS NULL AND n.id <= 99999
						ORDER BY n.id ASC LIMIT 1')) {
                    $this->db->Execute('UPDATE nodes SET id = ? WHERE id = ?', array($newid, $id));
                    $id = $newid;
                }
                $this->db->UnLockTables();
                $this->db->CommitTrans();
            }
            if ($this->syslog) {
                unset($args[$SYSLOG_RESOURCE_KEYS[SYSLOG_RES_USER]]);
                $args[$SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NODE]] = $id;
                $this->syslog->AddMessage(SYSLOG_RES_NODE, SYSLOG_OPER_ADD, $args, array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NODE], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NETWORK], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NETDEV]));
            }
            foreach ($nodedata['macs'] as $mac) {
                $this->db->Execute('INSERT INTO macs (mac, nodeid) VALUES(?, ?)', array(strtoupper($mac), $id));
            }
            if ($this->syslog) {
                $macs = $this->db->GetAll('SELECT id, mac FROM macs WHERE nodeid = ?', array($id));
                foreach ($macs as $mac) {
                    $args = array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_MAC] => $mac['id'], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NODE] => $id, $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST] => $nodedata['ownerid'], 'mac' => $mac['mac']);
                    $this->syslog->AddMessage(SYSLOG_RES_MAC, SYSLOG_OPER_ADD, $args, array($SYSLOG_RESOURCE_KEYS[SYSLOG_RES_MAC], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_NODE], $SYSLOG_RESOURCE_KEYS[SYSLOG_RES_CUST]));
                }
            }
            return $id;
        }
        return FALSE;
    }
Example #24
0
$SMARTY->assign('netdevauthtype', $netdevauthtype);
$SMARTY->assign('netdevips', $netdevips);
$SMARTY->assign('restnetdevlist', $netdevlist);
$SMARTY->assign('devlinktype', $SESSION->get('devlinktype'));
$SMARTY->assign('devlinksrcradiosector', $SESSION->get('devlinksrcradiosector'));
$SMARTY->assign('devlinkdstradiosector', $SESSION->get('devlinkdstradiosector'));
$SMARTY->assign('devlinktechnology', $SESSION->get('devlinktechnology'));
$SMARTY->assign('devlinkspeed', $SESSION->get('devlinkspeed'));
$SMARTY->assign('nodelinktype', $SESSION->get('nodelinktype'));
$SMARTY->assign('nodelinkradiosector', $SESSION->get('nodelinkradiosector'));
$SMARTY->assign('nodelinktechnology', $SESSION->get('nodelinktechnology'));
$SMARTY->assign('nodelinkspeed', $SESSION->get('nodelinkspeed'));
$SMARTY->assign('nastype', $LMS->GetNAStypes());
include MODULES_DIR . '/netdevxajax.inc.php';
switch ($edit) {
    case 'data':
        if (ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.ewx_support', false))) {
            $SMARTY->assign('channels', $DB->GetAll('SELECT id, name FROM ewx_channels ORDER BY name'));
        }
        $SMARTY->display('netdev/netdevedit.html');
        break;
    case 'ip':
        $SMARTY->display('netdev/netdevipedit.html');
        break;
    case 'addip':
        $SMARTY->display('netdev/netdevipadd.html');
        break;
    default:
        $SMARTY->display('netdev/netdevinfo.html');
        break;
}
Example #25
0
 public function invoice_body_ft0100()
 {
     $this->invoice_date();
     $this->invoice_title();
     $this->invoice_seller();
     $this->invoice_buyer();
     $this->invoice_data();
     $this->invoice_to_pay();
     $this->invoice_balance();
     $this->invoice_dates();
     $this->invoice_expositor();
     $this->invoice_footnote();
     if ($this->data['customerbalance'] < 0 || ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.always_show_form', true))) {
         /* draw FT-0100 form */
         $this->invoice_simple_form_draw();
         $this->invoice_main_form_draw();
         /* fill FT-0100 form */
         $this->invoice_simple_form_fill();
         $this->invoice_main_form_fill();
     }
     $docnumber = docnumber($this->data['number'], $this->data['template'], $this->data['cdate']);
     $this->backend->SetTitle(trans('Invoice No. $a', $docnumber));
     $this->backend->SetAuthor($this->data['division_name']);
     /* setup your cert & key file */
     $cert = 'file://' . LIB_DIR . '/tcpdf/config/lms.cert';
     $key = 'file://' . LIB_DIR . '/tcpdf/config/lms.key';
     /* setup signature additional information */
     $info = array('Name' => $this->data['division_name'], 'Location' => trans('Invoices'), 'Reason' => trans('Invoice No. $a', $docnumber), 'ContactInfo' => $this->data['division_author']);
     /* set document digital signature & protection */
     if (file_exists($cert) && file_exists($key)) {
         $this->backend->setSignature($cert, $key, 'lms-invoices', '', 1, $info);
         $this->backend->setSignatureAppearance(13, 10, 50, 20);
     }
     if (!$this->data['disable_protection']) {
         $this->backend->SetProtection(array('modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble'), '', 'PASSWORD_CHANGEME', '1');
     }
 }
Example #26
0
$catrights = $LMS->GetUserRightsToCategory($AUTH->id, 0, $_GET['id']);
if (!$rights || !$catrights) {
    $SMARTY->display('noaccess.html');
    $SESSION->close();
    die;
}
$ticket = $LMS->GetTicketContents($_GET['id']);
$categories = $LMS->GetCategoryListByUser($AUTH->id);
if ($ticket['customerid'] && ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.helpdesk_stats', false))) {
    $yearago = mktime(0, 0, 0, date('n'), date('j'), date('Y') - 1);
    $stats = $DB->GetAllByKey('SELECT COUNT(*) AS num, cause FROM rttickets 
			    WHERE customerid = ? AND createtime >= ? 
			    GROUP BY cause', 'cause', array($ticket['customerid'], $yearago));
    $SMARTY->assign('stats', $stats);
}
if ($ticket['customerid'] && ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.helpdesk_customerinfo', false))) {
    $customer = $LMS->GetCustomer($ticket['customerid'], true);
    $customer['groups'] = $LMS->CustomergroupGetForCustomer($ticket['customerid']);
    if (!empty($customer['contacts'])) {
        $customer['phone'] = $customer['contacts'][0]['phone'];
    }
    $customernodes = $LMS->GetCustomerNodes($ticket['customerid']);
    $allnodegroups = $LMS->GetNodeGroupNames();
    $SMARTY->assign('customerinfo', $customer);
    $SMARTY->assign('customernodes', $customernodes);
    $SMARTY->assign('allnodegroups', $allnodegroups);
}
foreach ($categories as $category) {
    $catids[] = $category['id'];
}
$iteration = $LMS->GetQueueContents($ticket['queueid'], $order = 'createtime,desc', $state = -1, 0, $catids);
Example #27
0
function commit_cashimport()
{
    global $LMS;
    $DB = LMSDB::getInstance();
    $imports = $DB->GetAll('SELECT i.*, f.idate
		FROM cashimport i
		LEFT JOIN sourcefiles f ON (f.id = i.sourcefileid)
		WHERE i.closed = 0 AND i.customerid <> 0');
    if (!empty($imports)) {
        $idate = ConfigHelper::checkValue(ConfigHelper::getConfig('finances.cashimport_use_idate', false));
        $icheck = ConfigHelper::checkValue(ConfigHelper::getConfig('finances.cashimport_checkinvoices', false));
        foreach ($imports as $import) {
            $DB->BeginTrans();
            $balance['time'] = $idate ? $import['idate'] : $import['date'];
            $balance['type'] = 1;
            $balance['value'] = $import['value'];
            $balance['customerid'] = $import['customerid'];
            $balance['comment'] = $import['description'];
            $balance['importid'] = $import['id'];
            $balance['sourceid'] = $import['sourceid'];
            $balance['userid'] = 0;
            if ($import['value'] > 0 && $icheck) {
                if ($invoices = $DB->GetAll('SELECT x.id, x.value FROM (
                                        SELECT d.id,
                                            (SELECT SUM(value*count) FROM invoicecontents WHERE docid = d.id) +
                                            COALESCE((
                                                SELECT SUM((a.value+b.value)*(a.count+b.count)) - SUM(b.value*b.count) 
                                                FROM documents dd
                                                JOIN invoicecontents a ON (a.docid = dd.id)
                                                JOIN invoicecontents b ON (dd.reference = b.docid AND a.itemid = b.itemid)
                                                WHERE dd.reference = d.id
                                                GROUP BY dd.reference), 0) AS value,
                                            d.cdate
                                        FROM documents d
                                        WHERE d.customerid = ? AND d.type = ? AND d.closed = 0
                                        GROUP BY d.id, d.cdate
                                        UNION
                                        SELECT d.id, dn.value, d.cdate
                                        FROM documents d 
                                        JOIN debitnotecontents dn ON dn.docid = d.id 
                                        WHERE d.customerid = ?
                                    ) x ORDER BY x.cdate', array($balance['customerid'], DOC_INVOICE, $balance['customerid']))) {
                    foreach ($invoices as $inv) {
                        $sum += $inv['value'];
                    }
                    $bval = $LMS->GetCustomerBalance($balance['customerid']);
                    $value = f_round($bval + $import['value'] + $sum);
                    foreach ($invoices as $inv) {
                        $inv['value'] = f_round($inv['value']);
                        if ($inv['value'] > $value) {
                            break;
                        } else {
                            // close invoice and assigned credit notes
                            $DB->Execute('UPDATE documents SET closed = 1
								WHERE id = ? OR reference = ?', array($inv['id'], $inv['id']));
                            $value -= $inv['value'];
                        }
                    }
                }
            }
            $DB->Execute('UPDATE cashimport SET closed = 1 WHERE id = ?', array($import['id']));
            $LMS->AddBalance($balance);
            $DB->CommitTrans();
        }
    }
}
Example #28
0
 public function invoice_body_ft0100()
 {
     $page = $this->backend->ezStartPageNumbers($this->backend->ez['pageWidth'] / 2 + 10, $this->backend->ez['pageHeight'] - 30, 8, '', trans('Page $a of $b', '{PAGENUM}', '{TOTALPAGENUM}'), 1);
     $top = $this->backend->ez['pageHeight'] - 50;
     $this->invoice_cancelled();
     $this->invoice_no_accountant();
     $this->invoice_header_image(30, $top - self::HEADER_IMAGE_HEIGHT / 2);
     $this->invoice_dates(500, $top);
     $this->invoice_address_box(400, $top - 100);
     $top = $this->invoice_title(30, $top - self::HEADER_IMAGE_HEIGHT);
     $top = $this->invoice_seller(30, $top);
     $top = $top - 10;
     $top = $this->invoice_buyer(30, $top);
     $top = $top - 10;
     $this->invoice_footnote(470, $top, 90, 8);
     $return = $this->new_invoice_data(30, $top, 430, 6, 1);
     $top = $return[2] - 10;
     $return[1] += 5;
     $this->invoice_expositor(30, $return[1]);
     $this->invoice_to_pay(30, $top);
     $this->backend->check_page_length($top, 200);
     if ($this->data['customerbalance'] < 0 || ConfigHelper::checkValue(ConfigHelper::getConfig('invoices.always_show_form', true))) {
         $this->invoice_main_form_fill(187, 3, 0.4);
         $this->invoice_simple_form_fill(14, 3, 0.4);
     }
     $page = $this->backend->ezStopPageNumbers(1, 1, $page);
 }
Example #29
0
}
else
	$ticketedit['categories'] = $ticket['categories'];

foreach ($categories as $category)
{
	$category['checked'] = isset($ticketedit['categories'][$category['id']]);
	$ncategories[] = $category;
}
$categories = $ncategories;

$layout['pagetitle'] = trans('Ticket Edit: $a',sprintf("%06d",$ticket['ticketid']));

$SESSION->save('backto', $_SERVER['QUERY_STRING']);

if (!ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.big_networks', false)))
{
        $SMARTY->assign('customerlist', $LMS->GetAllCustomerNames());
}

$queuelist = $LMS->GetQueueNames();
if (ConfigHelper::getConfig('userpanel.limit_ticket_movements_to_selected_queues')) {
	$selectedqueues = explode(';', ConfigHelper::getConfig('userpanel.queues'));
	if (in_array($ticket['queueid'], $selectedqueues))
		foreach ($queuelist as $idx => $queue)
			if (!in_array($queue['id'], $selectedqueues))
				unset($queuelist[$idx]);
}

$SMARTY->assign('ticket', $ticket);
$SMARTY->assign('queuelist', $queuelist);
Example #30
0
             if ($ip != $nodeipdata['ipaddr_pub'] && !$LMS->IsIPFree($nodeipdata['ipaddr_pub'])) {
                 $error['ipaddr_pub'] = trans('Specified IP address is in use!');
             }
         } else {
             $error['ipaddr_pub'] = trans('Specified IP address doesn\'t overlap with any network!');
         }
     } else {
         $error['ipaddr_pub'] = trans('Incorrect IP address!');
     }
 } else {
     $nodeipdata['ipaddr_pub'] = '0.0.0.0';
 }
 $macs = array();
 foreach ($nodeipdata['macs'] as $key => $value) {
     if (check_mac($value)) {
         if ($value != '00:00:00:00:00:00' && !ConfigHelper::checkValue(ConfigHelper::getConfig('phpui.allow_mac_sharing', true))) {
             if (($nodeid = $LMS->GetNodeIDByMAC($value)) != NULL && $nodeid != $_GET['ip']) {
                 $error['mac' . $key] = trans('MAC address is in use!');
             }
         }
         $macs[] = $value;
     } elseif ($value != '') {
         $error['mac' . $key] = trans('Incorrect MAC address!');
     }
 }
 if (empty($macs)) {
     $error['mac0'] = trans('MAC address is required!');
 } else {
     $nodeipdata['macs'] = $macs;
 }
 if (strlen($nodeipdata['passwd']) > 32) {