Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
17b08cc22f
@ -60,13 +60,6 @@ class box_dolibarr_state_board extends ModeleBoxes
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// disable box for such cases
|
||||
if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
|
||||
$this->enabled = 0; // disabled by this option
|
||||
}
|
||||
|
||||
$this->hidden = !(!empty($user->rights->societe->lire) && empty($user->socid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7692,8 +7692,12 @@ class Form
|
||||
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'),
|
||||
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'),
|
||||
'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').')'),
|
||||
'contrat'=>array(
|
||||
'enabled'=>$conf->contrat->enabled,
|
||||
'perms'=>1,
|
||||
'label'=>'LinkToContract',
|
||||
'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier'
|
||||
),
|
||||
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
|
||||
@ -103,11 +103,13 @@ class FormTicket
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->action = 'add';
|
||||
|
||||
$this->withcompany = 1;
|
||||
$this->withcompany = $conf->societe->enabled ? 1 : 0;
|
||||
$this->withfromsocid = 0;
|
||||
$this->withfromcontactid = 0;
|
||||
//$this->withthreadid=0;
|
||||
|
||||
@ -84,7 +84,7 @@ function ticket_prepare_head($object)
|
||||
$head[$h][2] = 'tabTicket';
|
||||
$h++;
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid)) {
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) {
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id;
|
||||
$head[$h][1] = $langs->trans('ContactsAddresses');
|
||||
@ -157,7 +157,8 @@ function showDirectPublicLink($object)
|
||||
|
||||
$out = '';
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
$out .= '<span class="opacitymedium">'.$langs->trans("PublicInterfaceNotEnabled").'</span>';
|
||||
$langs->load('errors');
|
||||
$out .= '<span class="opacitymedium">'.$langs->trans("ErrorPublicInterfaceNotEnabled").'</span>';
|
||||
} else {
|
||||
$out .= img_picto('', 'object_globe.png').' <span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span><br>';
|
||||
if ($url) {
|
||||
|
||||
@ -55,6 +55,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int'));
|
||||
$date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int'));
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int'));
|
||||
@ -120,7 +121,6 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$id = GETPOST("id", 'int');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
@ -171,9 +171,6 @@ $langs->load("boxes");
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,";
|
||||
$sql .= " d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE u.rowid = d.fk_user_author";
|
||||
// RESTRICT RIGHTS
|
||||
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)
|
||||
@ -183,12 +180,6 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense
|
||||
$sql .= " AND d.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n";
|
||||
}
|
||||
$sql .= ' AND d.entity IN ('.getEntity('expensereport').')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND d.fk_user_author = ".$socid;
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
|
||||
@ -40,8 +40,13 @@ if ($conf->deplacement->enabled) {
|
||||
if ($conf->expensereport->enabled) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
if ($conf->recruitment->enabled) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
|
||||
}
|
||||
if ($conf->holiday->enabled) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
}
|
||||
|
||||
$hookmanager = new HookManager($db);
|
||||
$hookmanager->initHooks('hrmindex');
|
||||
@ -60,10 +65,6 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF
|
||||
$setupcompanynotcomplete = 1;
|
||||
}
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic = new Holiday($db);
|
||||
$staticrecruitmentcandidature = new RecruitmentCandidature($db);
|
||||
|
||||
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
|
||||
@ -73,7 +74,8 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
// Update sold
|
||||
if (!empty($conf->holiday->enabled) && !empty($setupcompanynotcomplete)) {
|
||||
$result = $holiday->updateBalance();
|
||||
$holidaystatic = new Holiday($db);
|
||||
$result = $holidaystatic->updateBalance();
|
||||
}
|
||||
|
||||
|
||||
@ -144,6 +146,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel
|
||||
|
||||
if (!empty($conf->holiday->enabled)) {
|
||||
if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
|
||||
$holidaystatic = new Holiday($db);
|
||||
$user_id = $user->id;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -154,9 +157,9 @@ if (!empty($conf->holiday->enabled)) {
|
||||
|
||||
$out = '';
|
||||
$nb_holiday = 0;
|
||||
$typeleaves = $holiday->getTypes(1, 1);
|
||||
$typeleaves = $holidaystatic->getTypes(1, 1);
|
||||
foreach ($typeleaves as $key => $val) {
|
||||
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_type = $holidaystatic->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
$out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': <strong>'.($nb_type ? price2num($nb_type) : 0).'</strong><br>';
|
||||
}
|
||||
@ -179,7 +182,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
// Latest leave requests
|
||||
if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) {
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
|
||||
$sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql .= " x.rowid, x.ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND x.entity = ".$conf->entity;
|
||||
@ -330,20 +333,23 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
|
||||
// Last modified job position
|
||||
if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) {
|
||||
$sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
|
||||
$staticrecruitmentcandidature = new RecruitmentCandidature($db);
|
||||
$staticrecruitmentjobposition = new RecruitmentJobPosition($db);
|
||||
$sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,";
|
||||
$sql.= " rp.rowid as jobid, rp.ref as jobref, rp.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid";
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).")";
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.fk_soc = $socid";
|
||||
$sql .= " AND rp.fk_soc = $socid";
|
||||
}
|
||||
$sql .= " ORDER BY rc.tms DESC";
|
||||
$sql .= $db->order("rc.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -354,8 +360,8 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">';
|
||||
print $langs->trans("BoxTitleLatestModifiedCandidatures", $max);
|
||||
print '<th colspan="3">';
|
||||
print $langs->trans("BoxTitleLatestModifiedCandidatures", min($max, $num));
|
||||
print '</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>';
|
||||
@ -370,11 +376,15 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
|
||||
$staticrecruitmentcandidature->firstname = $objp->firstname;
|
||||
$staticrecruitmentcandidature->lastname = $objp->lastname;
|
||||
|
||||
$staticrecruitmentjobposition->id = $objp->jobid;
|
||||
$staticrecruitmentjobposition->ref = $objp->jobref;
|
||||
$staticrecruitmentjobposition->label = $objp->label;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$staticrecruitmentcandidature->getNomUrl(1, '').'</td>';
|
||||
print '<td class="right nowrap">';
|
||||
print "</td>";
|
||||
print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
|
||||
print '<td class="tdoverflowmax150">'.$staticrecruitmentcandidature->getFullName($langs).'</td>';
|
||||
print '<td class="nowrap">'.$staticrecruitmentjobposition->getNomUrl(1).'</td>';
|
||||
print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day').'</td>';
|
||||
print '<td class="right nowrap" width="16">';
|
||||
print $staticrecruitmentcandidature->getLibStatut(3);
|
||||
print "</td>";
|
||||
|
||||
@ -66,13 +66,13 @@ class FormProduct
|
||||
* 'warehouseclosed' = select products from closed warehouses,
|
||||
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
|
||||
* @param boolean $sumStock sum total stock of a warehouse, default true
|
||||
* @param string $exclude warehouses ids to exclude
|
||||
* @param array $exclude warehouses ids to exclude
|
||||
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
|
||||
* @param string $orderBy [='e.ref'] Order by
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '', $stockMin = false, $orderBy = 'e.ref')
|
||||
public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = array(), $stockMin = false, $orderBy = 'e.ref')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -80,10 +80,6 @@ class FormProduct
|
||||
return 0; // Cache already loaded and we do not want a list with information specific to a product
|
||||
}
|
||||
|
||||
if (is_array($exclude)) {
|
||||
$excludeGroups = implode("','", $exclude);
|
||||
}
|
||||
|
||||
$warehouseStatus = array();
|
||||
|
||||
if (preg_match('/warehouseclosed/', $status)) {
|
||||
@ -121,7 +117,7 @@ class FormProduct
|
||||
$sql .= " AND e.statut = 1";
|
||||
}
|
||||
|
||||
if (!empty($exclude)) {
|
||||
if (is_array($exclude) && !empty($exclude)) {
|
||||
$sql .= ' AND e.rowid NOT IN('.$this->db->sanitize(implode(',', $exclude)).')';
|
||||
}
|
||||
|
||||
@ -220,7 +216,7 @@ class FormProduct
|
||||
* @param int $forcecombo 1=Force combo iso ajax select2
|
||||
* @param array $events Events to add to select2
|
||||
* @param string $morecss Add more css classes to HTML select
|
||||
* @param string $exclude Warehouses ids to exclude
|
||||
* @param array $exclude Warehouses ids to exclude
|
||||
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
|
||||
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
|
||||
* @param string $orderBy [='e.ref'] Order by
|
||||
@ -228,7 +224,7 @@ class FormProduct
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref')
|
||||
public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref')
|
||||
{
|
||||
global $conf, $langs, $user, $hookmanager;
|
||||
|
||||
|
||||
@ -363,7 +363,7 @@ print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, ar
|
||||
print ' <span class="clearbothonsmartphone marginleftonly paddingleftonly marginrightonly paddingrightonly"> </span> ';
|
||||
print img_picto('', 'stock').' ';
|
||||
print $langs->trans('Warehouse').'</span> ';
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, '', 0, 0, null, '', '', 1, false, 'e.ref');
|
||||
print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, '', 0, 0, null, '', null, 1, false, 'e.ref');
|
||||
print '</div>';
|
||||
|
||||
$parameters = array();
|
||||
|
||||
@ -331,18 +331,18 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
|
||||
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.fk_soc = $socid";
|
||||
}
|
||||
$sql .= " GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status";
|
||||
$sql .= " ORDER BY s.tms DESC";
|
||||
$sql .= $db->order('s.tms', 'DESC');
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -402,17 +402,17 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme
|
||||
$sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.fk_soc = $socid";
|
||||
}
|
||||
$sql .= " ORDER BY rc.tms DESC";
|
||||
$sql .= $db->order('rc.tms', 'DESC');
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -2917,7 +2917,7 @@ class Ticket extends CommonObject
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||
$clause = " AND";
|
||||
|
||||
@ -138,7 +138,11 @@ if (empty($reshook)) {
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$object->entity = 0;
|
||||
} else {
|
||||
$object->entity = GETPOST("entity");
|
||||
if ($conf->entity == 1 && $user->admin && !$user->entity) { // Same permissions test than the one used to show the combo of entities into the form
|
||||
$object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity;
|
||||
} else {
|
||||
$object->entity = $conf->entity;
|
||||
}
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user