NEW Contract module can be used to follow both sold and bought

contracts/recurring subscriptions.
This commit is contained in:
Laurent Destailleur 2015-10-17 00:52:35 +02:00
parent 537a13e2f4
commit 2122d4d43a
8 changed files with 184 additions and 35 deletions

View File

@ -111,6 +111,7 @@ $hookmanager->initHooks(array('propallist'));
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.ref'=>'Ref',
'p.ref_client'=>'CustomerRef',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'p.note_public'=>'NotePublic',
@ -270,7 +271,11 @@ if ($result)
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{

View File

@ -76,7 +76,7 @@ $limit = $conf->liste_limit;
$viewstatut=GETPOST('viewstatut');
// Purge search criteria
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_categ='';
$search_user='';
@ -95,6 +95,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('orderlist'));
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'c.ref'=>'Ref',
'c.ref_client'=>'RefCustomerOrder',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'c.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
/*
* Actions
*/
@ -139,7 +150,7 @@ if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_produc
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($viewstatut <> '')
{
if ($viewstatut < 4 && $viewstatut > -3)
@ -259,9 +270,19 @@ if ($resql)
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
$moreforfilter='';
// If the user can view prospects other than his'
@ -305,7 +326,7 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)) print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);

View File

@ -237,6 +237,7 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid','int');
$object->remise_percent = GETPOST('remise_percent','alpha');
$object->ref = GETPOST('ref','alpha');
$object->ref_customer = GETPOST('ref_customer','alpha');
$object->ref_supplier = GETPOST('ref_supplier','alpha');
// If creation from another object of another module (Example: origin=propal, originid=1)
@ -747,7 +748,9 @@ if (empty($reshook))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")),'errors');
}
} else if ($action == 'update_extras') {
}
else if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
@ -767,9 +770,10 @@ if (empty($reshook))
$action = 'edit_extras';
setEventMessage($object->error,'errors');
}
} elseif ($action=='setref_supplier') {
}
elseif ($action=='setref_supplier')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton) {
$result = $object->fetch($id);
@ -790,7 +794,34 @@ if (empty($reshook))
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
} elseif ($action=='setref') {
}
elseif ($action=='setref_customer')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton)
{
$result = $object->fetch($id);
if ($result < 0) {
setEventMessage($object->errors, 'errors');
}
$result = $object->setValueFrom('ref_customer',GETPOST('ref_customer','alpha'));
if ($result < 0) {
setEventMessage($object->errors, 'errors');
$action = 'editref_customer';
} else {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
}
else {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
}
elseif ($action=='setref')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton) {
@ -1001,14 +1032,18 @@ if ($action == 'create')
}
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$tmpcode.'</td></tr>';
// Ref customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="2"><input type="text" size="5" name="ref_customer" id="ref_customer" value="'.GETPOST('ref_customer','alpha').'"></td></tr>';
// Ref supplier
print '<tr><td>'.$langs->trans('RefSupplier').'</td>';
print '<td colspan="2"><input type="text" size="5" name="ref_supplier" id="ref_supplier" value="'.GETPOST('ref_supplier','alpha').'"></td></tr>';
// Customer
// Thirdparty
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($socid>0)
print '<td class="fieldrequired">'.$langs->trans('Thirdparty').'</td>';
if ($socid>0)
{
print '<td colspan="2">';
print $soc->getNomUrl(1);
@ -1018,7 +1053,7 @@ if ($action == 'create')
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print $form->select_company('','socid','',1);
print '</td>';
}
print '</tr>'."\n";
@ -1206,6 +1241,14 @@ else
}
print '<tr>';
print '<td width="20%">';
print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer);
print '</td><td>';
print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer);
print '</td>';
print '</tr>';
print '<tr>';
print '<td width="20%">';
print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
print '</td><td>';

View File

@ -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();

View File

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* 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 '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
// If the user can view prospects other than his'
$moreforfilter='';
if ($user->rights->societe->client->voir || $socid)
@ -199,8 +220,9 @@ if ($resql)
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SalesRepresentative"), $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
@ -218,10 +240,13 @@ if ($resql)
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>';
@ -240,6 +265,7 @@ if ($resql)
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
if ($obj->nb_late) print img_warning($langs->trans("Late"));
print '</td>';
print '<td>'.$obj->ref_customer.'</td>';
print '<td>'.$obj->ref_supplier.'</td>';
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
//print '<td align="center">'.dol_print_date($obj->datec).'</td>';

View File

@ -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 '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<table class="noborder" width="100%">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder);
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
{

View File

@ -74,6 +74,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(
'cf.ref'=>'Ref',
'cf.ref_supplier'=>'RefSupplier',
//'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'cf.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
/*
* View
@ -141,7 +152,7 @@ if ($search_ttc != '')
}
if ($sall)
{
$sql .= natural_search(array('cf.ref', 'cf.ref_supplier', 'cf.note_public', 'cf.note_private'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
@ -190,6 +201,19 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder);

View File

@ -150,8 +150,6 @@ else
{
$texte = $langs->trans("ProductsAndServices");
}
// Add what we are searching for
if (! empty($sall)) $texte.= " - ".$sall;
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql.= ' p.fk_product_type, p.tms as datem,';
@ -238,7 +236,7 @@ else
$param.=isset($type)?"&amp;type=".$type:"";
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($texte, $page, "list.php", $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png');
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png');
if (! empty($catid))
{