Bonjour,

Voici un patch sur les points suivant:
- ajout de l'option, dans la configuration du module projet, autorisant le rattachement des commandes fournisseurs sur un projet quelconque - correction de typos/idents liées au refactoring (ex. GETPOT au lieu de GETPOST)
- ajout d'un test en cas de table non initialisée

C'est généré à partir de GIT, branche develop. Laurent, est ce que c'est exploitable pour toi par rapport à ton fonctionnement avec le CVS ?

Bonne journée, CF
>From 856bf0c6396a6b088a3dc93214e55d03727676ca Mon Sep 17 00:00:00 2001
From: graveen <[email protected]>
Date: Wed, 14 Sep 2011 14:55:16 +0200
Subject: [PATCH] Add: dolibarr_install.log to .gitignore
 Fix: typo GETPOT()
 Fix: check if array
 Add: allow attachment of any project to any supplier's order - configure this 
option via project admin

---
 .gitignore                      |    1 +
 htdocs/admin/project.php        |   35 +++++++++++++++++++++++++++++++++++
 htdocs/fourn/commande/fiche.php |    2 +-
 htdocs/langs/en_US/admin.lang   |    2 ++
 htdocs/langs/fr_FR/admin.lang   |    2 ++
 htdocs/product/fournisseurs.php |   12 ++++++------
 htdocs/societe/societe.php      |    2 +-
 7 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index 14b47b7..1585561 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ nbproject
 .settings/
 .buildpath
 .gitmodules
+dolibarr_install.log
diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php
index 26c95ec..a3d5c6f 100644
--- a/htdocs/admin/project.php
+++ b/htdocs/admin/project.php
@@ -396,8 +396,43 @@ if (is_resource($handle))
     closedir($handle);
 }
 
+// Allows you to select any project for supplier orders
 print '</table><br/>';
+print_fiche_titre($langs->trans("ProjectsMainOptions"),'','');
+print '<table class="noborder" width="100%">';
+print '<tr class="liste_titre">';
+print '<td>'.$langs->trans("Description").'</td>';
+print '<td align="center" width="20">&nbsp;</td>';
+print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
+print '</tr>';
+
+$var=true;
+$form = new Form($db);
 
+$var=!$var;
+print '<tr '.$bc[$var].'>';
+print '<td>'.$langs->trans("ProjectsAllAvailablesForSuppliersOrders").'</td>';
+print '<td align="center" width="20">&nbsp;</td>';
+
+print '<td align="center" width="100">';
+if ($conf->use_javascript_ajax)
+{
+       print ajax_constantonoff('PROJECT_ALL_SELECTABLES');
+}
+else
+{
+       if($conf->global->PROJECT_ALL_SELECTABLES == 0)
+       {
+               print '<a 
href="'.$_SERVER['PHP_SELF'].'?action=set_PROJECT_ALL_SELECTABLES">'.img_picto($langs->trans("Disabled"),'off').'</a>';
+       }
+       else if($conf->global->PROJECT_ALL_SELECTABLES == 1)
+       {
+               print '<a 
href="'.$_SERVER['PHP_SELF'].'?action=del_PROJECT_ALL_SELECTABLES">'.img_picto($langs->trans("Enabled"),'on').'</a>';
+       }
+}
+print '</td></tr>';
+
+print '</table><br/>';
 dol_htmloutput_mesg($mesg);
 
 $db->close();
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 41a39c7..a89ddf7 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -986,7 +986,7 @@ if ($id > 0 || ! empty($ref))
                        //print "$object->id, $object->socid, 
$object->fk_project";
                        if ($action == 'classify')
                        {
-                               
$html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, 
$object->fk_project, 'projectid');
+                               
$html->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, 
isset($conf->global->PROJECT_ALL_SELECTABLES)?'-1':$object->socid, 
$object->fk_project, 'projectid');
                        }
                        else
                        {
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 05915f0..cdbb3cb 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1291,3 +1291,5 @@ DescNumberWords=This module provide functions to convert 
number or amount in ful
 ProjectsNumberingModules=Projects numbering module
 ProjectsSetup=Project module setup
 ProjectsModelModule=Project's report document model
+ProjectsMainOptions=Main option
+ProjectsAllAvailablesForSuppliersOrders=Set to allow any project to be 
affected to supplier's order
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 8a7c02a..65410fe 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1299,6 +1299,8 @@ DescNumberWords=Ce module amène des fonctions de 
conversion de nombre ou montan
 ProjectsNumberingModules=Modèles de numérotation des références projets
 ProjectsSetup=Configuration du module Projets
 ProjectsModelModule=Modèles de document de rapport projets
+ProjectsMainOptions=Option principale
+ProjectsAllAvailablesForSuppliersOrders=Autorise le rattachement de n'importe 
quelle commande fournisseur à un projet
 ##### Externalsite #####
 ExternalSiteSetup=Configuration du lien vers le site externe
 ##### Ecommerce #####
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 2e7ed09..8b255ed 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -232,14 +232,14 @@ if ($_GET["id"] || $_GET["ref"])
 
                        // Minimum Price
                        print 
'<tr><td>'.$langs->trans("BuyingPriceMin").'</td>';
-            print '<td colspan="2">';
+                       print '<td colspan="2">';
                        $product_fourn = new ProductFournisseur($db);
                        if 
($product_fourn->find_min_price_product_fournisseur($product->id) > 0)
                        {
-                           if ($product_fourn->product_fourn_price_id > 0) 
print $product_fourn->display_price_product_fournisseur();
-                           else print $langs->trans("NotDefined");
+                               if ($product_fourn->product_fourn_price_id > 0) 
print $productfourn->display_price_product_fournisseur();
+                               else print $langs->trans("NotDefined");
                        }
-            print '</td></tr>';
+                       print '</td></tr>';
 
                        // Status (to buy)
                        print '<tr><td>'.$langs->trans("Status").' 
('.$langs->trans("Buy").')'.'</td><td>';
@@ -382,7 +382,7 @@ if ($_GET["id"] || $_GET["ref"])
                                $product_fourn = new ProductFournisseur($db);
                                $product_fourn_list = 
$product_fourn->fetch_product_fournisseur($product->id);
 
-                               if (sizeof($product_fourn_list)>0)
+                               if (is_array($product_fourn_list) && 
sizeof($product_fourn_list)>0)
                                {
                                        $var=true;
 
@@ -401,7 +401,7 @@ if ($_GET["id"] || $_GET["ref"])
                                                
if(!empty($conf->global->FOURN_PRODUCT_AVAILABILITY))
                                                {
                                                        
$html->load_cache_availability();
-                                       $availability= 
$html->cache_availability[$productfourn->fk_availability]['label'];
+                                                       $availability= 
$html->cache_availability[$productfourn->fk_availability]['label'];
                                                        print '<td 
align="left">'.$availability.'</td>';
                                                }
 
diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php
index 00d84ab..17cb102 100644
--- a/htdocs/societe/societe.php
+++ b/htdocs/societe/societe.php
@@ -39,7 +39,7 @@ $result = restrictedArea($user,'societe',$socid,'');
 $search_nom=trim(GETPOST("search_nom"));
 $search_nom_only=trim(GETPOST("search_nom_only"));
 $search_all=trim(GETPOST("search_all"));
-$search_ville=trim(GETPOT("search_ville"));
+$search_ville=trim(GETPOST("search_ville"));
 $socname=trim(GETPOST("socname"));
 $search_idprof1=trim(GETPOST('search_idprof1'));
 $search_idprof2=trim(GETPOST('search_idprof2'));
-- 
1.7.4.msysgit.0

_______________________________________________
Dolibarr-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à