Hopefully fixed the slow Quote Add/Edit page

This commit is contained in:
Karl Cordes 2019-07-02 18:47:58 +10:00
parent 860e4bfc6c
commit a6de4fbf10

View file

@ -61,14 +61,18 @@ class Principle extends AppModel {
function getCityCountryList() {
//$principles = $this->find('all', array('recursive'=>1));
$principles = $this->query("select p.name, p.city, c.name FROM principles p JOIN countries c ON p.country_id = c.id ORDER BY p.name ASC");
print_r($principles);
$search = array('{company}','{city}','{country}');
$phrase = "Ex Works Incoterms 2010 ({company}, {city}, {country})";
$list = array();
return $list;
/*
Format returned from that query
Array ( [0] => Array ( [p] => Array ( [name] => A GRADE AIR CONDITIONING PTY LIMITED [city] => SEVEN HILLS ) [c] => Array ( [name] => Australia ) )
*/
foreach($principles as $principle) {
$replace = array($principle['Principle']['name'], $principle['Principle']['city'], $principle['Country']['name']);
$replace = array($principle['p']['name'], $principle['p']['city'], $principle['c']['name']);
$newPhrase = str_replace($search, $replace, $phrase);