Make possible to edit contract after validated.
Make not possible if hidden option CONTRAT_NOEDITWHENVALIDATED is set
This commit is contained in:
parent
6a6a63613c
commit
d8ec223ba2
@ -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");
|
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();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -959,8 +959,7 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
if ($contrat->statut == 0 ||
|
if ($this->statut == 0 || ($this->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED)) )
|
||||||
($contrat->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED) )
|
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
||||||
$sql.= " WHERE rowid=".$idline;
|
$sql.= " WHERE rowid=".$idline;
|
||||||
|
|||||||
@ -827,9 +827,9 @@ else
|
|||||||
{
|
{
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
}
|
}
|
||||||
// Icon move, update et delete (statut contrat 0=brouillon,1=valid<EFBFBD>,2=ferm<72>)
|
// Icon move, update et delete (statut contrat 0=brouillon,1=valide,2=ferme)
|
||||||
print '<td align="right" nowrap="nowrap">';
|
print '<td align="right" nowrap="nowrap">';
|
||||||
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 '<a href="fiche.php?id='.$id.'&action=move&rowid='.$objp->rowid.'">';
|
print '<a href="fiche.php?id='.$id.'&action=move&rowid='.$objp->rowid.'">';
|
||||||
print img_picto($langs->trans("MoveToAnotherContract"),'uparrow');
|
print img_picto($langs->trans("MoveToAnotherContract"),'uparrow');
|
||||||
@ -838,7 +838,7 @@ else
|
|||||||
else {
|
else {
|
||||||
print ' ';
|
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 '<a href="fiche.php?id='.$id.'&action=editline&rowid='.$objp->rowid.'">';
|
print '<a href="fiche.php?id='.$id.'&action=editline&rowid='.$objp->rowid.'">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
@ -847,8 +847,7 @@ else
|
|||||||
else {
|
else {
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
if ( ($contrat->statut == 0 || ($contrat->statut == 1 && $conf->global->CONTRAT_EDITWHENVALIDATED))
|
if ( $user->rights->contrat->creer && ($contrat->statut == 0 || ($contrat->statut >= 1 && empty($conf->global->CONTRAT_NOEDITWHENVALIDATED))) )
|
||||||
&& $user->rights->contrat->creer)
|
|
||||||
{
|
{
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<a href="fiche.php?id='.$id.'&action=deleteline&lineid='.$objp->rowid.'">';
|
print '<a href="fiche.php?id='.$id.'&action=deleteline&lineid='.$objp->rowid.'">';
|
||||||
@ -1154,7 +1153,7 @@ else
|
|||||||
* Ajouter une ligne produit/service
|
* Ajouter une ligne produit/service
|
||||||
*/
|
*/
|
||||||
if ($user->rights->contrat->creer &&
|
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 '<br>';
|
print '<br>';
|
||||||
print '<table class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
print '<table class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user