diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index d13b73effb5af31b29ffa23b775cae819c8cc3ff..37862820da21a61c25b1f88f51671df11980965e 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -382,7 +382,7 @@ if ($socid > 0) { print " ".img_warning(); } - print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dp)."</td>\n"; + print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dp,'day')."</td>\n"; print '<td align="right" width="120">'.price($objp->total_ht).'</td>'; print '<td align="right" nowrap="nowrap">'.$propal_static->LibStatut($objp->fk_statut,5).'</td></tr>'; $var=!$var; @@ -431,7 +431,7 @@ if ($socid > 0) $var=!$var; print "<tr $bc[$var]>"; print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->cid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$objp->ref."</a>\n"; - print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dc)."</td>\n"; + print '</td><td align="right" width="80">'.dolibarr_print_date($objp->dc,'day')."</td>\n"; print '<td align="right" width="120">'.price($objp->total_ht).'</td>'; print '<td align="right" width="100">'.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'</td></tr>'; $i++; @@ -445,7 +445,7 @@ if ($socid > 0) } /* - * Derniers contrats + * Last linked contracts */ if($conf->contrat->enabled) { @@ -481,10 +481,10 @@ if ($socid > 0) print "<tr $bc[$var]>"; print '<td>'; $contrat->id=$objp->id; - $contrat->ref=$objp->ref; + $contrat->ref=$objp->ref?$objp->ref:$objp->id; print $contrat->getNomUrl(1); print "</td>\n"; - print '<td align="right" width="80">'.dolibarr_print_date($objp->dc)."</td>\n"; + print '<td align="right" width="80">'.dolibarr_print_date($objp->dc,'day')."</td>\n"; print '<td width="20"> </td>'; print '<td align="right" nowrap="nowrap">'; $contrat->fetch_lignes(); @@ -532,7 +532,7 @@ if ($socid > 0) $objp = $db->fetch_object($resql); print "<tr $bc[$var]>"; print '<td nowrap><a href="'.DOL_URL_ROOT."/fichinter/fiche.php?id=".$objp->id."\">".img_object($langs->trans("ShowPropal"),"propal")." ".$objp->ref."</a>\n"; - print "</td><td align=\"right\">".dolibarr_print_date($objp->di)."</td>\n"; + print "</td><td align=\"right\">".dolibarr_print_date($objp->di,'day')."</td>\n"; print '</tr>'; $var=!$var; $i++; @@ -546,7 +546,7 @@ if ($socid > 0) } /* - * Derniers projets associ�s + * Last linked projects */ if ($conf->projet->enabled) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index c3b2640896954e435c4e67d20c5483594d1e66ae..7461a4a5b167faaddbbd076a936b0ad25b38b3d5 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -21,10 +21,10 @@ */ /** - \file htdocs/commande/fiche.php - \ingroup commande - \brief Fiche commande client - \version $Id$ + * \file htdocs/commande/fiche.php + * \ingroup commande + * \brief Fiche commande client + * \version $Id$ */ require('./pre.inc.php'); @@ -1218,7 +1218,7 @@ else print '<tr><td>'.$langs->trans('Date').'</td>'; print '<td colspan="2">'.dolibarr_print_date($commande->date,'daytext').'</td>'; print '<td width="50%">'.$langs->trans('Source').' : '.$commande->getLabelSource(); - if ($commande->source == 0 && $conf->propal->enabled) + if ($commande->source == 0 && $conf->propal->enabled && $commande->propale_id) { // Si source = propal $propal = new Propal($db); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index af271b2894453177850b48967773cbd4299e8d2d..48078c5893f1676a888b30de2609dfe6c866a0d1 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -1119,9 +1119,9 @@ else print '<td colspan="3">'; // multiprix if($conf->global->PRODUIT_MULTIPRICES == 1) - $form->select_produits('','p_idprod','',$conf->produit->limit_size,$contrat->societe->price_level); + $form->select_produits('','p_idprod',1,$conf->produit->limit_size,$contrat->societe->price_level); else - $form->select_produits('','p_idprod','',$conf->produit->limit_size); + $form->select_produits('','p_idprod',1,$conf->produit->limit_size); if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; print '<textarea name="desc" cols="70" rows="'.ROWS_2.'"></textarea>'; print '</td>'; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index c653a45d06b82551131c969281ed6f8fffd3341c..c38dfd2cb3381f44e64abbee4829707f5ee89aa6 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -20,10 +20,10 @@ */ /** - \file htdocs/fourn/commande/fiche.php - \ingroup commande - \brief Fiche commande - \version $Id$ + * \file htdocs/fourn/commande/fiche.php + * \ingroup commande + * \brief Fiche commande + * \version $Id$ */ require('./pre.inc.php'); @@ -109,42 +109,42 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree if ($idprod > 0) { $prodfournprice->fetch($idprod); - + // cas special pour lequel on a les meme reference que le fournisseur // $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle; $label = $prodfournprice->libelle; - + $societe=''; if ($commande->socid) { $societe=new Societe($db); $societe->fetch($commande->socid); } - + $desc = $prodfournprice->description; $desc.= $prodfournprice->description && $_POST['np_desc'] ? "\n" : ""; $desc.= $_POST['np_desc']; - + $tva_tx = get_default_tva($societe,$mysoc,$prodfournprice->tva_tx,$prodfournprice->id); $result=$commande->addline( - $desc, - $pu, - $_POST['qty'], - $tva_tx, - $prodfournprice->id, - $_POST['idprodfournprice'], - $prodfournprice->fourn_ref, - $_POST['remise_percent'], + $desc, + $pu, + $_POST['qty'], + $tva_tx, + $prodfournprice->id, + $_POST['idprodfournprice'], + $prodfournprice->fourn_ref, + $_POST['remise_percent'], 'HT' - ); + ); } if ($idprod == -1) { // Quantity too low $mesg='<div class="error">'.$langs->trans("ErrorQtyTooLowForThisSupplier").'</div>'; - } + } } else { @@ -168,20 +168,20 @@ if ($_POST['action'] == 'addligne' && $user->rights->fournisseur->commande->cree } } } - + //print "xx".$tva_tx; exit; if ($result > 0) { - if ($_REQUEST['lang_id']) - { - $outputlangs = new Translate("",$conf); + if ($_REQUEST['lang_id']) + { + $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } supplier_order_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs); } else { - $mesg='<div class="error">'.$commande->error.'</div>'; + $mesg='<div class="error">'.$commande->error.'</div>'; } } } @@ -896,7 +896,7 @@ if ($id > 0) $var=!$var; print '<tr '.$bc[$var].'>'; print '<td colspan="3">'; - $html->select_produits_fournisseurs($commande->fourn_id,'','idprodfournprice',2,$filtre); + $html->select_produits_fournisseurs($commande->fourn_id,'','idprodfournprice','',$filtre); if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index d4bb1b03fafd1940f8c2408a348aa46c2443e949..ac353478aacf99e14c7a1d932c393784bc9916a0 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -870,7 +870,7 @@ else $var=! $var; print '<tr '.$bc[$var].'>'; print '<td colspan="4">'; - $html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid',2,$filtre); + $html->select_produits_fournisseurs($fac->socid,'','prodfournpriceid','',$filtre); print '</td>'; print '<td align="right"><input type="text" name="qty" value="1" size="1"></td>'; print '<td> </td>'; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 9767337e8843da5a71de6d9d92f6a85262a1ce97..5f226e9497b93ff2beb9c57db866faf93f2aa8f1 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -932,15 +932,15 @@ class Form /** - \brief Retourne la liste des produits en Ajax si ajax activ� ou renvoie � select_produits_do - \param selected Produit pr�-s�lectionn� - \param htmlname Nom de la zone select - \param filtretype Filter on product type (1=customer, 2=supplier) - \param limit Limite sur le nombre de lignes retourn�es - \param price_level Niveau de prix en fonction du client - \param status -1=Return all products, 0=Products not on sell, 1=Products on sell - */ - function select_produits($selected='',$htmlname='productid',$filtretype=1,$limit=20,$price_level=0,$status=1) + * \brief Retourne la liste des produits en Ajax si ajax activ� ou renvoie � select_produits_do + * \param selected Produit pr�-s�lectionn� + * \param htmlname Nom de la zone select + * \param filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * \param limit Limite sur le nombre de lignes retourn�es + * \param price_level Niveau de prix en fonction du client + * \param status -1=Return all products, 0=Products not on sell, 1=Products on sell + */ + function select_produits($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$status=1) { global $langs,$conf; @@ -957,27 +957,27 @@ class Form print '</tr>'; print '<tr class="nocellnopadd">'; print '<td class="nobordernopadding" colspan="3">'; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtretype.'&status='.$status,''); + print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status,''); print '</td></tr>'; print '</table>'; } else { - $this->select_produits_do($selected,$htmlname,$filtretype,$limit,$price_level,'',$status); + $this->select_produits_do($selected,$htmlname,$filtertype,$limit,$price_level,'',$status); } } /** - \brief Retourne la liste des produits - \param selected Produit pr�-s�lectionn� - \param htmlname Nom de la zone select - \param filtretype Filter on product type (1=customer, 2=supplier) - \param limit Limite sur le nombre de lignes retourn�es - \param price_level Niveau de prix en fonction du client - \param ajaxkeysearch Filtre des produits si ajax est utilis� - \param status -1=Return all products, 0=Products not on sell, 1=Products on sell - */ - function select_produits_do($selected='',$htmlname='productid',$filtretype=1,$limit=20,$price_level=0,$ajaxkeysearch='',$status=1) + * \brief Retourne la liste des produits + * \param selected Produit pr�-s�lectionn� + * \param htmlname Nom de la zone select + * \param filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * \param limit Limite sur le nombre de lignes retourn�es + * \param price_level Niveau de prix en fonction du client + * \param ajaxkeysearch Filtre des produits si ajax est utilis� + * \param status -1=Return all products, 0=Products not on sell, 1=Products on sell + */ + function select_produits_do($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$ajaxkeysearch='',$status=1) { global $langs,$conf,$user; @@ -999,7 +999,7 @@ class Form { $sql.= ' AND IFNULL(c.visible,1)=1'; } - if ($filtretype && $filtretype != '') $sql.=" AND p.fk_product_type=".$filtretype; + if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (p.ref like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')"; $sql.= " ORDER BY p.nbvente DESC"; if ($limit) $sql.= " LIMIT $limit"; @@ -1016,7 +1016,7 @@ class Form $sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'"; $sqld.= " ORDER BY p.nbvente DESC"; - dolibarr_syslog("Form::select_departement sql=".$sql, LOG_DEBUG); + dolibarr_syslog("Form::select_produits_do sql=".$sql, LOG_DEBUG); $resultd = $this->db->query($sqld); if ( $resultd ) $objtp = $this->db->fetch_object($resultd); } @@ -1127,37 +1127,37 @@ class Form } /** - \brief Retourne la liste des produits fournisseurs en Ajax si ajax activ� ou renvoie � select_produits_fournisseurs_do - \param socid Id third party - \param selected Produit pr�-s�lectionn� - \param htmlname Nom de la zone select - \param filtretype Filter on product type (1=customer, 2=supplier) - \param filtre Pour filtre sql - */ - function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtretype=2,$filtre) + * \brief Retourne la liste des produits fournisseurs en Ajax si ajax activ� ou renvoie � select_produits_fournisseurs_do + * \param socid Id third party + * \param selected Produit pr�-s�lectionn� + * \param htmlname Nom de la zone select + * \param filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * \param filtre Pour filtre sql + */ + function select_produits_fournisseurs($socid,$selected='',$htmlname='productid',$filtertype='',$filtre) { global $langs,$conf; if ($conf->global->PRODUIT_USE_SEARCH_TO_SELECT) { print $langs->trans("RefOrLabel").' : <input type="text" size="16" name="keysearch'.$htmlname.'" id="keysearch'.$htmlname.'">'; - print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtretype,'working'); + print ajax_updater($htmlname,'keysearch','/product/ajaxproducts.php','&socid='.$socid.'&type='.$filtertype.'&mode=2','working'); } else { - $this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtretype,$filtre,''); + $this->select_produits_fournisseurs_do($socid,$selected,$htmlname,$filtertype,$filtre,''); } } /** - \brief Retourne la liste des produits de fournisseurs - \param socid Id soci�t� fournisseur (0 pour aucun filtre) - \param selected Produit pr�-s�lectionn� - \param htmlname Nom de la zone select - \param filtretype Pour filtre sur type de produit - \param filtre Pour filtre sql - \param ajaxkeysearch Filtre des produits si ajax est utilis� - */ - function select_produits_fournisseurs_do($socid,$selected='',$htmlname='productid',$filtretype='',$filtre='',$ajaxkeysearch='') + * \brief Retourne la liste des produits de fournisseurs + * \param socid Id soci�t� fournisseur (0 pour aucun filtre) + * \param selected Produit pr�-s�lectionn� + * \param htmlname Nom de la zone select + * \param filtertype Filter on product type (''=nofilter, 0=product, 1=service) + * \param filtre Pour filtre sql + * \param ajaxkeysearch Filtre des produits si ajax est utilis� + */ + function select_produits_fournisseurs_do($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$ajaxkeysearch='') { global $langs,$conf; @@ -1173,7 +1173,7 @@ class Form $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pf.rowid = pfp.fk_product_fournisseur"; $sql.= " WHERE p.envente = 1"; if ($socid) $sql.= " AND pf.fk_soc = ".$socid; - if (! empty($filtretype)) $sql.=" AND p.fk_product_type=".$filtretype; + if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype; if (! empty($filtre)) $sql.=" ".$filtre; if ($ajaxkeysearch && $ajaxkeysearch != '') $sql.=" AND (pf.ref_fourn like '%".$ajaxkeysearch."%' OR p.label like '%".$ajaxkeysearch."%')"; $sql.= " ORDER BY pf.ref_fourn DESC"; diff --git a/htdocs/product/ajaxproducts.php b/htdocs/product/ajaxproducts.php index 2ad03cdc0208f8f1699aed2ee4a295c816d7f9bf..c99094aaccb804e35b41088acf97fdefc7c1e4c7 100644 --- a/htdocs/product/ajaxproducts.php +++ b/htdocs/product/ajaxproducts.php @@ -40,13 +40,13 @@ if (! empty($_GET['keysearch'])) if (isset($_GET['status'])) $status=$_GET['status']; $form = new Form($db); - if (empty($_GET['type']) || $_GET['type'] == 1) + if (empty($_GET['mode']) || $_GET['mode'] == 1) { - $form->select_produits_do("",$_GET["htmlname"],"","",$_GET["price_level"],$_GET["keysearch"],$status); + $form->select_produits_do("",$_GET["htmlname"],$_GET["type"],"",$_GET["price_level"],$_GET["keysearch"],$status); } - if ($_GET['type'] == 2) + if ($_GET['mode'] == 2) { - $form->select_produits_fournisseurs_do($_GET["socid"],"",$_GET["htmlname"],"","",$_GET["keysearch"]); + $form->select_produits_fournisseurs_do($_GET["socid"],"",$_GET["htmlname"],$_GET["type"],"",$_GET["keysearch"]); } } else if (! empty($_GET['markup']))