Пример #1
0
 function addSales($sale = null)
 {
     if ($sale == null) {
         $sale = $this;
     }
     $sale_id = $this->db_handler->add_model($sale);
     if (is_array($this->sales_items) and count($this->sales_items) != 0) {
         foreach ($this->sales_items as $sales_item) {
             $sales_item->sale_id = $sale_id;
             $sales_item->company_id = $sale->company_id;
             $sales_item->addSaleItem();
             $inv = new inventry();
             $inv->company_id = $sale->company_id;
             $inv->item_id = $sales_item->item_id;
             $invs = $inv->getInventryForSpecificCompanyAndItem();
             $inv = $invs[0];
             $inv->in_stock_count = $inv->in_stock_count - $sales_item->quantity;
             $inv->updateInventry();
         }
     }
     $description = "Added new Sale (" . $sale->to_string() . ")";
     $customer = new customer();
     $customer->id = $sale->customer_id;
     $customer->getCustomer();
     $customer->total_purchace_amount = $customer->total_purchace_amount + $sale->amount;
     $customer->updateCustomer();
     Log::i($this->tag, $description);
     return $sale_id;
 }
Пример #2
0
		public static function get($nocache = false) {
			static $customer;
			if(!$nocache && !is_null($customer)) {
				return $customer;
			}

			$objects = umiObjectsCollection::getInstance();
			$permissions = permissionsCollection::getInstance();

			if($permissions->isAuth()) {
				$userId = $permissions->getUserId();
				$object = $objects->getObject($userId);
			} else {
				$object = self::getCustomerId();

				//Second try may be usefull to avoid server after-reboot conflicts
				if($object === false) $object = self::getCustomerId(true);
			}

			if($object instanceof iUmiObject) {
				$customer = new customer($object);
				$customer->tryMerge();
				return $customer;
			}
		}
Пример #3
0
 public function store(Request $request)
 {
     $customer = new customer(array('customer' => $request->get('customer'), 'street' => $request->get('street'), 'city' => $request->get('city'), 'state' => $request->get('state'), 'zip' => $request->get('zip')));
     $customer->save();
     Toastr::success('Customer created.');
     return redirect('/customers');
 }
Пример #4
0
 public static function store()
 {
     $params = $_POST;
     //Kint::dump($params);
     $attributes = array('name' => $params['name'], 'phone' => $params['phone'], 'e_mail' => $params['e_mail']);
     $customer = new customer($attributes);
     $errors = $customer->errors();
     if (count($errors) == 0) {
         $customer->save();
         Redirect::to('/waybill/new', array('message' => 'Asiakas on lisätty onnistuneesti!'));
     } else {
         View::make('/customer/new.html', array('errors' => $errors, 'attributes' => $attributes));
     }
 }
Пример #5
0
 public function process($template = null)
 {
     list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/payment/invoice/" . $template, 'legal_person_block', 'legal_person_item');
     $collection = umiObjectsCollection::getInstance();
     $types = umiObjectTypesCollection::getInstance();
     $typeId = $types->getBaseType("emarket", "legal_person");
     $customer = customer::get();
     $order = $this->order;
     $mode = getRequest('param2');
     if ($mode == 'do') {
         $personId = getRequest('legal-person');
         $isNew = $personId == null || $personId == 'new';
         if ($isNew) {
             $typeId = $types->getBaseType("emarket", "legal_person");
             $personId = $collection->addObject("", $typeId);
             $controller = cmsController::getInstance();
             $data = getRequest('data');
             if ($data && ($dataModule = $controller->getModule("data"))) {
                 $person = $collection->getObject($personId);
                 $person->setName($data['new']['name']);
                 $dataModule->saveEditedObject($personId, $isNew, true);
             }
             if ($collection->getObject($personId) instanceof umiObject) {
                 $customer = customer::get();
                 $customer->legal_persons = array_merge($customer->legal_persons, array($personId));
             }
         }
         $order->legal_person = $personId;
         $order->order();
         $order->payment_document_num = $order->id;
         $result = $this->printInvoice($order);
         $buffer = outputBuffer::current();
         $buffer->charset('utf-8');
         $buffer->contentType('text/html');
         $buffer->clear();
         $buffer->push($result);
         $buffer->end();
         return true;
     } else {
         if ($mode == 'delete') {
             $personId = (int) getRequest('person-id');
             if ($collection->isExists($personId)) {
                 $customer = customer::get();
                 $customer->legal_persons = array_diff($customer->legal_persons, array($personId));
                 $collection->delObject($personId);
             }
         }
     }
     $items = array();
     $persons = $customer->legal_persons;
     if (is_array($persons)) {
         foreach ($persons as $personId) {
             $person = $collection->getObject($personId);
             $item_arr = array('attribute:id' => $personId, 'attribute:name' => $person->name);
             $items[] = def_module::parseTemplate($tpl_item, $item_arr, false, $personId);
         }
     }
     $block_arr = array('attribute:type-id' => $typeId, 'attribute:type_id' => $typeId, 'xlink:href' => 'udata://data/getCreateForm/' . $typeId, 'subnodes:items' => $items);
     return def_module::parseTemplate($tpl_block, $block_arr);
 }
Пример #6
0
 /**
  * Don't let the customer on the login page if they are already authenticated
  * @Developer brandon
  * @Date Oct 12, 2010
  */
 public function new_one()
 {
     if (customer::logged_in()) {
         url::redirect(url::site());
     }
     parent::new_one();
 }
Пример #7
0
function updateFromMobile($mobile, $customer)
{
    try {
        $entity_id_array = customer::getEntityId($mobile);
        if ($entity_id_array['success'] == 0) {
            $errorcode = $entity_id_array['errorcode'];
            throw new Exception($entity_id_array['data']);
        } else {
            $entity_id = $entity_id_array['data'];
            foreach ($customer as $customer_name => $column_value) {
                $enable_list = array('sex', 'nickname', 'myimage', 'birthday');
                if (in_array($customer_name, $enable_list)) {
                    $column_tmp = customer::updateCustomerColumn($entity_id, $customer_name, $column_value);
                    if ($column_tmp['success'] == 0) {
                        $errorcode = $column_tmp['errorcode'];
                        throw new Exception($column_tmp['data']);
                    }
                }
            }
            return array("data" => 'Update customer success', "success" => 1, 'errorcode' => 0);
        }
    } catch (Exception $e) {
        return array("data" => $e->getMessage(), "success" => 0, 'errorcode' => $errorcode);
    }
}
Пример #8
0
 public function validate()
 {
     if (is_array($this->users)) {
         $customer = customer::get();
         return in_array($customer->id, $this->users);
     } else {
         return false;
     }
 }
Пример #9
0
 public function validate()
 {
     $customer = customer::get();
     if (is_array($this->user_groups) && is_array($customer->groups)) {
         return sizeof(array_intersect($customer->groups, $this->user_groups));
     } else {
         return false;
     }
 }
 /**
  * adds customer to delivery table
  */
 public function addCust()
 {
     $delivery = new delivery();
     $customer = new customer();
     $data = $this->input->post(NULL, true);
     $cdata = array('cname' => $data['cname'], 'caddress' => $data['address'] . ', ' . $data['city'] . ',' . $data['state'] . ' ' . $data['zip'], 'cphone' => $data['cphone']);
     $ddata = array('schd' => $data['schd'], 'note' => $data['note']);
     $list = $this->input->post('list');
     $customer->setData($cdata);
     $delivery->setDelv($ddata);
     $delivery->cid = $customer->cid;
     $items = $this->item->getItems($customer->bname);
     if ($list == 'Yes') {
         $this->load->view('bChkList', array('delivery' => $delivery, 'items' => $items));
     } else {
         echo 'reset';
     }
     $this->db->insert('capsql.delivery', $delivery);
 }
Пример #11
0
 public function detail()
 {
     //get expenseaccount
     $expenseaccountobj = new expenseaccount();
     $detail['expense_account_all'] = $expenseaccountobj->get_all();
     //get customers with domain_id from session by constructor
     $customerobj = new customer();
     $detail['customer'] = $customerobj->get();
     $detail['customer_all'] = $customerobj->get_all();
     //get billers with domain_id from session by constructor
     $billerobj = new biller();
     $detail['biller_all'] = $billerobj->get_all();
     //get invoices
     $invoiceobj = new invoice();
     $detail['invoice_all'] = $invoiceobj->get_all();
     //get products
     $productobj = new product();
     $detail['product_all'] = $productobj->get_all();
     return $detail;
 }
Пример #12
0
 /**
  * Require administrator login
  * @Developer brandon
  * @Date Oct 11, 2010
  */
 public function __construct()
 {
     parent::__construct();
     $this->template = View::factory('layouts/admin');
     meta::set_title(store::name() . ' | Admin | ' . ucwords(Router::$controller));
     // Set the route for updating and creating files
     Kohana::config_set('routes.base_crud_route', 'admin/');
     // Require an admin login if we are in production.
     if (IN_PRODUCTION) {
         customer::require_admin_login();
     }
     ORM::factory('audit_trail')->create(array('user_id' => customer::current(), 'store_id' => store::get(), 'controller' => Router::$controller, 'method' => Router::$method, 'object_id' => $this->input->post('id')));
 }
Пример #13
0
 function edit($id = 0)
 {
     $customer = new customer($id);
     if ($_SERVER['REQUEST_METHOD'] == "GET") {
     } else {
         $customer->name = $this->input->post('name');
         $customer->address = $this->input->post('address');
         $customer->username = $this->input->post('username');
         $customer->homePhone = $this->input->post('homePhone');
         $customer->mobilePhone = $this->input->post('mobilePhone');
         $customer->email = $this->input->post('email');
         $customer->username = $this->input->post('username');
         if ($this->input->post('password') != "") {
             if ($this->input->post('password') == $this->input->post('confirmPassword')) {
                 $customer->password = md5($this->input->post('password'));
                 if ($customer->save()) {
                     redirect($this->admin . 'customers/edit/' . $customer->id);
                 }
             } else {
                 flash_message("error", "Xác nhận mật khẩu phải giống mật khẩu");
             }
         } else {
             if ($customer->save()) {
                 redirect($this->admin . 'customers/edit/' . $customer->id);
             }
         }
     }
     setPagination($this->admin . 'carts/list_all/', 1, 100000000, 4);
     $dis['carts'] = $customer->cartitem;
     $dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => $this->admin . 'customers/list_all/', "onclick" => ""));
     $dis['title_table'] = "Danh sách đơn hàng ";
     $dis['base_url'] = base_url();
     $dis['title'] = "Menu";
     $dis['menu_active'] = "Khách hàng";
     $dis['view'] = "customer/edit";
     $dis['object'] = $customer;
     $this->viewadmin($dis);
 }
Пример #14
0
 /**
  * Get the cart
  * @Developer brandon
  * @Date Oct 20, 2010
  */
 public static function get()
 {
     if (customer::logged_in()) {
         return customer::current()->load_cart();
     } else {
         if (Session::instance()->get('cart_' . store::get())) {
             return ORM::factory('cart', Session::instance()->get('cart_' . store::get()));
         } else {
             $cart = ORM::factory('cart');
             $cart->save();
             Session::instance()->set('cart_' . store::get(), (string) $cart);
             return $cart;
         }
     }
 }
Пример #15
0
 public static function detail()
 {
     //get customers
     $detail['expense_account_all'] = expenseaccount::get_all();
     //get customers
     $detail['customer'] = customer::get();
     $detail['customer_all'] = customer::get_all();
     //get billers
     $detail['biller_all'] = biller::get_all();
     //get invoices
     $detail['invoice_all'] = invoice::get_all();
     //get products
     $detail['product_all'] = product::get_all();
     return $detail;
 }
Пример #16
0
 /**
  * Создать новый пустой заказ
  * @return Integer $order id нового заказа
  */
 public static function create($useDummyOrder = false)
 {
     $objectTypes = umiObjectTypesCollection::getInstance();
     $objects = umiObjectsCollection::getInstance();
     $permissions = permissionsCollection::getInstance();
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $orderTypeId = $objectTypes->getBaseType('emarket', 'order');
     if ($useDummyOrder) {
         $sel = new selector('objects');
         $sel->types('object-type')->name('emarket', 'order');
         $sel->where('name')->equals('dummy');
         $sel->limit(0, 1);
         if ($sel->length()) {
             $orderId = $sel->first->id;
         } else {
             $orderTypeId = $objectTypes->getBaseType('emarket', 'order');
             $orderId = $objects->addObject('dummy', $orderTypeId);
             $order = $objects->getObject($orderId);
             if ($order instanceof iUmiObject == false) {
                 throw new publicException("Can't load dummy object for order #{$orderId}");
             } else {
                 $order->setValue('domain_id', $domainId);
                 $order->commit();
             }
         }
         return self::get($orderId);
     }
     $managerId = 0;
     $statusId = self::getStatusByCode('basket');
     $customer = customer::get();
     $createTime = time();
     $orderId = $objects->addObject('', $orderTypeId);
     $order = $objects->getObject($orderId);
     if ($order instanceof iUmiObject == false) {
         throw new publicException("Can't load created object for order #{$orderId}");
     }
     $order->domain_id = $domainId;
     $order->manager_id = $managerId;
     $order->status_id = $statusId;
     $order->customer_id = $customer->getId();
     $order->order_create_date = $createTime;
     $order->commit();
     $customer->setLastOrder($orderId, $domainId);
     return self::get($orderId);
 }
 protected function getCustomerOrders()
 {
     static $customerOrders = null;
     if (!is_null($customerOrders)) {
         return $customerOrders;
     }
     $customer = customer::get();
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->where('customer_id')->equals($customer->id);
     $sel->where('domain_id')->equals($domainId);
     $sel->where('status_id')->equals(order::getStatusByCode('ready'));
     return $customerOrders = $sel->result;
 }
Пример #18
0
 /**
  * Функция рисует список заказов пользователя
  * @param string $template Название шаблона
  * @return mixed Список заказов пользователя
  */
 public function show_user_orders($template = 'default')
 {
     list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
     $cmsController = cmsController::getInstance();
     $domain = $cmsController->getCurrentDomain();
     $domainId = $domain->getId();
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->where('customer_id')->equals(customer::get()->id);
     $sel->where('name')->isNull(false);
     $sel->where('domain_id')->equals($domainId);
     if ($sel->length == 0) {
         $tpl_block = $tpl_block_empty;
     }
     $items_arr = array();
     foreach ($sel->result as $selOrder) {
         $order = order::get($selOrder->id);
         $item_arr['attribute:id'] = $order->id;
         $item_arr['attribute:name'] = $order->name;
         $item_arr['attribute:type-id'] = $order->typeId;
         $item_arr['attribute:guid'] = $order->GUID;
         $item_arr['attribute:type-guid'] = $order->typeGUID;
         $item_arr['attribute:ownerId'] = $order->ownerId;
         $item_arr['xlink:href'] = $order->xlink;
         $item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
         //print_r($order->getValue('order_items'));
         //Получаем список товаров заказа
         $items = array();
         foreach ($order->getItems() as $orderItem) {
             //					print_r($order_item); die;
             $item_line = array();
             //					print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
             $item_line['attribute:element_id'] = $orderItem->id;
             $item_line['attribute:name'] = $orderItem->name;
             $item_line['attribute:item_amount'] = $orderItem->getAmount();
             //					$item_line['attribute:options'] = $orderItem->getOptions();
             //						print_r($order_item->options);
             $items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
             umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
         }
         $item_arr['subnodes:order_items'] = $items;
         $items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
     }
     return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
 }
Пример #19
0
 public static function import_orders($order, $product)
 {
     try {
         $conn = db_connect();
         $order_id = $order[0];
         $customer_id_return = customer::getCustomerEntityIdFromUserId($order[3]);
         if ($customer_id_return['success'] == 0) {
             $errorcode = $customer_id_return['errorcode'];
             throw new Exception($customer_id_return['data']);
         }
         $customer_id = $customer_id_return['data'];
         $order_sn = $order[2];
         $order_status_code = $order[4];
         $pay_status_code = $order[6];
         $referer = $order[44];
         $to_buyer = $order[55];
         $is_1yuan = $order[69];
         $device_id = $order[70];
         $shipping_type = $order[73];
         $create_at = date('y-m-d H:i:s', $order[45]);
         if ($order_status_code) {
         }
         $order_list = array("origin_order_id" => $order_id, "customer_id" => $customer_id, "order_sn" => $order_sn, "referer" => $referer, "to_buyer" => $to_buyer, "is_1yuan" => $is_1yuan, "device_id" => $device_id, "shipping_type" => $shipping_type, "create_at" => $create_at);
         $product_list = array();
         foreach ($product as $p) {
             $goods_id = self::getProductId($p[2]);
             $qty = array('qty', $p[6]);
             $product_list[$goods_id] = $qty;
         }
         self::createOrder($order_list, $product_list);
         $conn->close();
         return array('data' => '', "success" => 1, "errorcode" => 0);
     } catch (Exception $e) {
         $conn->close();
         return array('data' => $e->getMessage(), "success" => 0, "errorcode" => $errorcode);
     }
 }
Пример #20
0
$biller_id = $_GET['biller_id'];
$customer_id = $_GET['customer_id'];
$filter_by_date = $_GET['filter_by_date'];
if ( $filter_by_date =="yes" )
{
	$start_date = $_GET['start_date'];
	$end_date = $_GET['end_date'];
}
$show_only_unpaid = $_GET['show_only_unpaid'];
$show_only_real = $_GET['show_only_real'];
$get_format = $_GET['format'];
$get_file_type = $_GET['filetype'];


$biller = $SI_BILLER->getBiller($_GET['biller_id']);
$customer = customer::get($_GET['customer_id']);

#create PDF name

if ($_GET['stage'] == 2 ) {

	#echo $block_stage2;


	#get the invoice id
	$export = new export();
	$export -> format = 'pdf';
	$export -> file_type = $get_file_type;
	$export -> file_location = 'file';
	$export -> module = 'statement';
	$export -> biller_id = $biller_id;
Пример #21
0
        while ($zones = smn_db_fetch_array($Qzones)) {
            $zones_array[] = '"' . $zones['zone_name'] . '": "' . $zones['zone_name'] . '"';
        }
        echo '{
                 hasZones: true,
                 zones: {' . implode(',', $zones_array) . '}
          }';
    } else {
        echo '{ hasZones: false }';
    }
    exit;
}
if (!class_exists('customer')) {
    require DIR_WS_CLASSES . 'customer.php';
}
$customerInfo = new customer($customer_id);
if (smn_session_is_registered('customer_store_id')) {
    if (!class_exists('store')) {
        require 'includes/classes/store.php';
    }
    $customersStore = new store($customer_store_id);
}
if (isset($_POST) && !empty($_POST) && $action == 'save') {
    $error = false;
    // include validation functions (right now only email address)
    require DIR_WS_FUNCTIONS . 'validations.php';
    $customer_first_name = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $dob = $_POST['dob_day'] . '-' . $_POST['dob_month'] . '-' . $_POST['dob_year'];
    $email_address = $_POST['email_address'];
    $company = $_POST['company'];
Пример #22
0
 public function index($id = null)
 {
     parent::routes()->render('index_customer.twig', array('app_base' => $this->appBase, 'customer_page' => customer::CustomerPage($id), 'results' => customer::CustomerPagination($id), 'title' => 'Customers'));
 }
Пример #23
0
<?php

//required includes at start
require_once 'inc/top.php';
//others required includes only here
require_once 'inc/session.php';
require_once 'inc/functions/time.php';
require_once 'inc/classes/call.php';
require_once 'inc/classes/customer.php';
require_once 'inc/classes/web.php';
require_once 'inc/classes/subject.php';
require_once 'inc/classes/country.php';
if (isset($_POST['create'])) {
    $call = new call();
    $customer = new customer();
    $duration = $_POST['minutes'] * 60 + $_POST['seconds'];
    if ($customer->exists($_POST['mail'], false)) {
        $call->create($_SESSION['users']['id'], $_POST['type'], $_POST['web'], $_POST['subject'], $duration, $_POST['comments'], $customer->MailToId($_POST['mail']));
    } else {
        $customer->create($_POST['name'], $_POST['mail'], $_POST['city'], $_POST['country'], $_POST['phone']);
        $call->create($_SESSION['users']['id'], $_POST['type'], $_POST['web'], $_POST['subject'], $duration, $_POST['comments'], $customer->MailToId($_POST['mail']));
    }
    $msg = $call->printNiceLog(false);
}
$html['title'] = 'Create';
$html['head'] = '<script src="themes/' . THEME . '/js/jquery.js" type="text/javascript"></script>';
//theme header
include_once 'themes/' . THEME . '/header.php';
?>
			<div class="title">
				<h2>Create</h2>
Пример #24
0
<?php

include_once "../../../include/basics/basics.inc";
global $db;
// if the 'term' variable is not sent with the request, exit
if (!isset($_REQUEST['term'])) {
    echo "exit";
    exit;
} else {
    $customer_name = $_REQUEST['term'];
    if (!empty($_GET['bu_org_id'])) {
        $org_id = $_GET['bu_org_id'];
    }
    //echo $org_id;
    $data = customer::find_customer_by_customerName($customer_name);
    // jQuery wants JSON data
    $json = json_encode($data);
    print $json;
    //
}
Пример #25
0
	public function run()
	{
        global $db;
        global $auth_session;
        
        $SI_BILLER = new SimpleInvoices_Db_Table_Biller();
        $SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();

        $today = date('Y-m-d');
        $domain_id = domain_id::get($this->domain_id);

        $cron_log = new cronlog();
        $cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
        $check_cron_log = $cron_log->check();        	

        //only proceed if cron has not been run for today
        $cron = new cron();
        $data = $cron->select_all('no_limit');

        $return['cron_message'] ="Cron started";
        $number_of_crons_run = "0";	
        foreach ($data as $key=>$value)
        {

            $cron_log = new cronlog();
            $cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
            $cron_log->cron_id = $data[$key]['cron_id'];
            $check_cron_log = $cron_log->check();        	

            $i="0";
            if ($check_cron_log == 0)
            {
                $run_cron ='false';
                $start_date = date('Y-m-d', strtotime( $data[$key]['start_date'] ) );
                $end_date = $data[$key]['end_date'] ;

                $diff = number_format((strtotime($today) - strtotime($start_date)) / (60 * 60 * 24),0);
                

                //only check if diff is positive
                if (($diff >= 0) AND ($end_date =="" OR $end_date >= $today))
                {

                    if($data[$key]['recurrence_type'] == 'day')
                    {
                        $modulus = $diff % $data[$key]['recurrence'] ;
                        if($modulus == 0)
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron does not runs TODAY-days";

                        }

                    }

                    if($data[$key]['recurrence_type'] == 'week')
                    {
                        $period = 7 * $data[$key]['recurrence'];
                        $modulus = $diff % $period ;
                        if($modulus == 0)
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron is not runs TODAY-week";
                        }

                    }
                    if($data[$key]['recurrence_type'] == 'month')
                    {
                        $start_day = date('d', strtotime( $data[$key]['start_date'] ) );
                        $start_month = date('m', strtotime( $data[$key]['start_date'] ) );
                        $start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
                        $today_day = date('d');	
                        $today_month = date('m');	
                        $today_year = date('Y'); 	

                        $months = ($today_month-$start_month)+12*($today_year-$start_year);
                        $modulus =  $months % $data[$key]['recurrence']  ;
                        if( ($modulus == 0) AND ( $start_day == $today_day ) )
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron is not runs TODAY-month";
                        }

                    }
                    if($data[$key]['recurrence_type'] == 'year')
                    {
                        $start_day = date('d', strtotime( $data[$key]['start_date'] ) );
                        $start_month = date('m', strtotime( $data[$key]['start_date'] ) );
                        $start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
                        $today_day = date('d');	
                        $today_month = date('m');	
                        $today_year = date('Y'); 	

                        $years = $today_year-$start_year;
                        $modulus =  $years % $data[$key]['recurrence']  ;
                        if( ($modulus == 0) AND ( $start_day == $today_day ) AND  ( $start_month == $today_month ) )
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron is not runs TODAY-year";
                        }
                    }
                    //run the recurrence for this invoice
                    if ($run_cron == 'true')
                    {
                        $number_of_crons_run++;	
                        $return['cron_message_'.$data[$key]['cron_id']] = "Cron ID: ". $data[$key]['cron_id'] ." - Cron for ".$data[$key]['index_name']." with start date of ".$data[$key]['start_date'].", end date of ".$data[$key]['end_date']." where it runs each ".$data[$key]['recurrence']." ".$data[$key]['recurrence_type']." was run today :: Info diff=".$diff;
                        $i++;

                        $ni = new invoice();
                        $ni->id = $data[$key]['invoice_id'];
                        $new_invoice_id = $ni->recur();

                        //insert into cron_log date of run
                        $cron_log = new cronlog();
                        $cron_log->run_date = $today;
                        $cron_log->domain_id = $domain_id;
                        $cron_log->cron_id = $data[$key]['cron_id'];
                        $cron_log->insert();

                        ## email the people
                        
                        $invoice= invoice::select($new_invoice_id);
                        $preference = $SI_PREFERENCES->getPreferenceById($invoice['preference_id']);
                        $biller = $_SI_BILLER->getBiller($invoice['biller_id']);
                        $customer = customer::get($invoice['customer_id']);
                        #print_r($customer);
                        #create PDF nameVj
                        $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
                        $pdf_file_name_invoice = $spc2us_pref.".pdf";
                            
                            
                        // email invoice
                        if( ($data[$key]['email_biller'] == "1") OR ($data[$key]['email_customer'] == "1") )
                        {
                            $export = new export();
                            $export -> format = "pdf";
                            $export -> file_location = 'file';
                            $export -> module = 'invoice';
                            $export -> id = $invoice['id'];
                            $export -> execute();

                            #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                            $email = new email();
                            $email -> format = 'cron_invoice';

                                $email_body = new email_body();
                                $email_body->email_type = 'cron_invoice';
                                $email_body->customer_name = $customer['name'];
                                $email_body->invoice_name = $invoice['index_name'];
                                $email_body->biller_name = $biller['name'];
                            
                            $email -> notes = $email_body->create();
                            $email -> from = $biller['email'];
                            $email -> from_friendly = $biller['name'];
                            if($data[$key]['email_customer'] == "1")
                            {
                                $email -> to = $customer['email'];
                            }
                            if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "1")
                            {
                                $email -> to = $customer['email'].";".$biller['email'];
                            }
                            if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "0")
                            {
                                $email -> to = $biller['email'];
                            }
                            $email -> invoice_name = $invoice['index_name'];
                            $email -> subject = $email->set_subject();
                            $email -> attachment = $pdf_file_name_invoice;
                            $return['email_message'] = $email -> send ();

                        }

                        //Check that all details are OK before doing the eway payment
                        $eway_check = new eway();
                        $eway_check->invoice = $invoice;
                        $eway_check->customer = $customer;
                        $eway_check->biller = $biller;
                        $eway_check->preference = $preference;
                        $eway_pre_check = $eway_check->pre_check();

                        //do eway payment
                        if ($eway_pre_check == 'true')         
                        {
                            
                            // input customerID,  method (REAL_TIME, REAL_TIME_CVN, GEO_IP_ANTI_FRAUD) and liveGateway or not
                            $eway = new eway();
                            $eway->invoice = $invoice;
                            $eway->biller = $biller ;
                            $eway->customer = $customer;
                            $payment_done = $eway->payment();  
                            
                            $payment_id = $db->lastInsertID();

                            $pdf_file_name_receipt = 'payment'.$payment_id.'.pdf';
                            if ($payment_done =='true')
                            {
                                //do email of receipt to biller and customer
                                if( ($data[$key]['email_biller'] == "1") OR ($data[$key]['email_customer'] == "1") )
                                {

                                    /*
                                    * If you want a new copy of the invoice being emailed to the customer 
                                    * use this code
                                    */
                                    $export_rec = new export();
                                    $export_rec -> format = "pdf";
                                    $export_rec -> file_location = 'file';
                                    $export_rec -> module = 'invoice';
                                    $export_rec -> id = $invoice['id'];
                                    $export_rec -> execute();

                                    #$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
                                    $email_rec = new email();
                                    $email_rec -> format = 'cron_invoice';

                                        $email_body_rec = new email_body();
                                        $email_body_rec->email_type = 'cron_invoice_receipt';
                                        $email_body_rec->customer_name = $customer['name'];
                                        $email_body_rec->invoice_name = $invoice['index_name'];
                                        $email_body_rec->biller_name = $biller['name'];
                                    
                                    $email_rec -> notes = $email_body_rec->create();
                                    $email_rec -> from = $biller['email'];
                                    $email_rec -> from_friendly = $biller['name'];
                                    if($data[$key]['email_customer'] == "1")
                                    {
                                        $email_rec -> to = $customer['email'];
                                    }
                                    if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "1")
                                    {
                                        $email_rec -> to = $customer['email'].";".$biller['email'];
                                    }
                                    if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "0")
                                    {
                                        $email_rec -> to = $biller['email'];
                                    }
                                    $email_rec -> invoice_name = $invoice['index_name'];
                                    $email_rec -> attachment = $pdf_file_name_invoice;
                                    $email_rec -> subject = $email_rec->set_subject('invoice_eway_receipt');
                                    $return['email_message'] = $email_rec -> send ();


                                    /*
                                    * If you want a receipt as PDF being emailed to the customer uncomment
                                    * the below code
                                    */
                                    /*
                                    $export = new export();
                                    $export -> format = "pdf";
                                    $export -> file_location = 'file';
                                    $export -> module = 'payment';
                                    $export -> id = $payment_id;
                                    $export -> execute();

                                    $email = new email();
                                    $email -> format = 'cron_payment';

                                        $email_body = new email_body();
                                        $email_body->email_type = 'cron_payment';
                                        $email_body->customer_name = $customer['name'];
                                        $email_body->invoice_name = 'payment'.$payment_id;
                                        $email_body->biller_name = $biller['name'];
                                    
                                    $email -> notes = $email_body->create();
                                    $email -> from = $biller['email'];
                                    $email -> from_friendly = $biller['name'];
                                    if($data[$key]['email_customer'] == "1")
                                    {
                                        $email -> to = $customer['email'];
                                    }
                                    if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "1")
                                    {
                                        $email -> to = $customer['email'].";".$biller['email'];
                                    }
                                    if($data[$key]['email_biller'] == "1" AND $data[$key]['email_customer'] == "0")
                                    {
                                        $email -> to = $customer['email'];
                                    }
                                    $email -> subject = $pdf_file_name_receipt." from ".$biller['name'];
                                    $email -> attachment = $pdf_file_name_receipt;
                                    $return['email_message'] = $email->send();
                                    */
                                }
                            } else {
                                //do email to biller/admin - say error
                                
                                $email = new email();
                                $email -> format = 'cron_payment';
                                $email -> from = $biller['email'];
                                $email -> from_friendly = $biller['name'];
                                $email -> to = $biller['email'];
                                $email -> subject = "Payment failed for ".$invoice['index_name'];
                                $error_message ="Invoice:  ".$invoice['index_name']."<br /> Amount: ".$invoice['total']." <br />";
                                foreach($eway->get_message() as $key => $value)
                                    $error_message .= "\n<br>\$ewayResponseFields[\"$key\"] = $value";
                                $email -> notes = $error_message;
                                $return['email_message'] = $email->send();

                            }

                        }



                    } else {

                        //cron not run for this cron_id
                        $return['cron_message_'.$data[$key]['cron_id']] = "Cron ID: ". $data[$key]['cron_id'] ." NOT RUN: Cron for ".$data[$key]['index_name']." with start date of ".$data[$key]['start_date'].", end date of ".$data[$key]['end_date']." where it runs each ".$data[$key]['recurrence']." ".$data[$key]['recurrence_type']." did not recur today :: Info diff=".$diff;

                    }
            
                
                } else {		

                        //days diff is negaqtive - whats going on
                        $return['cron_message_'.$data[$key]['cron_id']] = "Cron ID: ". $data[$key]['cron_id'] ." NOT RUN: - Not cheduled for today - Cron for ".$data[$key]['index_name']." with start date of ".$data[$key]['start_date'].", end date of ".$data[$key]['end_date']." where it runs each ".$data[$key]['recurrence']." ".$data[$key]['recurrence_type']." did not recur today :: Info diff=".$diff;
                }
            } else {
                // cron has already been run for that cron_id toda
                   $return['cron_message_'.$data[$key]['cron_id']] = "Cron ID: ".$data[$key]['cron_id']." - Cron has already been run for domain: ".$domain_id." for the date: ".$today." for invoice ".$data[$key]['invoice_id'];
                   $return['email_message'] = "";
                   
            }
        }

        // no crons scheduled for today	
        if ($number_of_crons_run  == '0')
        {
            $return['id'] = $i;
            $return['cron_message'] = "No invoices recurred for this cron run for domain: ".$domain_id." for the date: ".$today;
            $return['email_message'] = "";
        }
        //insert into cron_log date of run
       /* $cron_log = new cronlog();
        $cron_log->run_date = $today;
        $cron_log->domain_id = $domain_id;
        $cron_log->insert();*/

    /*
    * If you want to get an email once cron has been run edit the below details
    *
    */
    /*
        $email = new email();
        $email -> format = 'cron';
        #$email -> notes = $return;
        $email -> from = "simpleinvoices@localhost";
        $email -> from_friendly = "Simple Invoices - Cron";
        $email -> to = "simpleinvoices@localhost";
        #$email -> bcc = $_POST['email_bcc'];
        $email -> subject = "Cron for Simple Invoices has been run for today:";
        $email -> send ();
    */
            return $return;
        
    }
Пример #26
0
 $page_title = "Tambah Data";
 //$kode = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Kode Error.');
 include_once $path . '/admin/header.php';
 echo "<div class='col-md-3 col-sm-5'>";
 include_once $path . '/admin/sidebarmenu.php';
 echo "</div>";
 include_once $path . '/objects/customer.php';
 $customer = new customer($db);
 //	$users->username = $kode;
 //$customer->ShowOne();
 echo "<div class='container'>";
 echo "<div class='col-md-9'>";
 if ($_POST) {
     //public $cust_kode, $cust_nama, $cust_alamat, $cust_jk, $cust_tempat, $cust_dob, $isactive;
     include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/customer.php';
     $customer = new customer($db);
     $customer->cust_kode = $_POST['cust_kode'];
     $customer->cust_nama = $_POST['cust_nama'];
     $customer->cust_alamat = $_POST['cust_alamat'];
     $customer->cust_jk = $_POST['cust_jk'];
     $customer->cust_tempat = $_POST['cust_tempat'];
     $customer->cust_dob = $_POST['cust_dob'];
     //tanggal lahir pelanggan
     $customer->isactive = $_POST['isactive'];
     //fungsi insert data pelanggan
     if ($customer->insert()) {
         echo "<div class='alert alert-success alert-dismissable'>";
         echo "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>";
         echo "Pelanggan Baru berhasil di Tambah";
         echo "</div>";
     } else {
Пример #27
0
    echo $lang['common_accessDenied'] . "\n";
    exit;
}
if (!$loginInst->hasAccess("customer")) {
    echo $global_status;
    exit;
}
?>

<h1><?php 
echo $lang['common_customers'];
?>
</h1>

<?php 
$customerInst = new customer();
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') == "save" && tool::securePost('id')) {
    # fill customer with submitted data
    $customerInst->id = tool::securePost('id');
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->update();
} elseif (tool::securePost('action') == "save") {
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->insert();
}
if (tool::securePost('action') == "delete") {
    $customerInst->id = tool::securePost('id');
    $customerInst->delete();
Пример #28
0
    ?>
 (<?php 
    echo $config['currency'];
    ?>
):&nbsp;</td><td><input value="<?php 
    echo $projectInst->budget;
    ?>
" maxlength="10" type="text" name="budget" size="10"></td></tr>
    <tr>
      <td><?php 
    echo $lang['common_customer'];
    ?>
:&nbsp;</td>
      <td><select name="customerid">
        <?php 
    $customerInst = new customer();
    $list = $customerInst->getList();
    while ($element = current($list)) {
        $customerInst->activate($element);
        $selected = "";
        if ($customerInst->id == $projectInst->customerId) {
            $selected = "selected";
        }
        echo "<option " . $selected . " value=\"" . $customerInst->id . "\">" . $customerInst->company . "\n";
        next($list);
    }
    ?>
      </select></td>
    </tr>
    <tr>
      <td><?php 
Пример #29
0
 /**
  * Displays the registration form
  *
  * @param	array 	$form_errors
  * @return	@e void
  */
 public function registerForm($form_errors = array())
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $final_errors = array();
     $coppa = IPSCookie::get('coppa');
     $step = $this->request['step'] ? intval($this->request['step']) : 1;
     $this->settings['username_errormsg'] = str_replace('{chars}', $this->settings['username_characters'], $this->settings['username_errormsg']);
     if ($coppa == 'yes') {
         $this->registry->output->showError('awaiting_coppa', 10124);
     }
     $this->_resetMember();
     //-----------------------------------------
     // COPPA swapout
     //-----------------------------------------
     if ($this->settings['use_coppa']) {
         $this->lang->words['confirm_over_thirteen'] = str_replace("<#FORM_LINK#>", "{$this->settings['base_url']}app=core&amp;module=global&amp;section=register&amp;do=12", $this->lang->words['confirm_over_thirteen']);
     }
     //-----------------------------------------
     // T & C
     //-----------------------------------------
     $cache = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'"));
     $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
     IPSText::getTextClass('bbcode')->parse_smilies = 1;
     IPSText::getTextClass('bbcode')->parse_html = 1;
     IPSText::getTextClass('bbcode')->parse_nl2br = 1;
     IPSText::getTextClass('bbcode')->parse_bbcode = 1;
     IPSText::getTextClass('bbcode')->parsing_section = 'global';
     $this->settings['_termsAndConditions'] = IPSText::getTextClass('bbcode')->preDisplayParse($text);
     //-----------------------------------------
     // Page title / navigation
     //-----------------------------------------
     $this->registry->output->setTitle($this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name']);
     $this->registry->output->addNavigation($this->lang->words['registration_form'], '');
     //-----------------------------------------
     // If Nexus is installed, that is the first step
     //-----------------------------------------
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         //-----------------------------------------
         // We just submitted the form
         //-----------------------------------------
         if ($this->request['nexus_pass']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('nexus') . '/sources/hooks.php', 'nexusHooks', 'nexus');
             $hookGateway = new $classToLoad($this->registry);
             //-----------------------------------------
             // Check for errors
             //-----------------------------------------
             if ($this->settings['nexus_reg_force'] and !IPSCookie::get('cm_reg') and empty($this->request['cm_package'])) {
                 $nexusError = $this->lang->words['forceby_no_sel'];
             }
         }
         //-----------------------------------------
         // If no errors, create invoice and set cookie
         //-----------------------------------------
         if (!$nexusError and $this->request['nexus_pass']) {
             //-----------------------------------------
             // Did we buy a package?
             //-----------------------------------------
             $chosenPackages = ipsRegistry::$request['cm_package'];
             if (!empty($chosenPackages)) {
                 foreach ($chosenPackages as $itemID) {
                     require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
                     /*noLibHook*/
                     $package = package::load($itemID);
                     $shippingData = $package->shippingData();
                     $renewTerm = $package->renewalTerms();
                     $items[] = array('act' => 'new', 'app' => 'nexus', 'type' => $package->data['p_type'], 'cost' => $package->price($this->memberData['member_id'], FALSE), 'tax' => $package->data['p_tax'], 'renew_term' => $renewTerm['term'], 'renew_units' => $renewTerm['unit'], 'renew_cost' => $renewTerm['price'], 'physical' => is_null($shippingData) ? FALSE : TRUE, 'shipping' => is_null($shippingData) ? array() : $shippingData['shipping'], 'weight' => is_null($shippingData) ? 0 : $shippingData['weight'], 'itemName' => $package->data['p_name'], 'itemID' => $package->data['p_id'], 'groupRenewals' => $package->data['p_group_renewals'], 'methods' => $package->data['p_methods'] ? explode(',', $package->data['p_methods']) : array());
                 }
                 // Generate it
                 require_once IPSLib::getAppDir('nexus') . '/sources/nexusApi.php';
                 /*noLibHook*/
                 $invoiceID = nexusApi::generateInvoice(NULL, $this->memberData['member_id'], $items);
                 IPSCookie::set('cm_reg', $invoiceID);
             }
         } else {
             //-----------------------------------------
             // "step 1" if Nexus is set to show packages on registration
             //-----------------------------------------
             require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
             /*noLibHook*/
             $packages = array();
             $this->DB->build(array('select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position'));
             $e = $this->DB->execute();
             while ($row = $this->DB->fetch($e)) {
                 $packages[$row['p_id']] = package::load($row['p_id'])->buildDisplayData();
             }
             if (!empty($packages)) {
                 if (isset($this->request['cm_package'])) {
                     foreach ($this->request['cm_package'] as $packageID) {
                         $packages[$packageID]['checked'] = "checked='checked'";
                     }
                 }
                 $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32($packages, $nexusError);
                 return;
             } else {
                 $this->settings['nexus_reg_show'] = false;
             }
         }
     }
     //-----------------------------------------
     // Send to an alternate registration URL?
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         if ($r['login_register_url']) {
             $this->registry->output->silentRedirect($r['login_register_url']);
         }
     }
     //-----------------------------------------
     // Adjust text as needed based on validation type
     //-----------------------------------------
     if ($this->settings['reg_auth_type']) {
         if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['email_validate_text'];
         }
         /* User then admin? */
         if ($this->settings['reg_auth_type'] == 'admin_user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['user_admin_validation'];
         }
         if ($this->settings['reg_auth_type'] == 'admin') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['just_admin_validation'];
         }
     }
     //-----------------------------------------
     // Captcha / Q&A
     //-----------------------------------------
     $captchaHTML = '';
     $qandaHTML = '';
     $question = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1)));
     if ($question and count($question)) {
         $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer($question);
     }
     if ($this->settings['bot_antispam_type'] != 'none') {
         $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
     }
     //-----------------------------------------
     // Custom fields
     //-----------------------------------------
     $custom_fields_out = array('required', 'optional');
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields = new $classToLoad();
     $custom_fields->member_data = $this->memberData;
     $custom_fields->initData('edit', 0, array('tabindex' => 6));
     $custom_fields->parseToEdit('register');
     if (count($custom_fields->out_fields)) {
         foreach ($custom_fields->out_fields as $id => $form_element) {
             if ($custom_fields->cache_data[$id]['pf_not_null'] == 1) {
                 $ftype = 'required';
             } else {
                 $ftype = 'optional';
             }
             $custom_fields_out[$ftype][] = array('name' => $custom_fields->field_names[$id], 'desc' => $custom_fields->field_desc[$id], 'field' => $form_element, 'id' => $id, 'error' => '', 'type' => $custom_fields->cache_data[$id]['pf_type']);
         }
     }
     //-----------------------------------------
     // If Nexus is installed, also add billing information
     //-----------------------------------------
     $nexusFields = array();
     $nexusStates = array();
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_countries'), 'nexus');
         $fields = array();
         $_fields = ipsRegistry::cache()->getCache('customer_fields');
         if (is_array($_fields) and count($_fields)) {
             foreach ($_fields['reg'] as $k) {
                 $nexusFields[] = $_fields['fields'][$k];
             }
         }
         $nexusStates = customer::generateStateDropdown(TRUE);
     }
     //-----------------------------------------
     // Got errors to show?
     //-----------------------------------------
     $final_errors = array('dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL);
     foreach (array('dname', 'password', 'email', 'tos') as $thing) {
         if (isset($form_errors[$thing]) and is_array($form_errors[$thing]) and count($form_errors[$thing])) {
             $final_errors[$thing] = implode("<br />", $form_errors[$thing]);
         }
     }
     $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '';
     $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '';
     $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '';
     $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '';
     $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '';
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '';
     //-----------------------------------------
     // Create time zone dropdown array
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_usercp'), 'core');
     $time_select = array();
     foreach ($this->lang->words as $k => $v) {
         if (strpos($k, "time_") === 0) {
             $k = str_replace("time_", '', $k);
             if (preg_match('/^[\\-\\d\\.]+$/', $k)) {
                 $time_select[$k] = $v;
             }
         }
     }
     ksort($time_select);
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : $this->settings['time_offset'];
     //-----------------------------------------
     // Start output
     //-----------------------------------------
     $this->output .= $this->registry->output->getTemplate('register')->registerForm($form_errors['general'], array('TEXT' => $this->lang->words['std_text'], 'coppa_user' => $coppa, 'captchaHTML' => $captchaHTML, 'qandaHTML' => $qandaHTML, 'showCOPPA' => $this->settings['use_coppa'] and !(IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online'])), $final_errors, $time_select, $custom_fields_out, $nexusFields, $nexusStates);
     //-----------------------------------------
     // Member sync module
     //-----------------------------------------
     IPSLib::runMemberSync('onRegisterForm');
 }
Пример #30
0
<?php
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();

$SI_SYSTEM_DEFAULTS = new SimpleInvoices_Db_Table_SystemDefaults();
$SI_TAX = new SimpleInvoices_Db_Table_Tax();

#get the invoice id
$expense_id = $_GET['id'];

$expense = expense::get($expense_id);
$detail = expense::detail();
$detail['customer'] = customer::get($expense['customer_id']);
$detail['biller'] = biller::select($expense['biller_id']);
$detail['invoice'] = invoice::select($expense['invoice_id']);
$detail['product'] = product::get($expense['product_id']);
$detail['expense_account'] = expenseaccount::select($expense['expense_account_id']);
$detail['expense_tax'] = expensetax::get_all($expense_id);
$detail['expense_tax_total'] = $expense['amount'] + expensetax::get_sum($expense_id);
$detail['expense_tax_grouped'] = expensetax::grouped($expense_id);
$detail['status_wording'] = $expense['status']==1?$LANG['paid']:$LANG['not_paid'];

$taxes = $SI_TAX->fetchAllActive();
#$tax_selected = getTaxRate($product['default_tax_id']);
$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();

$smarty -> assign('expense',$expense);
$smarty -> assign('detail',$detail);
$smarty -> assign('taxes',$taxes);
$smarty -> assign('defaults',$defaults);
$smarty -> assign('tax_selected',$tax_selected);