Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
aab1358b0d
@ -190,6 +190,13 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Set sales representatives
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
||||
}
|
||||
|
||||
if ($action == 'update_extras') {
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
@ -55,6 +55,10 @@ class Ldap
|
||||
/**
|
||||
* Version du protocole ldap
|
||||
*/
|
||||
public $ldapProtocolVersion;
|
||||
/**
|
||||
* Server DN
|
||||
*/
|
||||
public $domain;
|
||||
/**
|
||||
* User administrateur Ldap
|
||||
@ -160,7 +164,7 @@ class Ldap
|
||||
public function connect_bind()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
global $conf;
|
||||
|
||||
$connected = 0;
|
||||
$this->bind = 0;
|
||||
@ -183,7 +187,7 @@ class Ldap
|
||||
if (empty($this->error))
|
||||
{
|
||||
// Loop on each ldap server
|
||||
foreach ($this->server as $key => $host)
|
||||
foreach ($this->server as $host)
|
||||
{
|
||||
if ($connected) break;
|
||||
if (empty($host)) continue;
|
||||
@ -395,8 +399,6 @@ class Ldap
|
||||
*/
|
||||
public function add($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
@ -447,8 +449,6 @@ class Ldap
|
||||
*/
|
||||
public function modify($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::modify dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
@ -473,6 +473,11 @@ class Ldap
|
||||
$this->dump($dn, $info);
|
||||
|
||||
//print_r($info);
|
||||
|
||||
// For better compatibility with Samba4 AD
|
||||
if ($this->serverType == "activedirectory") {
|
||||
unset($info['cn']); // For avoid error : Operation not allowed on RDN (Code 67)
|
||||
}
|
||||
$result = @ldap_modify($this->connection, $dn, $info);
|
||||
|
||||
if ($result)
|
||||
@ -499,8 +504,6 @@ class Ldap
|
||||
*/
|
||||
public function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::modify dn=".$dn." newrdn=".$newrdn." newparent=".$newparent." deleteoldrdn=".($deleteoldrdn ? 1 : 0));
|
||||
|
||||
// Check parameters
|
||||
@ -548,8 +551,6 @@ class Ldap
|
||||
*/
|
||||
public function update($dn, $info, $user, $olddn, $newrdn = false, $newparent = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::update dn=".$dn." olddn=".$olddn);
|
||||
|
||||
// Check parameters
|
||||
@ -566,11 +567,12 @@ class Ldap
|
||||
|
||||
if (!$olddn || $olddn != $dn)
|
||||
{
|
||||
if (!empty($olddn) && !empty($newrdn) && !empty($newparent) && $conf->global->LDAP_SERVER_PROTOCOLVERSION === '3')
|
||||
if (! empty($olddn) && ! empty($newrdn) && ! empty($newparent) && $this->ldapProtocolVersion === '3')
|
||||
{
|
||||
// This function currently only works with LDAPv3
|
||||
$result = $this->rename($olddn, $newrdn, $newparent, $user, true);
|
||||
} else {
|
||||
$result = $this->modify($dn, $info, $user); // We force "modify" for avoid some fields not modify
|
||||
} else {
|
||||
// If change we make is rename the key of LDAP record, we create new one and if ok, we delete old one.
|
||||
$result = $this->add($dn, $info, $user);
|
||||
if ($result > 0 && $olddn && $olddn != $dn) $result = $this->delete($olddn); // If add fails, we do not try to delete old one
|
||||
@ -602,8 +604,6 @@ class Ldap
|
||||
*/
|
||||
public function delete($dn)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::delete Delete LDAP entry dn=".$dn);
|
||||
|
||||
// Check parameters
|
||||
@ -658,7 +658,7 @@ class Ldap
|
||||
{
|
||||
$content .= "$key: $value\n";
|
||||
} else {
|
||||
foreach ($value as $valuekey => $valuevalue)
|
||||
foreach ($value as $valuevalue)
|
||||
{
|
||||
$content .= "$key: $valuevalue\n";
|
||||
}
|
||||
@ -738,8 +738,6 @@ class Ldap
|
||||
*/
|
||||
public function addAttribute($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::addAttribute dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
@ -788,8 +786,6 @@ class Ldap
|
||||
*/
|
||||
public function updateAttribute($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::updateAttribute dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
@ -838,8 +834,6 @@ class Ldap
|
||||
*/
|
||||
public function deleteAttribute($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::deleteAttribute dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
|
||||
@ -306,7 +306,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
} elseif ($feature == 'cheque')
|
||||
{
|
||||
if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; }
|
||||
} elseif (!empty($feature2)) // This is for permissions on one level
|
||||
} elseif ($feature == 'import') {
|
||||
if (!$user->rights->import->run) { $createok = 0; $nbko++; }
|
||||
}
|
||||
elseif (!empty($feature2)) // This is for permissions on one level
|
||||
{
|
||||
foreach ($feature2 as $subfeature)
|
||||
{
|
||||
|
||||
@ -263,7 +263,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_fields_array[$r] = array(
|
||||
's.rowid'=>"Id", 's.nom'=>"Name", 's.name_alias'=>"AliasNameShort", 's.status'=>"Status", 's.client'=>"Customer", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification",
|
||||
's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'd.nom'=>'State', 'r.nom' => 'Region', 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax",
|
||||
's.url'=>"Url", 's.email'=>"Email", 's.default_lang'=>"DefaultLang", 's.siren'=>"ProfId1", 's.siret'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4",
|
||||
's.idprof5'=>"ProfId5", 's.idprof6'=>"ProfId6", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_private'=>"NotePrivate", 's.note_public'=>"NotePublic",
|
||||
't.libelle'=>"ThirdPartyType", 'ce.code'=>"Staff", "cfj.libelle"=>"JuridicalStatus", 's.fk_prospectlevel'=>'ProspectLevel',
|
||||
@ -295,7 +295,7 @@ class modSociete extends DolibarrModules
|
||||
's.default_lang'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", 's.idprof5'=>"Text", 's.idprof6'=>"Text",
|
||||
's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_private'=>"Text", 's.note_public'=>"Text", 't.libelle'=>"Text",
|
||||
'ce.code'=>"List:c_effectif:libelle:code", "cfj.libelle"=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code',
|
||||
'st.code'=>'List:c_stcomm:libelle:code', 'd.nom'=>'Text', 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', 'payterm.libelle'=>'Text',
|
||||
'st.code'=>'List:c_stcomm:libelle:code', 'd.nom'=>'Text', 'r.nom' => 'Text', 'u.login'=>'Text', 'u.firstname'=>'Text', 'u.lastname'=>'Text', 'payterm.libelle'=>'Text',
|
||||
'paymode.libelle'=>'Text', 's.entity'=>'Numeric',
|
||||
's.price_level'=>'Numeric'
|
||||
);
|
||||
@ -310,6 +310,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = s.fk_pays';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid';
|
||||
@ -333,7 +334,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_fields_array[$r] = array(
|
||||
'c.rowid'=>"IdContact", 'c.civility'=>"CivilityCode", 'c.lastname'=>'Lastname', 'c.firstname'=>'Firstname', 'c.poste'=>'PostOrFunction',
|
||||
'c.datec'=>"DateCreation", 'c.tms'=>"DateLastModification", 'c.priv'=>"ContactPrivate", 'c.address'=>"Address", 'c.zip'=>"Zip", 'c.town'=>"Town",
|
||||
'd.nom'=>'State', 'co.label'=>"Country", 'co.code'=>"CountryCode", 'c.phone'=>"Phone", 'c.fax'=>"Fax", 'c.phone_mobile'=>"Mobile", 'c.email'=>"EMail",
|
||||
'd.nom'=>'State', 'r.nom' => 'Region', 'co.label'=>"Country", 'co.code'=>"CountryCode", 'c.phone'=>"Phone", 'c.fax'=>"Fax", 'c.phone_mobile'=>"Mobile", 'c.email'=>"EMail",
|
||||
'c.statut'=>"Status",
|
||||
's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode",
|
||||
's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode",
|
||||
@ -344,7 +345,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)');
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean",
|
||||
'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text",
|
||||
'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'r.nom' => 'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text",
|
||||
'c.fax'=>"Text", 'c.email'=>"Text",
|
||||
'c.statut'=>"Status",
|
||||
's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text",
|
||||
@ -375,6 +376,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object';
|
||||
if (is_object($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_regions as r ON r.code_region = d.fk_region AND r.fk_pays = c.fk_pays';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id';
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 François Legastelois <flegastelois@teclib.com>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -42,13 +43,79 @@ if ($user->socid > 0) // Protection if external user
|
||||
}
|
||||
$result = restrictedArea($user, 'holiday', $id, '');
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ');
|
||||
$optioncss = GETPOST('optioncss', 'aZ');
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
|
||||
if (! $sortfield) $sortfield = "cp.rowid";
|
||||
if (! $sortorder) $sortorder = "ASC";
|
||||
|
||||
$hookmanager->initHooks(array('leavemovementlist'));
|
||||
|
||||
$arrayfields = array();
|
||||
$arrayofmassactions = array();
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha')
|
||||
|| GETPOST('button_removefilter.x', 'alpha')
|
||||
|| GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha')
|
||||
|| GETPOST('button_search.x', 'alpha')
|
||||
|| GETPOST('button_search', 'alpha'))
|
||||
{
|
||||
$massaction = '';
|
||||
}
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
'cp.ref'=>array('label'=>$langs->trans('Ref'), 'checked'=>1),
|
||||
'cp.fk_user'=>array('label'=>$langs->trans('Employee'), 'checked'=>1),
|
||||
'ct.label'=>array('label'=>$langs->trans('Type'), 'checked'=>1),
|
||||
'cp.date_debut'=>array('label'=>$langs->trans('DateDebCP'), 'checked'=>1),
|
||||
'cp.date_fin'=>array('label'=>$langs->trans('DateFinCP'), 'checked'=>1),
|
||||
'used_days'=>array('label'=>$langs->trans('NbUseDaysCPShort'), 'checked'=>1),
|
||||
'date_start_month'=>array('label'=>$langs->trans('DateStartInMonth'), 'checked'=>1),
|
||||
'date_end_month'=>array('label'=>$langs->trans('DateEndInMonth'), 'checked'=>1),
|
||||
'used_days_month'=>array('label'=>$langs->trans('NbUseDaysCPShortInMonth'), 'checked'=>1),
|
||||
'cp.description'=>array('label'=>$langs->trans('DescCP'), 'checked'=>1),
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$holidaystatic = new Holiday($db);
|
||||
|
||||
@ -56,36 +123,21 @@ $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->t
|
||||
|
||||
llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
|
||||
print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
|
||||
|
||||
|
||||
// Selection filter
|
||||
print '<div class="tabBar">';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
$search_month = GETPOST("remonth", 'int') ?GETPOST("remonth", 'int') : date("m", time());
|
||||
$search_year = GETPOST("reyear", 'int') ?GETPOST("reyear", 'int') : date("Y", time());
|
||||
|
||||
$year_month = sprintf("%04d", $search_year).'-'.sprintf("%02d", $search_month);
|
||||
|
||||
print $formother->select_month($search_month, 'remonth');
|
||||
$sql = "SELECT cp.rowid, cp.ref, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday cp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
|
||||
$sql.= " WHERE cp.rowid > 0";
|
||||
$sql.= " AND cp.statut = 3"; // 3 = Approved
|
||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
|
||||
|
||||
print $formother->select_year($search_year, 'reyear');
|
||||
if ($search_ref != '') $sql.= natural_search('cp.ref', $search_ref, 0);
|
||||
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
$sql = "SELECT cp.rowid, cp.fk_user, cp.date_debut, cp.date_fin, ct.label, cp.description, cp.halfday";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday cp";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
|
||||
$sql .= " WHERE cp.rowid > 0";
|
||||
$sql .= " AND cp.statut = 3"; // Approved
|
||||
$sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
|
||||
$sql .= " ORDER BY u.lastname, cp.date_debut";
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (empty($resql))
|
||||
@ -96,31 +148,78 @@ if (empty($resql))
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.= '&limit='.urlencode($limit);
|
||||
if ($search_ref) $param = '&search_ref='.urlencode($search_ref);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
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="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
|
||||
|
||||
// Selection filter
|
||||
print '<div class="tabBar">';
|
||||
print $formother->select_month($search_month, 'remonth');
|
||||
print $formother->select_year($search_year, 'reyear');
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = '';
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields.= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Employee').'</td>';
|
||||
print '<td>'.$langs->trans('Type').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DateDebCP').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DateFinCP').'</td>';
|
||||
print '<td class="right">'.$langs->trans('NbUseDaysCPShort').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DateStartInMonth').'</td>';
|
||||
print '<td class="center">'.$langs->trans('DateEndInMonth').'</td>';
|
||||
print '<td class="right">'.$langs->trans('NbUseDaysCPShortInMonth').'</td>';
|
||||
print '<td class="maxwidth300">'.$langs->trans('DescCP').'</td>';
|
||||
if (!empty($arrayfields['cp.ref']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth100" name="search_ref" value="'.$search_ref.'"></td>';
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['ct.label']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cp.date_debut']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cp.date_fin']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['used_days']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['date_start_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['date_end_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['used_days_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cp.description']['checked'])) print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['cp.ref']['checked'])) print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], 'cp.ref', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], 'cp.fk_user', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['ct.label']['checked'])) print_liste_field_titre($arrayfields['ct.label']['label'], $_SERVER["PHP_SELF"], 'ct.label', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], 'cp.date_debut', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], 'cp.date_fin', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['used_days']['checked'])) print_liste_field_titre($arrayfields['used_days']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['date_start_month']['checked'])) print_liste_field_titre($arrayfields['date_start_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['date_end_month']['checked'])) print_liste_field_titre($arrayfields['date_end_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['used_days_month']['checked'])) print_liste_field_titre($arrayfields['used_days_month']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cp.description']['checked'])) print_liste_field_titre($arrayfields['cp.description']['label'], $_SERVER["PHP_SELF"], 'cp.description', '', '', '', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print '</tr>';
|
||||
|
||||
if ($num == 0)
|
||||
{
|
||||
print '<tr><td colspan="10" class="opacitymedium">'.$langs->trans('None').'</td></tr>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$user = new User($db);
|
||||
@ -161,34 +260,54 @@ if ($num == 0)
|
||||
|
||||
// Leave request
|
||||
$holidaystatic->id = $obj->rowid;
|
||||
$holidaystatic->ref = $obj->rowid;
|
||||
$holidaystatic->ref = $obj->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print $holidaystatic->getNomUrl(1, 1);
|
||||
print '</td>';
|
||||
print '<td>'.$user->getFullName($langs).'</td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
|
||||
print '</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_fin), 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.num_open_day($date_start, $date_end, 0, 1, $obj->halfday).'</td>';
|
||||
print '<td class="center">'.dol_print_date($date_start_inmonth, 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
|
||||
print '</td>';
|
||||
print '<td class="center">'.dol_print_date($date_end_inmonth, 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
|
||||
print '<td class="maxwidth300">'.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).'</td>';
|
||||
|
||||
if (!empty($arrayfields['cp.ref']['checked'])) print '<td>'.$holidaystatic->getNomUrl(1, 1).'</td>';
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) print '<td>'.$user->getFullName($langs).'</td>';
|
||||
if (!empty($arrayfields['ct.label']['checked'])) print '<td>'.$obj->label.'</td>';
|
||||
|
||||
if (!empty($arrayfields['cp.date_debut']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_debut), 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfday]).')</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cp.date_fin']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_fin), 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfday]).')</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['used_days']['checked'])) print '<td class="right">'.num_open_day($date_start, $date_end, 0, 1, $obj->halfday).'</td>';
|
||||
|
||||
if (!empty($arrayfields['date_start_month']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($date_start_inmonth, 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$starthalfdayinmonth]).')</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['date_end_month']['checked']))
|
||||
{
|
||||
print '<td class="center">'.dol_print_date($date_end_inmonth, 'day');
|
||||
print ' <span class="opacitymedium">('.$langs->trans($listhalfday[$endhalfdayinmonth]).')</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['used_days_month']['checked'])) print '<td class="right">'.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).'</td>';
|
||||
if (!empty($arrayfields['cp.description']['checked'])) print '<td class="maxwidth300">'.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -28,18 +29,20 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$search_id = GETPOST('search_id', 'alpha');
|
||||
$year = GETPOST('year');
|
||||
$search_id = GETPOST('search_id', 'alpha');
|
||||
$search_prev_solde = GETPOST('search_prev_solde', 'alpha');
|
||||
$search_new_solde = GETPOST('search_new_solde', 'alpha');
|
||||
$year = GETPOST('year');
|
||||
if (empty($year))
|
||||
{
|
||||
$tmpdate = dol_getdate(dol_now());
|
||||
@ -47,7 +50,7 @@ if (empty($year))
|
||||
}
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
@ -55,8 +58,8 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST(
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
//if (! $sortfield) $sortfield="p.date_fin";
|
||||
//if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="cpl.rowid";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
|
||||
// Protection if external user
|
||||
@ -101,8 +104,13 @@ if (empty($reshook))
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha')
|
||||
|| GETPOST('button_removefilter.x', 'alpha')
|
||||
|| GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha')
|
||||
|| GETPOST('button_search.x', 'alpha')
|
||||
|| GETPOST('button_search', 'alpha'))
|
||||
{
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
@ -118,6 +126,18 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
|
||||
// Definition of fields for lists
|
||||
$arrayfields = array(
|
||||
'cpl.rowid'=>array('label'=>$langs->trans("ID"), 'checked'=>1),
|
||||
'cpl.date_action'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
|
||||
'cpl.fk_user_action'=>array('label'=>$langs->trans("ActionByCP"), 'checked'=>1),
|
||||
'cpl.fk_user_update'=>array('label'=>$langs->trans("UserUpdateCP"), 'checked'=>1),
|
||||
'cpl.type_action'=>array('label'=>$langs->trans("Description"), 'checked'=>1),
|
||||
'cpl.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'cpl.prev_solde'=>array('label'=>$langs->trans("PrevSoldeCP"), 'checked'=>1),
|
||||
'variation'=>array('label'=>$langs->trans("Variation"), 'checked'=>1),
|
||||
'cpl.new_solde'=>array('label'=>$langs->trans("NewSoldeCP"), 'checked'=>1),
|
||||
);
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -129,13 +149,16 @@ $alltypeleaves = $object->getTypes(1, -1); // To have labels
|
||||
|
||||
llxHeader('', $langs->trans('CPTitreMenu').' ('.$langs->trans("Year").' '.$year.')');
|
||||
|
||||
$sqlwhere = " AND date_action BETWEEN ".
|
||||
$sqlwhere.= "'".$db->idate(dol_get_first_day($year, 1, 1))."'";
|
||||
$sqlwhere.= " AND ";
|
||||
$sqlwhere.= "'".$db->idate(dol_get_last_day($year, 12, 1))."'";
|
||||
|
||||
if ($search_id != '') $sqlwhere.= natural_search('rowid', $search_id, 1);
|
||||
if ($search_prev_solde != '') $sqlwhere.= natural_search('prev_solde', $search_prev_solde, 1);
|
||||
if ($search_new_solde != '') $sqlwhere.= natural_search('new_solde', $search_new_solde, 1);
|
||||
|
||||
$sqlwhere = '';
|
||||
$sqlwhere .= " AND date_action BETWEEN '".$db->idate(dol_get_first_day($year, 1, 1))."' AND '".$db->idate(dol_get_last_day($year, 12, 1))."'";
|
||||
if ($search_id != '') $sqlwhere .= natural_search('rowid', $search_id, 1);
|
||||
|
||||
$sqlorder = 'ORDER BY cpl.rowid DESC';
|
||||
$sqlorder = $db->order($sortfield, $sortorder);
|
||||
|
||||
// Recent changes are more important than old changes
|
||||
$log_holiday = $object->fetchLog($sqlorder, $sqlwhere); // Load $object->logs
|
||||
@ -155,10 +178,32 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$pagination = '<div class="pagination"><ul><li class="pagination"><a href="'.$_SERVER["PHP_SELF"].'?year='.($year - 1).$param.'"><i class="fa fa-chevron-left" title="Previous"></i></a><li class="pagination"><span class="active">'.$langs->trans("Year").' '.$year.'</span></li><li class="pagination"><a href="'.$_SERVER["PHP_SELF"].'?year='.($year + 1).$param.'"><i class="fa fa-chevron-right" title="Next"></i></a></li></lu></div>';
|
||||
$pagination = '<div class="pagination">';
|
||||
$pagination.= '<ul>';
|
||||
$pagination.= '<li class="pagination">';
|
||||
|
||||
$pagination.= '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year - 1).$param.'">';
|
||||
$pagination.= '<i class="fa fa-chevron-left" title="Previous"></i>';
|
||||
$pagination.= '</a>';
|
||||
|
||||
$pagination.= '<li class="pagination">';
|
||||
$pagination.= '<span class="active">'.$langs->trans("Year").' '.$year.'</span>';
|
||||
$pagination.= '</li>';
|
||||
|
||||
$pagination.= '<li class="pagination">';
|
||||
$pagination.= '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year + 1).$param.'">';
|
||||
$pagination.= '<i class="fa fa-chevron-right" title="Next"></i>';
|
||||
$pagination.= '</a>';
|
||||
$pagination.= '</li>';
|
||||
|
||||
$pagination.= '</li>';
|
||||
$pagination.= '</ul>';
|
||||
$pagination.= '</div>';
|
||||
|
||||
print load_fiche_titre($langs->trans('LogCP'), $pagination, 'title_hrm.png');
|
||||
|
||||
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
|
||||
|
||||
$lastUpdate = $object->getConfCP('lastUpdate');
|
||||
if ($lastUpdate)
|
||||
{
|
||||
@ -166,15 +211,18 @@ if ($lastUpdate)
|
||||
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
|
||||
print '<strong>'.dol_print_date($db->jdate($object->getConfCP('lastUpdate')), 'dayhour', 'tzuser').'</strong>';
|
||||
print '<br>'.$langs->trans("MonthOfLastMonthlyUpdate").': <strong>'.$yearLastUpdate.'-'.$monthLastUpdate.'</strong>'."\n";
|
||||
} else print $langs->trans('None');
|
||||
}
|
||||
else {
|
||||
print $langs->trans('None');
|
||||
}
|
||||
print "</div><br>\n";
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
//$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
$selectedfields = '';
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'" id="tablelines3">'."\n";
|
||||
@ -182,15 +230,15 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
||||
print '<tbody>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></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>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.rowid']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_id" value="'.$search_id.'"></td>';
|
||||
if (!empty($arrayfields['cpl.date_action']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.fk_user_action']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.fk_user_update']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.type_action']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.fk_type']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.prev_solde']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_prev_solde" value="'.$search_prev_solde.'"></td>';
|
||||
if (!empty($arrayfields['variation']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cpl.new_solde']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_new_solde" value="'.$search_new_solde.'"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
@ -199,45 +247,49 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('ID');
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre('ActionByCP');
|
||||
print_liste_field_titre('UserUpdateCP');
|
||||
print_liste_field_titre('Description');
|
||||
print_liste_field_titre('Type');
|
||||
print_liste_field_titre('PrevSoldeCP', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right ');
|
||||
print_liste_field_titre('Variation', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right ');
|
||||
print_liste_field_titre('NewSoldeCP', $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'right ');
|
||||
if (!empty($arrayfields['cpl.rowid']['checked'])) print_liste_field_titre($arrayfields['cpl.rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cpl.date_action']['checked'])) print_liste_field_titre($arrayfields['cpl.date_action']['label'], $_SERVER["PHP_SELF"], 'date_action', '', '', '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['cpl.fk_user_action']['checked'])) print_liste_field_titre($arrayfields['cpl.fk_user_action']['label'], $_SERVER["PHP_SELF"], 'fk_user_action', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cpl.fk_user_update']['checked'])) print_liste_field_titre($arrayfields['cpl.fk_user_update']['label'], $_SERVER["PHP_SELF"], 'fk_user_update', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cpl.type_action']['checked'])) print_liste_field_titre($arrayfields['cpl.type_action']['label'], $_SERVER["PHP_SELF"], 'type_action', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cpl.fk_type']['checked'])) print_liste_field_titre($arrayfields['cpl.fk_type']['label'], $_SERVER["PHP_SELF"], 'fk_type', '', '', '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['cpl.prev_solde']['checked'])) print_liste_field_titre($arrayfields['cpl.prev_solde']['label'], $_SERVER["PHP_SELF"], 'prev_solde', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['variation']['checked'])) print_liste_field_titre($arrayfields['variation']['label'], $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['cpl.new_solde']['checked'])) print_liste_field_titre($arrayfields['cpl.new_solde']['label'], $_SERVER["PHP_SELF"], 'new_solde', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
foreach ($object->logs as $logs_CP)
|
||||
{
|
||||
$user_action = new User($db);
|
||||
$user_action->fetch($logs_CP['fk_user_action']);
|
||||
$user_action = new User($db);
|
||||
$user_action->fetch($logs_CP['fk_user_action']);
|
||||
|
||||
$user_update = new User($db);
|
||||
$user_update->fetch($logs_CP['fk_user_update']);
|
||||
$user_update = new User($db);
|
||||
$user_update->fetch($logs_CP['fk_user_update']);
|
||||
|
||||
$delta = price2num($logs_CP['new_solde'] - $logs_CP['prev_solde'], 5);
|
||||
$detasign = ($delta > 0 ? '+' : '-');
|
||||
$delta = price2num($logs_CP['new_solde'] - $logs_CP['prev_solde'], 5);
|
||||
$detasign = ($delta > 0 ? '+' : '');
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$logs_CP['rowid'].'</td>';
|
||||
print '<td style="text-align: center;">'.$logs_CP['date_action'].'</td>';
|
||||
print '<td>'.$user_action->getNomUrl(-1).'</td>';
|
||||
print '<td>'.$user_update->getNomUrl(-1).'</td>';
|
||||
print '<td>'.$logs_CP['type_action'].'</td>';
|
||||
print '<td>';
|
||||
$label = (($alltypeleaves[$logs_CP['fk_type']]['code'] && $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) != $alltypeleaves[$logs_CP['fk_type']]['code']) ? $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) : $alltypeleaves[$logs_CP['fk_type']]['label']);
|
||||
print $label ? $label : $logs_CP['fk_type'];
|
||||
print '</td>';
|
||||
print '<td style="text-align: right;">'.price2num($logs_CP['prev_solde'], 5).' '.$langs->trans('days').'</td>';
|
||||
print '<td style="text-align: right;">'.$detasign.$delta.'</td>';
|
||||
print '<td style="text-align: right;">'.price2num($logs_CP['new_solde'], 5).' '.$langs->trans('days').'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
if (!empty($arrayfields['cpl.rowid']['checked'])) print '<td>'.$logs_CP['rowid'].'</td>';
|
||||
if (!empty($arrayfields['cpl.date_action']['checked'])) print '<td style="text-align: center;">'.$logs_CP['date_action'].'</td>';
|
||||
if (!empty($arrayfields['cpl.fk_user_action']['checked'])) print '<td>'.$user_action->getNomUrl(-1).'</td>';
|
||||
if (!empty($arrayfields['cpl.fk_user_update']['checked'])) print '<td>'.$user_update->getNomUrl(-1).'</td>';
|
||||
if (!empty($arrayfields['cpl.type_action']['checked'])) print '<td>'.$logs_CP['type_action'].'</td>';
|
||||
if (!empty($arrayfields['cpl.fk_type']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$label = (($alltypeleaves[$logs_CP['fk_type']]['code'] && $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) != $alltypeleaves[$logs_CP['fk_type']]['code']) ? $langs->trans($alltypeleaves[$logs_CP['fk_type']]['code']) : $alltypeleaves[$logs_CP['fk_type']]['label']);
|
||||
print $label ? $label : $logs_CP['fk_type'];
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cpl.prev_solde']['checked'])) print '<td style="text-align: right;">'.price2num($logs_CP['prev_solde'], 5).' '.$langs->trans('days').'</td>';
|
||||
if (!empty($arrayfields['variation']['checked'])) print '<td style="text-align: right;">'.$detasign.$delta.'</td>';
|
||||
if (!empty($arrayfields['cpl.new_solde']['checked'])) print '<td style="text-align: right;">'.price2num($logs_CP['new_solde'], 5).' '.$langs->trans('days').'</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
if ($log_holiday == '2')
|
||||
|
||||
@ -61,6 +61,7 @@ $search_task_description = GETPOST('search_task_description');
|
||||
$search_task_ref_parent = GETPOST('search_task_ref_parent');
|
||||
$search_project_user = GETPOST('search_project_user');
|
||||
$search_task_user = GETPOST('search_task_user');
|
||||
$search_task_progress = GETPOST('search_task_progress');
|
||||
|
||||
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
|
||||
if ($mine) { $search_task_user = $user->id; $mine = 0; }
|
||||
@ -175,6 +176,7 @@ if (empty($reshook))
|
||||
$search_task_label = "";
|
||||
$search_task_description = "";
|
||||
$search_task_ref_parent = "";
|
||||
$search_task_progress = "";
|
||||
$search_task_user = -1;
|
||||
$search_project_user = -1;
|
||||
$search_sday = '';
|
||||
@ -309,6 +311,7 @@ if ($search_task_ref) $sql .= natural_search('t.ref', $search_task_ref);
|
||||
if ($search_task_label) $sql .= natural_search('t.label', $search_task_label);
|
||||
if ($search_task_description) $sql .= natural_search('t.description', $search_task_description);
|
||||
if ($search_task_ref_parent) $sql .= ' AND t.fk_task_parent IN (SELECT ipt.rowid FROM '.MAIN_DB_PREFIX.'projet_task as ipt WHERE '.natural_search('ipt.ref', $search_task_ref_parent, 0, 1).')';
|
||||
if ($search_task_progress) $sql .= natural_search('t.progress', $search_task_progress, 1);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
$sql .= dolSqlDateFilter('t.dateo', $search_sday, $search_smonth, $search_syear);
|
||||
$sql .= dolSqlDateFilter('t.datee', $search_eday, $search_emonth, $search_eyear);
|
||||
@ -396,6 +399,7 @@ if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_r
|
||||
if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_label);
|
||||
if ($search_task_description != '') $param .= '&search_task_description='.urlencode($search_description);
|
||||
if ($search_task_ref_parent != '') $param .= '&search_task_ref_parent='.urlencode($search_task_ref_parent);
|
||||
if ($search_task_progress != '') $param .= '&search_task_progress='.urlencode($search_task_progress);
|
||||
if ($search_societe != '') $param .= '&search_societe='.urlencode($search_societe);
|
||||
if ($search_projectstatus != '') $param .= '&search_projectstatus='.urlencode($search_projectstatus);
|
||||
if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'none'))) $param .= '&search_opp_status='.urlencode($search_opp_status);
|
||||
@ -571,7 +575,13 @@ if (!empty($arrayfields['p.fk_statut']['checked']))
|
||||
if (!empty($arrayfields['t.planned_workload']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.duration_effective']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.progress_calculated']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.progress']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.progress']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" class="flat" name="search_task_progress" value="'.$search_task_progress.'" size="4">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.progress_summary']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.tobill']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['t.billed']['checked'])) print '<td class="liste_titre"></td>';
|
||||
|
||||
@ -839,6 +839,13 @@ if (empty($reshook))
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Set sales representatives
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($socid);
|
||||
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
||||
}
|
||||
|
||||
$id = $socid;
|
||||
$object->fetch($socid);
|
||||
|
||||
|
||||
@ -23,30 +23,48 @@ if (empty($conf) || !is_object($conf))
|
||||
}
|
||||
|
||||
// Sale representative
|
||||
print '<tr><td class="titlefield">';
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('SalesRepresentatives');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) {
|
||||
print '<td class="right">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=editsalesrepresentatives&socid=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
$listsalesrepresentatives = $object->getSalesRepresentatives($user);
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
$userstatic = new User($db);
|
||||
foreach ($listsalesrepresentatives as $val)
|
||||
{
|
||||
$userstatic->id = $val['id'];
|
||||
$userstatic->login = $val['login'];
|
||||
$userstatic->lastname = $val['lastname'];
|
||||
$userstatic->firstname = $val['firstname'];
|
||||
$userstatic->statut = $val['statut'];
|
||||
$userstatic->photo = $val['photo'];
|
||||
$userstatic->email = $val['email'];
|
||||
$userstatic->phone = $val['phone'];
|
||||
$userstatic->job = $val['job'];
|
||||
$userstatic->entity = $val['entity'];
|
||||
print $userstatic->getNomUrl(-1);
|
||||
print ' ';
|
||||
}
|
||||
} else print '<span class="opacitymedium">'.$langs->trans("NoSalesRepresentativeAffected").'</span>';
|
||||
print '</td></tr>';
|
||||
if ($action == 'editsalesrepresentatives') {
|
||||
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">';
|
||||
print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
|
||||
print '<input type="hidden" name="token" value="' . newToken() . '" />';
|
||||
print '<input type="hidden" name="socid" value="' . $object->id . '" />';
|
||||
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
|
||||
$arrayselected = GETPOST('commercial', 'array');
|
||||
if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1);
|
||||
print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%");
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '" />';
|
||||
print '</form>';
|
||||
} else {
|
||||
$listsalesrepresentatives = $object->getSalesRepresentatives($user);
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 0) {
|
||||
$userstatic = new User($db);
|
||||
foreach ($listsalesrepresentatives as $val) {
|
||||
$userstatic->id = $val['id'];
|
||||
$userstatic->login = $val['login'];
|
||||
$userstatic->lastname = $val['lastname'];
|
||||
$userstatic->firstname = $val['firstname'];
|
||||
$userstatic->statut = $val['statut'];
|
||||
$userstatic->photo = $val['photo'];
|
||||
$userstatic->email = $val['email'];
|
||||
$userstatic->phone = $val['phone'];
|
||||
$userstatic->job = $val['job'];
|
||||
$userstatic->entity = $val['entity'];
|
||||
print $userstatic->getNomUrl(-1);
|
||||
print ' ';
|
||||
}
|
||||
} else print '<span class="opacitymedium">' . $langs->trans("NoSalesRepresentativeAffected") . '</span>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user