FIX: Disallow line start date > end date
This commit is contained in:
parent
949ef79227
commit
7bfa49b29c
@ -7,6 +7,7 @@ For Users:
|
|||||||
NEW: Module Ticket is available as a stable module.
|
NEW: Module Ticket is available as a stable module.
|
||||||
NEW: Experimental module "Vendor receptions".
|
NEW: Experimental module "Vendor receptions".
|
||||||
NEW: Experimental module "BOM".
|
NEW: Experimental module "BOM".
|
||||||
|
FIX: Disallow line start date to be after end date
|
||||||
|
|
||||||
For Developers:
|
For Developers:
|
||||||
NEW: Module DebugBar is available as a stable module.
|
NEW: Module DebugBar is available as a stable module.
|
||||||
|
|||||||
@ -474,6 +474,12 @@ class Propal extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
@ -666,7 +672,7 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc, $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
||||||
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||||
@ -685,6 +691,12 @@ class Propal extends CommonObject
|
|||||||
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
if (! empty($qty) && $special_code == 3) $special_code=0; // Remove option tag
|
||||||
if (empty($type)) $type=0;
|
if (empty($type)) $type=0;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -1368,6 +1368,12 @@ class Commande extends CommonOrder
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
@ -2932,7 +2938,6 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if ($this->statut == Propal::STATUS_DRAFT)
|
if ($this->statut == Propal::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($qty)) $qty=0;
|
if (empty($qty)) $qty=0;
|
||||||
@ -2943,6 +2948,12 @@ class Commande extends CommonOrder
|
|||||||
if (empty($remise_percent)) $remise_percent=0;
|
if (empty($remise_percent)) $remise_percent=0;
|
||||||
if (empty($special_code) || $special_code == 3) $special_code=0;
|
if (empty($special_code) || $special_code == 3) $special_code=0;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty=price2num($qty);
|
||||||
$pu = price2num($pu);
|
$pu = price2num($pu);
|
||||||
@ -2952,6 +2963,8 @@ class Commande extends CommonOrder
|
|||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2=price2num($txlocaltax2);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||||
// qty, pu, remise_percent et txtva
|
// qty, pu, remise_percent et txtva
|
||||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
||||||
|
|||||||
@ -2721,6 +2721,12 @@ class Facture extends CommonInvoice
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
@ -2924,6 +2930,12 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|||||||
@ -1374,7 +1374,6 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
if ($this->statut >= 0)
|
if ($this->statut >= 0)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
@ -1407,6 +1406,14 @@ class Contrat extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($remise_percent)) $remise_percent=0;
|
if (empty($remise_percent)) $remise_percent=0;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||||
|
|
||||||
// Clean vat code
|
// Clean vat code
|
||||||
@ -1597,6 +1604,12 @@ class Contrat extends CommonObject
|
|||||||
$remise_percent=0;
|
$remise_percent=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx, $localtax1tx, $localtax2tx, $price_base_type, $info_bits");
|
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $date_debut_reel, $date_fin_reel, $tvatx, $localtax1tx, $localtax2tx, $price_base_type, $info_bits");
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|||||||
@ -1543,6 +1543,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
@ -2470,7 +2475,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
||||||
{
|
{
|
||||||
global $mysoc, $conf;
|
global $mysoc, $conf, $langs;
|
||||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
@ -2478,8 +2483,6 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if ($this->brouillon)
|
if ($this->brouillon)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($qty)) $qty=0;
|
if (empty($qty)) $qty=0;
|
||||||
if (empty($info_bits)) $info_bits=0;
|
if (empty($info_bits)) $info_bits=0;
|
||||||
@ -2500,6 +2503,13 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||||
// qty, pu, remise_percent et txtva
|
// qty, pu, remise_percent et txtva
|
||||||
|
|||||||
@ -1617,6 +1617,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if ($fk_product > 0)
|
if ($fk_product > 0)
|
||||||
@ -1837,7 +1843,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc, $langs;
|
||||||
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG);
|
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
@ -1850,6 +1856,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
|
//if (! is_numeric($pu) || ! is_numeric($qty)) return -1;
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
|
if ($date_start && $date_end && $date_start > $date_end) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorStartDateGreaterEnd');
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($vatrate)) $vatrate=0;
|
if (empty($vatrate)) $vatrate=0;
|
||||||
if (empty($txlocaltax1)) $txlocaltax1=0;
|
if (empty($txlocaltax1)) $txlocaltax1=0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user