diff --git a/ChangeLog b/ChangeLog
index 722472591d3..93561e57480 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,17 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
+***** ChangeLog for 1.0.0 compared to 18.0.0 *****
+
+
+WARNING:
+
+Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
+* The property ->brouillon has been removed from all classes. It was not reliable and was a duplicate of ->status == self::STATUS_DRAFT.
+
+
+
+
***** ChangeLog for 18.0.0 compared to 17.0.0 *****
For uses:
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index c78eb01d4c5..d0b5249376f 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1694,10 +1694,6 @@ class Propal extends CommonObject
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
- if ($obj->fk_statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
@@ -2071,10 +2067,11 @@ class Propal extends CommonObject
}
$this->ref = $num;
- $this->brouillon = 0;
$this->statut = self::STATUS_VALIDATED;
+ $this->status = self::STATUS_VALIDATED;
$this->user_valid_id = $user->id;
$this->datev = $now;
+ $this->date_validation = $now;
$this->db->commit();
return 1;
@@ -2901,7 +2898,7 @@ class Propal extends CommonObject
if (!$error) {
$this->statut = self::STATUS_DRAFT;
- $this->brouillon = 1;
+ $this->status = self::STATUS_DRAFT;
$this->db->commit();
return 1;
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index f9f6bd79380..65d35fbc3fd 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -608,8 +608,8 @@ class Commande extends CommonOrder
// Set new ref and current status
if (!$error) {
$this->ref = $num;
- $this->statut = self::STATUS_VALIDATED;
- $this->brouillon = 0;
+ $this->statut = self::STATUS_VALIDATED; // deprecated
+ $this->status = self::STATUS_VALIDATED;
}
if (!$error) {
@@ -909,7 +909,6 @@ class Commande extends CommonOrder
$error = 0;
// Clean parameters
- $this->brouillon = 1; // set command as draft
// Set tmp vars
$date = ($this->date_commande ? $this->date_commande : $this->date);
@@ -1989,10 +1988,6 @@ class Commande extends CommonOrder
$this->lines = array();
- if ($this->statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index fc1ce0eee81..de4984facc9 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -1333,7 +1333,7 @@ if ($action == 'create') {
print '
| ';
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' | ';
- if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
+ if ($usercancreate && $action != 'editmulticurrencycode' && $object->suspended == $object::STATUS_SUSPENDED) {
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' | ';
}
print '
';
@@ -1349,7 +1349,7 @@ if ($action == 'create') {
print '| ';
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' | ';
- if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' | ';
}
print '
';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 524da4fbba0..96e1109ce79 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4505,7 +4505,7 @@ if ($action == 'create') {
print '| ';
print $langs->trans('DateInvoice');
print ' | ';
- if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
+ if ($action != 'editinvoicedate' && $object->status == $object::STATUS_DRAFT && $usercancreate && !getDolGlobalString('FAC_FORCE_DATE_VALIDATION')) {
print 'id.'">'.img_edit($langs->trans('SetDate'), 1).' | ';
}
print '
';
@@ -4607,7 +4607,7 @@ if ($action == 'create') {
print '| ';
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print ' | ';
- if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
+ if ($usercancreate && $action != 'editmulticurrencycode' && $object->status == $object::STATUS_DRAFT) {
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' | ';
}
print '
';
@@ -4623,7 +4623,7 @@ if ($action == 'create') {
print '| ';
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' | ';
- if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ if ($usercancreate && $action != 'editmulticurrencyrate' && $object->status == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).' | ';
}
print '
';
@@ -4865,7 +4865,7 @@ if ($action == 'create') {
print '| ';
print $langs->trans('RevenueStamp');
print ' | ';
- if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $usercancreate) {
+ if ($action != 'editrevenuestamp' && $object->status == $object::STATUS_DRAFT && $usercancreate) {
print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' | ';
}
print '
';
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index e58f0ee9f55..53b3d1c536e 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -273,8 +273,6 @@ class FactureRec extends CommonInvoice
$facsrc = new Facture($this->db);
$result = $facsrc->fetch($facid);
if ($result > 0) {
- // On positionne en mode brouillon la facture
- $this->brouillon = 1;
$this->fk_soc = $facsrc->socid;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (";
@@ -617,10 +615,6 @@ class FactureRec extends CommonInvoice
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
- if ($this->statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
@@ -890,7 +884,7 @@ class FactureRec extends CommonInvoice
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
- if ($this->brouillon) {
+ if ($this->suspended == self::STATUS_SUSPENDED) {
// Clean parameters
$remise_percent = price2num($remise_percent);
if (empty($remise_percent)) {
@@ -1090,7 +1084,7 @@ class FactureRec extends CommonInvoice
return -1;
}
- if ($this->brouillon) {
+ if ($this->suspended == self::STATUS_SUSPENDED) {
// Clean parameters
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
@@ -1338,8 +1332,7 @@ class FactureRec extends CommonInvoice
$facture->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
$facture->type = self::TYPE_STANDARD;
- $facture->brouillon = 1;
- $facture->statut = self::STATUS_DRAFT;
+ $facture->statut = self::STATUS_DRAFT; // deprecated
$facture->status = self::STATUS_DRAFT;
$facture->date = (empty($facturerec->date_when) ? $now : $facturerec->date_when); // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
$facture->socid = $facturerec->socid;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 4fade5c5b6f..e944691eec6 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -509,9 +509,8 @@ class Facture extends CommonInvoice
if (!$this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
- $this->brouillon = 1;
$this->status = self::STATUS_DRAFT;
- $this->statut = self::STATUS_DRAFT;
+ $this->statut = self::STATUS_DRAFT; // deprecated
if (!empty($this->multicurrency_code)) {
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -611,9 +610,8 @@ class Facture extends CommonInvoice
if (!$this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
- $this->brouillon = 1;
$this->status = self::STATUS_DRAFT;
- $this->statut = self::STATUS_DRAFT;
+ $this->statut = self::STATUS_DRAFT; // deprecated
$this->linked_objects = $_facrec->linkedObjectsIds;
// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -1961,7 +1959,7 @@ class Facture extends CommonInvoice
// Load the alreadypaid field
$this->alreadypaid = $this->getSommePaiement(0);
}
- if (isset($this->statut) && isset($this->alreadypaid)) {
+ if (isset($this->status) && isset($this->alreadypaid)) {
$datas['picto'] .= ' '.$this->getLibStatut(5, $this->alreadypaid);
}
if ($moretitle) {
@@ -2152,7 +2150,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.fk_user_modif, f.model_pdf, f.last_main_doc';
+ $sql .= ', f.note_private, f.note_public, f.fk_statut as status, 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';
@@ -2219,8 +2217,8 @@ class Facture extends CommonInvoice
$this->fk_project = $obj->fk_project;
$this->project = null; // Clear if another value was already set by fetch_projet
- $this->statut = $obj->fk_statut;
- $this->status = $obj->fk_statut;
+ $this->statut = $obj->status; // deprecated
+ $this->status = $obj->status;
$this->date_lim_reglement = $this->db->jdate($obj->dlr);
$this->mode_reglement_id = $obj->fk_mode_reglement;
@@ -2274,10 +2272,6 @@ class Facture extends CommonInvoice
$this->fetchPreviousNextSituationInvoice();
}
- if ($this->status == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
@@ -2545,7 +2539,7 @@ class Facture extends CommonInvoice
$sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
$sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
$sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? $this->db->escape($this->revenuestamp) : "null").",";
- $sql .= " fk_statut=".(isset($this->statut) ? $this->db->escape($this->statut) : "null").",";
+ $sql .= " fk_statut=".(isset($this->status) ? $this->db->escape($this->status) : "null").",";
$sql .= " fk_user_author=".(isset($this->user_author) ? $this->db->escape($this->user_author) : "null").",";
$sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->db->escape($this->fk_user_valid) : "null").",";
$sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->db->escape($this->fk_facture_source) : "null").",";
@@ -3209,8 +3203,8 @@ class Facture extends CommonInvoice
$this->fetch_lines();
// Check parameters
- if ($this->statut != self::STATUS_DRAFT) {
- dol_syslog(get_class($this)."::validate status is not draft. operation canceled.", LOG_WARNING);
+ if ($this->status != self::STATUS_DRAFT) {
+ dol_syslog(get_class($this)."::validate Current status is not draft. operation canceled.", LOG_WARNING);
return 0;
}
if (count($this->lines) <= 0) {
@@ -3562,9 +3556,8 @@ class Facture extends CommonInvoice
// Set new ref and define current status
if (!$error) {
$this->ref = $num;
- $this->statut = self::STATUS_VALIDATED;
+ $this->statut = self::STATUS_VALIDATED; // deprecated
$this->status = self::STATUS_VALIDATED;
- $this->brouillon = 0;
$this->date_validation = $now;
$i = 0;
@@ -3609,13 +3602,11 @@ class Facture extends CommonInvoice
foreach ($this->tab_next_situation_invoice as $next_invoice) {
$is_last = $next_invoice->is_last_in_cycle();
- if ($next_invoice->statut == self::STATUS_DRAFT && $is_last != 1) {
+ if ($next_invoice->status == self::STATUS_DRAFT && $is_last != 1) {
$this->error = $langs->trans('updatePriceNextInvoiceErrorUpdateline', $next_invoice->ref);
return false;
}
- $next_invoice->brouillon = 1;
-
foreach ($next_invoice->lines as $line) {
$result = $next_invoice->updateline(
$line->id,
@@ -3668,7 +3659,7 @@ class Facture extends CommonInvoice
$error = 0;
- if ($this->statut == self::STATUS_DRAFT) {
+ if ($this->status == self::STATUS_DRAFT) {
dol_syslog(__METHOD__." already draft status", LOG_WARNING);
return 0;
}
@@ -3709,18 +3700,16 @@ class Facture extends CommonInvoice
}
if ($error == 0) {
- $old_statut = $this->statut;
- $this->brouillon = 1;
- $this->statut = self::STATUS_DRAFT;
+ $old_statut = $this->status;
+ $this->statut = self::STATUS_DRAFT; // deprecated
$this->status = self::STATUS_DRAFT;
// Call trigger
$result = $this->call_trigger('BILL_UNVALIDATE', $user);
if ($result < 0) {
$error++;
- $this->statut = $old_statut;
+ $this->statut = $old_statut; // deprecated
$this->status = $old_statut;
- $this->brouillon = 0;
}
// End call triggers
} else {
@@ -3827,7 +3816,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::addline id=$this->id, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, ventil=$ventil, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, desc=".dol_trunc($desc, 25), LOG_DEBUG);
- if ($this->statut == self::STATUS_DRAFT) {
+ if ($this->status == self::STATUS_DRAFT) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
@@ -4094,7 +4083,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::updateline rowid=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, type=$type, fk_parent_line=$fk_parent_line pa_ht=$pa_ht, special_code=$special_code, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
- if ($this->statut == self::STATUS_DRAFT) {
+ if ($this->status == self::STATUS_DRAFT) {
if (!$this->is_last_in_cycle() && empty($this->error)) {
if (!$this->checkProgressLine($rowid, $situation_percent)) {
if (!$this->error) {
@@ -4369,7 +4358,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::deleteline rowid=".((int) $rowid), LOG_DEBUG);
- if ($this->statut != self::STATUS_DRAFT) {
+ if ($this->status != self::STATUS_DRAFT) {
$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
return -1;
}
@@ -4936,7 +4925,7 @@ class Facture extends CommonInvoice
$clause = " WHERE";
- $sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut, f.total_ht";
+ $sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut as status, f.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
@@ -4966,7 +4955,8 @@ class Facture extends CommonInvoice
while ($obj = $this->db->fetch_object($resql)) {
$generic_facture->date_lim_reglement = $this->db->jdate($obj->datefin);
- $generic_facture->statut = $obj->fk_statut;
+ $generic_facture->statut = $obj->status;
+ $generic_facture->status = $obj->status;
$response->nbtodo++;
$response->total += $obj->total_ht;
@@ -5448,7 +5438,7 @@ class Facture extends CommonInvoice
$now = dol_now();
// Paid invoices have status STATUS_CLOSED
- if ($this->statut != Facture::STATUS_VALIDATED) {
+ if ($this->status != Facture::STATUS_VALIDATED) {
return false;
}
@@ -5575,7 +5565,7 @@ class Facture extends CommonInvoice
{
dol_syslog(get_class($this).'::setRetainedWarranty('.$value.')');
- if ($this->statut >= 0) {
+ if ($this->status >= 0) {
$fieldname = 'retained_warranty';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ".$fieldname." = ".((float) $value);
@@ -5591,7 +5581,7 @@ class Facture extends CommonInvoice
}
} else {
dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible');
- $this->error = 'Status of the object is incompatible '.$this->statut;
+ $this->error = 'Status of the object is incompatible '.$this->status;
return -2;
}
}
@@ -5612,7 +5602,7 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')');
- if ($this->statut >= 0) {
+ if ($this->status >= 0) {
$fieldname = 'retained_warranty_date_limit';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ".$fieldname." = ".(strval($timestamp) != '' ? "'".$this->db->idate($timestamp)."'" : 'null');
@@ -5628,7 +5618,7 @@ class Facture extends CommonInvoice
}
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible');
- $this->error = 'Status of the object is incompatible '.$this->statut;
+ $this->error = 'Status of the object is incompatible '.$this->status;
return -2;
}
}
diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php
index 4da9dbb1559..81e4af99e2a 100644
--- a/htdocs/compta/facture/class/paymentterm.class.php
+++ b/htdocs/compta/facture/class/paymentterm.class.php
@@ -402,6 +402,7 @@ class PaymentTerm // extends CommonObject
$object->fetch($fromid);
$object->id = 0;
$object->statut = 0;
+ $object->status = 0;
// Clear fields
// ...
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 7211b7098a6..f6e9bd9883e 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -417,7 +417,7 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
setEventMessage($facture->error, 'errors');
$errorpayment++;
} else {
- if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->statut == Facture::STATUS_VALIDATED && $facture->paye == 0) {
+ if ($facture->type != Facture::TYPE_CREDIT_NOTE && $facture->status == Facture::STATUS_VALIDATED && $facture->paye == 0) {
$paiementAmount = $facture->getSommePaiement();
$totalcreditnotes = $facture->getSumCreditNotesUsed();
$totaldeposits = $facture->getSumDepositsUsed();
@@ -487,7 +487,7 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
- if ($objecttmp->statut == Facture::STATUS_DRAFT) {
+ if ($objecttmp->status == Facture::STATUS_DRAFT) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
} elseif ($objecttmp->paye || $objecttmp->resteapayer == 0) {
@@ -1906,7 +1906,7 @@ if ($resql) {
$multicurrency_totalpay = $multicurrency_paiement + $multicurrency_totalcreditnotes + $multicurrency_totaldeposits;
$multicurrency_remaintopay = price2num($facturestatic->multicurrency_total_ttc - $multicurrency_totalpay);
- if ($facturestatic->statut == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
+ if ($facturestatic->status == Facture::STATUS_CLOSED && $facturestatic->close_code == 'discount_vat') { // If invoice closed with discount for anticipated payment
$remaintopay = 0;
$multicurrency_remaintopay = 0;
}
@@ -2294,7 +2294,8 @@ if ($resql) {
$userstatic->lastname = $obj->lastname;
$userstatic->firstname = $obj->firstname;
$userstatic->email = $obj->user_email;
- $userstatic->statut = $obj->user_statut;
+ $userstatic->statut = $obj->user_statut; // deprecated
+ $userstatic->status = $obj->user_statut;
$userstatic->entity = $obj->entity;
$userstatic->photo = $obj->photo;
$userstatic->office_phone = $obj->office_phone;
@@ -2336,7 +2337,8 @@ if ($resql) {
$userstatic->lastname = $val['lastname'];
$userstatic->firstname = $val['firstname'];
$userstatic->email = $val['email'];
- $userstatic->statut = $val['statut'];
+ $userstatic->statut = $val['statut']; // deprecated
+ $userstatic->status = $val['statut'];
$userstatic->entity = $val['entity'];
$userstatic->photo = $val['photo'];
$userstatic->login = $val['login'];
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 4962448f18c..fe8dd0375e2 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -500,7 +500,7 @@ if ($object->id > 0) {
print '| ';
print $langs->trans('DateInvoice');
print ' | ';
- if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
+ if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && $object->status == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer')) {
print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).' | ';
}
print '
';
@@ -523,7 +523,7 @@ if ($object->id > 0) {
print '| ';
print $langs->trans('PaymentConditionsShort');
print ' | ';
- if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
+ if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && $object->status == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer')) {
print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).' | ';
}
print '
';
@@ -544,7 +544,7 @@ if ($object->id > 0) {
print '| ';
print $langs->trans('DateMaxPayment');
print ' | ';
- if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
+ if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $object->status == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer')) {
print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).' | ';
}
print '
';
@@ -573,7 +573,7 @@ if ($object->id > 0) {
print '';
@@ -594,7 +594,7 @@ if ($object->id > 0) {
print '';
@@ -679,7 +679,7 @@ if ($object->id > 0) {
print '| ';
print $langs->trans('RevenueStamp');
print ' | ';
- if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) {
+ if ($action != 'editrevenuestamp' && $object->status == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer')) {
print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).' | ';
}
print '
';
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 39f44e35585..57f7b320fe7 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1369,7 +1369,7 @@ if ($action == 'create') {
// Contract
- if (!empty($object->brouillon) && $user->hasRight('contrat', 'creer')) {
+ if ($object->status == $object::STATUS_DRAFT && $user->hasRight('contrat', 'creer')) {
print '';
}
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 7db2cf5546b..27e63efa8e7 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -118,8 +118,14 @@ class Contrat extends CommonObject
/**
* Status of the contract
* @var int
+ * @deprecated
*/
- public $statut = 0; // 0=Draft,
+ public $statut = 0;
+ /**
+ * Status of the contract (0=Draft, 1=Validated)
+ * @var int
+ */
+ public $status = 0;
public $product;
@@ -569,8 +575,8 @@ class Contrat extends CommonObject
// Set new ref and define current statut
if (!$error) {
$this->ref = $num;
- $this->statut = 1;
- $this->brouillon = 0;
+ $this->status = self::STATUS_VALIDATED;
+ $this->statut = self::STATUS_VALIDATED; // deprecated
$this->date_validation = $now;
}
} else {
@@ -631,8 +637,8 @@ class Contrat extends CommonObject
// Set new ref and define current status
if (!$error) {
- $this->statut = 0;
- $this->brouillon = 1;
+ $this->statut = self::STATUS_DRAFT;
+ $this->status = self::STATUS_DRAFT;
$this->date_validation = $now;
}
diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php
index a01fe7119b4..9461eaa39e8 100644
--- a/htdocs/core/class/commonobjectline.class.php
+++ b/htdocs/core/class/commonobjectline.class.php
@@ -108,6 +108,12 @@ abstract class CommonObjectLine extends CommonObject
public $subprice;
public $tva_tx;
+ public $multicurrency_code;
+ public $multicurrency_tx;
+ public $multicurrency_subprice;
+ public $multicurrency_total_ht;
+ public $multicurrency_total_tva;
+ public $multicurrency_total_ttc;
/**
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index b62a9a94a5b..1953640a251 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -326,7 +326,6 @@ class Expedition extends CommonObject
$error = 0;
// Clean parameters
- $this->brouillon = 1;
$this->tracking_number = dol_sanitizeFileName($this->tracking_number);
if (empty($this->fk_project)) {
$this->fk_project = 0;
@@ -334,7 +333,6 @@ class Expedition extends CommonObject
$this->user = $user;
-
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition (";
@@ -648,10 +646,6 @@ class Expedition extends CommonObject
$this->db->free($result);
- if ($this->statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Tracking url
$this->getUrlTrackingStatus($obj->tracking_number);
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 35a9d37443c..43a8dac10b7 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -438,7 +438,7 @@ class Fichinter extends CommonObject
*/
public function fetch($rowid, $ref = '')
{
- $sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut,";
+ $sql = "SELECT f.rowid, f.ref, f.ref_client, f.description, f.fk_soc, f.fk_statut as status,";
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
@@ -462,7 +462,8 @@ class Fichinter extends CommonObject
$this->ref_client = $obj->ref_client;
$this->description = $obj->description;
$this->socid = $obj->fk_soc;
- $this->statut = $obj->fk_statut;
+ $this->status = $obj->status;
+ $this->statut = $obj->status; // deprecated
$this->duration = $obj->duree;
$this->datec = $this->db->jdate($obj->datec);
$this->dateo = $this->db->jdate($obj->dateo);
@@ -484,10 +485,6 @@ class Fichinter extends CommonObject
$this->last_main_doc = $obj->last_main_doc;
- if ($this->statut == 0) {
- $this->brouillon = 1;
- }
-
// Retrieve extrafields
$this->fetch_optionals();
@@ -573,7 +570,7 @@ class Fichinter extends CommonObject
$error = 0;
- if ($this->statut != 1) {
+ if ($this->status != self::STATUS_VALIDATED) {
$this->db->begin();
$now = dol_now();
@@ -653,8 +650,8 @@ class Fichinter extends CommonObject
// Set new ref and define current statut
if (!$error) {
$this->ref = $num;
- $this->statut = 1;
- $this->brouillon = 0;
+ $this->status = self::STATUS_VALIDATED;
+ $this->statut = self::STATUS_VALIDATED; // deprecated
$this->date_validation = $now;
$this->db->commit();
return 1;
@@ -1240,7 +1237,8 @@ class Fichinter extends CommonObject
$this->id = 0;
$this->ref = '';
- $this->statut = 0;
+ $this->status = self::STATUS_DRAFT;
+ $this->statut = self::STATUS_DRAFT; // deprecated
// Clear fields
$this->user_author_id = $user->id;
@@ -1302,7 +1300,7 @@ class Fichinter extends CommonObject
{
dol_syslog(get_class($this)."::addline $fichinterid, $desc, $date_intervention, $duration");
- if ($this->statut == self::STATUS_DRAFT) {
+ if ($this->status == self::STATUS_DRAFT) {
$this->db->begin();
// Insertion ligne
@@ -1846,49 +1844,44 @@ class FichinterLigne extends CommonObjectLine
*/
public function deleteline($user, $notrigger = 0)
{
- global $langs, $conf;
-
$error = 0;
- if ($this->statut == 0) {
- dol_syslog(get_class($this)."::deleteline lineid=".$this->id);
- $this->db->begin();
+ dol_syslog(get_class($this)."::deleteline lineid=".$this->id);
- $result = $this->deleteExtraFields();
- if ($result < 0) {
- $error++;
- $this->db->rollback();
- return -1;
- }
+ $this->db->begin();
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".((int) $this->id);
- $resql = $this->db->query($sql);
+ $result = $this->deleteExtraFields();
+ if ($result < 0) {
+ $error++;
+ $this->db->rollback();
+ return -1;
+ }
- if ($resql) {
- $result = $this->update_total();
- if ($result > 0) {
- if (!$notrigger) {
- // Call trigger
- $result = $this->call_trigger('LINEFICHINTER_DELETE', $user);
- if ($result < 0) {
- $error++; $this->db->rollback(); return -1;
- }
- // End call triggers
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".((int) $this->id);
+ $resql = $this->db->query($sql);
+
+ if ($resql) {
+ $result = $this->update_total();
+ if ($result > 0) {
+ if (!$notrigger) {
+ // Call trigger
+ $result = $this->call_trigger('LINEFICHINTER_DELETE', $user);
+ if ($result < 0) {
+ $error++; $this->db->rollback(); return -1;
}
-
- $this->db->commit();
- return $result;
- } else {
- $this->db->rollback();
- return -1;
+ // End call triggers
}
+
+ $this->db->commit();
+ return $result;
} else {
- $this->error = $this->db->error()." sql=".$sql;
$this->db->rollback();
return -1;
}
} else {
- return -2;
+ $this->error = $this->db->error()." sql=".$sql;
+ $this->db->rollback();
+ return -1;
}
}
}
diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php
index a1df7940142..f29e1e17eec 100644
--- a/htdocs/fichinter/class/fichinterrec.class.php
+++ b/htdocs/fichinter/class/fichinterrec.class.php
@@ -121,7 +121,7 @@ class FichinterRec extends Fichinter
*/
public function getLibStatut($mode = 0)
{
- return $this->LibStatut($this->statut, $mode);
+ return $this->LibStatut($this->status, $mode);
}
@@ -150,13 +150,11 @@ class FichinterRec extends Fichinter
$fichintsrc = new Fichinter($this->db);
$result = $fichintsrc->fetch($this->id_origin);
- $result = $fichintsrc->fetch_lines(); // to get all lines
-
+ if ($result > 0) {
+ $result = $fichintsrc->fetch_lines(); // to get all lines
+ }
if ($result > 0) {
- // On positionne en mode brouillon la facture
- $this->brouillon = 1;
-
$sql = "INSERT INTO ".MAIN_DB_PREFIX."fichinter_rec (";
$sql .= "titre";
$sql .= ", fk_soc";
@@ -170,7 +168,6 @@ class FichinterRec extends Fichinter
$sql .= ", fk_projet";
$sql .= ", fk_contrat";
$sql .= ", modelpdf";
-
$sql .= ", frequency";
$sql .= ", unit_frequency";
$sql .= ", date_when";
@@ -178,7 +175,6 @@ class FichinterRec extends Fichinter
$sql .= ", nb_gen_done";
$sql .= ", nb_gen_max";
// $sql.= ", auto_validate";
-
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($this->title)."'";
$sql .= ", ".($this->socid > 0 ? ((int) $this->socid) : 'null');
@@ -199,12 +195,12 @@ class FichinterRec extends Fichinter
$sql .= ", ".(!empty($fichintsrc->model_pdf) ? "'".$this->db->escape($fichintsrc->model_pdf)."'" : "''");
- // récurrence
+ // Frequency
$sql .= ", ".(!empty($this->frequency) ? ((int) $this->frequency) : "null");
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'null');
$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'null');
- $sql .= ", 0"; // we start à 0
+ $sql .= ", 0"; // we start at 0
$sql .= ", ".((int) $this->nb_gen_max);
// $sql.= ", ".$this->auto_validate;
$sql .= ")";
@@ -299,7 +295,8 @@ class FichinterRec extends Fichinter
$this->datec = $obj->datec;
$this->duration = $obj->duree;
$this->socid = $obj->fk_soc;
- $this->statut = 0;
+ $this->status = 0;
+ $this->statut = 0; // deprecated
$this->fk_project = $obj->fk_projet;
$this->fk_contrat = $obj->fk_contrat;
$this->note_private = $obj->note_private;
@@ -317,8 +314,6 @@ class FichinterRec extends Fichinter
$this->nb_gen_max = $obj->nb_gen_max;
$this->auto_validate = $obj->auto_validate;
- $this->brouillon = 1;
-
// Lines
$result = $this->fetch_lines();
if ($result < 0) {
@@ -483,7 +478,7 @@ class FichinterRec extends Fichinter
return -1;
}
- if ($this->brouillon) {
+ if ($this->status == self::STATUS_DRAFT) {
// Clean parameters
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php
index 6971f7e90c7..cec7cba23b7 100644
--- a/htdocs/fichinter/list.php
+++ b/htdocs/fichinter/list.php
@@ -720,7 +720,7 @@ while ($i < $imaxinloop) {
$objectstatic->id = $obj->rowid;
$objectstatic->ref = $obj->ref;
$objectstatic->ref_client = $obj->ref_client;
- $objectstatic->statut = $obj->status;
+ $objectstatic->statut = $obj->status; // deprecated
$objectstatic->status = $obj->status;
$companystatic->name = $obj->name;
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index da0b82ca00d..57a932ebbe5 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -375,14 +375,12 @@ class CommandeFournisseur extends CommonOrder
*/
public function fetch($id, $ref = '')
{
- global $conf;
-
// Check parameters
if (empty($id) && empty($ref)) {
return -1;
}
- $sql = "SELECT c.rowid, c.entity, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.total_tva,";
+ $sql = "SELECT c.rowid, c.entity, c.ref, ref_supplier, c.fk_soc, c.fk_statut as status, c.amount_ht, c.total_ht, c.total_ttc, c.total_tva,";
$sql .= " c.localtax1, c.localtax2, ";
$sql .= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,";
$sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,";
@@ -428,8 +426,8 @@ class CommandeFournisseur extends CommonOrder
$this->ref_supplier = $obj->ref_supplier;
$this->socid = $obj->fk_soc;
$this->fourn_id = $obj->fk_soc;
- $this->statut = $obj->fk_statut;
- $this->status = $obj->fk_statut;
+ $this->statut = $obj->status; // deprecated
+ $this->status = $obj->status;
$this->billed = $obj->billed;
$this->user_author_id = $obj->fk_user_author;
$this->user_valid_id = $obj->fk_user_valid;
@@ -494,13 +492,7 @@ class CommandeFournisseur extends CommonOrder
// fetch optionals attributes and labels
$this->fetch_optionals();
- if ($this->statut == 0) {
- $this->brouillon = 1;
- }
-
- /*
- * Lines
- */
+ // Lines
$result = $this->fetch_lines();
if ($result < 0) {
@@ -689,11 +681,11 @@ class CommandeFournisseur extends CommonOrder
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande_fournisseur";
$sql .= " SET ref='".$this->db->escape($num)."',";
- $sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
+ $sql .= " fk_statut = ".((int) self::STATUS_VALIDATED).",";
$sql .= " date_valid='".$this->db->idate(dol_now())."',";
$sql .= " fk_user_valid = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
- $sql .= " AND fk_statut = ".self::STATUS_DRAFT;
+ $sql .= " AND fk_statut = ".((int) self::STATUS_DRAFT);
$resql = $this->db->query($sql);
if (!$resql) {
@@ -749,7 +741,8 @@ class CommandeFournisseur extends CommonOrder
if (!$error) {
$result = 1;
- $this->statut = self::STATUS_VALIDATED;
+ $this->status = self::STATUS_VALIDATED;
+ $this->statut = self::STATUS_VALIDATED; // deprecated
$this->ref = $num;
}
@@ -1445,8 +1438,8 @@ class CommandeFournisseur extends CommonOrder
$this->multicurrency_tx = 1;
}
- // We set order into draft status
- $this->brouillon = 1;
+ $this->statut = self::STATUS_DRAFT; // deprecated
+ $this->status = self::STATUS_DRAFT;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (";
$sql .= "ref";
@@ -1503,12 +1496,11 @@ class CommandeFournisseur extends CommonOrder
// insert products details into database
for ($i = 0; $i < $num; $i++) {
- $line = $this->lines[$i];
+ $line = $this->lines[$i];
if (!is_object($line)) {
$line = (object) $line;
}
-
//$this->special_code = $line->special_code; // TODO : remove this in 9.0 and add special_code param to addline()
// This include test on qty if option SUPPLIER_ORDER_WITH_NOPRICEDEFINED is not set
@@ -1544,6 +1536,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
$sql .= " SET ref='(PROV".$this->id.")'";
$sql .= " WHERE rowid=".((int) $this->id);
+
dol_syslog(get_class($this)."::create", LOG_DEBUG);
if ($this->db->query($sql)) {
// Add link with price request and supplier order
@@ -2833,7 +2826,7 @@ class CommandeFournisseur extends CommonOrder
$error = 0;
- if ($this->brouillon) {
+ if ($this->statut == self::STATUS_DRAFT) {
// Clean parameters
if (empty($qty)) {
$qty = 0;
diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php
index 6e7b5d60505..363400b0822 100644
--- a/htdocs/fourn/class/fournisseur.facture-rec.class.php
+++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php
@@ -77,7 +77,8 @@ class FactureFournisseurRec extends CommonInvoice
public $ref_supplier;
public $socid;
- public $suspended;
+ public $suspended; // status
+
public $libelle;
public $label;
@@ -111,6 +112,7 @@ class FactureFournisseurRec extends CommonInvoice
public $fk_multicurrency;
public $multicurrency_code;
public $multicurrency_tx;
+ public $multicurrency_subprice;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
@@ -642,11 +644,6 @@ class FactureFournisseurRec extends CommonInvoice
$this->auto_validate = $obj->auto_validate;
$this->generate_pdf = $obj->generate_pdf;
-
- if ($this->statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
@@ -1078,7 +1075,7 @@ class FactureFournisseurRec extends CommonInvoice
return -1;
}
- if ($this->brouillon) {
+ if ($this->status == self::STATUS_SUSPENDED) {
// Clean parameters
$fk_product = empty($fk_product) ? 0 : $fk_product;
$label = empty($label) ? '' : $label;
@@ -1305,7 +1302,6 @@ class FactureFournisseurRec extends CommonInvoice
$new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
$new_fac_fourn->type = self::TYPE_STANDARD;
- $new_fac_fourn->brouillon = 1;
$new_fac_fourn->statut = self::STATUS_DRAFT;
$new_fac_fourn->status = self::STATUS_DRAFT;
$new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
@@ -1992,23 +1988,6 @@ class FactureFournisseurLigneRec extends CommonObjectLine
public $fk_user_author;
public $fk_user_modif;
public $fk_multicurrency;
- public $multicurrency_subprice;
-
-
- /* Overrides fields in CommonObject
- public $total_ht;
- public $total_tva;
- public $total_localtax1;
- public $total_localtax2;
- public $total_ttc;
-
- public $fk_unit;
- public $import_key;
- public $multicurrency_code;
- public $multicurrency_total_ht;
- public $multicurrency_total_tva;
- public $multicurrency_total_ttc;
- */
/**
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 6ac986093b7..954fd158014 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -481,9 +481,8 @@ class FactureFournisseur extends CommonInvoice
if (! $this->mode_reglement_id) {
$this->mode_reglement_id = 0;
}
- $this->brouillon = 1;
$this->status = self::STATUS_DRAFT;
- $this->statut = self::STATUS_DRAFT;
+ $this->statut = self::STATUS_DRAFT; // deprecated
$this->linked_objects = $_facrec->linkedObjectsIds;
// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -1012,10 +1011,6 @@ class FactureFournisseur extends CommonInvoice
// fetch optionals attributes and labels
$this->fetch_optionals();
- if ($this->statut == self::STATUS_DRAFT) {
- $this->brouillon = 1;
- }
-
$result = $this->fetch_lines();
if ($result < 0) {
$this->error = $this->db->lasterror();
diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php
index 37c5df2509a..5cee86ae231 100644
--- a/htdocs/fourn/facture/card-rec.php
+++ b/htdocs/fourn/facture/card-rec.php
@@ -1255,7 +1255,7 @@ if ($action == 'create') {
print '';
@@ -1271,7 +1271,7 @@ if ($action == 'create') {
print '| ';
print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print ' | ';
- if ($usercancreate && $action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
+ if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ' | ';
}
print '
';
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 6ab3bcecbdd..419e747d7e7 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -206,7 +206,7 @@ class Reception extends CommonObject
*/
public function create($user, $notrigger = 0)
{
- global $conf, $hookmanager;
+ global $conf;
$now = dol_now();
@@ -214,7 +214,6 @@ class Reception extends CommonObject
$error = 0;
// Clean parameters
- $this->brouillon = 1;
$this->tracking_number = dol_sanitizeFileName($this->tracking_number);
if (empty($this->fk_project)) {
$this->fk_project = 0;
@@ -437,10 +436,6 @@ class Reception extends CommonObject
$this->db->free($result);
- if ($this->statut == 0) {
- $this->brouillon = 1;
- }
-
//$file = $conf->reception->dir_output."/".get_exdir(0, 0, 0, 1, $this, 'reception')."/".$this->id.".pdf";
//$this->pdf_filename = $file;
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 288386810eb..dba68f99190 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -634,8 +634,6 @@ class SupplierProposal extends CommonObject
$this->db->commit();
return $this->line->id;
} else {
- $this->error = $this->error();
- $this->errors = $this->errors();
$this->db->rollback();
return -1;
}
@@ -1291,10 +1289,6 @@ class SupplierProposal extends CommonObject
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
- if ($obj->fk_statut == 0) {
- $this->brouillon = 1;
- }
-
// Retrieve all extrafield
// fetch optionals attributes and labels
$this->fetch_optionals();
@@ -1492,10 +1486,11 @@ class SupplierProposal extends CommonObject
}
$this->ref = $num;
- $this->brouillon = 0;
- $this->statut = 1;
+ $this->statut = self::STATUS_VALIDATED;
+ $this->status = self::STATUS_VALIDATED;
$this->user_valid_id = $user->id;
$this->datev = $now;
+ $this->date_validation = $now;
$this->db->commit();
return 1;
@@ -1916,8 +1911,8 @@ class SupplierProposal extends CommonObject
}
if (!$error) {
- $this->statut = self::STATUS_DRAFT;
- $this->brouillon = 1;
+ $this->status = self::STATUS_DRAFT;
+ $this->statut = self::STATUS_DRAFT; // dperecated
$this->db->commit();
return 1;
} else {