From f09638972cf3aa63873ae8fd4ab3305828f6a331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jun 2022 10:45:04 +0200 Subject: [PATCH] Debug v16 --- htdocs/compta/facture/class/facture.class.php | 12 +++++-- htdocs/compta/facture/info.php | 4 +-- htdocs/compta/index.php | 32 ++++++++--------- htdocs/core/class/commonobject.class.php | 35 +++++++++++++++---- 4 files changed, 56 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5993bd39a7c..59564612cc2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -124,6 +124,12 @@ class Facture extends CommonInvoice */ public $fk_user_valid; + /** + * @var int ID + */ + public $fk_user_modif; + + public $date; // Date invoice public $datem; @@ -1935,7 +1941,7 @@ class Facture extends CommonInvoice $sql .= ', f.datec as datec'; $sql .= ', f.date_valid as datev'; $sql .= ', f.tms as datem'; - $sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf, f.last_main_doc'; + $sql .= ', f.note_private, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.fk_user_modif, f.model_pdf, f.last_main_doc'; $sql .= ', f.fk_facture_source, f.fk_fac_rec_source'; $sql .= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet as fk_project, f.extraparams'; $sql .= ', f.situation_cycle_ref, f.situation_counter, f.situation_final'; @@ -2023,8 +2029,10 @@ class Facture extends CommonInvoice $this->note_public = $obj->note_public; $this->user_author = $obj->fk_user_author; // deprecated $this->user_valid = $obj->fk_user_valid; // deprecated - $this->fk_user_author = $obj->fk_user_author; + $this->user_modification = $obj->fk_user_modif; // deprecated + $this->fk_user_author = $obj->fk_user_author; $this->fk_user_valid = $obj->fk_user_valid; + $this->fk_user_modif = $obj->fk_user_modif; $this->model_pdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; // deprecated $this->last_main_doc = $obj->last_main_doc; diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 8b198e5f991..4521c7e5096 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -51,12 +51,12 @@ if ($id > 0 || !empty($ref)) { } // Security check -$fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) { $socid = $user->socid; } $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); -$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft); + +$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); /* diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 93b73d8ddd4..e7cb0b1d4b5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015-2020 Juanjo Menent + * Copyright (C) 2015-2020 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García @@ -237,7 +237,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { } print ''.price($obj->total_ttc).''; - print ''.dol_print_date($db->jdate($obj->tms), 'day').''; + print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''; print ''.$tmpinvoice->getLibStatut(3, $obj->am).''; @@ -367,7 +367,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.price($obj->total_ht).''; } print ''.price($obj->total_ttc).''; - print ''.dol_print_date($db->jdate($obj->tms), 'day').''; + print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''; $alreadypaid = $facstatic->getSommePaiement(); print ''.$facstatic->getLibStatut(3, $alreadypaid).''; print ''; @@ -437,7 +437,7 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) { $total_ttc = $totalam = $total_ht = 0; while ($i < $num && $i < $max) { - $objp = $db->fetch_object($result); + $obj = $db->fetch_object($result); if ($i >= $max) { $othernb += 1; @@ -447,24 +447,24 @@ if (!empty($conf->don->enabled) && !empty($user->rights->don->lire)) { continue; } - $donationstatic->id = $objp->rowid; - $donationstatic->ref = $objp->rowid; - $donationstatic->lastname = $objp->lastname; - $donationstatic->firstname = $objp->firstname; - $donationstatic->date = $objp->date; - $donationstatic->statut = $objp->status; - $donationstatic->status = $objp->status; + $donationstatic->id = $obj->rowid; + $donationstatic->ref = $obj->rowid; + $donationstatic->lastname = $obj->lastname; + $donationstatic->firstname = $obj->firstname; + $donationstatic->date = $obj->date; + $donationstatic->statut = $obj->status; + $donationstatic->status = $obj->status; $label = $donationstatic->getFullName($langs); - if ($objp->societe) { - $label .= ($label ? ' - ' : '').$objp->societe; + if ($obj->societe) { + $label .= ($label ? ' - ' : '').$obj->societe; } print ''; print ''.$donationstatic->getNomUrl(1).''; print ''.$label.''; - print ''.price($objp->amount).''; - print ''.dol_print_date($db->jdate($objp->dm), 'day').''; + print ''.price($obj->amount).''; + print 'jdate($obj->dm), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->dm), 'day', 'tzuserrel').''; print ''.$donationstatic->getLibStatut(3).''; print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1d3a091cab1..7f2ffb3ddad 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -169,13 +169,13 @@ abstract class CommonObject public $canvas; /** - * @var Project The related project + * @var Project The related project object * @see fetch_projet() */ public $project; /** - * @var int The related project ID + * @var int The related project ID * @see setProject(), project */ public $fk_project; @@ -188,24 +188,24 @@ abstract class CommonObject /** * @deprecated - * @see fk_project + * @see $fk_project */ public $fk_projet; /** - * @var Contact a related contact + * @var Contact A related contact object * @see fetch_contact() */ public $contact; /** - * @var int The related contact ID + * @var int The related contact ID * @see fetch_contact() */ public $contact_id; /** - * @var Societe A related thirdparty + * @var Societe A related thirdparty object * @see fetch_thirdparty() */ public $thirdparty; @@ -254,7 +254,7 @@ abstract class CommonObject public $newref; /** - * @var int The object's status + * @var int The object's status. Prefer use of status. * @see setStatut() */ public $statut; @@ -265,6 +265,7 @@ abstract class CommonObject */ public $status; + /** * @var string * @see getFullAddress() @@ -319,6 +320,7 @@ abstract class CommonObject */ public $region; + /** * @var int * @see fetch_barcode() @@ -518,6 +520,24 @@ abstract class CommonObject */ public $date_modification; // Date last change (tms field) + /** + * @var string User id of author + * @deprecated + */ + public $user_author; + /** + * @var string User id of validation + * @deprecated + */ + public $user_valid; + + /** + * @var string User id of last modifier + * @deprecated + */ + public $user_modification; + + public $next_prev_filter; /** @@ -535,6 +555,7 @@ abstract class CommonObject */ public $alreadypaid; + /** * @var array List of child tables. To test if we can delete object. */