Merge branch '6.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-08-01 10:22:37 +02:00
commit b6a7ce6822
26 changed files with 283 additions and 172 deletions

View File

@ -147,8 +147,12 @@ Following changes may create regression for some external modules, but were nece
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used. * Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still * Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
exists, but if an external module need action on it, it must provides itself its trigger file. exists, but if an external module need action on it, it must provides itself its trigger file.
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode * Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
the Home - setup - other admin page.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx') * Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
* The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output * The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint". hook specifications so you must return output into "resprint".

View File

@ -1194,7 +1194,7 @@ class ActionComm extends CommonObject
{ {
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
} }
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend; $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend;
} }
if ($withpicto==1) $result.=' '; if ($withpicto==1) $result.=' ';
$result.=$linkstart.$libelleshort.$linkend; $result.=$linkstart.$libelleshort.$linkend;

View File

@ -749,6 +749,15 @@ class Facture extends CommonInvoice
// Charge facture source // Charge facture source
$facture=new Facture($this->db); $facture=new Facture($this->db);
$this->fetch_optionals();
if(!empty($this->array_options)){
$facture->array_options = $this->array_options;
}
foreach($this->lines as &$line){
$line->fetch_optionals();//fetch extrafields
}
$facture->fk_facture_source = $this->fk_facture_source; $facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type; $facture->type = $this->type;
$facture->socid = $this->socid; $facture->socid = $this->socid;

View File

@ -1482,7 +1482,7 @@ else
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,"; $sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,"; $sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql.= " cd.fk_unit,"; $sql.= " cd.fk_unit,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity"; $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id; $sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id;
@ -1513,7 +1513,7 @@ else
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{ {
print '<tr '.$bcnd[$var].' valign="top">'; print '<tr '.$bcnd[$var].' valign="top">';
// Libelle // Label
if ($objp->fk_product > 0) if ($objp->fk_product > 0)
{ {
print '<td>'; print '<td>';
@ -1521,19 +1521,21 @@ else
$productstatic->type=$objp->ptype; $productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref; $productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity; $productstatic->entity=$objp->pentity;
$productstatic->label=$objp->plabel;
$text = $productstatic->getNomUrl(1,'',20); $text = $productstatic->getNomUrl(1,'',20);
if ($objp->label) if ($objp->plabel)
{ {
$text .= ' - '; $text .= ' - ';
$productstatic->ref=$objp->label; //$productstatic->ref=$objp->label;
$text .= $productstatic->getNomUrl(0,'',16); //$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel;
} }
$description = $objp->description; $description = $objp->description;
// Add description in form // Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):''; $text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc $description = ''; // Already added into main visible desc
} }
@ -1543,7 +1545,7 @@ else
} }
else else
{ {
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n"; print '<td>'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."</td>\n";
} }
// TVA // TVA
print '<td align="center">'; print '<td align="center">';

View File

@ -1831,13 +1831,13 @@ class Contrat extends CommonObject
$text.=': &nbsp; &nbsp; '; $text.=': &nbsp; &nbsp; ';
} }
$text.=($mode == 7?'<div class="inline-block">':''); $text.=($mode == 7?'<div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofserviceswait > 0) ? $this->nbofserviceswait.' '.$line->LibStatut(0,3).(($this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : ''; $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3)).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':''); $text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesopened > 0) ? $this->nbofservicesopened.' '.$line->LibStatut(4,3,0).(($this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : ''; $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0)).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':''); $text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesexpired > 0) ? $this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).(($this->nbofservicesclosed)?' &nbsp; ':'') : ''; $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1)).(($mode != 7 || $this->nbofservicesclosed)?' &nbsp; ':'') : '';
$text.=($mode == 7?'</div><div class="inline-block">':''); $text.=($mode == 7?'</div><div class="inline-block">':'');
$text.=($mode != 7 || $this->nbofservicesclosed > 0) ? $this->nbofservicesclosed.' '.$line->LibStatut(5,3) : ''; $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3)) : '';
$text.=($mode == 7?'</div>':''); $text.=($mode == 7?'</div>':'');
return $text; return $text;
} }

View File

@ -27,7 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/** /**
* Class to manage the box to show last services lines * Class to manage the box to show last contracted products/services lines
*/ */
class box_services_contracts extends ModeleBoxes class box_services_contracts extends ModeleBoxes
{ {
@ -72,6 +72,8 @@ class box_services_contracts extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$form = new Form($db);
$this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max)); $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max));
if ($user->rights->service->lire && $user->rights->contrat->lire) if ($user->rights->service->lire && $user->rights->contrat->lire)
@ -79,11 +81,12 @@ class box_services_contracts extends ModeleBoxes
$contractstatic=new Contrat($db); $contractstatic=new Contrat($db);
$contratlignestatic=new ContratLigne($db); $contratlignestatic=new ContratLigne($db);
$thirdpartytmp = new Societe($db); $thirdpartytmp = new Societe($db);
$productstatic = new Product($db);
$sql = "SELECT s.nom as name, s.rowid as socid,"; $sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " c.rowid, c.ref, c.statut as contract_status,"; $sql.= " c.rowid, c.ref, c.statut as contract_status,";
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; $sql.= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,";
$sql.= " p.rowid as product_id, p.ref as product_ref"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
@ -140,8 +143,41 @@ class box_services_contracts extends ModeleBoxes
} }
} }
// Label
if ($objp->product_id > 0)
{
$productstatic->id=$objp->product_id;
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->product_ref;
$productstatic->entity=$objp->pentity;
$productstatic->label=$objp->plabel;
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->plabel)
{
$text .= ' - ';
//$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel;
}
$description = $objp->description;
// Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
//$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
$s = $form->textwithtooltip($text,$description,3,'','',$cursorline,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
}
else
{
$s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description);
}
$this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
'text' => $contratlignestatic->getNomUrl(1), 'text' => $s,
'asis' => 1 'asis' => 1
); );

View File

@ -166,7 +166,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
} }
$conf_css = $themepath."?lang=".$langs->defaultlang; $conf_css = $themepath."?lang=".$langs->defaultlang;
// Select templates // Select templates dir
if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application
{ {
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
@ -205,6 +205,7 @@ function dol_loginfunction($langs,$conf,$mysoc)
// Should be an array with differents options in $hookmanager->resArray // Should be an array with differents options in $hookmanager->resArray
$parameters=array('entity' => GETPOST('entity','int')); $parameters=array('entity' => GETPOST('entity','int'));
$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. resArray is filled by hook. $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. resArray is filled by hook.
$morelogincontent = $hookmanager->resArray['options']; // TODO Use here a resprints
// Login // Login
$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin)); $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));

View File

@ -808,8 +808,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
$langs->load("bills"); $langs->load("bills");
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills');
$newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create');
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, 'suppliers_bills_list'); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) {
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&amp;search_status=0", $langs->trans("BillShortStatusDraft"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft');

View File

@ -568,7 +568,7 @@ class pdf_crabe extends ModelePDFFactures
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress($object->id); $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0) // Compute progress from previous situation if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) // Compute progress from previous situation
{ {
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;

View File

@ -17,7 +17,7 @@
*/ */
// Need global variable $title to be defined by caller (like dol_loginfunction) // Need global variable $title to be defined by caller (like dol_loginfunction)
// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...);
header('Cache-Control: Public, must-revalidate'); header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client); header("Content-type: text/html; charset=".$conf->file->character_set_client);
@ -123,8 +123,8 @@ if ($disablenofollow) echo '</a>';
</span> </span>
</td></tr> </td></tr>
<?php <?php
if (! empty($hookmanager->resArray['options'])) { if (! empty($morelogincontent) && is_array($morelogincontent)) {
foreach ($hookmanager->resArray['options'] as $format => $option) foreach ($morelogincontent as $format => $option)
{ {
if ($format == 'table') { if ($format == 'table') {
echo '<!-- Option by hook -->'; echo '<!-- Option by hook -->';
@ -278,8 +278,8 @@ if (!empty($conf->global->MAIN_EASTER_EGG_COMMITSTRIP)) {
<?php if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?> <?php if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?>
<?php <?php
if (! empty($hookmanager->resArray['options'])) { if (! empty($morelogincontent) && is_array($morelogincontent)) {
foreach ($hookmanager->resArray['options'] as $format => $option) foreach ($morelogincontent as $format => $option)
{ {
if ($format == 'js') { if ($format == 'js') {
echo "\n".'<!-- Javascript by hook -->'; echo "\n".'<!-- Javascript by hook -->';

View File

@ -973,6 +973,7 @@ class Cronjob extends CommonObject
$object = new $this->objectname($this->db); $object = new $this->objectname($this->db);
$params_arr = array_map('trim', explode(",",$this->params)); $params_arr = array_map('trim', explode(",",$this->params));
if (!is_array($params_arr)) if (!is_array($params_arr))
{ {
$result = call_user_func(array($object, $this->methodename), $this->params); $result = call_user_func(array($object, $this->methodename), $this->params);
@ -982,7 +983,7 @@ class Cronjob extends CommonObject
$result = call_user_func_array(array($object, $this->methodename), $params_arr); $result = call_user_func_array(array($object, $this->methodename), $params_arr);
} }
if ($result===false || $result != 0) if ($result === false || (! is_bool($result) && $result != 0))
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR); dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
@ -1031,7 +1032,7 @@ class Cronjob extends CommonObject
$result = call_user_func_array($this->methodename, $params_arr); $result = call_user_func_array($this->methodename, $params_arr);
} }
if ($result === false || $result != 0) if ($result === false || (! is_bool($result) && $result != 0))
{ {
$langs->load("errors"); $langs->load("errors");
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR); dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);

View File

@ -118,7 +118,7 @@ $langs->load("contracts");
if (empty($user->societe_id)) if (empty($user->societe_id))
{ {
$boxstat.='<div class="box">'; $boxstat.='<div class="box">';
$boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable" width="100%">'; $boxstat.='<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable nohover" width="100%">';
$boxstat.='<tr class="liste_titre">'; $boxstat.='<tr class="liste_titre">';
$boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>'; $boxstat.='<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
$boxstat.='</tr>'; $boxstat.='</tr>';
@ -541,7 +541,7 @@ if ($showweather)
$boxwork.='</tr>'; $boxwork.='</tr>';
} }
$boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer">'; $boxwork.='<tr class="nohover"><td class="tdboxstats nohover flexcontainer centpercent">';
// Show dashboard // Show dashboard
$nbworkboardempty=0; $nbworkboardempty=0;

View File

@ -78,6 +78,11 @@ InvoiceDeleted=Invoice deleted
PRODUCT_CREATEInDolibarr=Product %s created PRODUCT_CREATEInDolibarr=Product %s created
PRODUCT_MODIFYInDolibarr=Product %s modified PRODUCT_MODIFYInDolibarr=Product %s modified
PRODUCT_DELETEInDolibarr=Product %s deleted PRODUCT_DELETEInDolibarr=Product %s deleted
EXPENSE_REPORT_CREATEInDolibarr=Expense report %s created
EXPENSE_REPORT_VALIDATEInDolibarr=Expense report %s validated
EXPENSE_REPORT_APPROVEInDolibarr=Expense report %s approved
EXPENSE_REPORT_DELETEInDolibarr=Expense report %s deleted
EXPENSE_REPORT_REFUSEDInDolibarr=Expense report %s refused
##### End agenda events ##### ##### End agenda events #####
AgendaModelModule=Document templates for event AgendaModelModule=Document templates for event
DateActionStart=Start date DateActionStart=Start date

View File

@ -23,7 +23,7 @@ OnlyOpenedProject=Only open projects are visible (projects in draft or closed st
ClosedProjectsAreHidden=Closed projects are not visible. ClosedProjectsAreHidden=Closed projects are not visible.
TasksPublicDesc=This view presents all projects and tasks you are allowed to read. TasksPublicDesc=This view presents all projects and tasks you are allowed to read.
TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything). TasksDesc=This view presents all projects and tasks (your user permissions grant you permission to view everything).
AllTaskVisibleButEditIfYouAreAssigned=All tasks for such project are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it. AllTaskVisibleButEditIfYouAreAssigned=All tasks for qualified projects are visible, but you can enter time only for task assigned to you. Assign task to yourself if you need to enter time on it.
OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it. OnlyYourTaskAreVisible=Only tasks assigned to you are visible. Assign task to yourself if it is not visible and you need to enter time on it.
ImportDatasetTasks=Tasks of projects ImportDatasetTasks=Tasks of projects
ProjectCategories=Project tags/categories ProjectCategories=Project tags/categories

View File

@ -29,7 +29,9 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$mine = $_REQUEST['mode']=='mine' ? 1 : 0; $search_project_user = GETPOST('search_project_user','int');
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
if ($search_project_user == $user->id) $mine = 1;
// Security check // Security check
$socid=0; $socid=0;
@ -73,7 +75,7 @@ $morehtml='';
$morehtml.='<form name="projectform">'; $morehtml.='<form name="projectform">';
$morehtml.='<SELECT name="mode">'; $morehtml.='<SELECT name="mode">';
$morehtml.='<option name="all" value="all"'.($mine?'':' selected').'>'.$titleall.'</option>'; $morehtml.='<option name="all" value="all"'.($mine?'':' selected').'>'.$titleall.'</option>';
$morehtml.='<option name="mine" value="mine"'.($mine?' selected':'').'>'.$langs->trans("ProjectsImContactFor").'</option>'; $morehtml.='<option name="mine" value="'.$user->id.'"'.(($search_project_user == $user->id)?' selected':'').'>'.$langs->trans("ProjectsImContactFor").'</option>';
$morehtml.='</SELECT>'; $morehtml.='</SELECT>';
$morehtml.='<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">'; $morehtml.='<input type="submit" class="button" name="refresh" value="'.$langs->trans("Refresh").'">';

View File

@ -82,13 +82,18 @@ else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day,
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{ {
$usertoprocess=$user; $usertoprocess=$user;
$search_usertoprocessid=$usertoprocess->id;
}
elseif (search_usertoprocessid > 0)
{
$usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
$search_usertoprocessid=$usertoprocess->id;
} }
else else
{ {
$usertoprocess=new User($db); $usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
} }
$search_usertoprocessid=$usertoprocess->id;
$object=new Task($db); $object=new Task($db);
@ -305,9 +310,9 @@ $next_month = $next['mon'];
$next_day = $next['mday']; $next_day = $next['mday'];
$title=$langs->trans("TimeSpent"); $title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent"); if ($mine || ($usertoprocess->id == $user->id)) $title=$langs->trans("MyTimeSpent");
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(empty($usertoprocess->id)?2:0),1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project
if ($id) if ($id)
{ {
@ -320,7 +325,7 @@ $morewherefilter='';
if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref); if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
//var_dump($tasksarray); //var_dump($tasksarray);
@ -362,13 +367,16 @@ dol_fiche_head($head, 'inputperday', '', -1, 'task');
// Show description of content // Show description of content
print '<div class="hideonsmartphone">'; print '<div class="hideonsmartphone">';
if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else else
{ {
if (empty($usertoprocess->id) || $usertoprocess->id < 0)
{
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
}
} }
if ($mine) if ($mine || ($usertoprocess->id == $user->id))
{ {
print $langs->trans("OnlyYourTaskAreVisible").'<br>'; print $langs->trans("OnlyYourTaskAreVisible").'<br>';
} }
@ -413,7 +421,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
$includeonly='hierachyme'; $includeonly='hierachyme';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
if (! empty($moreforfilter)) if (! empty($moreforfilter))

View File

@ -95,13 +95,18 @@ $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd');
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id)
{ {
$usertoprocess=$user; $usertoprocess=$user;
$search_usertoprocessid=$usertoprocess->id;
}
elseif (search_usertoprocessid > 0)
{
$usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
$search_usertoprocessid=$usertoprocess->id;
} }
else else
{ {
$usertoprocess=new User($db); $usertoprocess=new User($db);
$usertoprocess->fetch($search_usertoprocessid);
} }
$search_usertoprocessid=$usertoprocess->id;
$object=new Task($db); $object=new Task($db);
@ -300,9 +305,9 @@ $taskstatic = new Task($db);
$thirdpartystatic = new Societe($db); $thirdpartystatic = new Societe($db);
$title=$langs->trans("TimeSpent"); $title=$langs->trans("TimeSpent");
if ($mine) $title=$langs->trans("MyTimeSpent"); if ($mine || $usertoprocess->id == $user->id) $title=$langs->trans("MyTimeSpent");
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(empty($usertoprocess->id)?2:0),1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project
//var_dump($projectsListId); //var_dump($projectsListId);
if ($id) if ($id)
{ {
@ -316,7 +321,7 @@ if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref
if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label);
if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty);
$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later.
$projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject);
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject);
//var_dump($tasksarray); //var_dump($tasksarray);
@ -356,13 +361,16 @@ dol_fiche_head($head, 'inputperweek', '', -1, 'task');
// Show description of content // Show description of content
print '<div class="hideonsmartphone">'; print '<div class="hideonsmartphone">';
if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else else
{ {
if (empty($usertoprocess->id) || $usertoprocess->id < 0)
{
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>'; else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'<br>';
}
} }
if ($mine) if ($mine || ($usertoprocess->id == $user->id))
{ {
print $langs->trans("OnlyYourTaskAreVisible").'<br>'; print $langs->trans("OnlyYourTaskAreVisible").'<br>';
} }
@ -408,7 +416,7 @@ $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
$includeonly='hierachyme'; $includeonly='hierachyme';
if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); if (empty($user->rights->user->user->lire)) $includeonly=array($user->id);
$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>'; $moreforfilter.='</div>';
if (! empty($moreforfilter)) if (! empty($moreforfilter))

View File

@ -33,8 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("projects"); $langs->load("projects");
$langs->load("companies"); $langs->load("companies");
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
$search_project_user = GETPOST('search_project_user','int'); $search_project_user = GETPOST('search_project_user','int');
$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0;
if ($search_project_user == $user->id) $mine = 1;
// Security check // Security check
$socid=0; $socid=0;

View File

@ -261,8 +261,8 @@ if ($search_project_user > 0)
} }
$sql.= " WHERE p.entity IN (".getEntity('project').')'; $sql.= " WHERE p.entity IN (".getEntity('project').')';
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser // No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid > 0) $sql.= " AND (p.fk_soc = ".$socid.")";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
@ -487,19 +487,25 @@ print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['p.ref']['checked'])) if (! empty($arrayfields['p.ref']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_ref" value="'.$search_ref.'" size="6">'; print '<input type="text" class="flat" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="6">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.title']['checked'])) if (! empty($arrayfields['p.title']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_label" size="8" value="'.$search_label.'">'; print '<input type="text" class="flat" name="search_label" size="8" value="'.dol_escape_htmltag($search_label).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_societe" size="8" value="'.$search_societe.'">'; if ($socid > 0)
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($socid);
$search_societe=$tmpthirdparty->nom;
}
print '<input type="text" class="flat" name="search_societe" size="8" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>'; print '</td>';
} }
// Sale representative // Sale representative
@ -511,8 +517,8 @@ if (! empty($arrayfields['commercial']['checked']))
if (! empty($arrayfields['p.dateo']['checked'])) if (! empty($arrayfields['p.dateo']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.$search_sday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_sday" value="'.dol_escape_htmltag($search_sday).'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.$search_smonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_smonth" value="'.dol_escape_htmltag($search_smonth).'">';
$formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5); $formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5);
print '</td>'; print '</td>';
} }
@ -520,8 +526,8 @@ if (! empty($arrayfields['p.dateo']['checked']))
if (! empty($arrayfields['p.datee']['checked'])) if (! empty($arrayfields['p.datee']['checked']))
{ {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.$search_eday.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="search_eday" value="'.dol_escape_htmltag($search_eday).'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.$search_emonth.'">'; print '<input class="flat" type="text" size="1" maxlength="2" name="search_emonth" value="'.dol_escape_htmltag($search_emonth).'">';
$formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5); $formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5);
print '</td>'; print '</td>';
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <forian.henry@open-cocnept.pro> * Copyright (C) 2013 Florian Henry <forian.henry@open-cocnept.pro>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
* *
* 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
@ -30,6 +31,11 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOLOGIN')) define('NOLOGIN','1'); if (! defined('NOLOGIN')) define('NOLOGIN','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) define("DOLENTITY", $entity);
// librarie core // librarie core
// Dolibarr environment // Dolibarr environment
$res = @include("../../main.inc.php"); // From htdocs directory $res = @include("../../main.inc.php"); // From htdocs directory

View File

@ -63,7 +63,7 @@ require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login'],'',1);
// Define css type // Define css type

View File

@ -64,7 +64,7 @@ require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login'],'',1);
// Define css type // Define css type

View File

@ -223,7 +223,7 @@ class User extends CommonObject
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
$sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database $sql.= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
else else
$sql.= " WHERE u.entity IN (0, ".($entity!=''?$entity:$conf->entity).")"; // search in entity provided in parameter $sql.= " WHERE u.entity IN (0, ".(($entity!='' && $entity >= 0)?$entity:$conf->entity).")"; // search in entity provided in parameter
} }
if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba
@ -667,7 +667,14 @@ class User extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur";
$sql.= ", ".MAIN_DB_PREFIX."rights_def as r"; $sql.= ", ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.id = ur.fk_id"; $sql.= " WHERE r.id = ur.fk_id";
if (! empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY))
{
$sql.= " AND r.entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)?"1,":"").$conf->entity.")";
}
else
{
$sql.= " AND ur.entity = ".$conf->entity; $sql.= " AND ur.entity = ".$conf->entity;
}
$sql.= " AND ur.fk_user= ".$this->id; $sql.= " AND ur.fk_user= ".$this->id;
$sql.= " AND r.perms IS NOT NULL"; $sql.= " AND r.perms IS NOT NULL";
if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'"; if ($moduletag) $sql.= " AND r.module = '".$this->db->escape($moduletag)."'";
@ -713,8 +720,19 @@ class User extends CommonObject
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; $sql.= " ".MAIN_DB_PREFIX."usergroup_user as gu,";
$sql.= " ".MAIN_DB_PREFIX."rights_def as r"; $sql.= " ".MAIN_DB_PREFIX."rights_def as r";
$sql.= " WHERE r.id = gr.fk_id"; $sql.= " WHERE r.id = gr.fk_id";
if (! empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY))
{
if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$sql.= " AND gu.entity IN (0,".$conf->entity.")";
} else {
$sql.= " AND r.entity = ".$conf->entity;
}
}
else
{
$sql.= " AND gr.entity = ".$conf->entity; $sql.= " AND gr.entity = ".$conf->entity;
$sql.= " AND r.entity = ".$conf->entity; $sql.= " AND r.entity = ".$conf->entity;
}
$sql.= " AND gr.fk_usergroup = gu.fk_usergroup"; $sql.= " AND gr.fk_usergroup = gu.fk_usergroup";
$sql.= " AND gu.fk_user = ".$this->id; $sql.= " AND gu.fk_user = ".$this->id;
$sql.= " AND r.perms IS NOT NULL"; $sql.= " AND r.perms IS NOT NULL";

View File

@ -104,6 +104,7 @@ if ($user->rights->user->user->lire || $user->admin) {
dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -128,7 +129,7 @@ if ($conf->global->LDAP_SERVER_TYPE == "activedirectory")
{ {
$userSID = $ldap->getObjectSid($object->login); $userSID = $ldap->getObjectSid($object->login);
} }
print '<tr><td width="25%" valign="top">'.$langs->trans("SID").'</td>'; print '<tr><td class="valigntop">'.$langs->trans("SID").'</td>';
print '<td>'.$userSID.'</td>'; print '<td>'.$userSID.'</td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -150,6 +151,8 @@ print '</table>';
print '</div>'; print '</div>';
dol_fiche_end();
/* /*
* Barre d'actions * Barre d'actions
*/ */

View File

@ -249,9 +249,10 @@ class ProductCombination
/** /**
* Deletes a product combination * Deletes a product combination
* *
* @return int <0 KO >0 OK * @param User $user Object user
* @return int <0 if KO, >0 if OK
*/ */
public function delete() public function delete(User $user)
{ {
$this->db->begin(); $this->db->begin();

View File

@ -234,7 +234,7 @@ if ($action === 'confirm_deletecombination') {
$db->begin(); $db->begin();
if ($prodcomb->delete() > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete() > 0) { if ($prodcomb->delete($user) > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0) {
$db->commit(); $db->commit();
setEventMessage($langs->trans('RecordSaved')); setEventMessage($langs->trans('RecordSaved'));
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2)); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));