mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-02 13:59:30 -05:00
Merge pull request #2319 from opensourcepos/fix-attribute-datetime
Fix attribute datetime formatting
This commit is contained in:
@@ -231,6 +231,8 @@ class Receiving_lib
|
||||
$receiving_quantity = $item_info->receiving_quantity;
|
||||
}
|
||||
|
||||
$attribute_links = $this->CI->Attribute->get_link_values($item_id, 'receiving_id', $receiving_id, Attribute::SHOW_IN_RECEIVINGS)->row_object();
|
||||
|
||||
$item = array($insertkey => array(
|
||||
'item_id' => $item_id,
|
||||
'item_location' => $item_location,
|
||||
@@ -240,7 +242,8 @@ class Receiving_lib
|
||||
'name' => $item_info->name,
|
||||
'description' => $description != NULL ? $description: $item_info->description,
|
||||
'serialnumber' => $serialnumber != NULL ? $serialnumber: '',
|
||||
'attribute_values' => $this->CI->Attribute->get_link_values($item_id, 'receiving_id', $receiving_id, Attribute::SHOW_IN_RECEIVINGS),
|
||||
'attribute_values' => $attribute_links->attribute_values,
|
||||
'attribute_dtvalues' => $attribute_links->attribute_dtvalues,
|
||||
'allow_alt_description' => $item_info->allow_alt_description,
|
||||
'is_serialized' => $item_info->is_serialized,
|
||||
'quantity' => $quantity,
|
||||
|
||||
@@ -719,6 +719,8 @@ class Sale_lib
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$price = 0.00;
|
||||
$cost_price = 0.00;
|
||||
$item_id = $item_info->item_id;
|
||||
$item_type = $item_info->item_type;
|
||||
$stock_type = $item_info->stock_type;
|
||||
@@ -745,16 +747,7 @@ class Sale_lib
|
||||
$price = $item_info->unit_price;
|
||||
$cost_price = $item_info->cost_price;
|
||||
}
|
||||
else
|
||||
{
|
||||
$price = 0.00;
|
||||
$cost_price = 0.00;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$price= 0.00;
|
||||
$cost_price = 0.00;
|
||||
|
||||
}
|
||||
|
||||
if($price_override != NULL)
|
||||
@@ -840,6 +833,7 @@ class Sale_lib
|
||||
$item_info->name .= NAME_SEPARATOR . $item_info->pack_name;
|
||||
}
|
||||
|
||||
$attribute_links = $this->CI->Attribute->get_link_values($item_id, 'sale_id', $sale_id, Attribute::SHOW_IN_SALES)->row_object();
|
||||
|
||||
//Item already exists and is not serialized, add to quantity
|
||||
if(!$itemalreadyinsale || $item_info->is_serialized)
|
||||
@@ -851,7 +845,8 @@ class Sale_lib
|
||||
'line' => $insertkey,
|
||||
'name' => $item_info->name,
|
||||
'item_number' => $item_info->item_number,
|
||||
'attribute_values' => $this->CI->Attribute->get_link_values($item_id, 'sale_id', $sale_id, Attribute::SHOW_IN_SALES),
|
||||
'attribute_values' => $attribute_links->attribute_values,
|
||||
'attribute_dtvalues' => $attribute_links->attribute_dtvalues,
|
||||
'description' => $description != NULL ? $description : $item_info->description,
|
||||
'serialnumber' => $serialnumber != NULL ? $serialnumber : '',
|
||||
'allow_alt_description' => $item_info->allow_alt_description,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once(APPPATH . 'libraries/tokens/Token.php');
|
||||
require_once(APPPATH . 'models/tokens/Token.php');
|
||||
|
||||
/**
|
||||
* Token library
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once(APPPATH . 'libraries/tokens/Token.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_customer.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_invoice_count.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_invoice_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_quote_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_work_order_sequence.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_suspended_invoice_count.php');
|
||||
require_once(APPPATH . 'libraries/tokens/Token_year_invoice_count.php');
|
||||
|
||||
/**
|
||||
* Token class
|
||||
*/
|
||||
|
||||
abstract class Token
|
||||
{
|
||||
protected $CI;
|
||||
|
||||
protected $value = '';
|
||||
|
||||
public function __construct($value = '')
|
||||
{
|
||||
$this->CI =& get_instance();
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
static function get_tokens()
|
||||
{
|
||||
return array(new Token_customer(), new Token_invoice_count(), new Token_invoice_sequence(),
|
||||
new Token_quote_sequence(), new Token_suspended_invoice_count(), new Token_quote_sequence(),
|
||||
new Token_work_order_sequence(), new Token_year_invoice_count());
|
||||
}
|
||||
|
||||
abstract public function token_id();
|
||||
|
||||
abstract public function get_value();
|
||||
|
||||
function matches($token_id)
|
||||
{
|
||||
return token_id() == $token_id;
|
||||
}
|
||||
|
||||
function replace($text)
|
||||
{
|
||||
if(strstr($text, $this->token_id()))
|
||||
{
|
||||
return str_replace($this->token_id(), $this->get_value(), $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_customer class
|
||||
*/
|
||||
|
||||
class Token_customer extends Token
|
||||
{
|
||||
|
||||
private $customer_info;
|
||||
|
||||
public function __construct($customer_info = '')
|
||||
{
|
||||
parent::__construct();
|
||||
$this->customer_info = $customer_info;
|
||||
$this->CI->load->library('sale_lib');
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'CU';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
// substitute customer info
|
||||
$customer_id = $this->CI->sale_lib->get_customer();
|
||||
if($customer_id != -1 && empty($this->customer_info))
|
||||
{
|
||||
$customer_info = $this->CI->Customer->get_info($customer_id);
|
||||
if($customer_info != '')
|
||||
{
|
||||
return trim($customer_info->first_name . ' ' . $customer_info->last_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_invoice_count class
|
||||
*/
|
||||
|
||||
class Token_invoice_count extends Token
|
||||
{
|
||||
public function __construct($value = '')
|
||||
{
|
||||
parent::__construct($value);
|
||||
|
||||
$this->CI->load->model('Sale');
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'CO';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return empty($value) ? $this->CI->Sale->get_invoice_count() : $value;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_invoice_sequence class
|
||||
*/
|
||||
|
||||
class Token_invoice_sequence extends Token
|
||||
{
|
||||
|
||||
public function __construct($value = '')
|
||||
{
|
||||
parent::__construct($value);
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'ISEQ';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Appconfig->acquire_save_next_invoice_sequence();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_quote_sequence class
|
||||
*/
|
||||
|
||||
class Token_quote_sequence extends Token
|
||||
{
|
||||
public function token_id()
|
||||
{
|
||||
return 'QSEQ';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Appconfig->acquire_save_next_quote_sequence();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_suspended_invoice_count class
|
||||
*/
|
||||
|
||||
class Token_suspended_invoice_count extends Token
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->CI->load->model('Sale');
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'SCO';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Sale->get_suspended_invoice_count();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_work_order_sequence class
|
||||
*/
|
||||
|
||||
class Token_work_order_sequence extends Token
|
||||
{
|
||||
public function token_id()
|
||||
{
|
||||
return 'WSEQ';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Appconfig->acquire_save_next_work_order_sequence();
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Token_year_invoice_count class
|
||||
*/
|
||||
|
||||
class Token_year_invoice_count extends Token
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->CI->load->model('Sale');
|
||||
}
|
||||
|
||||
public function token_id()
|
||||
{
|
||||
return 'YCO';
|
||||
}
|
||||
|
||||
public function get_value()
|
||||
{
|
||||
return $this->CI->Sale->get_invoice_number_for_year();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user