Quelques amlioration sur fonction selection produit ajax:
Look: On supprime espace encombrant sous la liste. Fix: Correction problme de gestion des accents Fix: Produits en doubles selon activation et droits de categories New: Affiche message si aucun lment trouv Look: Agrandissement zone de saisie
This commit is contained in:
parent
7174e0a5f1
commit
e21c82d60b
@ -25,8 +25,19 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require('./pre.inc.php');
|
require('./main.inc.php');
|
||||||
|
|
||||||
|
$langs->load("products");
|
||||||
|
|
||||||
|
//header("Content-type: text/html; charset=UTF-8");
|
||||||
|
header("Content-type: text/html; charset=iso-8859-1");
|
||||||
|
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||||
|
print "\n<html>";
|
||||||
|
print "\n<body>";
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]);
|
$form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keyref"],$_GET["keylabel"]);
|
||||||
|
|
||||||
|
print "</body>";
|
||||||
|
print "</html>";
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1236,7 +1236,7 @@ if ($_GET['propalid'] > 0)
|
|||||||
{
|
{
|
||||||
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
$html->select_produits('','idprod','',$conf->produit->limit_size);
|
||||||
}
|
}
|
||||||
print '<br>';
|
if (! $conf->use_ajax) print '<br>';
|
||||||
print '<textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
print '<textarea cols="50" name="np_desc" rows="'.ROWS_2.'"></textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
|
|||||||
@ -704,20 +704,16 @@ class Form
|
|||||||
if($conf->use_ajax)
|
if($conf->use_ajax)
|
||||||
{
|
{
|
||||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/prototype.js"></script>';
|
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/prototype.js"></script>';
|
||||||
print $langs->trans("Ref").'<input type="text" size="5" name="ajkeyref'.$htmlname.'" id="ajkeyref'.$htmlname.'"> ';
|
print $langs->trans("Ref").':<input type="text" size="8" name="ajkeyref'.$htmlname.'" id="ajkeyref'.$htmlname.'"> ';
|
||||||
print $langs->trans("Label").'<input type="text" size="5" name="ajkeylabel'.$htmlname.'" id="ajkeylabel'.$htmlname.'">';
|
print $langs->trans("Label").':<input type="text" size="16" name="ajkeylabel'.$htmlname.'" id="ajkeylabel'.$htmlname.'">';
|
||||||
print '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
|
print '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
|
||||||
print '<script type="text/javascript">';
|
print '<script type="text/javascript">';
|
||||||
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
||||||
print 'new Form.Element.Observer($("ajkeyref'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keyref="+$("ajkeyref'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
print 'new Form.Element.Observer($("ajkeyref'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keyref="+$("ajkeyref'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
||||||
|
print 'new Form.Element.Observer($("ajkeylabel'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keylabel="+$("ajkeylabel'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
||||||
print 'function publish_selvalue(obj){$("'.$htmlname.'").value = obj.options[obj.selectedIndex].value;}';
|
print 'function publish_selvalue(obj){$("'.$htmlname.'").value = obj.options[obj.selectedIndex].value;}';
|
||||||
print '</script>';
|
print '</script>';
|
||||||
print '<script type="text/javascript">';
|
print '<div class="notopnoleftnoright" id="ajdynfield'.$htmlname.'"></div>';
|
||||||
print 'var url = \''.DOL_URL_ROOT.'/ajaxresponse.php\';';
|
|
||||||
print 'new Form.Element.Observer($("ajkeylabel'.$htmlname.'"), 1, function(){var myAjax = new Ajax.Updater( {success: \'ajdynfield'.$htmlname.'\'}, url, {method: \'get\', parameters: "keylabel="+$("ajkeylabel'.$htmlname.'").value+"&htmlname='.$htmlname.'&price_level='.$price_level.'"});});';
|
|
||||||
print '</script>';
|
|
||||||
print '<div id="ajdynfield'.$htmlname.'">';
|
|
||||||
print '</div>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -736,16 +732,22 @@ class Form
|
|||||||
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeyref='',$ajaxkeylabel='')
|
function select_produits_do($selected='',$htmlname='productid',$filtretype='',$limit=20,$price_level=0,$ajaxkeyref='',$ajaxkeylabel='')
|
||||||
{
|
{
|
||||||
global $langs,$conf,$user;
|
global $langs,$conf,$user;
|
||||||
|
$user->getrights("categorie");
|
||||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p ";
|
$sql = "SELECT ";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
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.="DISTINCT";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
|
}
|
||||||
|
$sql.= " p.rowid, p.label, p.ref, p.price, p.duration";
|
||||||
|
$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.envente = 1";
|
$sql.= " WHERE p.envente = 1";
|
||||||
if ($conf->categorie->enabled && !$user->rights->categorie->voir)
|
if ($conf->categorie->enabled && ! $user->rights->categorie->voir)
|
||||||
{
|
{
|
||||||
$sql.= ' AND IFNULL(c.visible,1)=1';
|
$sql.= ' AND IFNULL(c.visible,1)=1';
|
||||||
}
|
}
|
||||||
@ -755,48 +757,61 @@ class Form
|
|||||||
$sql.= " ORDER BY p.nbvente DESC";
|
$sql.= " ORDER BY p.nbvente DESC";
|
||||||
if ($limit) $sql.= " LIMIT $limit";
|
if ($limit) $sql.= " LIMIT $limit";
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if (! $result) dolibarr_print_error($this->db);
|
if (! $result) dolibarr_print_error($this->db);
|
||||||
|
|
||||||
// Multilang : on construit une liste des traductions des produits listés
|
// Multilang : on construit une liste des traductions des produits listés
|
||||||
$sqld = "SELECT d.fk_product, d.label";
|
if ($conf->global->MAIN_MULTILANGS)
|
||||||
$sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d ";
|
{
|
||||||
$sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'";
|
$sqld = "SELECT d.fk_product, d.label";
|
||||||
$sqld.= " ORDER BY p.nbvente DESC";
|
$sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d ";
|
||||||
|
$sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'";
|
||||||
// inutile de faire la requete si l'option n'est pas active
|
$sqld.= " ORDER BY p.nbvente DESC";
|
||||||
if ($conf->global->MAIN_MULTILANGS)
|
$resultd = $this->db->query($sqld);
|
||||||
{
|
if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
|
||||||
$resultd = $this->db->query($sqld);
|
}
|
||||||
if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
if($conf->use_ajax)
|
|
||||||
print '<select class="flat" name="'.$htmlname.'" onchange="publish_selvalue(this);">';
|
|
||||||
else
|
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
|
||||||
print "<option value=\"0\" selected=\"true\"> </option>";
|
|
||||||
|
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
|
|
||||||
|
if ($conf->use_ajax)
|
||||||
|
{
|
||||||
|
if (! $num)
|
||||||
|
{
|
||||||
|
print $langs->trans("NoProductMatching").' ';
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
print '<select class="flat" name="'.$htmlname.'" onchange="publish_selvalue(this);">';
|
||||||
|
print "<option value=\"0\" selected=\"true\"> </option>";
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
|
print "<option value=\"0\" selected=\"true\"> </option>";
|
||||||
|
}
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
// Multilangs : modification des donnée si une traduction existe
|
// Multilangs : modification des donnée si une traduction existe
|
||||||
if ($conf->global->MAIN_MULTILANGS)
|
if ($conf->global->MAIN_MULTILANGS)
|
||||||
|
{
|
||||||
if ( $objp->rowid == $objtp->fk_product ) // si on a une traduction
|
if ( $objp->rowid == $objtp->fk_product ) // si on a une traduction
|
||||||
{
|
{
|
||||||
if ( $objtp->label != '') $objp->label = $objtp->label;
|
if ( $objtp->label != '') $objp->label = $objtp->label;
|
||||||
if ( $resultd ) $objtp = $this->db->fetch_object($resultd); // on charge la traduction suivante
|
if ( $resultd ) $objtp = $this->db->fetch_object($resultd); // on charge la traduction suivante
|
||||||
}
|
}
|
||||||
$opt = '<option value="'.$objp->rowid.'">'.$objp->ref.' - ';
|
}
|
||||||
$opt.= dolibarr_trunc($objp->label,32).' - ';
|
$opt = '<option value="'.$objp->rowid.'">'.$objp->ref.' - ';
|
||||||
|
$opt.= dolibarr_trunc($objp->label,32).' - ';
|
||||||
|
|
||||||
//multiprix
|
// Multiprix
|
||||||
if($price_level > 1)
|
if ($price_level > 1)
|
||||||
{
|
{
|
||||||
$sql= "SELECT price ";
|
$sql= "SELECT price ";
|
||||||
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
$sql.= "FROM ".MAIN_DB_PREFIX."product_price ";
|
||||||
@ -816,8 +831,17 @@ class Form
|
|||||||
print $opt;
|
print $opt;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print '</select>';
|
if ($conf->use_ajax)
|
||||||
|
{
|
||||||
|
// if ($num)
|
||||||
|
// {
|
||||||
|
print '</select>';
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '</select>';
|
||||||
|
}
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -122,7 +122,7 @@ class modUser extends DolibarrModules
|
|||||||
$this->rights[$r][2] = 'w';
|
$this->rights[$r][2] = 'w';
|
||||||
$this->rights[$r][3] = 1;
|
$this->rights[$r][3] = 1;
|
||||||
$this->rights[$r][4] = 'self';
|
$this->rights[$r][4] = 'self';
|
||||||
$this->rights[$r][5] = 'supprimer';
|
$this->rights[$r][5] = 'creer';
|
||||||
|
|
||||||
$r++;
|
$r++;
|
||||||
$this->rights[$r][0] = 256;
|
$this->rights[$r][0] = 256;
|
||||||
|
|||||||
@ -58,6 +58,8 @@ ContractStatusToRun=A mettre en service
|
|||||||
ContractNotRunning=This contract is not running
|
ContractNotRunning=This contract is not running
|
||||||
ErrorProductAlreadyExists=A product with reference %s already exists.
|
ErrorProductAlreadyExists=A product with reference %s already exists.
|
||||||
ErrorProductBadRefOrLabel=Wrong value for reference or label.
|
ErrorProductBadRefOrLabel=Wrong value for reference or label.
|
||||||
|
Suppliers=Suppliers
|
||||||
|
SupplierRef=Supplier ref.
|
||||||
ShowProduct=Show product
|
ShowProduct=Show product
|
||||||
ShowService=Show service
|
ShowService=Show service
|
||||||
ProductsAndServicesArea=Product and Services area
|
ProductsAndServicesArea=Product and Services area
|
||||||
@ -66,12 +68,18 @@ AddToOtherProposals=Add to other proposals
|
|||||||
AddToMyBills=Add to my bills
|
AddToMyBills=Add to my bills
|
||||||
AddToOtherBills=Add to other bills
|
AddToOtherBills=Add to other bills
|
||||||
CorrectStock=Correct stock
|
CorrectStock=Correct stock
|
||||||
|
AddPhoto=Add photo
|
||||||
ListOfStockMovements=List of stock movements
|
ListOfStockMovements=List of stock movements
|
||||||
NoPhotoYet=No pictures available yet
|
NoPhotoYet=No pictures available yet
|
||||||
|
BuiingPrice=Buying price
|
||||||
|
SupplierCard=Supplier card
|
||||||
|
CommercialCard=Commercial card
|
||||||
|
AllWays=Path to find your product in stock
|
||||||
|
NoCat=Your product is not in any category
|
||||||
|
PrimaryWay=Primary path
|
||||||
|
DeleteFromCat=Remove from category
|
||||||
PriceRemoved=Price removed
|
PriceRemoved=Price removed
|
||||||
BarCode=Barcode
|
BarCode=Barcode
|
||||||
Pack=Pack
|
|
||||||
Packs=Packs
|
|
||||||
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
NoteNotVisibleOnBill=Note (not visible on invoices, proposals...)
|
||||||
CreateCopy=Create copy
|
CreateCopy=Create copy
|
||||||
ServiceLimitedDuration=If produced of service type at limited duration:
|
ServiceLimitedDuration=If produced of service type at limited duration:
|
||||||
@ -89,9 +97,12 @@ ProductToAddSearch=Search product to add
|
|||||||
AddDel=Add/Delete
|
AddDel=Add/Delete
|
||||||
Quantity=Quantity
|
Quantity=Quantity
|
||||||
NoMatchFound=No match found
|
NoMatchFound=No match found
|
||||||
|
ProductAssociationList=List of related products/services: name of product/service (quantity affected)
|
||||||
|
ErrorAssociationIsFatherOfThis=One of selected product is parent with current product
|
||||||
DeleteProduct=Delete a product/service
|
DeleteProduct=Delete a product/service
|
||||||
ConfirmDeleteProduct=Are you sure you want to delete this product/service?
|
ConfirmDeleteProduct=Are you sure you want to delete this product/service?
|
||||||
ProductDeleted=Product/Service "%s" deleted from database.
|
ProductDeleted=Product/Service "%s" deleted from database.
|
||||||
ExportDataset_produit_1=Products and services
|
ExportDataset_produit_1=Products and services
|
||||||
DeleteProductLine=Delete product line
|
DeleteProductLine=Delete product line
|
||||||
ConfirmDeleteProductLine=Are you sure you want to delete this product line?
|
ConfirmDeleteProductLine=Are you sure you want to delete this product line?
|
||||||
|
NoProductMatching=No product/service match your criteria
|
||||||
@ -5,6 +5,7 @@ GroupCard=Group card
|
|||||||
NoContactCard=No card among contacts
|
NoContactCard=No card among contacts
|
||||||
Permission=Permission
|
Permission=Permission
|
||||||
Permissions=Permissions
|
Permissions=Permissions
|
||||||
|
EditPassword=Edit password
|
||||||
SendNewPassword=Send new password
|
SendNewPassword=Send new password
|
||||||
ReinitPassword=Generate new password
|
ReinitPassword=Generate new password
|
||||||
PasswordChangedTo=Password changed to: %s
|
PasswordChangedTo=Password changed to: %s
|
||||||
|
|||||||
@ -59,7 +59,7 @@ ContractNotRunning=Ce contrat n'est pas en service
|
|||||||
ErrorProductAlreadyExists=Un produit avec la référence %s existe déjà.
|
ErrorProductAlreadyExists=Un produit avec la référence %s existe déjà.
|
||||||
ErrorProductBadRefOrLabel=La valeur de la reference ou du libellé est incorrecte.
|
ErrorProductBadRefOrLabel=La valeur de la reference ou du libellé est incorrecte.
|
||||||
Suppliers=Fournisseurs
|
Suppliers=Fournisseurs
|
||||||
SupplierRef=Référence fournisseur
|
SupplierRef=Réf. fournisseur
|
||||||
ShowProduct=Afficher produit
|
ShowProduct=Afficher produit
|
||||||
ShowService=Afficher service
|
ShowService=Afficher service
|
||||||
ProductsAndServicesArea=Espace Produit et Services
|
ProductsAndServicesArea=Espace Produit et Services
|
||||||
@ -104,4 +104,5 @@ ConfirmDeleteProduct=Etes-vous s
|
|||||||
ProductDeleted=Le produit/service "%s" à été supprimé de la base.
|
ProductDeleted=Le produit/service "%s" à été supprimé de la base.
|
||||||
ExportDataset_produit_1=Produits et services
|
ExportDataset_produit_1=Produits et services
|
||||||
DeleteProductLine=Supprimer ligne produit
|
DeleteProductLine=Supprimer ligne produit
|
||||||
ConfirmDeleteProductLine=Êtes-vous sûr de vouloir effacer cette ligne produit ?
|
ConfirmDeleteProductLine=Êtes-vous sûr de vouloir effacer cette ligne produit ?
|
||||||
|
NoProductMatching=Aucun produit/service ne répond au critère
|
||||||
@ -5,6 +5,7 @@ GroupCard=Fiche groupe
|
|||||||
NoContactCard=Pas de fiche parmi les contacts
|
NoContactCard=Pas de fiche parmi les contacts
|
||||||
Permission=Droit
|
Permission=Droit
|
||||||
Permissions=Droits
|
Permissions=Droits
|
||||||
|
EditPassword=Modifier mot de passe
|
||||||
SendNewPassword=Envoyer nouveau mot de passe
|
SendNewPassword=Envoyer nouveau mot de passe
|
||||||
ReinitPassword=Générer nouveau mot de passe
|
ReinitPassword=Générer nouveau mot de passe
|
||||||
PasswordChangedTo=Mot de passe modifié en: %s
|
PasswordChangedTo=Mot de passe modifié en: %s
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user