mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix sql error
This commit is contained in:
parent
b863b2a3f3
commit
9edb2fd857
|
|
@ -107,6 +107,7 @@ class Canvas
|
|||
$this->card = $card;
|
||||
$this->dirmodule = $module;
|
||||
// Correct values if canvas is into an external module
|
||||
$regs = array();
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $canvas, $regs)) {
|
||||
$this->canvas = $regs[1];
|
||||
$this->dirmodule = $regs[2];
|
||||
|
|
|
|||
|
|
@ -940,20 +940,6 @@ if (empty($reshook)) {
|
|||
* View
|
||||
*/
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
$helpurl = '';
|
||||
$shortlabel = dol_trunc($object->label, 16);
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
|
||||
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Card');
|
||||
$helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte';
|
||||
}
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
|
||||
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Card');
|
||||
$helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Leistungen';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
|
@ -962,6 +948,21 @@ if (!empty($conf->accounting->enabled)) {
|
|||
$formaccounting = new FormAccounting($db);
|
||||
}
|
||||
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
$help_url = '';
|
||||
$shortlabel = dol_trunc($object->label, 16);
|
||||
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) {
|
||||
$title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Card');
|
||||
$help_url = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos|DE:Modul_Produkte';
|
||||
}
|
||||
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) {
|
||||
$title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Card');
|
||||
$help_url = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios|DE:Modul_Leistungen';
|
||||
}
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
// Load object modBarCodeProduct
|
||||
$res = 0;
|
||||
if (!empty($conf->barcode->enabled) && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
|
||||
|
|
@ -984,7 +985,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
// When used with CANVAS
|
||||
// -----------------------------------------
|
||||
if (empty($object->error) && $id) {
|
||||
$object = new Product($db);
|
||||
$result = $object->fetch($id);
|
||||
if ($result <= 0) {
|
||||
dol_print_error('', $object->error);
|
||||
|
|
@ -1465,6 +1465,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
/*
|
||||
* Product card
|
||||
*/
|
||||
|
||||
// Fiche en mode edition
|
||||
if ($action == 'edit' && $usercancreate) {
|
||||
//WYSIWYG Editor
|
||||
|
|
|
|||
|
|
@ -2172,20 +2172,20 @@ class Product extends CommonObject
|
|||
}
|
||||
$sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.fk_unit,";
|
||||
$sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_accounting as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
if ($id) {
|
||||
$sql .= " WHERE rowid = ".(int) $id;
|
||||
$sql .= " WHERE p.rowid = ".((int) $id);
|
||||
} else {
|
||||
$sql .= " WHERE entity IN (".getEntity($this->element).")";
|
||||
$sql .= " WHERE p.entity IN (".getEntity($this->element).")";
|
||||
if ($ref) {
|
||||
$sql .= " AND ref = '".$this->db->escape($ref)."'";
|
||||
$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
|
||||
} elseif ($ref_ext) {
|
||||
$sql .= " AND ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
$sql .= " AND p.ref_ext = '".$this->db->escape($ref_ext)."'";
|
||||
} elseif ($barcode) {
|
||||
$sql .= " AND barcode = '".$this->db->escape($barcode)."'";
|
||||
$sql .= " AND p.barcode = '".$this->db->escape($barcode)."'";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user