### Eclipse Workspace Patch 1.0
#P dolibarr
Index: documents/.htaccess
===================================================================
RCS file: documents/.htaccess
diff -N documents/.htaccess
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ documents/.htaccess 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,2 @@
+Order allow,deny
+Deny from all
Index: htdocs/admin/societe.php
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/admin/societe.php,v
retrieving revision 1.58
diff -u -r1.58 societe.php
--- htdocs/admin/societe.php 24 Feb 2011 18:22:27 -0000 1.58
+++ htdocs/admin/societe.php 29 Apr 2011 14:02:31 -0000
@@ -63,6 +63,19 @@
}
}
+if($_POST["action"] == 'COMPANY_SEARCH_FILTER')
+{
+ if (dolibarr_set_const($db, "COMPANY_SEARCH_FILTER", $_POST["COMPANY_SEARCH_FILTER"],'chaine',0,'',$conf->entity))
+ {
+ Header("Location: ".$_SERVER["PHP_SELF"]);
+ exit;
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+}
+
if ($_POST["action"] == 'COMPANY_USE_SEARCH_TO_SELECT')
{
if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_COMPANY_USE_SEARCH_TO_SELECT"],'chaine',0,'',$conf->entity))
@@ -448,6 +461,35 @@
print ' ';
+print_titre($langs->trans("SearchFilter"));
+// Activation du filtre de recherche en fonction de l'activity_state
+$html= new Form($db);
+$var=true;
+print'
';
+print '
';
+print "
".$langs->trans("Parameters")."
\n";
+print '
'.$langs->trans("Value").'
'."\n";
+print '
'."\n";
+$var=!$var;
+print '';
+print '
';
+print ' ';
+
print_titre($langs->trans("Other"));
// Autres options
Index: htdocs/install/mysql/migration/3.0.0-3.1.0.sql
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/install/mysql/migration/3.0.0-3.1.0.sql,v
retrieving revision 1.27
diff -u -r1.27 3.0.0-3.1.0.sql
--- htdocs/install/mysql/migration/3.0.0-3.1.0.sql 21 Apr 2011 09:11:49 -0000 1.27
+++ htdocs/install/mysql/migration/3.0.0-3.1.0.sql 29 Apr 2011 14:02:31 -0000
@@ -41,6 +41,8 @@
ALTER TABLE llx_societe ADD COLUMN fk_currency integer DEFAULT 0 AFTER fk_forme_juridique;
+ALTER TABLE llx_societe ADD COLUMN activity_state tinyint DEFAULT 1;
+
ALTER TABLE llx_societe_remise MODIFY remise_client double(6,3) DEFAULT 0 NOT NULL;
ALTER TABLE llx_menu ADD COLUMN fk_mainmenu varchar(16) after fk_menu;
Index: htdocs/install/mysql/tables/llx_societe.sql
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/install/mysql/tables/llx_societe.sql,v
retrieving revision 1.12
diff -u -r1.12 llx_societe.sql
--- htdocs/install/mysql/tables/llx_societe.sql 10 Mar 2011 10:38:08 -0000 1.12
+++ htdocs/install/mysql/tables/llx_societe.sql 29 Apr 2011 14:02:31 -0000
@@ -30,10 +30,12 @@
datec datetime, -- creation date
datea datetime, -- activation date
+ activity_state tinyint DEFAULT 1, -- cessation d'activité ( 1 -- en activité, 0 -- cessation d'activité)
+
nom varchar(60), -- company reference name
entity integer DEFAULT 1 NOT NULL, -- multi company id
- ref_ext varchar(60), -- reference into an external system (not used by dolibarr)
+ ref_ext varchar(60), -- reference into an external system (not used by dolibarr)
code_client varchar(15), -- code client
code_fournisseur varchar(15), -- code founisseur
Index: htdocs/langs/en_US/admin.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/en_US/admin.lang,v
retrieving revision 1.596
diff -u -r1.596 admin.lang
--- htdocs/langs/en_US/admin.lang 9 Apr 2011 20:10:57 -0000 1.596
+++ htdocs/langs/en_US/admin.lang 29 Apr 2011 14:02:32 -0000
@@ -46,6 +46,8 @@
DisableJavascript=Disable JavaScript and Ajax functions
ConfirmAjax=Use Ajax confirmation popups
UseSearchToSelectCompany=Use autocompletion fields to choose third parties (instead of using a list box).
Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant SOCIETE_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
+ActivityStateToSelectCompany= Add a filter option to show/hide thirdparties which are currently in activity or has ceased it
+SearchFilter=Search filters options
NumberOfKeyToSearch=Nbr of characters to trigger search: %s
ViewFullDateActions=Show full dates actions in the third sheet
NotAvailableWhenAjaxDisabled=Not available when Ajax disabled
Index: htdocs/langs/en_US/companies.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/en_US/companies.lang,v
retrieving revision 1.173
diff -u -r1.173 companies.lang
--- htdocs/langs/en_US/companies.lang 22 Mar 2011 19:31:30 -0000 1.173
+++ htdocs/langs/en_US/companies.lang 29 Apr 2011 14:02:32 -0000
@@ -302,6 +302,9 @@
ThirdPartiesArea=Third parties area
LastModifiedThirdParties=Last %s modified third parties
UniqueThirdParties=Total of unique third parties
+InActivity=In activity
+ActivityCeased=Activity ceased
+ActivityStateFilter=Activity status
# Monkey
MonkeyNumRefModelDesc=Return numero with format %syymm-nnnn for customer code and %syymm-nnnn for supplier code where yy is year, mm is month and nnnn is a sequence with no break and no return to 0.
Index: htdocs/langs/fr_FR/admin.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/fr_FR/admin.lang,v
retrieving revision 1.649
diff -u -r1.649 admin.lang
--- htdocs/langs/fr_FR/admin.lang 18 Apr 2011 19:46:43 -0000 1.649
+++ htdocs/langs/fr_FR/admin.lang 29 Apr 2011 14:02:33 -0000
@@ -47,6 +47,8 @@
DisableJavascript= Désactiver les fonctions Javascript et Ajax
ConfirmAjax= Utiliser les popups de confirmation Ajax
UseSearchToSelectCompany= Utiliser un champ avec autocomplétion pour choisir un tiers (plutôt qu'une liste déroulante).
Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante SOCIETE_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
+ActivityStateToSelectCompany= Ajouter une option de filtrage lors des recherches pour afficher/masquer les tiers en exercice ou ayant cessés d'exercer
+SearchFilter=Options des filtres de recherche
NumberOfKeyToSearch=Nb caractères déclenchant la recherche: %s
ViewFullDateActions= Visualiser les dates des actions en entier dans la fiche tiers
NotAvailableWhenAjaxDisabled= Non disponible quand Ajax désactivé
Index: htdocs/langs/fr_FR/companies.lang
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/langs/fr_FR/companies.lang,v
retrieving revision 1.190
diff -u -r1.190 companies.lang
--- htdocs/langs/fr_FR/companies.lang 6 Apr 2011 09:32:51 -0000 1.190
+++ htdocs/langs/fr_FR/companies.lang 29 Apr 2011 14:02:33 -0000
@@ -309,6 +309,9 @@
ThirdPartiesArea=Espace Tiers
LastModifiedThirdParties=Les %s derniers tiers modifiés
UniqueThirdParties=Total de tiers uniques
+InActivity=En activité
+ActivityCeased=En cessation d'activité
+ActivityStateFilter=Statut d'activité
# Monkey
MonkeyNumRefModelDesc=Renvoie le numéro sous la forme %syymm-nnnn pour les codes clients et %syymm-nnnn pour les codes fournisseurs où yy est l'année, mm le mois et nnnn un compteur séquentiel sans rupture et sans remise à 0.
Index: htdocs/societe/class/societe.class.php
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/societe/class/societe.class.php,v
retrieving revision 1.69
diff -u -r1.69 societe.class.php
--- htdocs/societe/class/societe.class.php 26 Mar 2011 13:18:01 -0000 1.69
+++ htdocs/societe/class/societe.class.php 29 Apr 2011 14:02:35 -0000
@@ -53,7 +53,7 @@
var $address;
var $adresse; // TODO obsolete
var $cp;
- var $ville;
+ var $ville;
var $departement_id;
var $departement_code;
@@ -133,6 +133,8 @@
var $logo;
var $logo_small;
var $logo_mini;
+
+ var $activity_state; // 0=activity ceased, 1= in activity
/**
* Constructor for class
@@ -156,6 +158,8 @@
$this->prefixSupplierIsRequired = 0;
$this->tva_assuj = 1;
+
+
return 1;
}
@@ -184,6 +188,7 @@
}
if (empty($this->client)) $this->client=0;
if (empty($this->fournisseur)) $this->fournisseur=0;
+ $this->activity_state = $this->activity_state != 0 ? 1 : 0;
$this->db->begin();
@@ -198,10 +203,11 @@
if ($result >= 0)
{
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, datea, fk_user_creat, canvas)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, entity, datec, datea, fk_user_creat, canvas, activity_state)";
$sql.= " VALUES ('".$this->db->escape($this->nom)."', ".$conf->entity.", '".$this->db->idate($now)."', '".$this->db->idate($now)."'";
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
- $sql.= ", ".($this->canvas ? "'".$this->canvas."'":"null");
+ $sql.= ", ".($this->canvas ? "'".$this->canvas."'":"null");
+ $sql.= ", ".("'".$this->activity_state."'");
$sql.= ")";
dol_syslog("Societe::create sql=".$sql);
@@ -451,6 +457,8 @@
$sql .= ",tva_assuj = ".($this->tva_assuj!=''?"'".$this->tva_assuj."'":"null");
$sql .= ",tva_intra = '" . $this->db->escape($this->tva_intra) ."'";
+
+ $sql .= ",activity_state = '" .($this->activity_state != 0 ? 1 : 0). "'";
// Local taxes
$sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->localtax1_assuj."'":"null");
@@ -555,7 +563,7 @@
{
global $langs;
global $conf;
-
+
if (empty($rowid) && empty($ref) && empty($ref_ext)) return -1;
$sql = 'SELECT s.rowid, s.nom as name, s.entity, s.ref_ext, s.address, s.datec as dc, s.prefix_comm';
@@ -570,7 +578,8 @@
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.gencod';
$sql .= ', s.fk_departement, s.fk_pays, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
$sql .= ', s.localtax1_assuj, s.localtax2_assuj, s.fk_prospectlevel, s.default_lang';
- $sql .= ', s.import_key';
+ $sql .= ', s.import_key';
+ $sql .= ', s.activity_state';
$sql .= ', fj.libelle as forme_juridique';
$sql .= ', e.libelle as effectif';
$sql .= ', p.code as pays_code, p.libelle as pays';
@@ -592,11 +601,11 @@
if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($ape)."' AND s.entity = ".$conf->entity;
if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity = ".$conf->entity;
- $resql=$this->db->query($sql);
+ $resql=$this->db->query($sql);
dol_syslog("Societe::fetch ".$sql);
if ($resql)
- {
- $num=$this->db->num_rows($resql);
+ {
+ $num=$this->db->num_rows($resql);
if ($num > 1)
{
$this->error='Societe::Fetch several records found for ref='.$ref;
@@ -635,7 +644,9 @@
$this->departement_id = $obj->fk_departement; // TODO obsolete
$this->state_id = $obj->fk_departement;
$this->departement = $obj->fk_departement?$obj->departement:'';
-
+
+ $this->activity_state = ($obj->activity_state != null ? $obj->activity_state : 1); // Any null is replaced by true
+
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm);
$libelle=($transcode!='StatusProspect'.$obj->fk_stcomm?$transcode:$obj->stcomm);
$this->stcomm_id = $obj->fk_stcomm; // id statut commercial
Index: htdocs/societe/soc.php
===================================================================
RCS file: /sources/dolibarr/dolibarr/htdocs/societe/soc.php,v
retrieving revision 1.81
diff -u -r1.81 soc.php
--- htdocs/societe/soc.php 13 Apr 2011 12:19:52 -0000 1.81
+++ htdocs/societe/soc.php 29 Apr 2011 14:02:34 -0000
@@ -138,6 +138,7 @@
{
$soc->nom = $_POST["nom"];
}
+ $soc->activity_state = $_POST["activity_state"];
$soc->address = $_POST["adresse"];
$soc->adresse = $_POST["adresse"]; // TODO obsolete
$soc->cp = $_POST["zipcode"];
@@ -182,7 +183,7 @@
$soc->commercial_id = $_POST["commercial_id"];
$soc->default_lang = $_POST["default_lang"];
-
+
// Check parameters
if (empty($_POST["cancel"]))
{
@@ -317,7 +318,7 @@
$_GET["action"]='';
}
}
-
+
/*
* Generate document
@@ -441,7 +442,7 @@
// When used in standard mode
// -----------------------------------------
if (GETPOST('action') == 'create')
- {
+ {
/*
* Creation
*/
@@ -475,6 +476,7 @@
if (GETPOST("private")==1) { $soc->particulier=1; }
$soc->nom=$_POST["nom"];
+ $soc->activity_state= $_POST["activity_state"];
$soc->prenom=$_POST["prenom"];
$soc->particulier=$_REQUEST["private"];
$soc->prefix_comm=$_POST["prefix_comm"];
@@ -595,22 +597,23 @@
// Name, firstname
if ($soc->particulier)
{
- print '
'.$langs->trans('LastName').'
global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>
';
+ print '
'.$langs->trans('LastName').'
global->SOCIETE_USEPREFIX)?' colspan="1"':'').'>
';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '
'.$langs->trans('Prefix').'
';
- }
- print '
';
+ }
}
else
{
- print '
'.$langs->trans('ThirdPartyName').'
global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>
';
+ print '
'.$langs->trans('ThirdPartyName').'
global->SOCIETE_USEPREFIX)?' colspan="1"':'').'>
';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '