Dolibarr Projects Module: DB_ERROR_42803 - php

Long story Short: I launched an EC2 instance on AWS to run Dolibarr v13, running PostgreSQL 12.4 on RDS, and Dolibarr itself on Ubuntu 20.04 LTS. All DIY, not Bitnami’s AMI.
Once I started setting up modules on the web app's console, I got this:
Modules/Applications: user, societe, projet, import, export
Database type manager: pgsql
Latest database access request error: SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.rowid as socid, s.nom as socname, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee, COUNT(t.rowid) as nb, SUM(t.planned_workload) as planned_workload, SUM(t.planned_workload * t.progress / 100) as declared_progess_workload FROM llx_projet as p LEFT JOIN llx_societe as s ON s.rowid = p.fk_soc LEFT JOIN llx_projet_task as t ON p.rowid = t.fk_projet WHERE p.rowid IN (-1) GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee ORDER BY p.title, p.ref
Return code for latest database access request error: DB_ERROR_42803
Information for latest database access request error: ERROR: 42803: column "s.rowid" must appear in the GROUP BY clause or be used in an aggregate function\nLINE 1: ...T p.rowid as projectid, p.ref, p.title, p.fk_soc, s.rowid as...\n ^\nLOCATION: check_ungrouped_columns_walker, parse_agg.c:1409
I can’t find anyone else seeing this on the usual sites, but I can’t be the only one. How do I fix this? I’m not well versed in PHP, so I’m not sure where to find the line of code trying to access my DB.

Related

How to create a product options prices by customer group wise in opencart 2.3.0.2

I created two group one is A and other is B . i want there multiple option as each have different prices as acording to customer group i have some code but it does not run properly it give a message as "Call to undefined method Cart\Customer::getCustomerGroupId() in C:\xampp\htdocs\postal\vqmod\vqcache\vq2-catalog_model_catalog_product.php on line 340".
the code is in vqmod xml file -enter code here
problem is there i can not know how to definde customer group id and this code is running in old version perfectly
the code is attach in link -- product-option by download-customer group
please check this and send me how to define and fix the bug.
the code run proper before login- wen i login then give error message.
I suggest to modify system\library\cart\customer.php to:
/create a function/
public function getCustomerGroupId() {
return $this->customer_group_id;
}

Prestashop : use Product class in personnal script

I need to create a cron script to process products (add, delete, update) when I get them from a raw data file from a third party firm which sends a new file (data separated with ;) whenever a product is changed (added, deleted, updated).
I tried using the Product class (from Product.php) to add new products in the shop. The problem at first was that I got this error :
class 'ObjectModel' not found in importProducts.php
I found an apparent solution, which was to require_once the config and init file from the config folder in importProduct.php :
require_once(dirname(__FILE__).'/../config/config.inc.php');
require_once(dirname(__FILE__) . '/../init.php');
The require points to the right files. My file is located in a new folder, called "crontasks".
prestashop/crontaskt/import.php
(import.php starts importProduct.php)
But now there is a new error :
Fatal error: Uncaught You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7
SELECT c.id_category
FROM ps_category_product cp
LEFT JOIN ps_category c ON (c.id_category = cp.id_category)
INNER JOIN ps_category_shop category_shop ON (category_shop.id_category = c.id_category AND category_shop.id_shop = 1)
WHERE cp.id_category NOT IN (18)
AND cp.id_product = thrown in D:\Travail\BUSCI\prestashop\prestashop\classes\db\Db.php on line 791
(they don't appear, but around the query are < br />< br />< pre >...< /pre > without the spaces in it)
Problem is, I checked in the database, and the columns are all there, and I don't get why there is a problem on that line.
Also, I could not find from which file that query was. I looked in Product.php, and I found one very similar but not exactly the same :
$result = Db::getInstance()->executeS('
SELECT c.`id_category`
FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
'.Shop::addSqlAssociation('category', 'c', true, null, true).'
WHERE cp.`id_category` NOT IN ('.implode(',', array_map('intval', $categories)).')
AND cp.id_product = '.$this->id
);
line 1051 in Product.php, method updateCategories.
I could not find anything similar in Category.php or any other file I looked in. But this query is missing the inner join, so I don't know if that's really the one. I suppose the problem comes from the fact that there is nothing after the =, but I don't know if that's just a character limitation (amount of characters printed in an error) or if it is the error. I'm feeling a little lost.
I did not change any files from prestashop. This is the latest update I just installed a week ago on my computer. The tests are done in local, on my computer.
I would really appreciate some help.
Excuse me for my english, it's not amazing.
Edit :
So I searched through the whole project, in every file for the line
INNER JOIN '._DB_PREFIX_.'category_shop
and could not find it. I tried taking away the extra spaces, just in case, but could not find the file in which this sql query is in.

Cannot access Categories in dashboard (Magento)

So i have installed couple of extensions one of them was fontis feed generator, everything is working fine till i try and access Manage Categories the it comes up with "There has been an error processing your request"
The error is as follows
a:5:{i:0;s:110:"Source model "feedsgenerator/googleproducts_source_taxonomy" not found for attribute "google_product_category"";i:1;s:4101:"#0
Run this sql code to check if there's the attribute causing issues:
select * from eav_attribute where attribute_code = "google_product_category";
If you'll get a result showing the attribute then you should remove it. To do this you can do the following:
Add this to the end of your index.php file:
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->removeAttribute('catalog_category','google_product_category');
Run the website once with disabled cache (make sure the code run) and then remove the two lines from index.php.
This should be fixed now. You can check if the attribute still exists by running the sql code again:
select * from eav_attribute where attribute_code = "google_product_category";

How to pull an image from a MySQL column to display on web app

Sorry if I am not too clear..
Okay so what I have is a web app that shows all the fleet vehicles for my company.I am pulling the information from my database and what I want is to insert and image for the "support van" so that when it is displayed on my app that the image is pulled from the database, I am not sure about Blob data or anything so a clear instruction would be really helpful
here is my master query-Not the "support vans" query ill post that under this one
Maaster-query
SELECT
vi.id as 'VehicleId',
vi.class_type as 'VehicleClass',
vi.registration_number as 'VehicleRegistrationNumber',
vr.role_name as 'VehicleRole',
vm.name as 'VehicleMake',
vmo.name as 'VehicleModel',
ud.name as 'Depot location'
FROM
unify_rebuild.vehicle_information as vi
LEFT JOIN
unify_rebuild.vehicle_role as vr
ON
vi.unit_role = vr.role_id
LEFT JOIN
unify_rebuild.vehicle_manufacturer as vm
ON
vi.make = vm.id
LEFT JOIN
unify_rebuild.vehicle_model as vmo
ON
vi.model = vmo.id
LEFT JOIN
unify_rebuild.unify_depot as ud
ON
vi.depot_current_location = ud.id
and here is the support van query-
SELECT
vi.id as 'VehicleId',
vi.class_type as 'VehicleClass',
vi.registration_number as 'VehicleRegistrationNumber',
vr.role_name as 'VehicleRole',
vm.name as 'VehicleMake',
vmo.name as 'VehicleModel',
ud.name as 'Depot location'
FROM
unify_rebuild.vehicle_information as vi
LEFT JOIN
unify_rebuild.vehicle_role as vr
ON
vi.unit_role = vr.role_id
LEFT JOIN
unify_rebuild.vehicle_manufacturer as vm
ON
vi.make = vm.id
LEFT JOIN
unify_rebuild.vehicle_model as vmo
ON
vi.model = vmo.id
LEFT JOIN
unify_rebuild.unify_depot as ud
ON
vi.depot_current_location = ud.id
WHERE vr.role_name='Support Van';
Any questions please leave a comment and thanks in advance for any help
Calvin
Via your cms you upload images to a folder and take their address and save it in database
and to show that image you take URL from database and in your image source give that URL of the image
I think this link would be helpful for you
How to store file name in database, with other info while uploading image to server using PHP?
Well you can simply record the url of the image into DB as a new row (for ex. vi.imageUrl='http://url-of-image.png').
Then you call that row of the DB and you save it into a variable (you know how to extract values from the DB) for ex: $url_of_img_extracted_from_db is the variable of the image url, then simply you can call it into html with <img src="$url_of_img_extracted_from_db">
I know the code I posted is wrong, it is just an example, you know how to do it ;)

Sphinx returns wrong document ids

My sphinx search returns wrong results, if I search for a keyword, the document ids returned do not contain that keyword.
Here is how I created conf settings:
source source_name
{
type = mysql
sql_host = ******
sql_user = ******
sql_pass = ******
sql_db = ******
sql_port = # optional, default is 3306
sql_query_pre = SET CHARACTER_SET_RESULTS=utf8
sql_query_pre = SET NAMES utf8
sql_query = \
SELECT \
P.ID AS ID, P.TITLE AS TITLE, P.TITLE AS TITLE_SORT \
FROM \
PRODUCT P \
WHERE \
P.ISVALID='Y'
sql_attr_string = TITLE_SORT
sql_query_info = SELECT * FROM PRODUCT WHERE ID=$id
}
index index_name
{
source = source_name
path = /path/to/data/file_name
docinfo = extern
min_word_len = 1
charset_type = utf-8
}
indexer
{
mem_limit = 128M
}
searchd
{
listen = 3312 # port is deprecated from 2.1+
log = /path/to/log/searchd.log
query_log = /path/to/log/query.log
read_timeout = 5
max_children = 30
pid_file = /path/to/log/searchd.pid
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
compat_sphinxql_magics = 0
}
One important thing is that If I search with the test.php tool, I can see that the attribute value shows products with searched keywords, but document ids are still wrong, which makes me thing why it is returning wrong document ids
Another important thing is that on the same machine and same conf file, I created an index for another mysql database and it works fine.
Thanks
EDIT:
Here is an example:
I search for "professional" and I get this result
1. doc_id=33285, weight=102, title_sort=Wella Professional Bezoplachový kondicionér pro objem vlasï SP Volumize 150 ml, manufacturer_id=217, category_id=4648, min_price=0, product_rating=4294967295, filter_userid=(2714222508,3149373076)
2. doc_id=33286, weight=102, title_sort=Wella Professional àampon pro lesk vlasï SP Shine Define 250 ml, manufacturer_id=217, category_id=3046113, min_price=0, product_rating=4294967295, filter_userid=(2714222508,3149373076)
3. doc_id=33287, weight=102, title_sort=Wella Professional àampon pro barvené vlasy SP Color Save 250 ml, manufacturer_id=217, category_id=3046113, min_price=0, product_rating=4294967295, filter_userid=(2714222508,3149373076)
.. and so on ..
You can see that the title_sort field has the word professional in it, but the doc_ids returned (33285, 33286, 33287) are not these records.
This below is the id - title data from database
33285 Avon Čisticí tonikum na tělo proti akné ve spreji Blemish Clearing 100 ml
33286 Biotherm Pleťový krém a sérum 2v1 pro navrácení pružnosti normální až smíšené pleti Age Fitness Elastic 30 ml AKCE
33287 Avon Dětský šampon Barbie® 200 ml
While the results you see in the title_sort above are tied to these ids:
32854 Wella Professional Bezoplachový kondicionér pro objem vlasů SP Volumize 150 ml
32855 Wella Professional Šampon pro lesk vlasů SP Shine Define 250 ml
32856 Wella Professional Šampon pro barvené vlasy SP Color Save 250 ml
Sorry guys, issue is solved! It was a stupid mistake by our hosting support.
They created a new database and transferred old db data into it. The old database was corrupted.
I found this out when I created a duplicate table of the original and then tried to index it, sphinx gave me error that table does not exist, and that clicked my mind and I compared the database settings on site and sphinx.conf
I did not find an issue like mine on any forums and google, apart from one that had a similar configuration problem. So if you are reading this answer to find a solution for a similar problem, then you must check your configuration and confirm that your conf file is pointing to the correct database and table. This will save you days, may be weeks of pain :).

Categories