From d8ec223ba2e47d52b0b92734f295d015ff6c1aa5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Apr 2009 13:12:14 +0000 Subject: [PATCH] Make possible to edit contract after validated. Make not possible if hidden option CONTRAT_NOEDITWHENVALIDATED is set --- htdocs/contrat/contrat.class.php | 5 ++--- htdocs/contrat/fiche.php | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index ef4392a25d5..d5429e36b15 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -767,7 +767,7 @@ class Contrat extends CommonObject dol_syslog("Contrat::addline $desc, $pu_ht, $qty, $txtva, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits"); - if ($this->statut == 0 || ($this->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED)) + if ($this->statut == 0 || ($this->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED))) { $this->db->begin(); @@ -959,8 +959,7 @@ class Contrat extends CommonObject { global $conf, $langs; - if ($contrat->statut == 0 || - ($contrat->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED) ) + if ($this->statut == 0 || ($this->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED)) ) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet"; $sql.= " WHERE rowid=".$idline; diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 871c4beb9a8..7ff49222af5 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -827,9 +827,9 @@ else { print ' '; } - // Icon move, update et delete (statut contrat 0=brouillon,1=valid�,2=ferm�) + // Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme) print ''; - if (sizeof($arrayothercontracts) && $contrat->statut != 2 && $user->rights->contrat->creer) + if ($user->rights->contrat->creer && sizeof($arrayothercontracts) && ($contrat->statut == 0 || ($contrat->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED)))) { print ''; print img_picto($langs->trans("MoveToAnotherContract"),'uparrow'); @@ -838,7 +838,7 @@ else else { print ' '; } - if ($contrat->statut != 2 && $user->rights->contrat->creer) + if ($user->rights->contrat->creer && ($contrat->statut == 0 || ($contrat->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED))) ) { print ''; print img_edit(); @@ -847,8 +847,7 @@ else else { print ' '; } - if ( ($contrat->statut == 0 || ($contrat->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED)) - && $user->rights->contrat->creer) + if ( $user->rights->contrat->creer && ($contrat->statut == 0 || ($contrat->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED))) ) { print ' '; print ''; @@ -1154,7 +1153,7 @@ else * Ajouter une ligne produit/service */ if ($user->rights->contrat->creer && - ($contrat->statut == 0 || ($contrat->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED)) ) + ($contrat->statut == 0 || ($contrat->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED))) ) { print '
'; print ''; // Array with (n*2)+1 lines