From 5842d1ee416d5b10d4ba9bc9e62ebc747b8f918d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Mar 2017 13:24:56 +0100 Subject: [PATCH] Fix link to notes ko for contracts. --- htdocs/contrat/class/contrat.class.php | 50 ++++++++++++++++++++------ htdocs/contrat/list.php | 23 +++++++++--- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2cffecfaf96..1e442aec41a 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1823,24 +1823,54 @@ class Contrat extends CommonObject * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $maxlength Max length of ref + * @param int $notooltip 1=Disable tooltip * @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=''; - $label=$langs->trans("ShowContract").': '.$this->ref; - $link = ''; + $url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id; + $picto = 'contract'; + $label = ''; + + if ($user->rights->contrat->lire) { + $label = ''.$langs->trans("ShowContract").''; + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.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"'; + } + + $linkstart = '
'; $linkend=''; - - $picto='contract'; - - - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); + + 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 != 2) $result.=$link.($maxlength?dol_trunc($this->ref,$maxlength):$this->ref).$linkend; + $result.=$linkstart.$this->ref.$linkend; return $result; } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 6c6b55ee949..7436c16fe69 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -187,11 +187,12 @@ $now=dol_now(); $form=new Form($db); $formother = new FormOther($db); $socstatic = new Societe($db); +$contracttmp = new Contrat($db); -llxHeader(); +llxHeader('', $langs->trans("Contracts")); $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.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; @@ -265,7 +266,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $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.= " typent.code,"; $sql.= " state.code_departement, state.nom"; @@ -556,13 +557,25 @@ if ($resql) while ($i < min($num,$limit)) { $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; print ''; if (! empty($arrayfields['c.ref']['checked'])) { - print ''; - print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->rowid) .''; + print ''; + print $contracttmp->getNomUrl(1); if ($obj->nb_late) print img_warning($langs->trans("Late")); + if (!empty($obj->note_private) || !empty($obj->note_public)) + { + print ' '; + print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + print ''; + } print ''; } if (! empty($arrayfields['c.ref_customer']['checked']))