--- dolibarr/htdocs/soc.php 2008-07-28 05:00:14.000000000 +0200
+++ new_dolibarr/htdocs/soc.php 2008-08-07 15:46:45.000000000 +0200
@@ -415,6 +415,21 @@
print '';
print '';
+ if ($soc->client)
+ {
+ $load = $soc->LoadCustomerCateg();
+ if ( $load == 0)
+ {
+ if (sizeof($soc->CustomerCategories) > 0)
+ {
+ print '
';
+ print ''.$langs->trans('SupplierCategory').' | ';
+ $form->select_array("fournisseur_categorie",$soc->CustomerCategories);
+ print ' |
';
+ }
+ }
+ }
+
// Fournisseur
print '';
--- dolibarr/htdocs/societe.class.php 2008-07-28 05:00:14.000000000 +0200
+++ new_dolibarr/htdocs/societe.class.php 2008-08-07 15:46:35.000000000 +0200
@@ -1764,6 +1764,27 @@
//print "dd".$this->pays_code;
return in_array($this->pays_code,$country_code_in_EEC);
}
+function LoadCustomerCateg()
+{
+ $this->CustomerCategories = array();
+ $sql = "SELECT rowid, label";
+ $sql.= " FROM ".MAIN_DB_PREFIX."categorie";
+ $sql.= " WHERE type = 2";
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ while ($obj = $this->db->fetch_object($resql) )
+ {
+ $this->CustomerCategories[$obj->rowid] = $obj->label;
+ }
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
/**
* \brief Charge la liste des categories fournisseurs
@@ -176,10 +176,7 @@
// si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);
- // si le client est classe on l'ajoute
- $this->AddClientInCategory($this->client_categorie);
-
if ($ret >= 0)
{
$this->use_webcal=($conf->global->PHPWEBCALENDAR_COMPANYCREATE=='always'?1:0);
@@ -429,8 +426,6 @@
{
// Si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);
- // si le client est classe on l'ajoute
- $this->AddClientInCategory($this->client_categorie);
if ($call_trigger)
{
@@ -1837,26 +1832,6 @@
}
return -1;
}
-/*
- * \brief Charge la liste des categories client
- * \return 0 in success, <> 0 in error
- */
- function AddclientInCategory($categorie_id)
- {
- if ($categorie_id > 0)
- {
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_societe (fk_categorie, fk_societe) ";
- $sql.= " VALUES ('".$categorie_id."','".$this->id."');";
-
- if ($resql=$this->db->query($sql))
- return 0;
- }
- else
- {
- return 0;
- }
- return -1;
- }