';
print '';
print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
print ' ';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 3b6b6bdac2e..1d2bd9f4181 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -50,6 +50,12 @@ class Contrat extends CommonObject
*/
protected $table_ref_field = 'ref';
+ /**
+ * Customer reference of the contract
+ * @var string
+ */
+ var $ref_customer;
+
/**
* Supplier reference of the contract
* @var string
@@ -476,13 +482,13 @@ class Contrat extends CommonObject
function fetch($id,$ref='')
{
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
+ $sql.= " ref_supplier, ref_customer,";
+ $sql.= " ref_ext,";
$sql.= " fk_user_mise_en_service, date_contrat as datecontrat,";
$sql.= " fk_user_author,";
$sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, model_pdf, extraparams";
- $sql.= " ,ref_supplier";
- $sql.= " ,ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
if ($ref)
{
@@ -501,6 +507,7 @@ class Contrat extends CommonObject
{
$this->id = $result["rowid"];
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
+ $this->ref_customer = $result["ref_customer"];
$this->ref_supplier = $result["ref_supplier"];
$this->ref_ext = $result["ref_ext"];
$this->statut = $result["statut"];
@@ -839,7 +846,7 @@ class Contrat extends CommonObject
// Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
- $sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)";
+ $sql.= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)";
$sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
@@ -849,6 +856,7 @@ class Contrat extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
+ $sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
$sql.= ")";
@@ -1101,6 +1109,7 @@ class Contrat extends CommonObject
// Clean parameters
if (isset($this->ref)) $this->ref=trim($this->ref);
+ if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer);
if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
if (isset($this->entity)) $this->entity=trim($this->entity);
@@ -1125,6 +1134,7 @@ class Contrat extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET";
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
+ $sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").",";
$sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
$sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
$sql.= " entity=".$conf->entity.",";
@@ -2024,6 +2034,8 @@ class Contrat extends CommonObject
$this->specimen=1;
$this->ref = 'SPECIMEN';
+ $this->ref_customer = 'SPECIMENCUST';
+ $this->ref_supplier = 'SPECIMENSUPP';
$this->socid = 1;
$this->statut= 0;
$this->date_contrat = dol_now();
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 9619713859a..07d3aa9e1c5 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -1,11 +1,11 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2004-2015 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2013 Cédric Salvador
* Copyright (C) 2014 Juanjo Menent
- * Copyright (C) 2015 Claudio Aschieri
- * Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2015 Claudio Aschieri
+ * Copyright (C) 2015 Jean-François Ferry
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,6 +80,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status == '') $search_status=1;
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array(
+ 'c.ref'=>'Ref',
+ 'c.ref_customer'=>'RefCustomer',
+ 'c.ref_supplier'=>'RefSupplier',
+ 's.nom'=>"ThirdParty",
+ 'cd.description'=>'Description',
+ 'c.note_public'=>'NotePublic',
+);
+if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
+
/*
* View
@@ -93,7 +104,7 @@ $socstatic = new Societe($db);
llxHeader();
$sql = 'SELECT';
-$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,";
+$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
$sql.= " s.nom as name, s.rowid as socid,";
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
@@ -132,7 +143,7 @@ if ($search_sale > 0)
}
if ($sall) {
- $sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
@@ -149,7 +160,17 @@ if ($resql)
print ' ';
print '';
- print ' ';
+ print ' ';
print ' ';
print '';
- print ' ';
+ print ' ';
+ print ' ';
+ print '';
+ print ' ';
print ' ';
print ' ';
//print ' ';
@@ -240,6 +265,7 @@ if ($resql)
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'';
if ($obj->nb_late) print img_warning($langs->trans("Late"));
print '';
+ print ''.$obj->ref_customer.' ';
print ''.$obj->ref_supplier.' ';
print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.' ';
//print ''.dol_print_date($obj->datec).' ';
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 74051b5bc70..896d8c6a4fa 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -64,7 +64,7 @@ $search_status=GETPOST('search_status');
$sall=GETPOST('sall');
$optioncss = GETPOST('optioncss','alpha');
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref="";
$search_company="";
@@ -72,6 +72,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_status="";
}
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array(
+ 'f.ref'=>'Ref',
+ 's.nom'=>"ThirdParty",
+ 'f.description'=>'Description',
+ 'f.note_public'=>'NotePublic',
+);
+if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
+if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']);
+
+
/*
* View
*/
@@ -110,9 +121,7 @@ if (! $user->rights->societe->client->voir && empty($socid))
if ($socid)
$sql.= " AND s.rowid = " . $socid;
if ($sall) {
- $arraytosearch=array('f.ref', 'f.description', 's.nom');
- if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $arraytosearch=array('f.ref', 'f.description', 's.nom', 'fd.description');
- $sql .= natural_search($arraytosearch, $sall);
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@@ -135,11 +144,22 @@ if ($result)
print '