Skip to content
Snippets Groups Projects
Commit 5842d1ee authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix link to notes ko for contracts.

parent 57b532cd
No related branches found
No related tags found
No related merge requests found
...@@ -1823,24 +1823,54 @@ class Contrat extends CommonObject ...@@ -1823,24 +1823,54 @@ class Contrat extends CommonObject
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length of ref * @param int $maxlength Max length of ref
* @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlength=0) function getNomUrl($withpicto=0,$maxlength=0,$notooltip=0)
{ {
global $langs; global $conf, $langs, $user;
$result=''; $result='';
$label=$langs->trans("ShowContract").': '.$this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$picto='contract';
$url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id;
$picto = 'contract';
$label = '';
if ($user->rights->contrat->lire) {
$label = '<u>'.$langs->trans("ShowContract").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_customer ? $this->ref_customer : $this->ref_client);
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
if (!empty($this->total_ht)) {
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_tva)) {
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->total_ttc)) {
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
}
$linkclose='';
if (empty($notooltip) && $user->rights->contrat->lire)
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowOrder");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); $linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$linkend; $result.=$linkstart.$this->ref.$linkend;
return $result; return $result;
} }
......
...@@ -187,11 +187,12 @@ $now=dol_now(); ...@@ -187,11 +187,12 @@ $now=dol_now();
$form=new Form($db); $form=new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$socstatic = new Societe($db); $socstatic = new Societe($db);
$contracttmp = new Contrat($db);
llxHeader(); llxHeader('', $langs->trans("Contracts"));
$sql = 'SELECT'; $sql = 'SELECT';
$sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,"; $sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql.= " typent.code as typent_code,"; $sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " state.code_departement as state_code, state.nom as state_name,";
...@@ -265,7 +266,7 @@ $parameters=array(); ...@@ -265,7 +266,7 @@ $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,"; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.tms, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
$sql.= " typent.code,"; $sql.= " typent.code,";
$sql.= " state.code_departement, state.nom"; $sql.= " state.code_departement, state.nom";
...@@ -556,13 +557,25 @@ if ($resql) ...@@ -556,13 +557,25 @@ if ($resql)
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$contracttmp->ref=$obj->ref;
$contracttmp->id=$obj->rowid;
$contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier;
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
print '<td class="nowrap"><a href="card.php?id='.$obj->rowid.'">'; print '<td class="nowrap">';
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->rowid) .'</a>'; print $contracttmp->getNomUrl(1);
if ($obj->nb_late) print img_warning($langs->trans("Late")); if ($obj->nb_late) print img_warning($langs->trans("Late"));
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['c.ref_customer']['checked'])) if (! empty($arrayfields['c.ref_customer']['checked']))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment