Move permission "see hidden categories" into "see hidden products/services".
This commit is contained in:
parent
7906b63597
commit
8980d9acc2
@ -3,17 +3,21 @@ English Dolibarr ChangeLog
|
|||||||
***** ChangeLog for 2.9 compared to 2.8 *****
|
***** ChangeLog for 2.9 compared to 2.8 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
- New: Support products property length and area.
|
||||||
- New: Add "payment due before" field in invoice exports
|
- New: Add "payment due before" field in invoice exports
|
||||||
- New: Add feature to resize or crop image files (for products photos)
|
- New: Add feature to resize or crop image files (for products photos)
|
||||||
- New: task #10113 : Show list of emailing on clicking on "number of mass emailing received"
|
- New: task #10113 : Show list of emailing on clicking on "number of mass emailing received"
|
||||||
- New: Add default language for third parties and use it when multilang is enabled
|
- New: Add default language for third parties and use it when multilang is enabled
|
||||||
to define default language for document generation.
|
to define default language for document generation.
|
||||||
- New: Can reopen a closed supplier invoice.
|
- New: Can reopen a closed supplier invoice.
|
||||||
|
- New: Move permission "see hidden categories" into "see hidden products/services".
|
||||||
- Fix: Format number was wrong for ar_AR language.
|
- Fix: Format number was wrong for ar_AR language.
|
||||||
- Fix: Can change password if has only permission change password.
|
- Fix: Can change password if has only permission change password.
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
- More comments in code
|
- More comments in code.
|
||||||
|
- Uniformize some code.
|
||||||
|
- First delete of useless pre.inc.php files.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 2.8 compared to 2.7 *****
|
***** ChangeLog for 2.8 compared to 2.7 *****
|
||||||
|
|||||||
@ -77,7 +77,8 @@ $sql.= " u.login, u.name, u.firstname";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user as u ON b.fk_user=u.rowid";
|
||||||
$sql.= " WHERE 1=1";
|
$sql.= " WHERE 1=1";
|
||||||
if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
|
if (! $user->admin) $sql.= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)";
|
||||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit( $limit, $offset);
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -92,7 +92,8 @@ $sql = "SELECT s.rowid, s.nom, ".$db->pdate("b.dateb")." as dateb, b.rowid as bi
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."bookmark as b, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE b.fk_soc = s.rowid AND b.fk_user=u.rowid";
|
$sql.= " WHERE b.fk_soc = s.rowid AND b.fk_user=u.rowid";
|
||||||
if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id;
|
if (! $user->admin) $sql.= " AND b.fk_user = ".$user->id;
|
||||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit( $limit, $offset);
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -84,7 +84,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -119,7 +119,8 @@ if ($_GET["contactname"]) // acces a partir du module de recherche
|
|||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($limit+1, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -357,7 +357,7 @@ if ($mil->fetch($_REQUEST["id"]) >= 0)
|
|||||||
if ($search_nom) $sql.= " AND mc.nom like '%".addslashes($search_nom)."%'";
|
if ($search_nom) $sql.= " AND mc.nom like '%".addslashes($search_nom)."%'";
|
||||||
if ($search_prenom) $sql.= " AND mc.prenom like '%".addslashes($search_prenom)."%'";
|
if ($search_prenom) $sql.= " AND mc.prenom like '%".addslashes($search_prenom)."%'";
|
||||||
if ($search_email) $sql.= " AND mc.email like '%".addslashes($search_email)."%'";
|
if ($search_email) $sql.= " AND mc.email like '%".addslashes($search_email)."%'";
|
||||||
if ($sortfield) { $sql .= " ORDER BY $sortfield $sortorder"; }
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -72,7 +72,8 @@ if ($filteremail)
|
|||||||
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
|
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="m.rowid";
|
if (! $sortfield) $sortfield="m.rowid";
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -83,7 +84,8 @@ else
|
|||||||
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
|
if ($sall) $sql.= " AND (m.titre like '%".$sall."%' OR m.sujet like '%".$sall."%' OR m.body like '%".$sall."%')";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="m.rowid";
|
if (! $sortfield) $sortfield="m.rowid";
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit +1, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_syslog("sql=".$sql);
|
dol_syslog("sql=".$sql);
|
||||||
|
|||||||
@ -844,18 +844,11 @@ class Form
|
|||||||
global $langs,$conf,$user;
|
global $langs,$conf,$user;
|
||||||
|
|
||||||
$sql = "SELECT ";
|
$sql = "SELECT ";
|
||||||
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.="DISTINCT";
|
|
||||||
}
|
|
||||||
$sql.= " p.rowid, p.label, p.ref, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.duration, p.stock";
|
$sql.= " p.rowid, p.label, p.ref, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.duration, p.stock";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
|
||||||
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
|
|
||||||
if($finished == 0)
|
if($finished == 0)
|
||||||
{
|
{
|
||||||
@ -870,11 +863,6 @@ class Form
|
|||||||
{
|
{
|
||||||
$sql.= " AND p.envente = ".$status;
|
$sql.= " AND p.envente = ".$status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
|
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
|
||||||
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')";
|
if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')";
|
||||||
$sql.= " ORDER BY p.ref";
|
$sql.= " ORDER BY p.ref";
|
||||||
|
|||||||
@ -138,13 +138,6 @@ class FormProduct
|
|||||||
$measuring_units[-3] = $langs->trans("WeightUnitg");
|
$measuring_units[-3] = $langs->trans("WeightUnitg");
|
||||||
$measuring_units[-6] = $langs->trans("WeightUnitmg");
|
$measuring_units[-6] = $langs->trans("WeightUnitmg");
|
||||||
}
|
}
|
||||||
else if ($measuring_style == 'volume')
|
|
||||||
{
|
|
||||||
$measuring_units[0] = $langs->trans("VolumeUnitm3");
|
|
||||||
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
|
|
||||||
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
|
||||||
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
|
|
||||||
}
|
|
||||||
else if ($measuring_style == 'size')
|
else if ($measuring_style == 'size')
|
||||||
{
|
{
|
||||||
$measuring_units[0] = $langs->trans("SizeUnitm");
|
$measuring_units[0] = $langs->trans("SizeUnitm");
|
||||||
@ -152,6 +145,20 @@ class FormProduct
|
|||||||
$measuring_units[-2] = $langs->trans("SizeUnitcm");
|
$measuring_units[-2] = $langs->trans("SizeUnitcm");
|
||||||
$measuring_units[-3] = $langs->trans("SizeUnitmm");
|
$measuring_units[-3] = $langs->trans("SizeUnitmm");
|
||||||
}
|
}
|
||||||
|
else if ($measuring_style == 'surface')
|
||||||
|
{
|
||||||
|
$measuring_units[0] = $langs->trans("SurfaceUnitm2");
|
||||||
|
$measuring_units[-2] = $langs->trans("SurfaceUnitdm2");
|
||||||
|
$measuring_units[-4] = $langs->trans("SurfaceUnitcm2");
|
||||||
|
$measuring_units[-6] = $langs->trans("SurfaceUnitmm2");
|
||||||
|
}
|
||||||
|
else if ($measuring_style == 'volume')
|
||||||
|
{
|
||||||
|
$measuring_units[0] = $langs->trans("VolumeUnitm3");
|
||||||
|
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
|
||||||
|
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
||||||
|
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
|
||||||
|
}
|
||||||
|
|
||||||
print '<select class="flat" name="'.$name.'">';
|
print '<select class="flat" name="'.$name.'">';
|
||||||
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
|
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
|
||||||
|
|||||||
@ -71,21 +71,14 @@ class box_produits extends ModeleBoxes {
|
|||||||
|
|
||||||
if ($user->rights->produit->lire || $user->rights->service->lire)
|
if ($user->rights->produit->lire || $user->rights->service->lire)
|
||||||
{
|
{
|
||||||
$clause = " WHERE";
|
|
||||||
|
|
||||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.envente";
|
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.envente";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
{
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
$sql.= $clause." COALESCE(c.visible,1)=1";
|
|
||||||
$clause = " AND";
|
|
||||||
}
|
|
||||||
$sql.= $clause." p.entity = ".$conf->entity;
|
|
||||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||||
$sql.= " ORDER BY p.datec DESC";
|
$sql.= $db->order('p.datec', 'DESC');
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -53,8 +53,8 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les donn<EFBFBD>es en m<EFBFBD>moire pour affichage ult<EFBFBD>rieur
|
* \brief Charge les donnees en memoire pour affichage ulterieur
|
||||||
* \param $max Nombre maximum d'enregistrements <EFBFBD> charger
|
* \param $max Nombre maximum d'enregistrements a charger
|
||||||
*/
|
*/
|
||||||
function loadBox($max=5)
|
function loadBox($max=5)
|
||||||
{
|
{
|
||||||
@ -79,22 +79,15 @@ class box_services_vendus extends ModeleBoxes {
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as ca ON cp.fk_categorie = ca.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE s.rowid = c.fk_soc";
|
$sql.= " WHERE s.rowid = c.fk_soc";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||||
$sql.= " AND cd.fk_product = p.rowid";
|
$sql.= " AND cd.fk_product = p.rowid";
|
||||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
$sql.= $db->order("c.tms","DESC");
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(ca.visible,1)=1';
|
|
||||||
}
|
|
||||||
$sql.= " ORDER BY c.tms DESC ";
|
|
||||||
$sql.= $db->plimit($max, 0);
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||||
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \defgroup category Module categories
|
* \defgroup category Module categories
|
||||||
* \brief Module pour g<EFBFBD>rer les cat<EFBFBD>gories
|
* \brief Module to manage categories
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -82,32 +82,25 @@ class modCategorie extends DolibarrModules
|
|||||||
|
|
||||||
$this->rights[$r][0] = 241; // id de la permission
|
$this->rights[$r][0] = 241; // id de la permission
|
||||||
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
|
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (d<EFBFBD>pr<EFBFBD>ci<EFBFBD> <20> ce jour)
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
|
||||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par d<EFBFBD>faut
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'lire';
|
$this->rights[$r][4] = 'lire';
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 242; // id de la permission
|
$this->rights[$r][0] = 242; // id de la permission
|
||||||
$this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission
|
$this->rights[$r][1] = 'Creer/modifier les categories'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'w'; // type de la permission (d<EFBFBD>pr<EFBFBD>ci<EFBFBD> <20> ce jour)
|
$this->rights[$r][2] = 'w'; // type de la permission (deprecated)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par d<EFBFBD>faut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'creer';
|
$this->rights[$r][4] = 'creer';
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 243; // id de la permission
|
$this->rights[$r][0] = 243; // id de la permission
|
||||||
$this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission
|
$this->rights[$r][1] = 'Supprimer les categories'; // libelle de la permission
|
||||||
$this->rights[$r][2] = 'd'; // type de la permission (d<EFBFBD>pr<EFBFBD>ci<EFBFBD> <20> ce jour)
|
$this->rights[$r][2] = 'd'; // type de la permission (deprecated)
|
||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par d<EFBFBD>faut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'supprimer';
|
$this->rights[$r][4] = 'supprimer';
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
$this->rights[$r][0] = 244; // id de la permission
|
|
||||||
$this->rights[$r][1] = 'Voir le contenu des categories cachees'; // libelle de la permission
|
|
||||||
$this->rights[$r][2] = 'r'; // type de la permission (d<>pr<70>ci<63> <20> ce jour)
|
|
||||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par d<>faut
|
|
||||||
$this->rights[$r][4] = 'voir';
|
|
||||||
$r++;
|
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
//--------
|
//--------
|
||||||
$r=0;
|
$r=0;
|
||||||
|
|||||||
@ -41,7 +41,6 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
|||||||
*/
|
*/
|
||||||
class modProduit extends DolibarrModules
|
class modProduit extends DolibarrModules
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur. Definit les noms, constantes et boites
|
* \brief Constructeur. Definit les noms, constantes et boites
|
||||||
* \param DB handler d'acces base
|
* \param DB handler d'acces base
|
||||||
@ -50,8 +49,8 @@ class modProduit extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$this->db = $DB ;
|
$this->db = $DB;
|
||||||
$this->numero = 50 ;
|
$this->numero = 50;
|
||||||
|
|
||||||
$this->family = "products";
|
$this->family = "products";
|
||||||
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
||||||
@ -118,6 +117,13 @@ class modProduit extends DolibarrModules
|
|||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'supprimer';
|
$this->rights[$r][4] = 'supprimer';
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 36; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Voir/gérer les produits cachés'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
|
||||||
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'hidden';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 38; // Must be same permission than in service module
|
$this->rights[$r][0] = 38; // Must be same permission than in service module
|
||||||
$this->rights[$r][1] = 'Exporter les produits';
|
$this->rights[$r][1] = 'Exporter les produits';
|
||||||
|
|||||||
@ -109,6 +109,13 @@ class modService extends DolibarrModules
|
|||||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
$this->rights[$r][4] = 'supprimer';
|
$this->rights[$r][4] = 'supprimer';
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 536; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Voir/gérer les services cachés'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
|
||||||
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'hidden';
|
||||||
|
$r++;
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 538; // Must be same permission than in product module
|
$this->rights[$r][0] = 538; // Must be same permission than in product module
|
||||||
$this->rights[$r][1] = 'Exporter les services';
|
$this->rights[$r][1] = 'Exporter les services';
|
||||||
|
|||||||
@ -75,3 +75,8 @@ alter table llx_facture_fourn_det add column total_localtax1 double(24,8) DEFAUL
|
|||||||
alter table llx_facture_fourn_det add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
|
alter table llx_facture_fourn_det add column total_localtax2 double(24,8) DEFAULT 0 after total_localtax1;
|
||||||
|
|
||||||
alter table llx_product add column hidden tinyint DEFAULT 0;
|
alter table llx_product add column hidden tinyint DEFAULT 0;
|
||||||
|
|
||||||
|
alter table llx_product add column length float DEFAULT NULL after weight_units;
|
||||||
|
alter table llx_product add column length_units tinyint DEFAULT NULL after length;
|
||||||
|
alter table llx_product add column surface float DEFAULT NULL after length_units;
|
||||||
|
alter table llx_product add column surface_units tinyint DEFAULT NULL after surface;
|
||||||
|
|||||||
@ -49,6 +49,10 @@ create table llx_product
|
|||||||
partnumber varchar(32),
|
partnumber varchar(32),
|
||||||
weight float DEFAULT NULL,
|
weight float DEFAULT NULL,
|
||||||
weight_units tinyint DEFAULT NULL,
|
weight_units tinyint DEFAULT NULL,
|
||||||
|
length float DEFAULT NULL,
|
||||||
|
length_units tinyint DEFAULT NULL,
|
||||||
|
surface float DEFAULT NULL,
|
||||||
|
surface_units tinyint DEFAULT NULL,
|
||||||
volume float DEFAULT NULL,
|
volume float DEFAULT NULL,
|
||||||
volume_units tinyint DEFAULT NULL,
|
volume_units tinyint DEFAULT NULL,
|
||||||
stock integer, -- physical stock
|
stock integer, -- physical stock
|
||||||
|
|||||||
@ -2766,11 +2766,13 @@ function migrate_project_task_time($db,$langs,$conf)
|
|||||||
}
|
}
|
||||||
print ". ";
|
print ". ";
|
||||||
$oldtime++;
|
$oldtime++;
|
||||||
$totaltime[$obj->fk_task] += $newtime;
|
if (! empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $newtime;
|
||||||
|
else $totaltime[$obj->fk_task] = $newtime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$totaltime[$obj->fk_task] += $obj->task_duration;
|
if (! empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $obj->task_duration;
|
||||||
|
else $totaltime[$obj->fk_task] = $obj->task_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -557,6 +557,7 @@ ToTest=Test
|
|||||||
ValidateBefore=Card must be validated before using this feature
|
ValidateBefore=Card must be validated before using this feature
|
||||||
Visibility=Visibility
|
Visibility=Visibility
|
||||||
Private=Private
|
Private=Private
|
||||||
|
Hidden=Hidden
|
||||||
# Week day
|
# Week day
|
||||||
Day1=Monday
|
Day1=Monday
|
||||||
Day2=Tuesday
|
Day2=Tuesday
|
||||||
|
|||||||
@ -69,13 +69,23 @@ FeatureDevelopment=Development feature. Not stable in this version
|
|||||||
FeaturesSupported=Features supported
|
FeaturesSupported=Features supported
|
||||||
Width=Width
|
Width=Width
|
||||||
Height=Height
|
Height=Height
|
||||||
Weight=Weight
|
|
||||||
Depth=Depth
|
Depth=Depth
|
||||||
|
Weight=Weight
|
||||||
TotalWeight=Total weight
|
TotalWeight=Total weight
|
||||||
WeightUnitton=tonnes
|
WeightUnitton=tonnes
|
||||||
WeightUnitkg=kg
|
WeightUnitkg=kg
|
||||||
WeightUnitg=g
|
WeightUnitg=g
|
||||||
WeightUnitmg=mg
|
WeightUnitmg=mg
|
||||||
|
Length=Length
|
||||||
|
LengthUnitm=m
|
||||||
|
LengthUnitdm=dm
|
||||||
|
LengthUnitcm=cm
|
||||||
|
LengthUnitmm=mm
|
||||||
|
Surface=Surface
|
||||||
|
SurfaceUnitm2=m2
|
||||||
|
SurfaceUnitdm2=dm2
|
||||||
|
SurfaceUnitcm2=cm2
|
||||||
|
SurfaceUnitmm2=mm2
|
||||||
Volume=Volume
|
Volume=Volume
|
||||||
TotalVolume=Total volume
|
TotalVolume=Total volume
|
||||||
VolumeUnitm3=m3
|
VolumeUnitm3=m3
|
||||||
|
|||||||
@ -556,6 +556,7 @@ ToTest=Tester
|
|||||||
ValidateBefore=La fiche doit être validée pour pouvoir utiliser cette fonction
|
ValidateBefore=La fiche doit être validée pour pouvoir utiliser cette fonction
|
||||||
Visibility=Visibilité
|
Visibility=Visibilité
|
||||||
Private=Privé
|
Private=Privé
|
||||||
|
Hidden=Caché
|
||||||
# Week day
|
# Week day
|
||||||
Day1=Lundi
|
Day1=Lundi
|
||||||
Day2=Mardi
|
Day2=Mardi
|
||||||
|
|||||||
@ -69,13 +69,23 @@ FeatureDevelopment=Fonctionnalité en développement. Non stable dans cette vers
|
|||||||
FeaturesSupported=Fonctionnalités supportées
|
FeaturesSupported=Fonctionnalités supportées
|
||||||
Width=Largeur
|
Width=Largeur
|
||||||
Height=Hauteur
|
Height=Hauteur
|
||||||
Weight=Poids
|
|
||||||
Depth=Profondeur
|
Depth=Profondeur
|
||||||
|
Weight=Poids
|
||||||
TotalWeight=Poids total
|
TotalWeight=Poids total
|
||||||
WeightUnitton=tonnes
|
WeightUnitton=tonnes
|
||||||
WeightUnitkg=kg
|
WeightUnitkg=kg
|
||||||
WeightUnitg=g
|
WeightUnitg=g
|
||||||
WeightUnitmg=mg
|
WeightUnitmg=mg
|
||||||
|
Length=Longueur
|
||||||
|
LengthUnitm=m
|
||||||
|
LengthUnitdm=dm
|
||||||
|
LengthUnitcm=cm
|
||||||
|
LengthUnitmm=mm
|
||||||
|
Surface=Surface
|
||||||
|
SurfaceUnitm2=m2
|
||||||
|
SurfaceUnitdm2=dm2
|
||||||
|
SurfaceUnitcm2=cm2
|
||||||
|
SurfaceUnitmm2=mm2
|
||||||
Volume=Volume
|
Volume=Volume
|
||||||
TotalVolume=Volume total
|
TotalVolume=Volume total
|
||||||
VolumeUnitm3=m3
|
VolumeUnitm3=m3
|
||||||
|
|||||||
@ -278,8 +278,8 @@ function show_stats_for_company($product,$socid)
|
|||||||
function measuring_units_string($unit,$measuring_style='')
|
function measuring_units_string($unit,$measuring_style='')
|
||||||
{
|
{
|
||||||
/* Note Rodo aux dev :)
|
/* Note Rodo aux dev :)
|
||||||
* Ne pas ins<EFBFBD>rer dans la base de donn<EFBFBD>es ces valeurs
|
* Ne pas inserer dans la base de donnees ces valeurs
|
||||||
* cela surchagerait inutilement d'une requete suppl<EFBFBD>mentaire
|
* cela surchagerait inutilement d'une requete supplementaire
|
||||||
* pour quelque chose qui est somme toute peu variable
|
* pour quelque chose qui est somme toute peu variable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -292,13 +292,6 @@ function measuring_units_string($unit,$measuring_style='')
|
|||||||
$measuring_units[-3] = $langs->trans("WeightUnitg");
|
$measuring_units[-3] = $langs->trans("WeightUnitg");
|
||||||
$measuring_units[-6] = $langs->trans("WeightUnitmg");
|
$measuring_units[-6] = $langs->trans("WeightUnitmg");
|
||||||
}
|
}
|
||||||
else if ($measuring_style == 'volume')
|
|
||||||
{
|
|
||||||
$measuring_units[0] = $langs->trans("VolumeUnitm3");
|
|
||||||
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
|
|
||||||
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
|
||||||
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
|
|
||||||
}
|
|
||||||
else if ($measuring_style == 'size')
|
else if ($measuring_style == 'size')
|
||||||
{
|
{
|
||||||
$measuring_units[0] = $langs->trans("SizeUnitm");
|
$measuring_units[0] = $langs->trans("SizeUnitm");
|
||||||
@ -306,6 +299,20 @@ function measuring_units_string($unit,$measuring_style='')
|
|||||||
$measuring_units[-2] = $langs->trans("SizeUnitcm");
|
$measuring_units[-2] = $langs->trans("SizeUnitcm");
|
||||||
$measuring_units[-3] = $langs->trans("SizeUnitmm");
|
$measuring_units[-3] = $langs->trans("SizeUnitmm");
|
||||||
}
|
}
|
||||||
|
else if ($measuring_style == 'surface')
|
||||||
|
{
|
||||||
|
$measuring_units[0] = $langs->trans("SurfaceUnitm2");
|
||||||
|
$measuring_units[-2] = $langs->trans("SurfaceUnitdm2");
|
||||||
|
$measuring_units[-4] = $langs->trans("SurfaceUnitcm2");
|
||||||
|
$measuring_units[-6] = $langs->trans("SurfaceUnitmm2");
|
||||||
|
}
|
||||||
|
else if ($measuring_style == 'volume')
|
||||||
|
{
|
||||||
|
$measuring_units[0] = $langs->trans("VolumeUnitm3");
|
||||||
|
$measuring_units[-3] = $langs->trans("VolumeUnitdm3");
|
||||||
|
$measuring_units[-6] = $langs->trans("VolumeUnitcm3");
|
||||||
|
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
|
||||||
|
}
|
||||||
|
|
||||||
return $measuring_units[$unit];
|
return $measuring_units[$unit];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,12 +80,18 @@ class Product extends CommonObject
|
|||||||
var $duration_unit;
|
var $duration_unit;
|
||||||
// Statut indique si le produit est en vente '1' ou non '0'
|
// Statut indique si le produit est en vente '1' ou non '0'
|
||||||
var $status;
|
var $status;
|
||||||
// Statut indique si le produit est un produit finis '1' ou une matiere premiere '0'
|
// Statut indique si le produit est un produit fini '1' ou une matiere premiere '0'
|
||||||
var $finished;
|
var $finished;
|
||||||
|
|
||||||
|
var $hidden;
|
||||||
|
|
||||||
//! Unites de mesure
|
//! Unites de mesure
|
||||||
var $weight;
|
var $weight;
|
||||||
var $weight_units;
|
var $weight_units;
|
||||||
|
var $length;
|
||||||
|
var $length_units;
|
||||||
|
var $surface;
|
||||||
|
var $surface_units;
|
||||||
var $volume;
|
var $volume;
|
||||||
var $volume_units;
|
var $volume_units;
|
||||||
|
|
||||||
@ -160,9 +166,9 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Insert product in database
|
* \brief Insert product into database
|
||||||
* \param user Utilisateur qui effectue l'insertion
|
* \param user User making insert
|
||||||
* \return int id du produit ou numero d'erreur < 0
|
* \return int id of product/service if OK or number of error < 0
|
||||||
*/
|
*/
|
||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
@ -182,6 +188,7 @@ class Product extends CommonObject
|
|||||||
if (empty($this->price_min)) $this->price_min = 0;
|
if (empty($this->price_min)) $this->price_min = 0;
|
||||||
if (empty($this->status)) $this->status = 0;
|
if (empty($this->status)) $this->status = 0;
|
||||||
if (empty($this->finished)) $this->finished = 0;
|
if (empty($this->finished)) $this->finished = 0;
|
||||||
|
if (empty($this->hidden)) $this->hidden = 0;
|
||||||
|
|
||||||
$price_ht=0;
|
$price_ht=0;
|
||||||
$price_ttc=0;
|
$price_ttc=0;
|
||||||
@ -247,6 +254,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", price_base_type";
|
$sql.= ", price_base_type";
|
||||||
$sql.= ", canvas";
|
$sql.= ", canvas";
|
||||||
$sql.= ", finished";
|
$sql.= ", finished";
|
||||||
|
$sql.= ", hidden";
|
||||||
$sql.= ") VALUES (";
|
$sql.= ") VALUES (";
|
||||||
$sql.= $this->db->idate(mktime());
|
$sql.= $this->db->idate(mktime());
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
@ -261,6 +269,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", '".$this->price_base_type."'";
|
$sql.= ", '".$this->price_base_type."'";
|
||||||
$sql.= ", '".$this->canvas."'";
|
$sql.= ", '".$this->canvas."'";
|
||||||
$sql.= ", ".$this->finished;
|
$sql.= ", ".$this->finished;
|
||||||
|
$sql.= ", ".$this->hidden;
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
|
|
||||||
dol_syslog("Product::Create sql=".$sql);
|
dol_syslog("Product::Create sql=".$sql);
|
||||||
@ -392,10 +401,15 @@ class Product extends CommonObject
|
|||||||
$this->stock_loc = trim($this->stock_loc);
|
$this->stock_loc = trim($this->stock_loc);
|
||||||
$this->weight = price2num($this->weight);
|
$this->weight = price2num($this->weight);
|
||||||
$this->weight_units = trim($this->weight_units);
|
$this->weight_units = trim($this->weight_units);
|
||||||
|
$this->length = price2num($this->length);
|
||||||
|
$this->length_units = trim($this->length_units);
|
||||||
|
$this->surface = price2num($this->surface);
|
||||||
|
$this->surface_units = trim($this->surface_units);
|
||||||
$this->volume = price2num($this->volume);
|
$this->volume = price2num($this->volume);
|
||||||
$this->volume_units = trim($this->volume_units);
|
$this->volume_units = trim($this->volume_units);
|
||||||
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
if (empty($this->tva_tx)) $this->tva_tx = 0;
|
||||||
if (empty($this->finished)) $this->finished = 0;
|
if (empty($this->finished)) $this->finished = 0;
|
||||||
|
if (empty($this->hidden)) $this->hidden = 0;
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
|
||||||
$sql .= " SET label = '" . addslashes($this->libelle) ."'";
|
$sql .= " SET label = '" . addslashes($this->libelle) ."'";
|
||||||
@ -403,8 +417,13 @@ class Product extends CommonObject
|
|||||||
$sql .= ",tva_tx = " . $this->tva_tx;
|
$sql .= ",tva_tx = " . $this->tva_tx;
|
||||||
$sql .= ",envente = " . $this->status;
|
$sql .= ",envente = " . $this->status;
|
||||||
$sql .= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
|
$sql .= ",finished = " . ($this->finished<0 ? "null" : $this->finished);
|
||||||
|
$sql .= ",hidden = " . ($this->hidden<0 ? "null" : $this->hidden);
|
||||||
$sql .= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
$sql .= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null');
|
||||||
$sql .= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
$sql .= ",weight_units = " . ($this->weight_units!='' ? "'".$this->weight_units."'": 'null');
|
||||||
|
$sql .= ",length = " . ($this->length!='' ? "'".$this->length."'" : 'null');
|
||||||
|
$sql .= ",length_units = " . ($this->length_units!='' ? "'".$this->length_units."'" : 'null');
|
||||||
|
$sql .= ",surface = " . ($this->surface!='' ? "'".$this->surface."'" : 'null');
|
||||||
|
$sql .= ",surface_units = " . ($this->surface_units!='' ? "'".$this->surface_units."'" : 'null');
|
||||||
$sql .= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
|
$sql .= ",volume = " . ($this->volume!='' ? "'".$this->volume."'" : 'null');
|
||||||
$sql .= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
|
$sql .= ",volume_units = " . ($this->volume_units!='' ? "'".$this->volume_units."'" : 'null');
|
||||||
$sql .= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
|
$sql .= ",seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->seuil_stock_alerte."'" : "null");
|
||||||
@ -891,7 +910,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
dol_syslog("Product::fetch id=$id ref=$ref");
|
dol_syslog("Product::fetch id=$id ref=$ref");
|
||||||
|
|
||||||
// Verification parametres
|
// Check parameters
|
||||||
if (! $id && ! $ref)
|
if (! $id && ! $ref)
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans('ErrorWrongParameters');
|
$this->error=$langs->trans('ErrorWrongParameters');
|
||||||
@ -901,8 +920,8 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT rowid, ref, label, description, note, price, price_ttc,";
|
$sql = "SELECT rowid, ref, label, description, note, price, price_ttc,";
|
||||||
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
$sql.= " price_min, price_min_ttc, price_base_type, tva_tx, envente,";
|
||||||
$sql.= " fk_product_type, duration, seuil_stock_alerte,canvas,";
|
$sql.= " fk_product_type, duration, seuil_stock_alerte, canvas,";
|
||||||
$sql.= " stock_loc, weight, weight_units, volume, volume_units, barcode, fk_barcode_type, finished,";
|
$sql.= " stock_loc, weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, hidden,";
|
||||||
$sql.= " stock, pmp,";
|
$sql.= " stock, pmp,";
|
||||||
$sql.= " import_key";
|
$sql.= " import_key";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||||
@ -929,6 +948,7 @@ class Product extends CommonObject
|
|||||||
$this->type = $result["fk_product_type"];
|
$this->type = $result["fk_product_type"];
|
||||||
$this->status = $result["envente"];
|
$this->status = $result["envente"];
|
||||||
$this->finished = $result["finished"];
|
$this->finished = $result["finished"];
|
||||||
|
$this->hidden = $result["hidden"];
|
||||||
$this->duration = $result["duration"];
|
$this->duration = $result["duration"];
|
||||||
$this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);
|
$this->duration_value = substr($result["duration"],0,strlen($result["duration"])-1);
|
||||||
$this->duration_unit = substr($result["duration"],-1);
|
$this->duration_unit = substr($result["duration"],-1);
|
||||||
@ -937,6 +957,10 @@ class Product extends CommonObject
|
|||||||
$this->stock_loc = $result["stock_loc"];
|
$this->stock_loc = $result["stock_loc"];
|
||||||
$this->weight = $result["weight"];
|
$this->weight = $result["weight"];
|
||||||
$this->weight_units = $result["weight_units"];
|
$this->weight_units = $result["weight_units"];
|
||||||
|
$this->length = $result["length"];
|
||||||
|
$this->length_units = $result["length_units"];
|
||||||
|
$this->surface = $result["surface"];
|
||||||
|
$this->surface_units = $result["surface_units"];
|
||||||
$this->volume = $result["volume"];
|
$this->volume = $result["volume"];
|
||||||
$this->volume_units = $result["volume_units"];
|
$this->volume_units = $result["volume_units"];
|
||||||
$this->barcode = $result["barcode"];
|
$this->barcode = $result["barcode"];
|
||||||
@ -991,7 +1015,8 @@ class Product extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_price";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_price";
|
||||||
$sql.= " where price_level=".$i." and";
|
$sql.= " where price_level=".$i." and";
|
||||||
$sql.= " fk_product = '".$this->id."'";
|
$sql.= " fk_product = '".$this->id."'";
|
||||||
$sql.= " order by date_price DESC limit 1";
|
$sql.= " ORDER BY date_price DESC";
|
||||||
|
$sql.= " LIMIT 1";
|
||||||
$resql = $this->db->query($sql) ;
|
$resql = $this->db->query($sql) ;
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -2651,17 +2676,11 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$sql = "SELECT count(p.rowid) as nb";
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.fk_product_type <> 1";
|
$sql.= " WHERE p.fk_product_type <> 1";
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " AND COALESCE(c.visible,1)=1";
|
|
||||||
}
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
@ -79,6 +79,14 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
|||||||
$_GET["type"] = $_POST["type"];
|
$_GET["type"] = $_POST["type"];
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
if (empty($_POST["ref"]))
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'</div>';
|
||||||
|
$_GET["action"] = "create";
|
||||||
|
$_GET["canvas"] = $product->canvas;
|
||||||
|
$_GET["type"] = $_POST["type"];
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -111,9 +119,14 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
|||||||
$product->canvas = $_POST["canvas"];
|
$product->canvas = $_POST["canvas"];
|
||||||
$product->weight = $_POST["weight"];
|
$product->weight = $_POST["weight"];
|
||||||
$product->weight_units = $_POST["weight_units"];
|
$product->weight_units = $_POST["weight_units"];
|
||||||
|
$product->length = $_POST["size"];
|
||||||
|
$product->length_units = $_POST["size_units"];
|
||||||
|
$product->surface = $_POST["surface"];
|
||||||
|
$product->surface_units = $_POST["surface_units"];
|
||||||
$product->volume = $_POST["volume"];
|
$product->volume = $_POST["volume"];
|
||||||
$product->volume_units = $_POST["volume_units"];
|
$product->volume_units = $_POST["volume_units"];
|
||||||
$product->finished = $_POST["finished"];
|
$product->finished = $_POST["finished"];
|
||||||
|
$product->hidden = $_POST["hidden"]=='yes'?1:0;
|
||||||
// MultiPrix
|
// MultiPrix
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
if($conf->global->PRODUIT_MULTIPRICES)
|
||||||
{
|
{
|
||||||
@ -133,9 +146,6 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
|||||||
|
|
||||||
if ( $value != $current_lang ) $e_product = $product;
|
if ( $value != $current_lang ) $e_product = $product;
|
||||||
|
|
||||||
// Specific product
|
|
||||||
// $_POST n'est pas utilise dans la classe Product
|
|
||||||
// mais dans des classes qui herite de Product
|
|
||||||
$id = $product->create($user);
|
$id = $product->create($user);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -177,9 +187,14 @@ if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rig
|
|||||||
$product->canvas = $_POST["canvas"];
|
$product->canvas = $_POST["canvas"];
|
||||||
$product->weight = $_POST["weight"];
|
$product->weight = $_POST["weight"];
|
||||||
$product->weight_units = $_POST["weight_units"];
|
$product->weight_units = $_POST["weight_units"];
|
||||||
|
$product->length = $_POST["size"];
|
||||||
|
$product->length_units = $_POST["size_units"];
|
||||||
|
$product->surface = $_POST["surface"];
|
||||||
|
$product->surface_units = $_POST["surface_units"];
|
||||||
$product->volume = $_POST["volume"];
|
$product->volume = $_POST["volume"];
|
||||||
$product->volume_units = $_POST["volume_units"];
|
$product->volume_units = $_POST["volume_units"];
|
||||||
$product->finished = $_POST["finished"];
|
$product->finished = $_POST["finished"];
|
||||||
|
$product->hidden = $_POST["hidden"]=='yes'?1:0;
|
||||||
|
|
||||||
if ($product->check())
|
if ($product->check())
|
||||||
{
|
{
|
||||||
@ -621,7 +636,7 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$product->ref.'">';
|
print '<td class="fieldrequired" width="20%">'.$langs->trans("Ref").'</td><td><input name="ref" size="40" maxlength="32" value="'.$_POST["ref"].'">';
|
||||||
if ($_error == 1)
|
if ($_error == 1)
|
||||||
{
|
{
|
||||||
print $langs->trans("RefAlreadyExists");
|
print $langs->trans("RefAlreadyExists");
|
||||||
@ -629,7 +644,7 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$_POST["libelle"].'"></td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
|
||||||
@ -641,7 +656,7 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
print '<tr><td>'.$langs->trans("StockLimit").'</td><td>';
|
||||||
print '<input name="seuil_stock_alerte" size="4" value="0">';
|
print '<input name="seuil_stock_alerte" size="4" value="'.$_POST["seuil_stock_alerte"].'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -655,12 +670,13 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('desc','',160,'dolibarr_notes','',false);
|
$doleditor=new DolEditor('desc',$_POST["desc"],160,'dolibarr_notes','',false);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<textarea name="desc" rows="4" cols="90">';
|
print '<textarea name="desc" rows="4" cols="90">';
|
||||||
|
print $_POST["desc"];
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,31 +703,51 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Weight - Volume
|
if ($_GET["type"] != 1) // Le poids et le volume ne concerne que les produits et pas les services
|
||||||
if ($_GET["type"] != 1)
|
|
||||||
{
|
{
|
||||||
// Le poids et le volume ne concerne que les produits et pas les services
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="4" value="">';
|
print '<input name="weight" size="4" value="'.$_POST["weight"].'">';
|
||||||
print $formproduct->select_measuring_units("weight_units","weight");
|
print $formproduct->select_measuring_units("weight_units","weight");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
// Length
|
||||||
|
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||||
|
print '<input name="size" size="4" value="'.$_POST["size"].'">';
|
||||||
|
print $formproduct->select_measuring_units("size_units","size");
|
||||||
|
print '</td></tr>';
|
||||||
|
// Surface
|
||||||
|
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||||
|
print '<input name="surface" size="4" value="'.$_POST["surface"].'">';
|
||||||
|
print $formproduct->select_measuring_units("surface_units","surface");
|
||||||
|
print '</td></tr>';
|
||||||
|
// Volume
|
||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||||
print '<input name="volume" size="4" value="">';
|
print '<input name="volume" size="4" value="'.$_POST["volume"].'">';
|
||||||
print $formproduct->select_measuring_units("volume_units","volume");
|
print $formproduct->select_measuring_units("volume_units","volume");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if (($_GET["type"] != 1 && $user->rights->produit->hidden)
|
||||||
|
|| ($_GET["type"] == 1 && $user->rights->service->hidden))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||||
|
print $html->selectyesno($product->hidden);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Note (invisible sur facture, propales...)
|
// Note (invisible sur facture, propales...)
|
||||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('note','',180,'dolibarr_notes','',false);
|
$doleditor=new DolEditor('note',$_POST["note"],180,'dolibarr_notes','',false);
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<textarea name="note" rows="8" cols="70">';
|
print '<textarea name="note" rows="8" cols="70">';
|
||||||
|
print $_POST["note"];
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
@ -719,14 +755,15 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||||
if($conf->global->PRODUIT_MULTIPRICES)
|
|
||||||
{
|
{
|
||||||
// We do no show price array on create when multiprices enabled.
|
// We do no show price array on create when multiprices enabled.
|
||||||
// We must set them on prices tab.
|
// We must set them on prices tab.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// PRIX
|
// PRIX
|
||||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
|
print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
|
||||||
print '<td><input name="price" size="10" value="'.$product->price.'">';
|
print '<td><input name="price" size="10" value="'.$product->price.'">';
|
||||||
@ -742,22 +779,20 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||||
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
print '<center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//RODO
|
|
||||||
// On assigne les valeurs meme en creation car elles sont definies si
|
// On assigne les valeurs meme en creation car elles sont definies si
|
||||||
// on revient en erreur
|
// on revient en erreur
|
||||||
//
|
|
||||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/templates/'.$_GET["canvas"].'/';
|
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/templates/'.$_GET["canvas"].'/';
|
||||||
$tvaarray = load_tva($db,"tva_tx",$conf->defaulttx,$mysoc,'');
|
$tvaarray = load_tva($db,"tva_tx",$conf->defaulttx,$mysoc,'');
|
||||||
$smarty->assign('tva_taux_value', $tvaarray['value']);
|
$smarty->assign('tva_taux_value', $tvaarray['value']);
|
||||||
@ -1016,7 +1051,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Weight / Volume
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
|
||||||
if ($product->weight != '')
|
if ($product->weight != '')
|
||||||
{
|
{
|
||||||
@ -1027,7 +1062,29 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
// Length
|
||||||
|
print '<tr><td>'.$langs->trans("Length").'</td><td colspan="2">';
|
||||||
|
if ($product->length != '')
|
||||||
|
{
|
||||||
|
print $product->length." ".measuring_units_string($product->length_units,"size");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
// Surface
|
||||||
|
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
||||||
|
if ($product->surface != '')
|
||||||
|
{
|
||||||
|
print $product->surface." ".measuring_units_string($product->surface_units,"surface");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
// Volume
|
||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
||||||
if ($product->volume != '')
|
if ($product->volume != '')
|
||||||
{
|
{
|
||||||
@ -1040,6 +1097,15 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if ((! $product->isservice() && $user->rights->produit->hidden)
|
||||||
|
|| ($product->isservice() && $user->rights->service->hidden))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td colspan="2">';
|
||||||
|
print yn($product->hidden);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.nl2br($product->note).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.nl2br($product->note).'</td></tr>';
|
||||||
|
|
||||||
@ -1148,18 +1214,37 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Weight / Volume
|
// Weight
|
||||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
|
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
|
||||||
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
|
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
// Length
|
||||||
|
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||||
|
print '<input name="size" size="5" value="'.$product->length.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("size_units", "size", $product->length_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
// Surface
|
||||||
|
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||||
|
print '<input name="surface" size="5" value="'.$product->surface.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("surface_units", "surface", $product->surface_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
// Volume
|
||||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||||
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
|
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
|
||||||
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
|
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if ((! $product->isservice() && $user->rights->produit->hidden)
|
||||||
|
|| ($product->isservice() && $user->rights->service->hidden))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||||
|
print $html->selectyesno('hidden',$product->hidden);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||||
@ -1175,10 +1260,13 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
print "</textarea>";
|
print "</textarea>";
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print "<!-- CUT HERE -->\n";
|
print "<!-- CUT HERE -->\n";
|
||||||
}
|
}
|
||||||
@ -1233,22 +1321,6 @@ if ($_GET["action"] == '')
|
|||||||
print '<a class="butAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("ToClone").'</a>';
|
print '<a class="butAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("ToClone").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if ($product->isproduct() && $user->rights->commande->creer)
|
|
||||||
{
|
|
||||||
$langs->load('orders');
|
|
||||||
print '<a class="butAction" href="fiche.php?action=fastappro&id='.$product->id.'">';
|
|
||||||
print $langs->trans("CreateCustomerOrder").'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($product->isproduct() && $user->rights->fournisseur->commande->creer)
|
|
||||||
{
|
|
||||||
$langs->load('orders');
|
|
||||||
print '<a class="butAction" href="fiche.php?action=fastappro&id='.$product->id.'">';
|
|
||||||
print $langs->trans("CreateSupplierOrder").'</a>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$product_is_used = $product->verif_prod_use($product->id);
|
$product_is_used = $product->verif_prod_use($product->id);
|
||||||
if ($user->rights->produit->supprimer)
|
if ($user->rights->produit->supprimer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -365,7 +365,7 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
$sql.= " WHERE pf.fk_soc = s.rowid";
|
$sql.= " WHERE pf.fk_soc = s.rowid";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
$sql.= " AND pf.fk_product = ".$product->id;
|
$sql.= " AND pf.fk_product = ".$product->id;
|
||||||
$sql.= " ORDER BY lower(s.nom), pfp.quantity";
|
$sql.= " ORDER BY s.nom, pfp.quantity";
|
||||||
|
|
||||||
$resql="";
|
$resql="";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
@ -165,15 +165,12 @@ $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_subproduct as sp ON p.rowid = sp.fk_product_subproduct";
|
||||||
$sql.= " WHERE sp.fk_product_subproduct IS NULL";
|
$sql.= " WHERE sp.fk_product_subproduct IS NULL";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
/*if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
{
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
$sql.= " AND COALESCE(c.visible,1)=1 ";
|
|
||||||
}*/
|
|
||||||
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
if ($type != '') $sql.= " AND p.fk_product_type = ".$type;
|
||||||
$sql.= $db->order("p.tms","DESC");
|
$sql.= $db->order("p.tms","DESC");
|
||||||
$sql.= $db->plimit($max,0);
|
$sql.= $db->plimit($max,0);
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $db->query($sql) ;
|
$result = $db->query($sql) ;
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -104,11 +104,6 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc
|
|||||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||||
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
|
$sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||||
if ($conf->categorie->enabled && ($catid || !$user->rights->categorie->voir))
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_GET["fourn_id"] > 0)
|
if ($_GET["fourn_id"] > 0)
|
||||||
{
|
{
|
||||||
@ -116,6 +111,8 @@ if ($_GET["fourn_id"] > 0)
|
|||||||
$sql.= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
$sql.= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
|
||||||
}
|
}
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
||||||
@ -144,10 +141,6 @@ if($catid)
|
|||||||
{
|
{
|
||||||
$sql.= " AND cp.fk_categorie = ".$catid;
|
$sql.= " AND cp.fk_categorie = ".$catid;
|
||||||
}
|
}
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
if ($fourn_id > 0)
|
if ($fourn_id > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||||
|
|||||||
@ -90,21 +90,14 @@ print "</tr>\n";
|
|||||||
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, count(*) as c";
|
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type as type, count(*) as c";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.rowid = pd.fk_product";
|
$sql.= " WHERE p.rowid = pd.fk_product";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
if (isset($_GET['type'])) $sql.= " AND fk_product_type = ".$_GET['type'];
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
$sql.= " GROUP BY (p.rowid)";
|
$sql.= " GROUP BY (p.rowid)";
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit( $limit ,$offset);
|
$sql.= $db->plimit($limit ,$offset);
|
||||||
|
|
||||||
$result=$db->query($sql) ;
|
$result=$db->query($sql) ;
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -78,11 +78,6 @@ $sql.= ' p.duration, p.envente as statut, p.seuil_stock_alerte,';
|
|||||||
$sql.= ' SUM(s.reel) as stock_physique';
|
$sql.= ' SUM(s.reel) as stock_physique';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
|
||||||
$sql.= ' '.MAIN_DB_PREFIX.'product as p';
|
$sql.= ' '.MAIN_DB_PREFIX.'product as p';
|
||||||
if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir))
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_GET["fourn_id"] > 0)
|
if ($_GET["fourn_id"] > 0)
|
||||||
{
|
{
|
||||||
@ -91,6 +86,8 @@ if ($_GET["fourn_id"] > 0)
|
|||||||
}
|
}
|
||||||
$sql.= " WHERE p.rowid = s.fk_product";
|
$sql.= " WHERE p.rowid = s.fk_product";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
if ($sall)
|
if ($sall)
|
||||||
{
|
{
|
||||||
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
$sql.= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
|
||||||
@ -119,16 +116,12 @@ if($catid)
|
|||||||
{
|
{
|
||||||
$sql.= " AND cp.fk_categorie = ".$catid;
|
$sql.= " AND cp.fk_categorie = ".$catid;
|
||||||
}
|
}
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
if ($fourn_id > 0)
|
if ($fourn_id > 0)
|
||||||
{
|
{
|
||||||
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
$sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
|
||||||
}
|
}
|
||||||
$sql.= " GROUP BY p.rowid";
|
$sql.= " GROUP BY p.rowid";
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||||
$resql = $db->query($sql) ;
|
$resql = $db->query($sql) ;
|
||||||
|
|
||||||
|
|||||||
@ -41,14 +41,10 @@ $mesg = '';
|
|||||||
*/
|
*/
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.fk_product_type <> 1";
|
$sql.= " WHERE p.fk_product_type <> 1";
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir) $sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
@ -60,15 +56,11 @@ $db->free();
|
|||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.envente = 0";
|
$sql.= " WHERE p.envente = 0";
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.fk_product_type <> '1'";
|
$sql.= " AND p.fk_product_type <> '1'";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir) $sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
@ -77,14 +69,18 @@ if ($db->query($sql))
|
|||||||
}
|
}
|
||||||
$db->free();
|
$db->free();
|
||||||
|
|
||||||
if ($conf->service->enabled)
|
if ($conf->produit->enabled && $conf->service->enabled)
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("ProductsAndServicesStatistics"), $mesg);
|
print_fiche_titre($langs->trans("ProductsAndServicesStatistics"), $mesg);
|
||||||
}
|
}
|
||||||
else
|
elseif ($conf->produit->enabled)
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans("ProductsStatistics"), $mesg);
|
print_fiche_titre($langs->trans("ProductsStatistics"), $mesg);
|
||||||
}
|
}
|
||||||
|
elseif ($conf->service->enabled)
|
||||||
|
{
|
||||||
|
print_fiche_titre($langs->trans("ServicesStatistics"), $mesg);
|
||||||
|
}
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
@ -106,14 +102,10 @@ if ($conf->service->enabled)
|
|||||||
{
|
{
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.fk_product_type = '1'";
|
$sql.= " WHERE p.fk_product_type = '1'";
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir) $sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
@ -124,15 +116,11 @@ if ($conf->service->enabled)
|
|||||||
|
|
||||||
$sql = "SELECT count(*)";
|
$sql = "SELECT count(*)";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.envente = 0";
|
$sql.= " WHERE p.envente = 0";
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.fk_product_type = '1'";
|
$sql.= " AND p.fk_product_type = '1'";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir) $sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
|
|
||||||
if ($db->query($sql))
|
if ($db->query($sql))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -357,17 +357,10 @@ class Entrepot extends CommonObject
|
|||||||
$ret=array();
|
$ret=array();
|
||||||
|
|
||||||
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value";
|
$sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * ps.pmp) as value";
|
||||||
$sql .= " FROM llx_product_stock as ps";
|
$sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
$sql .= " WHERE ps.fk_entrepot = ".$this->id." AND ps.fk_product=p.rowid";
|
||||||
{
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql .= " WHERE ps.fk_entrepot = ".$this->id;
|
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$result = $this->db->query($sql) ;
|
$result = $this->db->query($sql) ;
|
||||||
|
|||||||
@ -355,18 +355,11 @@ else
|
|||||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type,";
|
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type,";
|
||||||
$sql.= " ps.pmp, ps.reel as value";
|
$sql.= " ps.pmp, ps.reel as value";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql .= " WHERE ps.fk_product = p.rowid";
|
$sql .= " WHERE ps.fk_product = p.rowid";
|
||||||
$sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
$sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
||||||
$sql .= " AND ps.fk_entrepot = ".$entrepot->id;
|
$sql .= " AND ps.fk_entrepot = ".$entrepot->id;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
{
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= ' AND COALESCE(c.visible,1)=1';
|
|
||||||
}
|
|
||||||
$sql.= " ORDER BY " . $sortfield . " " . $sortorder;
|
$sql.= " ORDER BY " . $sortfield . " " . $sortorder;
|
||||||
//$sql .= $db->plimit($limit + 1 ,$offset);
|
//$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
|
|
||||||
|
|||||||
@ -114,18 +114,11 @@ $sql.= " m.value, ".$db->pdate("m.datem")." as datem";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as s";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m";
|
$sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
$sql.= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE m.fk_product = p.rowid";
|
$sql.= " WHERE m.fk_product = p.rowid";
|
||||||
$sql.= " AND m.fk_entrepot = s.rowid";
|
$sql.= " AND m.fk_entrepot = s.rowid";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
{
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND COALESCE(c.visible,1)=1";
|
|
||||||
}
|
|
||||||
$sql.= " ORDER BY datem DESC";
|
$sql.= " ORDER BY datem DESC";
|
||||||
$sql.= $db->plimit($max,0);
|
$sql.= $db->plimit($max,0);
|
||||||
|
|
||||||
|
|||||||
@ -82,22 +82,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as s,";
|
|||||||
$sql.= " ".MAIN_DB_PREFIX."stock_mouvement as m,";
|
$sql.= " ".MAIN_DB_PREFIX."stock_mouvement as m,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."product as p";
|
$sql.= " ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_author = u.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_author = u.rowid";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE m.fk_product = p.rowid";
|
$sql.= " WHERE m.fk_product = p.rowid";
|
||||||
$sql.= " AND m.fk_entrepot = s.rowid";
|
$sql.= " AND m.fk_entrepot = s.rowid";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
if ($_GET["id"])
|
if ($_GET["id"])
|
||||||
{
|
{
|
||||||
$sql.= " AND s.rowid ='".$_GET["id"]."'";
|
$sql.= " AND s.rowid ='".$_GET["id"]."'";
|
||||||
}
|
}
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " AND COALESCE(c.visible,1)=1";
|
|
||||||
}
|
|
||||||
if ($month > 0)
|
if ($month > 0)
|
||||||
{
|
{
|
||||||
if ($year > 0)
|
if ($year > 0)
|
||||||
|
|||||||
@ -407,7 +407,7 @@ $sql.= " WHERE ps.reel != 0";
|
|||||||
$sql.= " AND ps.fk_entrepot = e.rowid";
|
$sql.= " AND ps.fk_entrepot = e.rowid";
|
||||||
$sql.= " AND e.entity = ".$conf->entity;
|
$sql.= " AND e.entity = ".$conf->entity;
|
||||||
$sql.= " AND ps.fk_product = ".$product->id;
|
$sql.= " AND ps.fk_product = ".$product->id;
|
||||||
$sql.= " ORDER BY lower(e.label)";
|
$sql.= " ORDER BY e.label";
|
||||||
|
|
||||||
$entrepotstatic=new Entrepot($db);
|
$entrepotstatic=new Entrepot($db);
|
||||||
$total=0;
|
$total=0;
|
||||||
|
|||||||
@ -141,7 +141,7 @@ if ($_GET["id"])
|
|||||||
$sql .= " WHERE ue.fk_user = u.rowid ";
|
$sql .= " WHERE ue.fk_user = u.rowid ";
|
||||||
$sql .= " AND ue.fk_entrepot = ".$entrepot->id;
|
$sql .= " AND ue.fk_entrepot = ".$entrepot->id;
|
||||||
|
|
||||||
//$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
//$sql .= $db->order($sortfield,$sortorder);
|
||||||
//$sql .= $db->plimit($limit + 1 ,$offset);
|
//$sql .= $db->plimit($limit + 1 ,$offset);
|
||||||
|
|
||||||
$resql = $db->query($sql) ;
|
$resql = $db->query($sql) ;
|
||||||
|
|||||||
@ -93,7 +93,8 @@ if ($_GET["search_societe"])
|
|||||||
{
|
{
|
||||||
$sql.= " AND s.nom LIKE '%".addslashes($_GET["search_societe"])."%'";
|
$sql.= " AND s.nom LIKE '%".addslashes($_GET["search_societe"])."%'";
|
||||||
}
|
}
|
||||||
$sql.= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -85,8 +85,8 @@ $sql = "SELECT rowid, prenom, nom, societe, cp, ville, email, naiss, photo";
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||||
$sql.= " WHERE statut = 1";
|
$sql.= " WHERE statut = 1";
|
||||||
$sql.= " AND public = 1";
|
$sql.= " AND public = 1";
|
||||||
$sql.= " ORDER BY $sortfield $sortorder";
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
//$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, cp, ville, d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
|
//$sql = "SELECT d.rowid, d.prenom, d.nom, d.societe, cp, ville, d.email, t.libelle as type, d.morphy, d.statut, t.cotisation";
|
||||||
//$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
//$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||||
//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
|
//$sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = $statut";
|
||||||
|
|||||||
@ -23,13 +23,14 @@
|
|||||||
* \brief Fichier de la classe des services predefinis
|
* \brief Fichier de la classe des services predefinis
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Service
|
* \class Service
|
||||||
* \brief Classe permettant la gestion des services predefinis
|
* \brief Classe permettant la gestion des services predefinis
|
||||||
*/
|
*/
|
||||||
class Service
|
class Service extends CommonObject
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
@ -64,17 +65,11 @@ class Service
|
|||||||
|
|
||||||
$sql = "SELECT count(p.rowid) as nb";
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
|
||||||
{
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
|
||||||
}
|
|
||||||
$sql.= " WHERE p.fk_product_type = 1";
|
$sql.= " WHERE p.fk_product_type = 1";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if (!$user->rights->produit->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
{
|
if (!$user->rights->service->voir) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND COALESCE(c.visible,1)=1";
|
|
||||||
}
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -44,7 +44,7 @@ if(isset($_POST['pays']) && !empty($_POST['pays']))
|
|||||||
$sql = "SELECT rowid, code, libelle, active";
|
$sql = "SELECT rowid, code, libelle, active";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||||
$sql.= " WHERE active = 1 AND libelle LIKE '%" . utf8_decode($_POST['pays']) . "%'";
|
$sql.= " WHERE active = 1 AND libelle LIKE '%" . utf8_decode($_POST['pays']) . "%'";
|
||||||
$sql.= " ORDER BY libelle ASC;";
|
$sql.= " ORDER BY libelle ASC";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -189,7 +189,8 @@ if($_GET["socid"])
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
|
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY s.nom ASC " . $db->plimit($conf->liste_limit+1, $offset);
|
$sql.= $db->order("s.nom","ASC");
|
||||||
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -66,7 +66,8 @@ if ($socid > 0)
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.rowid = " . $user->societe_id;
|
$sql .= " AND s.rowid = " . $user->societe_id;
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
|
$sql .= $db->plimit($conf->liste_limit, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|||||||
@ -221,7 +221,7 @@ class Webcal {
|
|||||||
$sql.= " cal_date, cal_time, cal_mod_date,";
|
$sql.= " cal_date, cal_time, cal_mod_date,";
|
||||||
$sql.= " cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name, cal_description";
|
$sql.= " cal_mod_time, cal_duration, cal_priority, cal_type, cal_access, cal_name, cal_description";
|
||||||
$sql.= " FROM webcal_entry";
|
$sql.= " FROM webcal_entry";
|
||||||
$sql.= " order by cal_date";
|
$sql.= " ORDER BY cal_date";
|
||||||
|
|
||||||
dol_syslog("Webcal::build_vcal select events sql=".$sql);
|
dol_syslog("Webcal::build_vcal select events sql=".$sql);
|
||||||
$resql=$this->localdb->query($sql);
|
$resql=$this->localdb->query($sql);
|
||||||
|
|||||||
@ -98,7 +98,7 @@ $countries=array();
|
|||||||
$sql = "SELECT rowid, code, libelle, active";
|
$sql = "SELECT rowid, code, libelle, active";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
||||||
$sql.= " WHERE active = 1";
|
$sql.= " WHERE active = 1";
|
||||||
$sql.= " ORDER BY code ASC;";
|
$sql.= " ORDER BY code ASC";
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user