Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Change GLTags.php to behave like SalesTypes.php
10-06-2017, 03:09 AM, (This post was last modified: 10-06-2017, 03:54 AM by R2-G.)
#1
How to Change GLTags.php to behave like SalesTypes.php
Hi,

Am not a very good php/mysql programmer, so I need help to convert GLTags.php to behave like SalesType.php.

REASON: I would like to have the type and size of the field tagref in the tags table changed from tinyint(4) to varchar(6) so that I can have structures of Tags and be able to create new tags by entering the tagref and tagdescription and submitting creates a new tag in the required position in the tags structures. Currently GLTags.php does not allow for user entry of tagref but generates an auto increment number.

So before going into the actual php scripts conversion I would like to know from those more knowledgeable in php/mysql, if the following CREATE TABLE tags statement changes are correct for the purposes stated.

ORIGINAL STATEMENT
*********************
CREATE TABLE `tags` (
`tagref` tinyint(4) NOT NULL AUTO_INCREMENT,
`tagdescription` varchar(50) NOT NULL,
PRIMARY KEY (`tagref`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

CHANGED STATEMENT
**********************
CREATE TABLE `tags` (
`tagref` varchar(6) NOT NULL DEFAULT,
`tagdescription` varchar(50) NOT NULL,
PRIMARY KEY (`tagref`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Any advice greatly appreciated

Thanks in advance.

R2-g

Currently the new GLTags.php screen looks as below but is not fully working

[Image: newscreen.png]
Reply
10-06-2017, 07:21 AM,
#2
RE: How to Change GLTags.php to behave like SalesTypes.php
I am not totally sure what you are trying to achieve here?

An integer is always the best key to use on a table - though I did regret using a tinyint for this field when I initially wrote this code, and subsequently changed it to a full integer in my code. If you want an additional way of referencing a tag then I would recommend adding another field rather than changing the tagref to a varchar field which is very inefficient.

There are other tables hat need changing if you want to alter that field, I would recommend changing it to a full integer.

Thanks
Tim

PS I wrote the code to allow unlimited tags to be applied to individual changes if anybody wants help integrating this into their webERP drop me an email on tim@weberpafrica.com
Reply
10-19-2017, 03:14 AM,
#3
RE: How to Change GLTags.php to behave like SalesTypes.php
Hi Tim

Here is what am trying to achieve

1. To have a WebERP system with capability to create hundreds of tags
2. To have a WebERP system with capability to create new tags that fit into an existing tags structure as follows:
[Image: tags.png]

So when department A gets a new car it becomes A003 and so on
Even integer can be used to achieve the same purpose
What other scripts need changing if that field is changed ?


R2-g

****************************************************************************************
(10-06-2017, 07:21 AM)falkoner Wrote: I am not totally sure what you are trying to achieve here?

An integer is always the best key to use on a table - though I did regret using a tinyint for this field when I initially wrote this code, and subsequently changed it to a full integer in my code. If you want an additional way of referencing a tag then I would recommend adding another field rather than changing the tagref to a varchar field which is very inefficient.

There are other tables hat need changing if you want to alter that field, I would recommend changing it to a full integer.

Thanks
Tim

PS I wrote the code to allow unlimited tags to be applied to individual changes if anybody wants help integrating this into their webERP drop me an email on tim@weberpafrica.com

Reply
10-19-2017, 07:15 AM,
#4
RE: How to Change GLTags.php to behave like SalesTypes.php
To create hundreds of tags just change the field tagref in the tags table to type INT, also changing the tag field in gltrans.

To achieve what you are after in number 2 I would create a new field in the tags table for department. This would mean that the only scripts that would need changing are the GLTags.php script and any reports that you require for this functionality.

Tim
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)