Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.
In view to internationalize Projeqtor (my company has planned to have several branch in others countries – especially out of Europa, and we have already clients and resources in 50 countries !), I have added a values table for countries (in a first time, only french and english) as following :
CREATE TABLE IF NOT EXISTS `country` ( `id` int(12) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(4) DEFAULT NULL, `lang` varchar(2) DEFAULT NULL, `name` varchar(100) DEFAULT NULL, `idle` int(1) unsigned DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `countryCodeLang` (`code`,`lang`), KEY `countryCode` (`code`), KEY `countryLang` (`lang`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `country` VALUES(1, 'af', 'en', 'Afghanistan', 0); INSERT INTO `country` VALUES(2, 'af', 'fr', 'Afghanistan', 0); INSERT INTO `country` VALUES(3, 'al', 'en', 'Albania', 0); INSERT INTO `country` VALUES(4, 'al', 'fr', 'Albanie', 0); INSERT INTO `country` VALUES(5, 'dz', 'en', 'Algeria', 0); INSERT INTO `country` VALUES(6, 'dz', 'fr', 'Algérie', 0); INSERT INTO `country` VALUES(7, 'ad', 'en', 'Andorra', 0); INSERT INTO `country` VALUES(8, 'ad', 'fr', 'Andorre', 0); (…)
(As I understand, the ‘idle’ column is requested for use of the table in a combo box, is this true?)
I have added a new entry in ‘menu’ table :
INSERT INTO `menu` VALUES(135, 'menuCountry', 36, 'object', 710, NULL, 0);
… so it should comes in menu under ‘parameters / Values lists‘ before ‘roles’
I have created model/Country.php:
<?php
/* ============================================================================
* Country defines list of countries.
*/
require_once('_securityCheck.php');
class Country extends SqlElement {
// extends SqlElement, so has $id
public $_col_1_2_Description;
public $id; // redefine $id to specify its visible place
public $code;
public $lang;
public $name;
// Define the layout that will be used for lists
private static $_layout='
# ${id}
${code}
${lang}
${name}
';
private static $_fieldsAttributes=array("code"=>"required",
"lang"=>"required",
"name"=>"required"
);
/** ==========================================================================
* Constructor
* @param $id the id of the object in the database (null if not stored yet)
* @return void
*/
function __construct($id = NULL) {
parent::__construct($id);
}
/** ==========================================================================
* Destructor
* @return void
*/
function __destruct() {
parent::__destruct();
}
// ============================================================================*******
// GET STATIC DATA FUNCTIONS
// ============================================================================*******
/** ==========================================================================
* Return the specific layout
* @return the layout
*/
protected function getStaticLayout() {
return self::$_layout;
}
/** ==========================================================================
* Return the specific fieldsAttributes
* @return the fieldsAttributes
*/
protected function getStaticFieldsAttributes() {
return self::$_fieldsAttributes;
}
}
?>
Of course, I also added translations in adequate ‘lang‘ files:
colCountryCode: "country code",
colCountryName: "country name",
colLang: "language",
menuCountry: "Countries",
and
colCountryCode: "code pays",
colCountryName: "libellé pays",
colLang: "language",
menuCountry: "Pays",
… but I have two problems:
1. This new table does not appears in main menu! What have I missed?
2. How redefines ‘country‘ field in model/Client.php to have a combo box:
a. filtered on ‘lang’ column with user language (as stored in ‘parameter‘ table)
b. showing ‘country’ field and storing ‘councode’ in client.country ?
c. correctly labelled.
public $idCountry;
… don’t build the link with the new table.
As I understand, the ‘idle’ column is requested for use of the table in a combo box, is this true?
Yes, it is a way to disable some item wothout deleting it
1. This new table does not appears in main menu! What have I missed?
Yes : give access rights !
… don’t build the link with the new table.
idCountry should be added in Client table as int(12) !
As I understand, the ‘idle’ column is requested for use of the table in a combo box, is this true?
Yes, it is a way to disable some item wothout deleting it
1. This new table does not appears in main menu! What have I missed?
Yes : give access rights !
But some menu entries – as Role and all other entries under Values lists… and Values lists itself ! – are not in access rigths, however they are presents on menu! (I work as Admin, of course)
… don’t build the link with the new table.
idCountry should be added in Client table as int(12) !
But for one country, the id is not the same when langage change…
But some menu entries – as Role and all other entries under Values lists… and Values lists itself ! – are not in access rigths, however they are presents on menu! (I work as Admin, of course)
YES THEY ARE : in "access to forms"
If you deal with "Access mode to data", only project dependent items are managed here.
But for one country, the id is not the same when langage change…
:huh:
Please explain, it is not clear.
But some menu entries – as Role and all other entries under Values lists… and Values lists itself ! – are not in access rigths, however they are presents on menu! (I work as Admin, of course)
YES THEY ARE : in "access to forms"
If you deal with "Access mode to data", only project dependent items are managed here.
O.K., found.
Technically, it's not the 'accessright' table as I thought, but 'habilitation'. 🙂
And how add an icone in the menu ?
I have created iconCountry16.png, iconCountry22.png and iconCountry32.png in view/css/images, but noting appears…
But for one country, the id is not the same when langage change…
:huh:
Please explain, it is not clear.
there as many lines per country as number of languages used. At now, two :
Country code 'de' is for Germany, but with two lines (id, code, lang, name) :
121 de en Germany
122 de fr Allemagne
i.e. country is identified by code, not by line id.
In future, there could be added also, p.e.
487 de de Deutchland
503 de nl Duitsland
733 de es Alemania
999 de gr Γερµανία
etc.
And, even with country as int(12), nothing changes… only [colIdCountry] as label, and a (long) text input field.
And how add an icone in the menu ?
I have created iconCountry16.png, iconCountry22.png and iconCountry32.png in view/css/images, but noting appears…
Update /css/projectorIcon.css
there as many lines per country as number of languages used. At now, two :
Country code 'de' is for Germany, but with two lines (id, code, lang, name) :
121 de en Germany
122 de fr Allemagne
i.e. country is identified by code, not by line id.
In future, there could be added also, p.e.
487 de de Deutchland
503 de nl Duitsland
733 de es Alemania
999 de gr Γερµανία
etc.
You complicated much too much, and will have to code correct list.
Just single list with translatable name would be easier : just have to define field $_isTranslatable in the class :whistle:
And how add an icone in the menu ?
I have created iconCountry16.png, iconCountry22.png and iconCountry32.png in view/css/images, but noting appears…Update /css/projectorIcon.css
Done with
.iconCountry32 { background-image: url(images/iconCountry32.png); background-repeat: no-repeat; width: 32px; height: 32px; }
.iconCountry22 { background-image: url(images/iconCountry22.png); background-repeat: no-repeat; width: 22px; height: 22px; }
.iconCountry16 { background-image: url(images/iconCountry16.png); background-repeat: no-repeat; width: 16px; height: 16px; }
… but still nothing, even after close/reopne session.
(no error in data, pictures OK, all checked)
there as many lines per country as number of languages used. At now, two :
Country code 'de' is for Germany, but with two lines (id, code, lang, name) :
121 de en Germany
122 de fr Allemagne
i.e. country is identified by code, not by line id.
In future, there could be added also, p.e.
487 de de Deutchland
503 de nl Duitsland
733 de es Alemania
999 de gr Γερµανία
etc.You complicated much too much, and will have to code correct list.
Just single list with translatable name would be easier : just have to define field $_isTranslatable in the class :whistle:
I don’t understand.
Where are the translations, then ? Must fill lang.js files ?
What values list table would be a good sample ?
Note : I've defined another table (currencies), exacty as other values lists :
CREATE TABLE IF NOT EXISTS `currency` ( `id` int(12) unsigned NOT NULL AUTO_INCREMENT, `code` varchar(3) DEFAULT NULL, `name` varchar(32) DEFAULT NULL, `idle` int(1) unsigned DEFAULT '0', PRIMARY KEY (`id`), KEY `currencyCode` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; INSERT INTO `currency` VALUES(1, 'EUR', 'Euro', 0); INSERT INTO `currency` VALUES(2, 'USD', 'US Dollars', 0); INSERT INTO `currency` VALUES(3, 'AUD', 'Australian Dollar', 0); INSERT INTO `currency` VALUES(4, 'CAD', 'Canadian Dollar', 0); INSERT INTO `currency` VALUES(5, 'CHF', 'Swiss Franc', 0); INSERT INTO `currency` VALUES(6, 'GBP', 'British Pounds', 0); INSERT INTO `currency` VALUES(7, 'JPY', 'Japanese Yen', 0); INSERT INTO `currency` VALUES(8, 'SEK', 'Swedish Krona', 0);
Lang.js updated, module model/Currency.php created…
I can see and update this table, so it is OK.
Added a field in client table :
ALTER TABLE client ADD currency int(12) unsigned DEFAULT '0' ;
Defined in client.php :
public $idCurrency;
But for view/update a client, the fields is a normal input text, no combo box.
And when I put something in that field and record update :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'idCurrency' in 'field list'
Something is wrong, but models viewed seem similar… WTF ?
… but still nothing, even after close/reopne session.
(no error in data, pictures OK, all checked)
Seems correct.
No idea why it does not work. 🙁
Where are the translations, then ? Must fill lang.js files ?
Yes
What values list table would be a good sample ?
Profile
Something is wrong, but models viewed seem similar… WTF ?
db field should be named idCurrency, not currency.
… but still nothing, even after close/reopne session.
(no error in data, pictures OK, all checked)Seems correct.
No idea why it does not work. 🙁
Oops…
Too bad, but not blocking, so to be in-depth examinated later.
Where are the translations, then ? Must fill lang.js files ?
Yes
For countries, this will be a lot (around 200 countries !)
What values list table would be a good sample ?
Profile
OK. Have a look.
Not $_isTranslatable, but $_isNameTranslatable, no? Or $_isXxxxTranslatable? :unsure:
I think I will first test with 'currency' table. 😉
Something is wrong, but models viewed seem similar… WTF ?
db field should be named idCurrency, not currency.
Ah, OK. Changed, and… It works! 🙂
… but still nothing, even after close/reopne session.
(no error in data, pictures OK, all checked)Seems correct.
No idea why it does not work. 🙁Oops…
Too bad, but not blocking, so to be in-depth examinated later.
Appeared next day, after shutdown computer and reboot.
For another new table, I updated for icons BEFORE connect to Projeqtor. Result: visible at once!
So, certainly a cache story or so on. Case closed. 🙂
What values list table would be a good sample ?
Profile
OK. Have a look.
Not $_isTranslatable, but $_isNameTranslatable, no? Or $_isXxxxTranslatable? :unsure:
I think I will first test with 'currency' table. 😉
Done, all is now O.K. 🙂
Now, I have a problem with a new type (PaymentMode) added in 'type' table.
I used 'clientType' as model (just changed type name from 'ClientType' to 'PaymentMode')
All is OK with that type (in the menu, display and update OK)
Added also in 'client' table. Select value and update are O.K. (checked in the table with PhpMyAdmin).
But stored value don’t display, and in log file I have twice :
** ERROR ** Error on SqlElement to get 'idPaymentMode' for Class 'Client' : field 'idPaymentMode' not found in Database.
each time I display a client.
But 'idPaymentMode' is the good field/column name, and if I select another value for that field, update works well.
I created a table called "pipetapa" with fields id, name (int12 and varchar100),
I created the respective class copied from an existing call Pipetapa, and
I added the respective field in project.php called "public $ idPipetapa;".
Still not show me data in the combo list 🙁
Perhaps, it is mandatory to create the option on the menu for a combo list shows the data ?. It's access permissions problem?
what I missed? Thank you very much !!!!!!
Manuel
I found mi mistake.
Thanks for your very good software
Manuel