From 98eda68afb225ced789fcadb11403b7a52bc5d76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 19:49:45 +0100 Subject: [PATCH] Fix linkg to public notes --- htdocs/comm/propal/class/propal.class.php | 19 ++++++++++++++++++- htdocs/comm/propal/list.php | 12 ++++-------- htdocs/commande/class/commande.class.php | 19 ++++++++++++++++++- htdocs/commande/list.php | 10 +++------- .../pdf/pdf_canelle.modules.php | 1 + .../class/fournisseur.commande.class.php | 19 ++++++++++++++++++- .../fourn/class/fournisseur.facture.class.php | 19 ++++++++++++++++++- htdocs/fourn/commande/list.php | 5 ++++- htdocs/fourn/facture/list.php | 14 ++++++-------- htdocs/fourn/facture/note.php | 2 +- .../class/supplier_proposal.class.php | 19 ++++++++++++++++++- htdocs/supplier_proposal/list.php | 11 +++-------- 12 files changed, 112 insertions(+), 38 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index b3dab6d5703..40004344bd6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3541,9 +3541,10 @@ class Propal extends CommonObject * @param string $get_params Parametres added to url * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes Add linkt to notes * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { global $langs, $conf, $user; @@ -3609,6 +3610,22 @@ class Propal extends CommonObject if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; + if ($addlinktonotes) + { + $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); + if ($txttoshow) + { + $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 267b5d041ac..eee15e0a0c0 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -275,6 +275,7 @@ $sql .= " ava.rowid as availability,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; +$sql .= ' p.note_public, p.note_private,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql .= ' u.login'; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; @@ -764,6 +765,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; $companystatic->id = $obj->socid; $companystatic->name = $obj->name; @@ -784,18 +787,11 @@ if ($resql) print ''; // Picto + Ref print ''; // Warning $warnornote = ''; if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); - if (!empty($obj->note_private)) - { - $warnornote .= ($warnornote ? ' ' : ''); - $warnornote .= ''; - $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote .= ''; - } if ($warnornote) { print ''; @@ -946,7 +949,7 @@ if ($resql) print '
'; - print $objectstatic->getNomUrl(1, '', '', 0, 1); + print $objectstatic->getNomUrl(1, '', '', 0, 1, 1); print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a21e9534f49..04469a38ee6 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3559,9 +3559,10 @@ class Commande extends CommonOrder * @param int $short ??? * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes Add linkt to notes * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { global $conf, $langs, $user; @@ -3628,6 +3629,22 @@ class Commande extends CommonOrder if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; + if ($addlinktonotes) + { + $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); + if ($txttoshow) + { + $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f28d2a637b2..0f1b6e24e54 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -804,6 +804,8 @@ if ($resql) $generic_commande->total_ht = $obj->total_ht; $generic_commande->total_tva = $obj->total_tva; $generic_commande->total_ttc = $obj->total_ttc; + $generic_commande->note_public = $obj->note_public; + $generic_commande->note_private = $obj->note_private; $projectstatic->id = $obj->project_id; $projectstatic->ref = $obj->project_ref; @@ -818,7 +820,7 @@ if ($resql) $generic_commande->getLinesArray(); // This set ->lines - print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1); + print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1); // Show shippable Icon (create subloop, so may be slow) if ($conf->stock->enabled) @@ -926,12 +928,6 @@ if ($resql) if ($generic_commande->hasDelay()) { print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning"); } - if (!empty($obj->note_private) || !empty($obj->note_public)) - { - print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - print ''; - } $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index a5e8530d4bb..32926e098e3 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefo require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d153f8756c7..b8745aa0d2b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -700,9 +700,10 @@ class CommandeFournisseur extends CommonOrder * @param string $option On what the link points * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes Add link to show notes * @return string Chain with URL */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { global $langs, $conf; @@ -751,6 +752,22 @@ class CommandeFournisseur extends CommonOrder if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; + if ($addlinktonotes) + { + $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); + if ($txttoshow) + { + $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 807804ed5fe..1f00720a12d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2248,9 +2248,10 @@ class FactureFournisseur extends CommonInvoice * @param string $moretitle Add more text to title tooltip * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes Add link to show notes * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { global $langs, $conf; @@ -2318,6 +2319,22 @@ class FactureFournisseur extends CommonInvoice if ($withpicto != 2) $result.= ($max?dol_trunc($ref, $max):$ref); $result .= $linkend; + if ($addlinktonotes) + { + $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); + if ($txttoshow) + { + $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b64fde8bdad..71881d34103 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -486,6 +486,7 @@ $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_delivery,"; $sql .= ' cf.date_creation as date_creation, cf.tms as date_update,'; +$sql .= ' cf.note_public, cf.note_private,'; $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,"; $sql .= " u.firstname, u.lastname, u.photo, u.login, u.email as user_email"; // Add fields from extrafields @@ -936,6 +937,8 @@ if ($resql) $objectstatic->total_tva = $obj->total_tva; $objectstatic->total_ttc = $obj->total_ttc; $objectstatic->date_delivery = $db->jdate($obj->date_delivery); + $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; $objectstatic->statut = $obj->fk_statut; print '
'; // Picto + Ref - print $objectstatic->getNomUrl(1); + print $objectstatic->getNomUrl(1, '', 0, -1, 1); // Other picto tool $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->fournisseur->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 4141c8a7955..9b865cae3e6 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -269,6 +269,7 @@ if ($search_all || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql .= " f.rowid as facid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement,"; $sql .= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_update,"; $sql .= " f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,"; +$sql .= " f.note_public, f.note_private,"; $sql .= " s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,"; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -371,6 +372,7 @@ if (!$search_all) $sql .= " GROUP BY f.rowid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement, f.fk_mode_reglement,"; $sql .= " f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,"; $sql .= " f.localtax1, f.localtax2,"; + $sql .= " f.note_public, f.note_private,"; $sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom,"; @@ -827,7 +829,8 @@ if ($resql) $facturestatic->ref_supplier = $obj->ref_supplier; $facturestatic->date_echeance = $db->jdate($obj->datelimite); $facturestatic->statut = $obj->fk_statut; - + $facturestatic->note_public = $obj->note_public; + $facturestatic->note_private = $obj->note_private; $thirdparty->id = $obj->socid; $thirdparty->name = $obj->name; @@ -861,13 +864,8 @@ if ($resql) print ''; // Picto + Ref print ''; - // Warning - //print ''; - // Other picto tool - print '
'; - print $facturestatic->getNomUrl(1); - print ''; - //print ''; + print $facturestatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index ea6a2c55454..ae914b2f712 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -138,7 +138,7 @@ if ($object->id > 0) print '
'; print '
'; - print ''; + print '
'; // Type print ''; @@ -638,18 +640,11 @@ if ($resql) print '
'.$langs->trans('Type').''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index b0369dc1661..b01b7181f75 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2507,9 +2507,10 @@ class SupplierProposal extends CommonObject * @param string $get_params Parametres added to url * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $addlinktonotes Add link to show notes * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { global $langs, $conf, $user; @@ -2567,6 +2568,22 @@ class SupplierProposal extends CommonObject if ($withpicto != 2) $result.= $this->ref; $result .= $linkend; + if ($addlinktonotes) + { + $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); + if ($txttoshow) + { + $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $result .= ' '; + $result .= ''; + $result .= img_picto('', 'note'); + $result .= ''; + //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); + //$result.=''; + $result .= ''; + } + } + return $result; } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 7531cc133bf..02652da5875 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -628,6 +628,8 @@ if ($resql) $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->note_public = $obj->note_public; + $objectstatic->note_private = $obj->note_private; print '
'; // Picto + Ref print ''; // Warning $warnornote = ''; //if ($obj->fk_statut == 1 && $db->jdate($obj->date_valid) < ($now - $conf->supplier_proposal->warning_delay)) $warnornote .= img_warning($langs->trans("Late")); - if (!empty($obj->note_private)) - { - $warnornote .= ($warnornote ? ' ' : ''); - $warnornote .= ''; - $warnornote .= ''.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').''; - $warnornote .= ''; - } if ($warnornote) { print '
'; - print $objectstatic->getNomUrl(1); + print $objectstatic->getNomUrl(1, '', '', 0, -1, 1); print '';