NEW Contract module can be used to follow both sold and bought
contracts/recurring subscriptions.
This commit is contained in:
parent
537a13e2f4
commit
2122d4d43a
@ -111,6 +111,7 @@ $hookmanager->initHooks(array('propallist'));
|
|||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'p.ref'=>'Ref',
|
'p.ref'=>'Ref',
|
||||||
|
'p.ref_client'=>'CustomerRef',
|
||||||
'pd.description'=>'Description',
|
'pd.description'=>'Description',
|
||||||
's.nom'=>"ThirdParty",
|
's.nom'=>"ThirdParty",
|
||||||
'p.note_public'=>'NotePublic',
|
'p.note_public'=>'NotePublic',
|
||||||
@ -270,7 +271,11 @@ if ($result)
|
|||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
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)
|
if ($sall)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -76,7 +76,7 @@ $limit = $conf->liste_limit;
|
|||||||
$viewstatut=GETPOST('viewstatut');
|
$viewstatut=GETPOST('viewstatut');
|
||||||
|
|
||||||
// Purge search criteria
|
// 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_categ='';
|
||||||
$search_user='';
|
$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
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('orderlist'));
|
$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
|
* 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 ($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 (!$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 ($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 <> '')
|
||||||
{
|
{
|
||||||
if ($viewstatut < 4 && $viewstatut > -3)
|
if ($viewstatut < 4 && $viewstatut > -3)
|
||||||
@ -259,9 +270,19 @@ if ($resql)
|
|||||||
|
|
||||||
// Lignes des champs de filtre
|
// Lignes des champs de filtre
|
||||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
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.'">';
|
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='';
|
$moreforfilter='';
|
||||||
|
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
@ -305,7 +326,7 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre">';
|
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('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('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);
|
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);
|
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);
|
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
|
|||||||
@ -237,6 +237,7 @@ if (empty($reshook))
|
|||||||
$object->fk_project = GETPOST('projectid','int');
|
$object->fk_project = GETPOST('projectid','int');
|
||||||
$object->remise_percent = GETPOST('remise_percent','alpha');
|
$object->remise_percent = GETPOST('remise_percent','alpha');
|
||||||
$object->ref = GETPOST('ref','alpha');
|
$object->ref = GETPOST('ref','alpha');
|
||||||
|
$object->ref_customer = GETPOST('ref_customer','alpha');
|
||||||
$object->ref_supplier = GETPOST('ref_supplier','alpha');
|
$object->ref_supplier = GETPOST('ref_supplier','alpha');
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// 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');
|
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
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
@ -767,9 +770,10 @@ if (empty($reshook))
|
|||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
setEventMessage($object->error,'errors');
|
setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action=='setref_supplier') {
|
}
|
||||||
|
elseif ($action=='setref_supplier')
|
||||||
|
{
|
||||||
$cancelbutton = GETPOST('cancel');
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
if (!$cancelbutton) {
|
if (!$cancelbutton) {
|
||||||
|
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
@ -790,7 +794,34 @@ if (empty($reshook))
|
|||||||
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
|
||||||
exit;
|
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');
|
$cancelbutton = GETPOST('cancel');
|
||||||
|
|
||||||
if (!$cancelbutton) {
|
if (!$cancelbutton) {
|
||||||
@ -1001,14 +1032,18 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$tmpcode.'</td></tr>';
|
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
|
// Ref supplier
|
||||||
print '<tr><td>'.$langs->trans('RefSupplier').'</td>';
|
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>';
|
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 '<tr>';
|
||||||
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
print '<td class="fieldrequired">'.$langs->trans('Thirdparty').'</td>';
|
||||||
if($socid>0)
|
if ($socid>0)
|
||||||
{
|
{
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $soc->getNomUrl(1);
|
print $soc->getNomUrl(1);
|
||||||
@ -1018,7 +1053,7 @@ if ($action == 'create')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td colspan="2">';
|
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 '</td>';
|
||||||
}
|
}
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
@ -1206,6 +1241,14 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr>';
|
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 '<td width="20%">';
|
||||||
print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
|
print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|||||||
@ -50,6 +50,12 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
protected $table_ref_field = 'ref';
|
protected $table_ref_field = 'ref';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Customer reference of the contract
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
var $ref_customer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supplier reference of the contract
|
* Supplier reference of the contract
|
||||||
* @var string
|
* @var string
|
||||||
@ -476,13 +482,13 @@ class Contrat extends CommonObject
|
|||||||
function fetch($id,$ref='')
|
function fetch($id,$ref='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
|
$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_mise_en_service, date_contrat as datecontrat,";
|
||||||
$sql.= " fk_user_author,";
|
$sql.= " fk_user_author,";
|
||||||
$sql.= " fk_projet,";
|
$sql.= " fk_projet,";
|
||||||
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
|
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
|
||||||
$sql.= " note_private, note_public, model_pdf, extraparams";
|
$sql.= " note_private, note_public, model_pdf, extraparams";
|
||||||
$sql.= " ,ref_supplier";
|
|
||||||
$sql.= " ,ref_ext";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
|
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
|
||||||
if ($ref)
|
if ($ref)
|
||||||
{
|
{
|
||||||
@ -501,6 +507,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $result["rowid"];
|
$this->id = $result["rowid"];
|
||||||
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
|
$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_supplier = $result["ref_supplier"];
|
||||||
$this->ref_ext = $result["ref_ext"];
|
$this->ref_ext = $result["ref_ext"];
|
||||||
$this->statut = $result["statut"];
|
$this->statut = $result["statut"];
|
||||||
@ -839,7 +846,7 @@ class Contrat extends CommonObject
|
|||||||
// Insert contract
|
// Insert contract
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
|
$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.= " 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.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
|
||||||
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
|
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
|
||||||
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
|
||||||
@ -849,6 +856,7 @@ class Contrat extends CommonObject
|
|||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
$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->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_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL");
|
||||||
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
|
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
@ -1101,6 +1109,7 @@ class Contrat extends CommonObject
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
if (isset($this->ref)) $this->ref=trim($this->ref);
|
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_supplier)) $this->ref_supplier=trim($this->ref_supplier);
|
||||||
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
|
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
|
||||||
if (isset($this->entity)) $this->entity=trim($this->entity);
|
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 = "UPDATE ".MAIN_DB_PREFIX."contrat SET";
|
||||||
|
|
||||||
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
|
$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_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.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
|
||||||
$sql.= " entity=".$conf->entity.",";
|
$sql.= " entity=".$conf->entity.",";
|
||||||
@ -2024,6 +2034,8 @@ class Contrat extends CommonObject
|
|||||||
$this->specimen=1;
|
$this->specimen=1;
|
||||||
|
|
||||||
$this->ref = 'SPECIMEN';
|
$this->ref = 'SPECIMEN';
|
||||||
|
$this->ref_customer = 'SPECIMENCUST';
|
||||||
|
$this->ref_supplier = 'SPECIMENSUPP';
|
||||||
$this->socid = 1;
|
$this->socid = 1;
|
||||||
$this->statut= 0;
|
$this->statut= 0;
|
||||||
$this->date_contrat = dol_now();
|
$this->date_contrat = dol_now();
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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;
|
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
|
* View
|
||||||
@ -93,7 +104,7 @@ $socstatic = new Societe($db);
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$sql = 'SELECT';
|
$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.= " 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=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,';
|
$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) {
|
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;
|
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";
|
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
|
||||||
@ -149,6 +160,16 @@ if ($resql)
|
|||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
print '<form method="POST" 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)
|
||||||
|
{
|
||||||
|
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'
|
// If the user can view prospects other than his'
|
||||||
$moreforfilter='';
|
$moreforfilter='';
|
||||||
@ -199,8 +220,9 @@ if ($resql)
|
|||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
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("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("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$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("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("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);
|
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 '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="liste_titre">';
|
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>';
|
||||||
print '<td class="liste_titre">';
|
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>';
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
//print '<td class="liste_titre"> </td>';
|
//print '<td class="liste_titre"> </td>';
|
||||||
@ -240,6 +265,7 @@ if ($resql)
|
|||||||
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
|
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"));
|
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
print '<td>'.$obj->ref_customer.'</td>';
|
||||||
print '<td>'.$obj->ref_supplier.'</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><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>';
|
//print '<td align="center">'.dol_print_date($obj->datec).'</td>';
|
||||||
|
|||||||
@ -64,7 +64,7 @@ $search_status=GETPOST('search_status');
|
|||||||
$sall=GETPOST('sall');
|
$sall=GETPOST('sall');
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$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_ref="";
|
||||||
$search_company="";
|
$search_company="";
|
||||||
@ -72,6 +72,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||||||
$search_status="";
|
$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
|
* View
|
||||||
*/
|
*/
|
||||||
@ -110,9 +121,7 @@ if (! $user->rights->societe->client->voir && empty($socid))
|
|||||||
if ($socid)
|
if ($socid)
|
||||||
$sql.= " AND s.rowid = " . $socid;
|
$sql.= " AND s.rowid = " . $socid;
|
||||||
if ($sall) {
|
if ($sall) {
|
||||||
$arraytosearch=array('f.ref', 'f.description', 's.nom');
|
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $arraytosearch=array('f.ref', 'f.description', 's.nom', 'fd.description');
|
|
||||||
$sql .= natural_search($arraytosearch, $sall);
|
|
||||||
}
|
}
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
@ -135,11 +144,22 @@ if ($result)
|
|||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
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 '<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("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);
|
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder);
|
||||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -74,6 +74,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
|||||||
|
|
||||||
if ($search_status == '') $search_status=-1;
|
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
|
* View
|
||||||
@ -141,7 +152,7 @@ if ($search_ttc != '')
|
|||||||
}
|
}
|
||||||
if ($sall)
|
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;
|
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_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
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 '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder);
|
||||||
|
|||||||
@ -150,8 +150,6 @@ else
|
|||||||
{
|
{
|
||||||
$texte = $langs->trans("ProductsAndServices");
|
$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 = '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,';
|
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||||
@ -238,7 +236,7 @@ else
|
|||||||
$param.=isset($type)?"&type=".$type:"";
|
$param.=isset($type)?"&type=".$type:"";
|
||||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
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))
|
if (! empty($catid))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user