diff --git a/config/config.ini b/config/config.ini index 9366cef28..5302d1b4d 100644 --- a/config/config.ini +++ b/config/config.ini @@ -39,7 +39,7 @@ encryption.default.key = this_is_the_encryption_key_change_it nonce.key = this_should_be_random_and_secret_so_change_it nonce.timelimit = 3600 -version.name = 2013.1-beta1 +version.name = 2013.1-beta2 debug.level = All debug.error_reporting = E_ERROR diff --git a/include/class/invoice.php b/include/class/invoice.php index 1e95a556f..617954ea5 100644 --- a/include/class/invoice.php +++ b/include/class/invoice.php @@ -195,6 +195,23 @@ public static function get_all() } + public static function count() + { + global $logger; + global $auth_session; + + $sql = "SELECT + count(id) as count + FROM + ".TB_PREFIX."invoices + WHERE + domain_id = :domain_id + "; + $sth = dbQuery($sql, ':domain_id', $auth_session->domain_id); + + return $sth; + + } function select_all($type='', $dir='DESC', $rp='25', $page='1', $having='') { global $config; @@ -234,7 +251,7 @@ function select_all($type='', $dir='DESC', $rp='25', $page='1', $having='') $sort = "id"; } - if($type =="count") + if(substr($type,"count")) { //unset($limit); $limit=""; @@ -342,20 +359,34 @@ function select_all($type='', $dir='DESC', $rp='25', $page='1', $having='') iv.index_id as index_id, b.name AS biller, c.name AS customer, - (SELECT coalesce(SUM(ii.total), 0) FROM " . + DATE_FORMAT(date,'%Y-%m-%d') AS date,"; + + + $sql .="(SELECT coalesce(SUM(ii.total), 0) FROM " . TB_PREFIX . "invoice_items ii WHERE ii.invoice_id = iv.id) AS invoice_total, (SELECT coalesce(SUM(ac_amount), 0) FROM " . TB_PREFIX . "payment ap WHERE ap.ac_inv_id = iv.id) AS INV_PAID, - ROUND( (SELECT (coalesce(invoice_total,0) - coalesce(INV_PAID,0))) ,2) As owing, - DATE_FORMAT(date,'%Y-%m-%d') AS date, + (SELECT invoice_total - INV_PAID) As owing, + "; + + //only run aging for real query + if($type == '') + { + $sql .=" (SELECT IF((owing = 0 OR owing < 0), 0, DateDiff(now(), date))) AS Age, (SELECT (CASE WHEN Age = 0 THEN '' WHEN Age <= 14 THEN '0-14' WHEN Age <= 30 THEN '15-30' WHEN Age <= 60 THEN '31-60' WHEN Age <= 90 THEN '61-90' - ELSE '90+' END)) AS aging, - iv.type_id As type_id, + ELSE '90+' END)) AS aging,"; + } else { + $sql .=" + (SELECT '') as Age, + (SELECT '') as aging, + "; + } + $sql .="iv.type_id As type_id, pf.pref_description AS preference, pf.status AS status, (SELECT CONCAT(pf.pref_inv_wording,' ',iv.index_id)) as index_name @@ -408,6 +439,14 @@ public static function getInvoiceItems($id) { $invoiceItem['tax_amount'] = $invoiceItem['tax_amount']; $invoiceItem['gross_total'] = $invoiceItem['gross_total']; $invoiceItem['total'] = $invoiceItem['total']; + $invoiceItem['attribute_decode'] = json_decode($invoiceItem['attribute'],true); + foreach ($invoiceItem['attribute_decode'] as $key => $value) + { + $invoiceItem['attribute_json'][$key]['name'] = product_attributes::getName($key); + $invoiceItem['attribute_json'][$key]['value'] = product_attributes::getValue($key,$value); + $invoiceItem['attribute_json'][$key]['type'] = product_attributes::getType($key); + $invoiceItem['attribute_json'][$key]['visible'] = product_attributes::getVisible($key); + } $sql = "SELECT * FROM ".TB_PREFIX."products WHERE id = :id"; $tth = dbQuery($sql, ':id', $invoiceItem['product_id']) or die(htmlsafe(end($dbh->errorInfo()))); diff --git a/include/class/product/attributes.php b/include/class/product/attributes.php new file mode 100644 index 000000000..2fd2093bd --- /dev/null +++ b/include/class/product/attributes.php @@ -0,0 +1,76 @@ +fetch(); + + $sql2 = "select * from ".TB_PREFIX."products_attribute_type where id = :id"; + $sth2 = dbQuery($sql2,':id',$attribute['type_id']); + $name = $sth2->fetch(); + $attribute['type'] = $name['name']; + + return $attribute; + } + public function getName($id) + { + $sql = "select * from ".TB_PREFIX."products_attributes where id = :id"; + $sth = dbQuery($sql,':id',$id); + $attribute = $sth->fetch(); + return $attribute['name']; + } + public function getType($id) + { + $sql = "select + t.name as type + from + ".TB_PREFIX."products_attributes as a, + ".TB_PREFIX."products_attribute_type as t + where + a.id = :id + and a.type_id = t.id"; + $sth = dbQuery($sql,':id',$id); + $attribute = $sth->fetch(); + return $attribute['type']; + } + public function getValue($attribute_id, $value_id) + { + + $details = product_attributes::get($attribute_id); + + if($details['type'] == 'list') + { + $sql = "select value from ".TB_PREFIX."products_values where id = :id"; + $sth = dbQuery($sql,':id',$value_id); + $attribute = $sth->fetch(); + + return $attribute['value']; + } else { + return $value_id; + } + + } + public function getVisible($id) + { + $sql = "select * from ".TB_PREFIX."products_attributes where id = :id"; + $sth = dbQuery($sql,':id',$id); + $attribute = $sth->fetch(); + if($attribute['visible'] =='1') + { + return true; + } else { + return false; + } + + } + public function getAll() + { + $sql = "select * from ".TB_PREFIX."products_attributes"; + $sth = dbQuery($sql); + $attributes = $sth->fetchAll(); + return $attributes; + } +} diff --git a/include/jquery/jquery.functions.js.tpl b/include/jquery/jquery.functions.js.tpl index 48fb8c060..1c56b0a2f 100644 --- a/include/jquery/jquery.functions.js.tpl +++ b/include/jquery/jquery.functions.js.tpl @@ -40,13 +40,14 @@ $('#gmail_loading').show(); $.ajax({ type: 'GET', - url: './index.php?module=invoices&view=product_ajax&id='+product, + url: './index.php?module=invoices&view=product_ajax&id='+product+'&row='+row_number, data: "id: "+product, dataType: "json", success: function(data){ $('#gmail_loading').hide(); /*$('#state').html(data);*/ /*if ( (quantity.length==0) || (quantity.value==null) ) */ + $("#json_html"+row_number).remove(); if (quantity=="") { $("#quantity"+row_number).attr("value","1"); @@ -61,6 +62,30 @@ { $("#tax_id\\["+row_number+"\\]\\[1\\]").val(data['default_tax_id_2']); } + //do the product matric code + if (data['show_description'] =="Y") + { + $("tbody#row"+row_number+" tr.details").show(); + } else { + $("tbody#row"+row_number+" tr.details").hide(); + + } + if($("#description"+row_number).val() == $("#description"+row_number).attr('rel') || $("#description"+row_number).val() =='{/literal}{$LANG.description}{literal}') + { + if (data['notes_as_description'] =="Y") + { + $("#description"+row_number).val(data['notes']); + $("#description"+row_number).attr('rel',data['notes']); + } else { + $("#description"+row_number).val('{/literal}{$LANG.description}{literal}'); + $("#description"+row_number).attr('rel','{/literal}{$LANG.description}{literal}'); + + } + } + if (data['json_html'] !=="") + { + $("tbody#row"+row_number+" tr.details").before(data['json_html']); + } } }); @@ -188,6 +213,9 @@ clonedRow.find("#products"+rowID_old).attr("rel", rowID_new); clonedRow.find("#products"+rowID_old).attr("id", "products"+rowID_new); clonedRow.find("#products"+rowID_new).attr("name", "products"+rowID_new); + clonedRow.find("#products"+rowID_new).find('option:selected').removeAttr("selected"); + clonedRow.find("#products"+rowID_new).prepend(new Option("", "")); + clonedRow.find("#products"+rowID_new).find('option:eq(0)').attr('selected', true) clonedRow.find("#products"+rowID_new).removeClass("validate[required]"); //clonedRow.find("#products"+rowID_new).attr("onChange", "invoice_product_change_price($(this).val(), "+rowID_new+", jQuery('#quantity"+rowID_new+"').val() )"); @@ -201,12 +229,15 @@ $("#description"+rowID_new, clonedRow).attr("name", "description"+rowID_new); $("#description"+rowID_new, clonedRow).attr("value","{/literal}{$LANG.description}{literal}"); $("#description"+rowID_new, clonedRow).css({ color: "#b2adad" }); + $(".details",clonedRow).hide(); $("#tax_id\\["+rowID_old+"\\]\\[0\\]", clonedRow).attr("id", "tax_id["+rowID_new+"][0]"); $("#tax_id\\["+rowID_new+"\\]\\[0\\]", clonedRow).attr("name", "tax_id["+rowID_new+"][0]"); $("#tax_id\\["+rowID_old+"\\]\\[1\\]", clonedRow).attr("id", "tax_id["+rowID_new+"][1]"); $("#tax_id\\["+rowID_new+"\\]\\[1\\]", clonedRow).attr("name", "tax_id["+rowID_new+"][1]"); + $("#json_html"+rowID_old, clonedRow).remove(); + $('#itemtable').append(clonedRow); $('#gmail_loading').hide(); diff --git a/include/sql_patches.php b/include/sql_patches.php index 3e003d3d4..be8f2b1c0 100644 --- a/include/sql_patches.php +++ b/include/sql_patches.php @@ -1487,7 +1487,107 @@ $patch['253']['name'] = "Add PaymentsGateway API ID field"; $patch['253']['patch'] = "ALTER TABLE `".TB_PREFIX."biller` ADD `paymentsgateway_api_id` VARCHAR( 255 ) NULL AFTER `eway_customer_id`;"; $patch['253']['date'] = "20110918"; + + $patch['254']['name'] = "Product Matrix - update line items table"; + $patch['254']['patch'] = "ALTER TABLE `".TB_PREFIX."invoice_items` ADD `attribute` VARCHAR( 255 ) NULL ;"; + $patch['254']['date'] = "20130313"; + + $patch['255']['name'] = "Product Matrix - update line items table"; + $patch['255']['patch'] = " + CREATE TABLE `".TB_PREFIX."products_attributes` ( + `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , + `name` VARCHAR( 255 ) NOT NULL, + `type_id` VARCHAR( 255 ) NOT NULL + ) ENGINE = MYISAM ;"; + $patch['255']['date'] = "20130313"; + + $patch['256']['name'] = "Product Matrix - update line items table"; + $patch['256']['patch'] = "INSERT INTO `". TB_PREFIX ."products_attributes` (`id`, `name`, `type_id`) VALUES (NULL, 'Size','1'), (NULL,'Colour','1');"; + $patch['256']['date'] = "20130313"; + + $patch['257']['name'] = "Product Matrix - update line items table"; + $patch['257']['patch'] = "CREATE TABLE `". TB_PREFIX ."products_values` ( +`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , +`attribute_id` INT( 11 ) NOT NULL , +`value` VARCHAR( 255 ) NOT NULL +) ENGINE = MYISAM ;"; + $patch['257']['date'] = "20130313"; + + $patch['258']['name'] = "Product Matrix - update line items table"; + $patch['258']['patch'] = "INSERT INTO `". TB_PREFIX ."products_values` (`id`, `attribute_id`,`value`) VALUES (NULL,'1', 'S'), (NULL,'1', 'M'), (NULL,'1', 'L'), (NULL,'2', 'Red'), (NULL,'2', 'White');"; + $patch['258']['date'] = "20130313"; + + $patch['259']['name'] = "Product Matrix - update line items table"; + $patch['259']['patch'] = "CREATE TABLE `". TB_PREFIX ."products_matrix` ( +`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , +`product_id` INT( 11 ) NOT NULL , +`attribute_id` INT( 11 ) NOT NULL +) ENGINE = MYISAM ;"; + $patch['259']['date'] = "20130313"; + + $patch['260']['name'] = "Product Matrix - update line items table"; + $patch['260']['patch'] =" ALTER TABLE `". TB_PREFIX ."products_matrix` ADD `product_attribute_number` INT( 11 ) NOT NULL AFTER `product_id` ;"; + $patch['260']['date'] = "20130313"; + + $patch['261']['name'] = "Product Matrix - update line items table"; + $patch['261']['patch'] =" INSERT INTO `". TB_PREFIX ."products_matrix` (`id`, `product_id`,`product_attribute_number`, `attribute_id`) VALUES (NULL,'1', '1', '1'), (NULL,'1', '2', '2'), (NULL,'2', '1', '2');"; + $patch['261']['date'] = "20130313"; + + $patch['262']['name'] = "Add product attributes system preference"; + $patch['262']['patch'] = "INSERT INTO ".TB_PREFIX."system_defaults (id, name ,value ,domain_id ,extension_id ) VALUES (NULL , 'product_attributes', '0', '1', '1');"; + $patch['262']['date'] = "20130313"; + + $patch['263']['name'] = "Product Matrix - update line items table"; + $patch['263']['patch'] = "ALTER TABLE `".TB_PREFIX."products` ADD `attribute` VARCHAR( 255 ) NULL ;"; + $patch['263']['date'] = "20130313"; + + + $patch['264']['name'] = "Product - use notes as default line item description"; + $patch['264']['patch'] = "ALTER TABLE `".TB_PREFIX."products` ADD `notes_as_description` VARCHAR( 1 ) NULL ;"; + $patch['264']['date'] = "20130314"; + + + $patch['265']['name'] = "Product - expand/show line item description"; + $patch['265']['patch'] = "ALTER TABLE `".TB_PREFIX."products` ADD `show_description` VARCHAR( 1 ) NULL ;"; + $patch['265']['date'] = "20130314"; + + $patch['266']['name'] = "Product - expand/show line item description"; + $patch['266']['patch'] = "CREATE TABLE `".TB_PREFIX."products_attribute_type` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $patch['266']['date'] = "20130322"; + + $patch['267']['name'] = "Product Matrix - insert attribute types"; + $patch['267']['patch'] = "INSERT INTO `". TB_PREFIX ."products_attribute_type` (`id`, `name`) VALUES (NULL,'list'), (NULL,'decimal'), (NULL,'free');"; + $patch['267']['date'] = "20130325"; + + + $patch['268']['name'] = "Product Matrix - insert attribute types"; + $patch['268']['patch'] = "ALTER TABLE `". TB_PREFIX ."products_attributes` ADD `enabled` VARCHAR( 1 ) NULL DEFAULT '1', + ADD `visible` VARCHAR( 1 ) NULL DEFAULT '1';"; + $patch['268']['date'] = "20130327"; + + $patch['269']['name'] = "Product Matrix - insert attribute types"; + $patch['269']['patch'] = "ALTER TABLE `". TB_PREFIX ."products_values` ADD `enabled` VARCHAR( 1 ) NULL DEFAULT '1';"; + $patch['269']['date'] = "20130327"; + + + + $patch['270']['name'] = "Make Simple Invoices faster - add index"; + $patch['270']['patch'] = "ALTER TABLE `".TB_PREFIX."payment` ADD INDEX(`ac_inv_id`);"; + $patch['270']['date'] = "20100419"; + + $patch['271']['name'] = "Make Simple Invoices faster - add index"; + $patch['271']['patch'] = "ALTER TABLE `".TB_PREFIX."payment` ADD INDEX(`ac_amount`);"; + $patch['271']['date'] = "20100419"; + + $patch['272']['name'] = "Add product attributes system preference"; + $patch['272']['patch'] = "INSERT INTO ".TB_PREFIX."system_defaults (id, name ,value ,domain_id ,extension_id ) VALUES (NULL , 'large_dataset', '0', '1', '1');"; + $patch['272']['date'] = "20130313"; +/* /* ALTER TABLE `si_system_defaults` ADD `new_id` INT( 11 ) NOT NULL FIRST; UPDATE `si_system_defaults` SET new_id = id; ALTER TABLE `si_system_defaults` DROP `id` ; ALTER TABLE `si_system_defaults` DROP INDEX `name` ; ALTER TABLE `si_system_defaults` CHANGE `new_id` `id` INT( 11 ) NOT NULL; ALTER TABLE `si_system_defaults` ADD PRIMARY KEY(`domain_id`,`id` ); -*/ + */ diff --git a/include/sql_queries.php b/include/sql_queries.php index 86bc56637..ee5ea7035 100644 --- a/include/sql_queries.php +++ b/include/sql_queries.php @@ -672,8 +672,32 @@ function insertProductComplete($enabled=1,$visible=1,$description, function insertProduct($enabled=1,$visible=1) { global $auth_session; + global $logger; (isset($_POST['enabled'])) ? $enabled = $_POST['enabled'] : $enabled = $enabled ; + //select all attribts + $sql = "select * from ".TB_PREFIX."products_attributes"; + $sth = dbQuery($sql); + $attributes = $sth->fetchAll(); + + $logger->log('Attr: '.var_export($attributes,true), Zend_Log::INFO); + $attr = array(); + foreach($attributes as $k=>$v) + { + $logger->log('Attr key: '.$k, Zend_Log::INFO); + $logger->log('Attr value: '.var_export($v,true), Zend_Log::INFO); + $logger->log('Attr set value: '.$k, Zend_Log::INFO); + if($_POST['attribute'.$v[id]] == 'true') + { + //$attr[$k]['attr_id'] = $v['id']; + $attr[$v['id']] = $_POST['attribute'.$v[id]]; +// $attr[$k]['a$v['id']] = $_POST['attribute'.$v[id]]; + } + + } + $logger->log('Attr array: '.var_export($attr,true), Zend_Log::INFO); + $notes_as_description = ($_POST['notes_as_description'] == 'true' ? 'Y' : NULL) ; + $show_description = ($_POST['show_description'] == 'true' ? 'Y' : NULL) ; $sql = "INSERT into ".TB_PREFIX."products @@ -690,7 +714,10 @@ function insertProduct($enabled=1,$visible=1) { notes, default_tax_id, enabled, - visible + visible, + attribute, + notes_as_description, + show_description ) VALUES ( @@ -706,7 +733,10 @@ function insertProduct($enabled=1,$visible=1) { :notes, :default_tax_id, :enabled, - :visible + :visible, + :attribute, + :notes_as_description, + :show_description )"; return dbQuery($sql, @@ -722,13 +752,33 @@ function insertProduct($enabled=1,$visible=1) { ':notes', "".$_POST['notes'], ':default_tax_id', $_POST['default_tax_id'], ':enabled', $enabled, - ':visible', $visible + ':visible', $visible, + ':attribute', json_encode($attr), + ':notes_as_description', $notes_as_description, + ':show_description', $show_description ); } function updateProduct() { + //select all attribts + $sql = "select * from ".TB_PREFIX."products_attributes"; + $sth = dbQuery($sql); + $attributes = $sth->fetchAll(); + + $attr = array(); + foreach($attributes as $k=>$v) + { + if($_POST['attribute'.$v[id]] == 'true') + { + $attr[$v['id']] = $_POST['attribute'.$v[id]]; + } + + } + $notes_as_description = ($_POST['notes_as_description'] == 'true' ? 'Y' : NULL) ; + $show_description = ($_POST['show_description'] == 'true' ? 'Y' : NULL) ; + $sql = "UPDATE ".TB_PREFIX."products SET description = :description, @@ -741,7 +791,10 @@ function updateProduct() { custom_field4 = :custom_field4, unit_price = :unit_price, cost = :cost, - reorder_level = :reorder_level + reorder_level = :reorder_level, + attribute = :attribute, + notes_as_description = :notes_as_description, + show_description = :show_description WHERE id = :id"; @@ -757,6 +810,9 @@ function updateProduct() { ':unit_price', $_POST[unit_price], ':cost', $_POST[cost], ':reorder_level', $_POST[reorder_level], + ':attribute', json_encode($attr), + ':notes_as_description', $notes_as_description, + ':show_description', $show_description, ':id', $_GET[id] ); } @@ -903,6 +959,27 @@ function getDefaultInventory() { return $delete; } +function getDefaultProductAttributes() { + global $LANG; + global $dbh; + + $sql = "SELECT value from ".TB_PREFIX."system_defaults s WHERE ( s.name = 'product_attributes')"; + $sth = dbQuery($sql) or die(htmlsafe(end($dbh->errorInfo()))); + $array = $sth->fetch(); + $delete = $array['value']==1?$LANG['enabled']:$LANG['disabled']; + return $delete; +} +function getDefaultLargeDataset() { + global $LANG; + global $dbh; + + $sql = "SELECT value from ".TB_PREFIX."system_defaults s WHERE ( s.name = 'large_dataset')"; + $sth = dbQuery($sql) or die(htmlsafe(end($dbh->errorInfo()))); + $array = $sth->fetch(); + $delete = $array['value']==1?$LANG['enabled']:$LANG['disabled']; + return $delete; +} + function getDefaultLanguage() { global $LANG; global $dbh; @@ -2007,11 +2084,22 @@ function updateInvoice($invoice_id) { ); } -function insertInvoiceItem($invoice_id,$quantity,$product_id,$line_number,$line_item_tax_id,$description="", $unit_price="") { +function insertInvoiceItem($invoice_id,$quantity,$product_id,$line_number,$line_item_tax_id,$description="", $unit_price="", $attribute="") { global $logger; global $LANG; - //do taxes + //do taxes + + $attr = array(); + $logger->log('Line item attributes: '.var_export($attribute,true), Zend_Log::INFO); + foreach($attribute as $k=>$v) + { + if($attribute[$v] !== '') + { + $attr[$k] = $v; + } + + } $tax_total = getTaxesPerLineItem($line_item_tax_id,$quantity, $unit_price); @@ -2048,7 +2136,8 @@ function insertInvoiceItem($invoice_id,$quantity,$product_id,$line_number,$line_ tax_amount, gross_total, description, - total + total, + attribute ) VALUES ( @@ -2059,7 +2148,8 @@ function insertInvoiceItem($invoice_id,$quantity,$product_id,$line_number,$line_ :tax_amount, :gross_total, :description, - :total + :total, + :attribute )"; //echo $sql; @@ -2073,7 +2163,8 @@ function insertInvoiceItem($invoice_id,$quantity,$product_id,$line_number,$line_ ':tax_amount', $tax_total, ':gross_total', $gross_total, ':description', $description, - ':total', $total + ':total', $total, + ':attribute',json_encode($attr) ); invoice_item_tax(lastInsertId(),$line_item_tax_id,$unit_price,$quantity,"insert"); @@ -2194,13 +2285,24 @@ function invoice_item_tax($invoice_item_id,$line_item_tax_id,$unit_price,$quanti //TODO fix this return true; } -function updateInvoiceItem($id,$quantity,$product_id,$line_number,$line_item_tax_id,$description,$unit_price) { +function updateInvoiceItem($id,$quantity,$product_id,$line_number,$line_item_tax_id,$description,$unit_price,$attribute="") { global $logger; global $LANG; //$product = getProduct($product_id); //$tax = getTaxRate($tax_id); + $attr = array(); + $logger->log('Line item attributes: '.var_export($attribute,true), Zend_Log::INFO); + foreach($attribute as $k=>$v) + { + if($attribute[$v] !== '') + { + $attr[$k] = $v; + } + + } + $tax_total = getTaxesPerLineItem($line_item_tax_id,$quantity, $unit_price); $logger->log('Invoice: '.$invoice_id.' Tax '.$line_item_tax_id.' for line item '.$line_number.': '.$tax_total, Zend_Log::INFO); @@ -2232,7 +2334,8 @@ function updateInvoiceItem($id,$quantity,$product_id,$line_number,$line_item_tax tax_amount = :tax_amount, gross_total = :gross_total, description = :description, - total = :total + total = :total, + attribute = :attribute WHERE id = :id"; //echo $sql; @@ -2245,6 +2348,7 @@ function updateInvoiceItem($id,$quantity,$product_id,$line_number,$line_item_tax ':gross_total', $gross_total, ':description', $description, ':total', $total, + ':attribute',json_encode($attr), ':id', $id ); diff --git a/lang/en_GB/lang.php b/lang/en_GB/lang.php index d6826d53c..a794056f3 100644 --- a/lang/en_GB/lang.php +++ b/lang/en_GB/lang.php @@ -124,6 +124,7 @@ $LANG['debtors_by_aging_periods'] = "Debtors by Aging periods";//1 $LANG['debtors_by_amount_owed'] = "Debtors by amount owed";//1 $LANG['debtors_by_amount_owing_customer'] = "Debtors by Amount Owing per Customer";//1 +$LANG['decimal'] = "Decimal";//1 $LANG['default_biller'] = "Default Biller";//1 $LANG['default_customer'] = "Default Customer";//1 $LANG['default_inv_template'] = "Default Invoice Template ";//1 @@ -187,6 +188,7 @@ $LANG['format_tooltip'] = "format";//1 $LANG['for'] = "for";//1 $LANG['forum'] = "Forum";//1 +$LANG['free'] = "Free";//1 $LANG['from'] = "From";//1 $LANG['fwrite_error'] = "Did you get fwrite errors?";//1 $LANG['get_help'] = "Get Help";//1 @@ -230,10 +232,10 @@ $LANG['help_invoice_create'] = "Creating invoices is easy. Once a biller and customer have been entered into Simple Invoices all you need to do is select an invoice type from the 'Invoice +' menu, fill in the details and click 'Save Invoice'.";//1 $LANG['help_invoice_custom_fields'] = "Need more fields in the invoice screen? Want your own fields like 'Purchase Order', 'Project name' etc..

Simple Invoices allows you to add whatever fields you want into the invoices. These are called 'custom fields', to edit or setup your own fields select Custom Fields from the Options menu.";//1 $LANG['help_invoice_types'] = "In Simple Invoices there are 2 types of invoices available

-An Itemised Invoice is an invoice that list many different items in the same invoice, with optional notes area for each line item - think accounting/legal firms or a grocery store invoice. -

-A Total Invoice is an invoice that - think an invoice from a plumber that lists the actions and then has one price and the tax associated. -";//1 + An Itemised Invoice is an invoice that list many different items in the same invoice, with optional notes area for each line item - think accounting/legal firms or a grocery store invoice. +

+ A Total Invoice is an invoice that - think an invoice from a plumber that lists the actions and then has one price and the tax associated. + ";//1 $LANG['help_logging'] = "To log actions performed in Simple Invoices enable this option. This creates a log in the database of what actions were performed.

Note: At the moment the only way to view the log is in the database, soon we'll incorparte a nice log viewer into Simple Invoices.";//1 $LANG['help_manage_custom_fields'] = "Custom Fields are special fields that you can label as whatever you need.

This page allows you to define up to 4 custom fields for each of the following: products, customers, billers, and invoices.

Once you define a label of one of the fields, this field will become available for use. Ie. if you edit 'Invoice :: Custom field 1' and set the label as 'Project name', the next time you create an invoice there'll be a new field in the invoice screen called 'Project name'";//1 $LANG['help_mysql4'] = "As you are using MySQL 4 or below as your database server some features of Simple Invoices have been disabled. Some sql queries in Simple Invoices have taken advantage of new features in MySQL 5, so things like the quick reports here on the start page, some debtors reports and a few other features of Simple Invoices have been disabled.";//1 @@ -297,7 +299,9 @@ $LANG['itemised'] = "Itemised";//1 $LANG['itemised_style'] = "Itemised style";//1 $LANG['language'] = "Language";//1 +$LANG['large_dataset'] = "Large dataset";//1 $LANG['license'] = "License";//1 +$LANG['list'] = "List";//1 $LANG['loading'] = "Loading";//1 $LANG['locale'] = "Locale";//1 $LANG['logging'] = "Logging";//1 @@ -355,6 +359,9 @@ $LANG['no_users'] = "There have been no users created. Click the 'Add User' button above to create one";//1 $LANG['none'] = "none";//1 $LANG['note'] = "Note";//1 +$LANG['note_attributes'] = "Note Attributes";//1 +$LANG['note_as_description'] = "Use note as line item description";//1 +$LANG['note_expand'] = "Show line item description by default";//1 $LANG['notes'] = "Notes";//1 $LANG['notes_opt'] = "Notes (optional)";//1 $LANG['number_of_taxes_per_line_item'] = "Number of taxes per line item";//1 @@ -413,6 +420,7 @@ $LANG['process_payment_via_eway'] = "Process Payment via Eway";//1 $LANG['processing'] = "Processing, please wait ...";//1 $LANG['product'] = "Product";//1 +$LANG['product_attributes'] = "Product Attributes";//1 $LANG['product_description'] = "Product Description";//1 $LANG['product_edit'] = "Edit Product";//1 $LANG['product_enabled'] = "Product Enabled";//1 @@ -420,6 +428,7 @@ $LANG['product_sales'] = "Product Sales";//1 $LANG['product_to_add'] = "Product to add";//1 $LANG['product_unit_price'] = "Product Unit Price";//1 +$LANG['product_values'] = "Product Values";//1 $LANG['products'] = "Products";//1 $LANG['products_by_customer'] = "Products by Customer";//1 $LANG['products_sold_customer_total'] = "Products Sold - Customer - Total";//1 @@ -558,12 +567,14 @@ $LANG['type'] = "Type";//1 $LANG['Unit_Cost'] = "Unit Cost";//1 $LANG['unit_price'] = "Unit Price";//1 +$LANG['unpaid_invoices'] = "Unpaid Invoices";//1 $LANG['upgrading_simple_invoices'] = "Upgrading Simple Invoices";//1 $LANG['user_add'] = "Add User";//1 $LANG['users'] = "Users";//1 $LANG['using_simple_invoices'] = "Using Simple Invoices";//1 $LANG['value'] = "Value";//1 $LANG['view'] = "View";//1 +$LANG['visible'] = "Visible";//1 $LANG['want_more_fields'] = "Want more fields";//1 $LANG['warning_eway'] = "Note: You are about to charge your customers credit card
- make sure you know what you're doing!!"; $LANG['weeks'] = "weeks";//1 diff --git a/modules/customers/details.php b/modules/customers/details.php index 3216fd8a4..9f2f4000d 100755 --- a/modules/customers/details.php +++ b/modules/customers/details.php @@ -42,10 +42,34 @@ $customFieldLabel = getCustomFieldLabels(); $invoices = getCustomerInvoices($customer_id); +//$start = (isset($_POST['start'])) ? $_POST['start'] : "0" ; +$dir = "DESC" ; +$sort = "id" ; +$rp = (isset($_POST['rp'])) ? $_POST['rp'] : "25" ; +$having = 'money_owed' ; +$page = (isset($_POST['page'])) ? $_POST['page'] : "1" ; + +//$sql = "SELECT * FROM ".TB_PREFIX."invoices LIMIT $start, $limit"; +$invoice_owing = new invoice(); +$invoice_owing->sort=$sort; +$invoice_owing->query=$_REQUEST['query']; +$invoice_owing->qtype=$_REQUEST['qtype']; + +$large_dataset = getDefaultLargeDataset(); +if($large_dataset == $LANG['enabled']) +{ + $sth = $invoice_owing->select_all('large_count', $dir, $rp, $page, $having); +} else { + $sth = $invoice_owing->select_all('', $dir, $rp, $page, $having); + +} +$invoices_owing = $sth->fetchAll(PDO::FETCH_ASSOC); + //$customFieldLabel = getCustomFieldLabels("biller"); $smarty -> assign("stuff",$stuff); $smarty -> assign('customer',$customer); $smarty -> assign('invoices',$invoices); +$smarty -> assign('invoices_owing',$invoices_owing); $smarty -> assign('customFieldLabel',$customFieldLabel); $smarty -> assign('pageActive', 'customer'); diff --git a/modules/install/essential.php b/modules/install/essential.php index 828d18e24..b37c1894e 100644 --- a/modules/install/essential.php +++ b/modules/install/essential.php @@ -8,7 +8,7 @@ //JSON import $importjson = new importjson(); $importjson->file = "./databases/json/essential_data.json"; - //$importjson->debug = true; + //$importjson->debug = true; $importjson->pattern_find = array('si_','DOMAIN-ID','LOCALE','LANGUAGE'); $importjson->pattern_replace = array(TB_PREFIX,'1','en_GB','en_GB'); //dbQuery($importjson->collate()); diff --git a/modules/invoices/details.php b/modules/invoices/details.php index 243e16527..8da6fb5de 100755 --- a/modules/invoices/details.php +++ b/modules/invoices/details.php @@ -31,9 +31,95 @@ for($i=1;$i<=4;$i++) { - $customFields[$i] = show_custom_field("invoice_cf$i",$invoice["custom_field$i"],"write",'',"details_screen",'','',''); + $customFields[$i] = show_custom_field("invoice_cf$i",$invoice["custom_field$i"],"write",'',"details_screen",'','',''); } +foreach($invoiceItems as $key=>$value) +{ + //get list of attributes + $prod = getProduct($value['product_id']); + $json_att = json_decode($prod['attribute']); + if($json_att !== null) + { + $html =""; + foreach($json_att as $k=>$v) + { + if($v == 'true') + { + $attr_name_sql = sprintf('select + a.name as name, a.enabled as enabled, t.name type + from + si_products_attributes as a, + si_products_attribute_type as t + where + a.type_id = t.id + AND a.id = %d', $k); + $attr_name = dbQuery($attr_name_sql); + $attr_name = $attr_name->fetch(); + + $sql2 = sprintf('select + a.name as name, + v.id as id, + v.value as value, + v.enabled as enabled + from + si_products_attributes a, + si_products_values v + where + a.id = v.attribute_id + AND a.id = %d', $k); + $states2 = dbQuery($sql2); + + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'list') + { + $html .= ""; + } + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'free' ) + { + $attribute_value =''; + foreach ($value['attribute_decode'] as $a_key => $a_value) + { + if($k == $a_key){ $attribute_value = $a_value;} + } + $html .= ""; + } + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'decimal' ) + { + $attribute_value =''; + foreach ($value['attribute_decode'] as $a_key => $a_value) + { + if($k == $a_key){ $attribute_value = $a_value;} + } + $html .= ""; + } + } + } + $html .= "
".$attr_name['name']."".$attr_name['name']."".$attr_name['name']."
"; + $invoiceItems[$key]['html'] = $html; + } +} + +//var_dump($invoiceItems); $smarty -> assign("invoice",$invoice); $smarty -> assign("defaults",$defaults); $smarty -> assign("invoiceItems",$invoiceItems); diff --git a/modules/invoices/invoice.php b/modules/invoices/invoice.php index 097dffcd8..0bc470c03 100755 --- a/modules/invoices/invoice.php +++ b/modules/invoices/invoice.php @@ -49,6 +49,16 @@ $show_custom_field[$i] = show_custom_field("invoice_cf$i",'',"write",'',"details_screen",'','',''); } +$sql = "select CONCAT(a.id, '-', v.id) as id, CONCAT(a.name, '-',v.value) as display from ".TB_PREFIX."products_attributes a, ".TB_PREFIX."products_values v where a.id = v.attribute_id;"; +$sth = dbQuery($sql); +$matrix = $sth->fetchAll(); +$smarty -> assign("matrix", $matrix); + +$sql_prod = "select product_id as PID, (select count(product_id) from ".TB_PREFIX."products_matrix where product_id = PID ) as count from ".TB_PREFIX."products_matrix ORDER BY count desc LIMIT 1;"; +$sth_prod = dbQuery($sql_prod); +$number_of_products = $sth_prod->fetchAll(); + +$smarty -> assign("number_of_attributes", $number_of_products['0']['count']); $smarty -> assign("billers",$billers); $smarty -> assign("customers",$customers); $smarty -> assign("taxes",$taxes); diff --git a/modules/invoices/product_ajax.php b/modules/invoices/product_ajax.php index 05c1e5bd3..4f61295a4 100644 --- a/modules/invoices/product_ajax.php +++ b/modules/invoices/product_ajax.php @@ -1,27 +1,79 @@ rowCount() > 0) { $row = $states->fetch(); + $json_att = json_decode($row['attribute']); + if($json_att !== null) + { + $html =""; + foreach($json_att as $k=>$v) + { + if($v == 'true') + { + $attr_name_sql = sprintf('select + a.name as name, a.enabled as enabled, t.name type + from + si_products_attributes as a, + si_products_attribute_type as t + where + a.type_id = t.id + AND a.id = %d', $k); + $attr_name = dbQuery($attr_name_sql); + $attr_name = $attr_name->fetch(); + + $sql2 = sprintf('select a.name as name, v.id as id, v.value as value, v.enabled as enabled from si_products_attributes a, si_products_values v where a.id = v.attribute_id AND a.id = %d', $k); + $states2 = dbQuery($sql2); + + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'list') + { + $html .= ""; + } + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'free' ) + { + $html .= ""; + } + if($attr_name['enabled'] =='1' AND $attr_name['type'] == 'decimal' ) + { + $html .= ""; + } + } + } + $html .= "
".$attr_name['name']."".$attr_name['name']."".$attr_name['name']."
"; + } // print_r($row); // $output .= ''; /*Format with decimal places with precision as defined in config.ini*/ $output['unit_price'] = siLocal::number_clean($row['unit_price']); $output['default_tax_id'] = $row['default_tax_id']; $output['default_tax_id_2'] = $row['default_tax_id_2']; + $output['attribute'] = $row['attribute']; + $output['json_attribute'] = $json_att; + $output['json_html'] = $html; + $output['notes'] = $row['notes']; + $output['notes_as_description'] = $row['notes_as_description']; + $output['show_description'] = $row['show_description']; // $output .= $_POST['id']; - } - else - { + }else { $output .= ''; } diff --git a/modules/invoices/quick_view.php b/modules/invoices/quick_view.php index c658bb4fb..3adab1a77 100755 --- a/modules/invoices/quick_view.php +++ b/modules/invoices/quick_view.php @@ -57,6 +57,10 @@ } +$sql = "select * from ".TB_PREFIX."products_attributes"; +$sth = dbQuery($sql); +$attributes = $sth->fetchAll(); +$smarty -> assign("attributes", $attributes); //Customer accounts sections $customerAccount = null; $customerAccount['total'] = calc_customer_total($customer['id']); diff --git a/modules/invoices/save.php b/modules/invoices/save.php index 2a08cdb6e..e0b8bbfe3 100755 --- a/modules/invoices/save.php +++ b/modules/invoices/save.php @@ -65,7 +65,7 @@ if($_POST["quantity$i"] != null) { if ( - insertInvoiceItem($id,$_POST["quantity$i"],$_POST["products$i"],$i,$_POST["tax_id"][$i],$_POST["description$i"], $_POST["unit_price$i"] ) + insertInvoiceItem($id,$_POST["quantity$i"],$_POST["products$i"],$i,$_POST["tax_id"][$i],$_POST["description$i"], $_POST["unit_price$i"],$_POST["attribute"][$i] ) ) { // insert_invoice_item_tax(lastInsertId(), ) @@ -122,12 +122,12 @@ //new line item added in edit page if($_POST["line_item$i"] == "") { - insertInvoiceItem($id,$_POST["quantity$i"],$_POST["products$i"],$i,$_POST["tax_id"][$i],$_POST["description$i"], $_POST["unit_price$i"]); + insertInvoiceItem($id,$_POST["quantity$i"],$_POST["products$i"],$i,$_POST["tax_id"][$i],$_POST["description$i"], $_POST["unit_price$i"],$_POST["attribute"][$i]); } if($_POST["line_item$i"] != "") { - updateInvoiceItem($_POST["line_item$i"],$_POST["quantity$i"],$_POST["products$i"],$i,$_POST['tax_id'][$i],$_POST["description$i"],$_POST["unit_price$i"]); + updateInvoiceItem($_POST["line_item$i"],$_POST["quantity$i"],$_POST["products$i"],$i,$_POST['tax_id'][$i],$_POST["description$i"],$_POST["unit_price$i"],$_POST["attribute"][$i]); $saved; //$saved = true; /* diff --git a/modules/invoices/xml.php b/modules/invoices/xml.php index 631111de8..702b5bf82 100644 --- a/modules/invoices/xml.php +++ b/modules/invoices/xml.php @@ -15,17 +15,25 @@ $invoice->query=$_REQUEST['query']; $invoice->qtype=$_REQUEST['qtype']; $invoice->sort=$sort; -$sth = $invoice->select_all('', $dir, $rp, $page, $having); -$sth_count_rows = $invoice->select_all('count',$dir, $rp, $page, $having); - +$large_dataset = getDefaultLargeDataset(); +if($large_dataset == $LANG['enabled']) +{ + $sth = $invoice->select_all('large', $dir, $rp, $page, $having); + $sth_count_rows = invoice::count(); + $invoice_count = $sth_count_rows->fetch(PDO::FETCH_ASSOC); + $invoice_count = $invoice_count['count']; +} else { + $sth = $invoice->select_all('', $dir, $rp, $page, $having); + $sth_count_rows = $invoice->select_all('count',$dir, $rp, $page, $having); + $invoices_count = $sth_count_rows->rowCount(); + +} $invoices = $sth->fetchAll(PDO::FETCH_ASSOC); $xml =""; -$count = $sth_count_rows->rowCount(); - $xml .= ""; $xml .= "$page"; - $xml .= "$count"; + $xml .= "". $invoice_count .""; foreach ($invoices as $row) { $xml .= ""; diff --git a/modules/product_attribute/add.php b/modules/product_attribute/add.php new file mode 100755 index 000000000..b0f07d519 --- /dev/null +++ b/modules/product_attribute/add.php @@ -0,0 +1,24 @@ +fetchAll(PDO::FETCH_ASSOC); + +$smarty -> assign("types", $types); + +$smarty->assign('pageActive', $pageActive); +$smarty -> assign('save',$save); + + + +?> diff --git a/modules/product_attribute/details.php b/modules/product_attribute/details.php new file mode 100755 index 000000000..a6cdca642 --- /dev/null +++ b/modules/product_attribute/details.php @@ -0,0 +1,32 @@ +fetch(); +$type = product_attributes::get($id); +$product_attribute['type'] = $type['type']; + +$sql2= "select id, name from ".TB_PREFIX."products_attribute_type"; +$sth2 = dbQuery($sql2); +$types = $sth2->fetchAll(PDO::FETCH_ASSOC); + +$smarty -> assign("types", $types); + + +$product_attribute['wording_for_enabled'] = $product_attribute['enabled']==1?$LANG['enabled']:$LANG['disabled']; +$product_attribute['wording_for_visible'] = $product_attribute['visible']==1?$LANG['enabled']:$LANG['disabled']; +$pageActive = "options"; +$smarty->assign('pageActive', $pageActive); +$smarty->assign('product_attribute',$product_attribute); + +?> diff --git a/modules/product_attribute/manage.js.php b/modules/product_attribute/manage.js.php new file mode 100644 index 000000000..9c9ebf45b --- /dev/null +++ b/modules/product_attribute/manage.js.php @@ -0,0 +1,40 @@ + diff --git a/modules/product_attribute/manage.php b/modules/product_attribute/manage.php new file mode 100755 index 000000000..4742af60f --- /dev/null +++ b/modules/product_attribute/manage.php @@ -0,0 +1,11 @@ +assign('pageActive', $pageActive); + + + +?> diff --git a/modules/product_attribute/save.php b/modules/product_attribute/save.php new file mode 100755 index 000000000..cf71b30dd --- /dev/null +++ b/modules/product_attribute/save.php @@ -0,0 +1,87 @@ +"; + +} + +#edit preference + +else if ( $op === 'edit_product_attribute' ) { + + if (isset($_POST['save_product_attribute'])) { + $sql = "UPDATE + ".TB_PREFIX."products_attributes + SET + name = :name, + type_id = :type_id, + enabled = :enabled, + visible = :visible + WHERE + id = :id"; + + if (dbQuery($sql, + ':name', $_POST['name'], + ':type_id', $_POST['type_id'], + ':enabled', $_POST['enabled'], + ':visible', $_POST['visible'], + ':id', $_GET['id'])) + { + $display_block = "Successfully saved"; + } else { + $display_block = "Error occurred with saving"; + } + + $refresh_total = ""; + + } + + else if ($_POST[action] == "Cancel") { + + //header( 'refresh: 0; url=manage_preferences.php' ); + $refresh_total = ""; + } +} + + +$refresh_total = isset($refresh_total) ? $refresh_total : ' '; + +$pageActive = "options"; +$smarty->assign('pageActive', $pageActive); + +$smarty -> assign('display_block',$display_block); +$smarty -> assign('refresh_total',$refresh_total); +?> diff --git a/modules/product_attribute/xml.php b/modules/product_attribute/xml.php new file mode 100644 index 000000000..f9e4eb4aa --- /dev/null +++ b/modules/product_attribute/xml.php @@ -0,0 +1,110 @@ +errorInfo()))); + $customers = $sth->fetchAll(PDO::FETCH_ASSOC); +/* + $customers = null; + + for($i=0; $customer = $sth->fetch(PDO::FETCH_ASSOC); $i++) { + if ($customer['enabled'] == 1) { + $customer['enabled'] = $LANG['enabled']; + } else { + $customer['enabled'] = $LANG['disabled']; + } +*/ +global $dbh; + +$sqlTotal = "SELECT count(id) AS count FROM ".TB_PREFIX."products_attributes"; +$tth = dbQuery($sqlTotal) or die(end($dbh->errorInfo())); +$resultCount = $tth->fetch(); +$count = $resultCount[0]; +//echo sql2xml($customers, $count); +$xml .= ""; + +$xml .= "$page"; + +$xml .= "$count"; + +foreach ($customers as $row) { + + $xml .= ""; + $xml .= "View :: Edit]]>"; + $xml .= ""; + $xml .= ""; + if ($row['enabled']=='1') { + $xml .= "]]>"; + } + else { + $xml .= "]]>"; + } + if ($row['visible']=='1') { + $xml .= "]]>"; + } + else { + $xml .= "]]>"; + } + + + $xml .= ""; + +} + + + +$xml .= ""; + +echo $xml; + +?> diff --git a/modules/product_value/add.php b/modules/product_value/add.php new file mode 100755 index 000000000..6514c211f --- /dev/null +++ b/modules/product_value/add.php @@ -0,0 +1,21 @@ +assign('pageActive', $pageActive); +$smarty -> assign('save',$save); + +$sql = "select * from ".TB_PREFIX."products_attributes"; +$sth = dbQuery($sql); +$product_attributes = $sth->fetchAll(); +$smarty -> assign("product_attributes", $product_attributes); + +?> diff --git a/modules/product_value/details.php b/modules/product_value/details.php new file mode 100755 index 000000000..9f039647d --- /dev/null +++ b/modules/product_value/details.php @@ -0,0 +1,32 @@ +fetch(); +$smarty -> assign("product_value", $product_value); + +$sql_attr_sel = "select * from ".TB_PREFIX."products_attributes where id = ".$product_value['id']; +$sth_attr_sel = dbQuery($sql_attr_sel); +$product_attribute = $sth_attr_sel->fetch(); +$smarty -> assign("product_attribute", $product_attribute['name']); + + +$pageActive = "options"; +$smarty->assign('pageActive', $pageActive); +$smarty->assign('preference',$preference); + +$sql_attr = "select * from ".TB_PREFIX."products_attributes"; +$sth_attr = dbquery($sql_attr); +$product_attributes = $sth_attr->fetchall(); +$smarty -> assign("product_attributes", $product_attributes); +?> diff --git a/modules/product_value/manage.js.php b/modules/product_value/manage.js.php new file mode 100644 index 000000000..bd597a195 --- /dev/null +++ b/modules/product_value/manage.js.php @@ -0,0 +1,40 @@ + diff --git a/modules/product_value/manage.php b/modules/product_value/manage.php new file mode 100755 index 000000000..4742af60f --- /dev/null +++ b/modules/product_value/manage.php @@ -0,0 +1,11 @@ +assign('pageActive', $pageActive); + + + +?> diff --git a/modules/product_value/save.php b/modules/product_value/save.php new file mode 100755 index 000000000..8a0670cda --- /dev/null +++ b/modules/product_value/save.php @@ -0,0 +1,78 @@ +"; + +} + +#edit preference + +if ( $op === 'edit_product_value' ) { + + if (isset($_POST['save_product_value'])) { + $sql = "UPDATE + ".TB_PREFIX."products_values + SET + attribute_id = :attribute_id, + value = :value, + enabled = :enabled + WHERE + id = :id"; + + if (dbQuery($sql, + ':attribute_id', $_POST['attribute_id'], + ':value', $_POST['value'], + ':enabled', $_POST['enabled'], + ':id', $_GET['id'])) + { + $display_block = "Successfully saved"; + } else { + $display_block = "Error occurred with saving"; + } + + //header( 'refresh: 2; url=manage_preferences.php' ); + $refresh_total = ""; + + } +} + + +$refresh_total = isset($refresh_total) ? $refresh_total : ' '; + +$pageActive = "options"; +$smarty->assign('pageActive', $pageActive); + +$smarty -> assign('display_block',$display_block); +$smarty -> assign('refresh_total',$refresh_total); +?> diff --git a/modules/product_value/xml.php b/modules/product_value/xml.php new file mode 100644 index 000000000..865a8df5b --- /dev/null +++ b/modules/product_value/xml.php @@ -0,0 +1,110 @@ +errorInfo()))); + $customers = $sth->fetchAll(PDO::FETCH_ASSOC); +/* + $customers = null; + + for($i=0; $customer = $sth->fetch(PDO::FETCH_ASSOC); $i++) { + if ($customer['enabled'] == 1) { + $customer['enabled'] = $LANG['enabled']; + } else { + $customer['enabled'] = $LANG['disabled']; + } +*/ +global $dbh; + +$sqlTotal = "SELECT count(id) AS count FROM ".TB_PREFIX."products_values"; +$tth = dbQuery($sqlTotal) or die(end($dbh->errorInfo())); +$resultCount = $tth->fetch(); +$count = $resultCount[0]; +//echo sql2xml($customers, $count); +$xml .= ""; + +$xml .= "$page"; + +$xml .= "$count"; + +foreach ($customers as $row) { + + $xml .= ""; + + $xml .= "View :: Edit]]>"; + + $xml .= ""; + + $xml .= ""; + $xml .= ""; + if ($row['enabled']=='1') { + $xml .= "]]>"; + } + else { + $xml .= "]]>"; + } + + + $xml .= ""; + +} + + + +$xml .= ""; + +echo $xml; + +?> diff --git a/modules/products/add.php b/modules/products/add.php index 3cc5cdcf8..62f486d92 100755 --- a/modules/products/add.php +++ b/modules/products/add.php @@ -16,6 +16,11 @@ $smarty -> assign('save',$save); $smarty -> assign('taxes',$taxes); +$sql = "select * from ".TB_PREFIX."products_attributes where enabled ='1'"; +$sth = dbQuery($sql); +$attributes = $sth->fetchAll(); + +$smarty -> assign("attributes", $attributes); $smarty -> assign('pageActive', 'product_add'); $smarty -> assign('active_tab', '#product'); ?> diff --git a/modules/products/details.php b/modules/products/details.php index c106560a9..33ef82f56 100755 --- a/modules/products/details.php +++ b/modules/products/details.php @@ -13,11 +13,17 @@ $tax_selected = getTaxRate($product['default_tax_id']); $smarty -> assign("defaults",getSystemDefaults()); +$product['attribute_decode'] = json_decode($product['attribute'],true); $smarty -> assign('product',$product); $smarty -> assign('taxes',$taxes); $smarty -> assign('tax_selected',$tax_selected); $smarty -> assign('customFieldLabel',$customFieldLabel); +$sql = "select * from ".TB_PREFIX."products_attributes"; +$sth = dbQuery($sql); +$attributes = $sth->fetchAll(); +$smarty -> assign("attributes", $attributes); + $smarty -> assign('pageActive', 'product_manage'); $subPageActive = $_GET['action'] =="view" ? "product_view" : "product_edit" ; $smarty -> assign('subPageActive', $subPageActive); diff --git a/modules/system_defaults/edit.php b/modules/system_defaults/edit.php index 0466b744f..c9b8d9f93 100755 --- a/modules/system_defaults/edit.php +++ b/modules/system_defaults/edit.php @@ -294,6 +294,20 @@ $description = $LANG['inventory']; $value = dropDown($array, $defaults[$default]); } +else if ($_GET['submit'] == "product_attributes") { + + $array = array(0 => $LANG['disabled'], 1=>$LANG['enabled']); + $default = "product_attributes"; + $description = $LANG['product_attributes']; + $value = dropDown($array, $defaults[$default]); +} +else if ($_GET['submit'] == "large_dataset") { + + $array = array(0 => $LANG['disabled'], 1=>$LANG['enabled']); + $default = "large_dataset"; + $description = $LANG['large_dataset']; + $value = dropDown($array, $defaults[$default]); +} else { $description = "{$LANG['no_defaults']}"; } diff --git a/modules/system_defaults/manage.php b/modules/system_defaults/manage.php index 25b548046..68398fc1f 100755 --- a/modules/system_defaults/manage.php +++ b/modules/system_defaults/manage.php @@ -23,6 +23,8 @@ $smarty -> assign("defaultDelete", getDefaultDelete()); $smarty -> assign("defaultLogging", getDefaultLogging()); $smarty -> assign("defaultInventory", getDefaultInventory()); +$smarty -> assign("defaultProductAttributes", getDefaultProductAttributes()); +$smarty -> assign("defaultLargeDataset", getDefaultLargeDataset()); $smarty -> assign("defaultLanguage", $lang); $smarty -> assign('pageActive', 'system_default'); diff --git a/templates/default/css/main.css b/templates/default/css/main.css index 1abe45f0a..100e9f659 100644 --- a/templates/default/css/main.css +++ b/templates/default/css/main.css @@ -856,7 +856,6 @@ A.cluetip:hover IMG{ .si_form{ display: block; margin: 20px auto; - width: 650px; overflow: hidden; } #si_form_cron{ @@ -867,11 +866,11 @@ A.cluetip:hover IMG{ margin: 0 auto; } .si_form_view TABLE{ - border: 1px solid #ddd; + /*border: 1px solid #ddd;*/ } .si_form_view{ - padding: 10px 5px; + /*padding: 10px 5px;*/ } .si_form TH, @@ -880,7 +879,7 @@ A.cluetip:hover IMG{ border-bottom: 1px dotted #ddd; } .si_form TBODY TH{ - text-align: right; + text-align: left; white-space: nowrap; font-weight: normal; color: #777; @@ -889,6 +888,9 @@ A.cluetip:hover IMG{ vertical-align: top; line-height: 26px; } +.si_form TBODY TH.product_attribute{ + text-align:left; +} .si_form H4{ font-size: 12px; color: #666; @@ -920,21 +922,20 @@ A.cluetip:hover IMG{ } .si_cust_account{ - float: right; width: 300px; } .si_cust_invoices TABLE, .si_cust_account TABLE{ - margin: 0; + margin-top:10px; } .si_cust_card{ - float: right; width: 300px; - margin-top: 20px; + margin-top: 10px; } .si_cust_info{ float: left; - margin-right: 10px; + width:100%; + margin-bottom:20px; } .si_clear{ clear: both; @@ -944,7 +945,7 @@ A.cluetip:hover IMG{ } .si_cust_invoices TH, .si_cust_invoices TD{ - text-align: right; + text-align: left; padding-left: 30px; padding-right: 5px; } @@ -956,7 +957,7 @@ A.cluetip:hover IMG{ padding-bottom: 6px; border-top: 1px solid #DDD; border-bottom: 0px; - text-align: center; + text-align: left; vertical-align: middle; } .si_cust_invoices TD{ @@ -965,6 +966,9 @@ A.cluetip:hover IMG{ .si_cust_invoices TH.first{ border-left: none; } +.si_cust_invoices TABLE{ + width:100%; +} /* @end */ @@ -1354,6 +1358,13 @@ A.cluetip:hover IMG{ color: #666; text-align: center; } +TD.si_product_attribute , .si_product_attribute TD +{ + padding-right: 15px; + color: #666; + border-top:none; + font-size: 11px; +} /* @end */ @@ -1517,11 +1528,46 @@ padding-left;0px; padding-top: 4px; padding-bottom: 4px; } - #tabs_customer { border-bottom: 0px #efefef solid; -}*/ +} + +*/ + + +#tabs_customer .anchors a +{ + background-color:#fff; + margin-top:2px; + padding-top:6px; + padding-left;0px; +} +#tabs_customer .ui-tabs-panel a +{ + float:none; + background:#fff; + padding:0; + margin:0; +} +#tabs_customer .ui-tabs-panel +{ + color:#333333; + border-top: 1px #efefef solid; +} +#tabs_customer .anchors .ui-tabs-selected a +{ + background-color:#E9E9DA; + padding-left:12px; + padding-right:12px; + padding-top:4px; + padding-bottom:4px; +} + +#tabs_customer +{ + border-bottom: 0px #efefef solid; +} .ui-wrapper { border: 1px solid #50A029; @@ -1531,6 +1577,9 @@ padding-left;0px; border: 0; } +.ui-tabs-panel { +/* padding-top:10px;*/ +} .ui-tabs-hide { display: none; } @@ -1566,6 +1615,7 @@ padding-left;0px; margin: 0; padding: 0 0 0 4px; padding-left:20px; + padding-right:20px; } .ui-tabs-nav:after { diff --git a/templates/default/customers/details.tpl b/templates/default/customers/details.tpl index 1715e997e..19398d476 100644 --- a/templates/default/customers/details.tpl +++ b/templates/default/customers/details.tpl @@ -1 +1,402 @@ -{* /* * Script: details.tpl * Customer details template * * License: * GPL v3 or above * * Website: * http://www.simpleinvoices.org */ *} {if $smarty.get.action == 'view' }

{$LANG.customer_details}

{$LANG.customer_name} {$customer.name} {$LANG.phone} {$customer.phone|htmlsafe}
{$LANG.attention_short} {$customer.attention|htmlsafe} {$LANG.mobile_phone} {$customer.mobile_phone|htmlsafe}
{$LANG.street} {$customer.street_address|htmlsafe} {$LANG.fax} {$customer.fax|htmlsafe}
{$LANG.street2} {$customer.street_address2|htmlsafe} {$LANG.email} {$customer.email|htmlsafe}
{$LANG.city} {$customer.city|htmlsafe}
{$LANG.zip} {$customer.zip_code|htmlsafe} {$customFieldLabel.customer_cf1} {$customer.custom_field1|htmlsafe}
{$LANG.state} {$customer.state|htmlsafe} {$customFieldLabel.customer_cf2} {$customer.custom_field2|htmlsafe}
{$LANG.country} {$customer.country|htmlsafe} {$customFieldLabel.customer_cf3} {$customer.custom_field3|htmlsafe}
{$LANG.enabled} {$customer.wording_for_enabled|htmlsafe} {$customFieldLabel.customer_cf4} {$customer.custom_field4|htmlsafe}

{$LANG.credit_card_details}

{$LANG.credit_card_holder_name} {$customer.credit_card_holder_name|htmlsafe}
{$LANG.credit_card_number} {$customer.credit_card_number|regex_replace:'/^............/':"************"|htmlsafe}
{$LANG.credit_card_expiry_month} {$customer.credit_card_expiry_month|htmlsafe}
{$LANG.credit_card_expiry_year} {$customer.credit_card_expiry_year|htmlsafe}

{$LANG.notes}

{$customer.notes|outhtml}

{$LANG.invoice_listings}

{foreach from=$invoices item=invoice} {/foreach}
{$LANG.id} {$LANG.date_created} {$LANG.total} {$LANG.paid} {$LANG.owing}
{$invoice.index_id|htmlsafe} {$invoice.date|htmlsafe} {$invoice.total|number_format:2} {$invoice.paid|number_format:2} {$invoice.owing|number_format:2}
{/if} {* ##################################################################################################### *} {if $smarty.get.action == 'edit' }
{* {showCustomFields categorieId="2" itemId=$smarty.get.customer } *}
{$LANG.customer_name}
{$LANG.attention_short}
{$LANG.street}
{$LANG.street2}
{$LANG.city}
{$LANG.zip}
{$LANG.state}
{$LANG.country}
{$LANG.phone}
{$LANG.mobile_phone}
{$LANG.fax}
{$LANG.email}
{$LANG.credit_card_holder_name}
{$LANG.credit_card_number} {$LANG.credit_card_number_encrypted}
{$LANG.credit_card_number_new}
{$LANG.credit_card_expiry_month}
{$LANG.credit_card_expiry_year}
{$customFieldLabel.customer_cf1|htmlsafe}
{$customFieldLabel.customer_cf2|htmlsafe}
{$customFieldLabel.customer_cf3|htmlsafe}
{$customFieldLabel.customer_cf4|htmlsafe}
{$LANG.notes}
{$LANG.enabled} {html_options name=enabled options=$enabled selected=$customer.enabled}
{$LANG.cancel}
{/if} \ No newline at end of file +{* +/* +* Script: details.tpl +* Customer details template +* +* License: +* GPL v3 or above +* +* Website: +* http://www.simpleinvoices.org +*/ +*} + +{if $smarty.get.action == 'view' } +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$LANG.customer_name}{$customer.name}{$LANG.phone}{$customer.phone|htmlsafe}
{$LANG.attention_short}{$customer.attention|htmlsafe}{$LANG.mobile_phone}{$customer.mobile_phone|htmlsafe}
{$LANG.street}{$customer.street_address|htmlsafe}{$LANG.fax}{$customer.fax|htmlsafe}
{$LANG.street2}{$customer.street_address2|htmlsafe}{$LANG.email}{$customer.email|htmlsafe}
{$LANG.city}{$customer.city|htmlsafe}
{$LANG.zip}{$customer.zip_code|htmlsafe}{$customFieldLabel.customer_cf1}{$customer.custom_field1|htmlsafe}
{$LANG.state}{$customer.state|htmlsafe}{$customFieldLabel.customer_cf2}{$customer.custom_field2|htmlsafe}
{$LANG.country}{$customer.country|htmlsafe}{$customFieldLabel.customer_cf3}{$customer.custom_field3|htmlsafe}
{$LANG.enabled}{$customer.wording_for_enabled|htmlsafe}{$customFieldLabel.customer_cf4}{$customer.custom_field4|htmlsafe}
+
+ +
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + +
{$LANG.credit_card_holder_name}{$customer.credit_card_holder_name|htmlsafe}
{$LANG.credit_card_number}{$customer.credit_card_number|regex_replace:'/^............/':"************"|htmlsafe}
{$LANG.credit_card_expiry_month}{$customer.credit_card_expiry_month|htmlsafe}
{$LANG.credit_card_expiry_year}{$customer.credit_card_expiry_year|htmlsafe}
+
+
+ +
+
+ + + + + + + + + + + + + {foreach from=$invoices item=invoice} + + + + + + + + + {/foreach} + +
+ {$LANG.actions} + {$LANG.id}{$LANG.date_created}{$LANG.total}{$LANG.paid}{$LANG.owing}
+ + + {$invoice.index_id|htmlsafe}{$invoice.date|htmlsafe}{$invoice.total|number_format:2}{$invoice.paid|number_format:2}{$invoice.owing|number_format:2}
+
+
+
+
+ + + + + + + + + + + + {foreach from=$invoices item=invoice} + + + + + + + + {/foreach} + +
{$LANG.id}{$LANG.date_created}{$LANG.total}{$LANG.paid}{$LANG.owing}
{$invoice.index_id|htmlsafe}{$invoice.date|htmlsafe}{$invoice.total|number_format:2}{$invoice.paid|number_format:2}{$invoice.owing|number_format:2}
+
+
+
+ +
+ {$customer.notes|outhtml} +
+
+
+ + +
+{/if} + + +{* ##################################################################################################### *} + + + +{if $smarty.get.action == 'edit' } + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {* + {showCustomFields categorieId="2" itemId=$smarty.get.customer } + *} + + + + +
{$LANG.customer_name} + + + +
{$LANG.attention_short} + + + +
{$LANG.street}
{$LANG.street2} + + + +
{$LANG.city}
{$LANG.zip}
{$LANG.state}
{$LANG.country}
{$LANG.phone}
{$LANG.mobile_phone}
{$LANG.fax}
{$LANG.email} +
{$LANG.credit_card_holder_name} + +
{$LANG.credit_card_number} + {$LANG.credit_card_number_encrypted} +
{$LANG.credit_card_number_new} + +
{$LANG.credit_card_expiry_month} + +
{$LANG.credit_card_expiry_year} + +
{$customFieldLabel.customer_cf1|htmlsafe} + + + + +
{$customFieldLabel.customer_cf2|htmlsafe} + + + + +
{$customFieldLabel.customer_cf3|htmlsafe} + + + + +
{$customFieldLabel.customer_cf4|htmlsafe} + + + + +
{$LANG.notes}
{$LANG.enabled} + {html_options name=enabled options=$enabled selected=$customer.enabled} +
+ +
+ + {$LANG.cancel} +
+ +
+ + +
+{/if} + diff --git a/templates/default/footer.tpl b/templates/default/footer.tpl index ff70c48a5..21afbdd4a 100644 --- a/templates/default/footer.tpl +++ b/templates/default/footer.tpl @@ -3,7 +3,7 @@ diff --git a/templates/default/invoices/details.tpl b/templates/default/invoices/details.tpl index 6058c60b4..13ceb34f0 100644 --- a/templates/default/invoices/details.tpl +++ b/templates/default/invoices/details.tpl @@ -228,6 +228,7 @@ + {$invoiceItem.html} diff --git a/templates/default/invoices/quick_view.tpl b/templates/default/invoices/quick_view.tpl index b2ce0df4c..8c42c44c8 100644 --- a/templates/default/invoices/quick_view.tpl +++ b/templates/default/invoices/quick_view.tpl @@ -234,6 +234,26 @@ {$preference.pref_currency_sign}{$invoiceItem.unit_price|siLocal_number} {$preference.pref_currency_sign}{$invoiceItem.gross_total|siLocal_number} + {if $invoiceItem.attribute != null} + + + + + + {foreach from=$invoiceItem.attribute_json key=k item=v} + + {/foreach} + +
+ {if $v.type == 'decimal'} + {$v.name}: {$preference.pref_currency_sign|htmlsafe}{$v.value|siLocal_number} ; + {else} + {$v.name}: {$v.value} ; + {/if} +
+ + + {/if} {if $invoiceItem.description != null} diff --git a/templates/default/menu.tpl b/templates/default/menu.tpl index f451d3a7e..df6366514 100644 --- a/templates/default/menu.tpl +++ b/templates/default/menu.tpl @@ -92,6 +92,16 @@ { if $subPageActive == "inventory_view"}
  • {$LANG.view}
  • {/if} { if $subPageActive == "inventory_edit"}
  • {$LANG.edit}
  • {/if} { if $subPageActive == "inventory_add"}
  • {$LANG.add}
  • {/if} + {/if} + {if $defaults.product_attributes} +
  • {$LANG.product_attributes}
  • + { if $subPageActive == "inventory_view"}
  • {$LANG.view}
  • {/if} + { if $subPageActive == "inventory_edit"}
  • {$LANG.edit}
  • {/if} + { if $subPageActive == "inventory_add"}
  • {$LANG.add}
  • {/if} +
  • {$LANG.product_values}
  • + { if $subPageActive == "inventory_view"}
  • {$LANG.view}
  • {/if} + { if $subPageActive == "inventory_edit"}
  • {$LANG.edit}
  • {/if} + { if $subPageActive == "inventory_add"}
  • {$LANG.add}
  • {/if} {/if} diff --git a/templates/default/product_attribute/add.tpl b/templates/default/product_attribute/add.tpl new file mode 100755 index 000000000..3383e9d7e --- /dev/null +++ b/templates/default/product_attribute/add.tpl @@ -0,0 +1,63 @@ + +{* if customer is updated or saved.*} + +{if $smarty.post.name != "" && $smarty.post.submit != null } +{$refresh_total} + +
    +
    +{$display_block} +
    +
    + +{else} +{* if name was inserted *} + {if $smarty.post.submit !=null} +
    + You must enter a name for the product attribute
    +
    + {/if} +
    + +

    Add product attribute

    + +
    + + + + + + + + + + + + + + + + + + + +
    Attribute name
    {$LANG.type} + +
    {$LANG.enabled} + {html_options class=edit name=enabled options=$enabled selected=1} +
    {$LANG.visible} + {html_options class=edit name=visible options=$enabled selected=1} +
    + +
    +
    + + +
    +
    + +{/if} diff --git a/templates/default/product_attribute/details.tpl b/templates/default/product_attribute/details.tpl new file mode 100755 index 000000000..acccdabf5 --- /dev/null +++ b/templates/default/product_attribute/details.tpl @@ -0,0 +1,78 @@ + +
    + + +{if $smarty.get.action== 'view' } + Product Attribute :: {$LANG.edit} +
    + + + + + + + + + + + + + + + + + + + + + +
    {$LANG.id}{$product_attribute.id}
    {$LANG.name}{$product_attribute.name}
    {$LANG.type}{$product_attribute.type|capitalize|htmlsafe}
    {$LANG.enabled}{$product_attribute.wording_for_enabled|htmlsafe}
    {$LANG.visible}{$product_attribute.wording_for_visible|htmlsafe}
    +
    + +{$LANG.edit} + +{/if} + +{if $smarty.get.action== 'edit' } + +Product Attribute +
    + + + + + + + + + + + + + + + + + + + + +
    {$LANG.id}{$product_attribute.id}
    {$LANG.name}
    {$LANG.type} + +
    {$LANG.enabled} + {html_options name=enabled options=$enabled selected=$product_attribute.enabled} +
    {$LANG.visible} + {html_options name=visible options=$enabled selected=$product_attribute.visible} +
    +
    + + + +{/if} +
    diff --git a/templates/default/product_attribute/manage.tpl b/templates/default/product_attribute/manage.tpl new file mode 100755 index 000000000..c3abc5264 --- /dev/null +++ b/templates/default/product_attribute/manage.tpl @@ -0,0 +1,24 @@ +{* +/* +* Script: manage.tpl +* Invoice Preferences manage template +* +* Authors: +* Justin Kelly, Ben Brown +* +* Last edited: +* 2007-09-22 +* +* License: +* GPL v2 or above +*/ +*} +{if preferences == null} +

    {$LANG.no_preferences}.

    +{else} +

    Manage Product Attributes :: Add Attribute

    +
    + + + {include file='../modules/product_attribute/manage.js.php'} +{/if} diff --git a/templates/default/product_attribute/save.tpl b/templates/default/product_attribute/save.tpl new file mode 100755 index 000000000..3fbaa40a4 --- /dev/null +++ b/templates/default/product_attribute/save.tpl @@ -0,0 +1,4 @@ +
    +{$display_block} +{$refresh_total} +
    diff --git a/templates/default/product_value/add.tpl b/templates/default/product_value/add.tpl new file mode 100755 index 000000000..50732a488 --- /dev/null +++ b/templates/default/product_value/add.tpl @@ -0,0 +1,54 @@ +{if $smarty.post.value != "" && $smarty.post.submit != null } +{$refresh_total} + +
    +
    +{$display_block} +
    +
    + +{else} +{* if name was inserted *} + {if $smarty.post.submit !=null} +
    + You must enter a value
    +
    + {/if} +
    + +

    Add product value

    + +
    + + + + + + + + + + + + + + + +
    Attribute + +
    Value
    {$LANG.enabled} + {html_options class=edit name=enabled options=$enabled selected=1} +
    + +
    +
    + + +
    +
    + +{/if} diff --git a/templates/default/product_value/details.tpl b/templates/default/product_value/details.tpl new file mode 100755 index 000000000..e18c79469 --- /dev/null +++ b/templates/default/product_value/details.tpl @@ -0,0 +1,66 @@ +
    + + +{if $smarty.get.action== 'view' } + Product Values :: {$LANG.edit} +
    + + + + + + + + + + + + + + + + +
    {$LANG.id}{$product_value.id}
    {$LANG.attribute}{$product_attribute}
    {$LANG.value}{$product_value.value}
    {$LANG.enabled}{$product.wording_for_enabled|htmlsafe}
    +
    + +{$LANG.edit} + +{/if} + +{if $smarty.get.action== 'edit' } + +Preferences +
    + + + + + + + + + + + + + + + + +
    {$LANG.id}{$product_value.id}
    {$LANG.attribute} + +
    Value
    {$LANG.enabled} + {html_options name=enabled options=$enabled selected=$product_attribute.enabled} +
    +
    + + + +{/if} +
    diff --git a/templates/default/product_value/manage.tpl b/templates/default/product_value/manage.tpl new file mode 100755 index 000000000..46ff25a2d --- /dev/null +++ b/templates/default/product_value/manage.tpl @@ -0,0 +1,18 @@ +{* +/* +* Script: manage.tpl +* Invoice Preferences manage template +* +* License: +* GPL v2 or above +*/ +*} +{if preferences == null} +

    {$LANG.no_preferences}.

    +{else} +

    Manage Product Value :: Add Product Value

    +
    + + + {include file='../modules/product_value/manage.js.php'} +{/if} diff --git a/templates/default/product_value/save.tpl b/templates/default/product_value/save.tpl new file mode 100755 index 000000000..3fbaa40a4 --- /dev/null +++ b/templates/default/product_value/save.tpl @@ -0,0 +1,4 @@ +
    +{$display_block} +{$refresh_total} +
    diff --git a/templates/default/products/add.tpl b/templates/default/products/add.tpl index f5f8221c6..c58032e14 100755 --- a/templates/default/products/add.tpl +++ b/templates/default/products/add.tpl @@ -16,6 +16,14 @@
    + +
    @@ -51,6 +59,16 @@ + + + + +
    {$LANG.enabled} + {html_options class=edit name=enabled options=$enabled selected=1} +
    +
    +
    + + {if $defaults.product_attributes} + + + + + {foreach from=$attributes item=attribute} + + + + + {/foreach} + {/if} +
    {$customFieldLabel.product_cf1|htmlsafe} @@ -75,19 +93,53 @@
    {$LANG.product_attributes} +
    + + {$attribute.name} +
    +
    +
    + - - - - - {* {showCustomFields categorieId="3" itemId=""} *} + + + + + + + + + + + +
    {$LANG.notes}
    {$LANG.enabled} - {html_options class=edit name=enabled options=$enabled selected=1} -
    {$LANG.note_attributes} +
    + + {$LANG.note_as_description} +
    + + {$LANG.note_expand} +
    +
    +
    diff --git a/templates/invoices/default/style.css b/templates/invoices/default/style.css index c0aa9e603..23aa99c22 100755 --- a/templates/invoices/default/style.css +++ b/templates/invoices/default/style.css @@ -36,3 +36,7 @@ tr {margin: 0px; padding: 0px;} { border-bottom: 3px double #555; } +.si_product_attribute +{ + padding-right:20px; +} diff --git a/templates/invoices/default/template.tpl b/templates/invoices/default/template.tpl index 2e326ebc4..6c3cbdb07 100755 --- a/templates/invoices/default/template.tpl +++ b/templates/invoices/default/template.tpl @@ -215,6 +215,28 @@ {$preference.pref_currency_sign|htmlsafe}{$invoiceItem.unit_price|siLocal_number} {$preference.pref_currency_sign|htmlsafe}{$invoiceItem.gross_total|siLocal_number} + {if $invoiceItem.attribute != null} + + + + + + {foreach from=$invoiceItem.attribute_json key=k item=v} + {if $v.visible ==true } + + {/if} + {/foreach} + +
    + {if $v.type == 'decimal'} + {$v.name}: {$preference.pref_currency_sign|htmlsafe}{$v.value|siLocal_number}; + {else if $v.value !=''} + {$v.name}: {$v.value}; + {/if} +
    + + + {/if} {if $invoiceItem.description != null}