Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-03-02 17:42:24 +01:00
commit 81da38eb7f
17 changed files with 86 additions and 48 deletions

View File

@ -101,6 +101,10 @@ class ActionCommReminder extends CommonObject
public $entity;
public $dateremind;
/**
* @var string reminder type email, browser, sms
*/
public $typeremind;
/**
@ -108,7 +112,14 @@ class ActionCommReminder extends CommonObject
*/
public $fk_user;
/**
* @var int offset value
*/
public $offsetvalue;
/**
* @var string y, m, d, w, h, i
*/
public $offsetunit;
/**
@ -130,11 +141,8 @@ class ActionCommReminder extends CommonObject
* @var int Template Mail
*/
public $fk_email_template;
// END MODULEBUILDER PROPERTIES
/**
* Constructor
*

View File

@ -213,6 +213,10 @@ class Propal extends CommonObject
public $cond_reglement_code;
public $deposit_percent;
public $mode_reglement_code;
/**
* @deprecated
*/
public $remise_percent;
/**
@ -314,7 +318,7 @@ class Propal extends CommonObject
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
//'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
@ -1103,9 +1107,9 @@ class Propal extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
$sql .= "fk_soc";
$sql .= ", price";
$sql .= ", remise";
$sql .= ", remise_percent";
$sql .= ", remise_absolue";
$sql .= ", remise"; // deprecated
$sql .= ", remise_percent"; // deprecated
$sql .= ", remise_absolue"; // deprecated
$sql .= ", total_tva";
$sql .= ", total_ttc";
$sql .= ", datep";
@ -1139,7 +1143,7 @@ class Propal extends CommonObject
$sql .= $this->socid;
$sql .= ", 0";
$sql .= ", ".((float) $this->remise); // deprecated
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL');
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL'); // deprecated
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL'); // deprecated
$sql .= ", 0";
$sql .= ", 0";
@ -1595,10 +1599,11 @@ class Propal extends CommonObject
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->total = $obj->total_ttc; // TODO deprecated
$this->remise = $obj->remise; // TODO deprecated
$this->remise_percent = $obj->remise_percent; // TODO deprecated
$this->remise_absolue = $obj->remise_absolue; // TODO deprecated
$this->total = $obj->total_ttc; // TODO deprecated
$this->total_ttc = $obj->total_ttc;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
@ -2451,6 +2456,7 @@ class Propal extends CommonObject
* @param double $remise Amount discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
* @deprecated remise_percent is a deprecated field for object parent
*/
public function set_remise_percent($user, $remise, $notrigger = 0)
{

View File

@ -210,7 +210,11 @@ class Commande extends CommonOrder
*/
public $fk_remise_except;
/**
* @deprecated
*/
public $remise_percent;
public $remise_absolue;
public $info_bits;
public $rang;
@ -320,7 +324,7 @@ class Commande extends CommonOrder
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
@ -974,7 +978,7 @@ class Commande extends CommonOrder
$sql .= ", ".(!empty($this->shipping_method_id) && $this->shipping_method_id > 0 ? ((int) $this->shipping_method_id) : 'NULL');
$sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL');
$sql .= ", ".($this->remise_absolue > 0 ? $this->db->escape($this->remise_absolue) : 'NULL');
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0);
$sql .= ", ".($this->remise_percent > 0 ? $this->db->escape($this->remise_percent) : 0); // TODO deprecated
$sql .= ", ".(int) $this->fk_incoterms;
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
$sql .= ", ".setEntity($this);
@ -1920,7 +1924,7 @@ class Commande extends CommonOrder
$this->date_validation = $this->db->jdate($obj->date_valid);
$this->date_modification = $this->db->jdate($obj->tms);
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_percent = $obj->remise_percent; // TODO deprecated
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->billed = $obj->billed;
@ -2458,6 +2462,7 @@ class Commande extends CommonOrder
* @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
* @deprecated remise_percent is a deprecated field for object parent
*/
public function setDiscount($user, $remise, $notrigger = 0)
{

View File

@ -163,7 +163,12 @@ class Facture extends CommonInvoice
// Warning: Do not set default value into property defintion. it must stay null.
// For example to avoid to have substition done when object is generic and not yet defined.
public $remise_absolue;
/**
* @deprecated
*/
public $remise_percent;
public $total_ht;
public $total_tva;
public $total_localtax1;
@ -320,7 +325,7 @@ class Facture extends CommonInvoice
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
//'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>91),
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>92),
@ -560,7 +565,7 @@ class Facture extends CommonInvoice
// Fields always coming from template
$this->remise_absolue = $_facrec->remise_absolue;
$this->remise_percent = $_facrec->remise_percent;
$this->remise_percent = $_facrec->remise_percent; // TODO deprecated
$this->fk_incoterms = $_facrec->fk_incoterms;
$this->location_incoterms = $_facrec->location_incoterms;
@ -664,7 +669,7 @@ class Facture extends CommonInvoice
$sql .= ", fk_soc";
$sql .= ", datec";
$sql .= ", remise_absolue";
$sql .= ", remise_percent";
$sql .= ", remise_percent"; // TODO deprecated
$sql .= ", datef";
$sql .= ", date_pointoftax";
$sql .= ", note_private";
@ -690,7 +695,7 @@ class Facture extends CommonInvoice
$sql .= ", ".((int) $socid);
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".($this->remise_absolue > 0 ? $this->remise_absolue : 'NULL');
$sql .= ", ".($this->remise_percent > 0 ? $this->remise_percent : 'NULL');
$sql .= ", ".($this->remise_percent > 0 ? $this->remise_percent : 'NULL'); // TODO deprecated
$sql .= ", '".$this->db->idate($this->date)."'";
$sql .= ", ".(empty($this->date_pointoftax) ? "null" : "'".$this->db->idate($this->date_pointoftax)."'");
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
@ -1154,7 +1159,7 @@ class Facture extends CommonInvoice
$facture->cond_reglement_id = $this->cond_reglement_id;
$facture->mode_reglement_id = $this->mode_reglement_id;
$facture->remise_absolue = $this->remise_absolue;
$facture->remise_percent = $this->remise_percent;
$facture->remise_percent = $this->remise_percent; // TODO deprecated
$facture->origin = $this->origin;
$facture->origin_id = $this->origin_id;
@ -2032,7 +2037,7 @@ class Facture extends CommonInvoice
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = $this->db->jdate($obj->datem);
$this->datem = $this->db->jdate($obj->datem);
$this->remise_percent = $obj->remise_percent;
$this->remise_percent = $obj->remise_percent; // TODO deprecated
$this->remise_absolue = $obj->remise_absolue;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva;
@ -2368,7 +2373,7 @@ class Facture extends CommonInvoice
$sql .= " date_pointoftax=".(strval($this->date_pointoftax) != '' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
$sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
$sql .= " paye=".(isset($this->paye) ? $this->db->escape($this->paye) : 0).",";
$sql .= " remise_percent=".(isset($this->remise_percent) ? $this->db->escape($this->remise_percent) : "null").",";
$sql .= " remise_percent=".(isset($this->remise_percent) ? $this->db->escape($this->remise_percent) : "null").","; // TODO deprecated
$sql .= " remise_absolue=".(isset($this->remise_absolue) ? $this->db->escape($this->remise_absolue) : "null").",";
$sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").",";
$sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").",";
@ -4285,6 +4290,7 @@ class Facture extends CommonInvoice
* @param double $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
* @deprecated remise_percent is a deprecated field for object parent
*/
public function setDiscount($user, $remise, $notrigger = 0)
{
@ -5768,6 +5774,7 @@ class Facture extends CommonInvoice
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
$sql .= " WHERE type = " . (int) $this->type ;
$sql .= " AND date_valid IS NOT NULL";
$sql .= " AND entity IN (".getEntity('invoice').")";
$sql .= " ORDER BY datef DESC LIMIT 1";
$result = $this->db->query($sql);

View File

@ -689,7 +689,8 @@ class pdf_standard_asset extends ModelePDFAsset
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -697,7 +698,7 @@ class pdf_standard_asset extends ModelePDFAsset
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -542,7 +542,8 @@ class pdf_einstein extends ModelePDFCommandes
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -550,7 +551,7 @@ class pdf_einstein extends ModelePDFCommandes
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -767,7 +767,8 @@ class pdf_eratosthene extends ModelePDFCommandes
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -775,7 +776,7 @@ class pdf_eratosthene extends ModelePDFCommandes
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -761,7 +761,8 @@ class pdf_crabe extends ModelePDFFactures
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -769,7 +770,7 @@ class pdf_crabe extends ModelePDFFactures
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -925,7 +925,8 @@ class pdf_sponge extends ModelePDFFactures
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -933,7 +934,7 @@ class pdf_sponge extends ModelePDFFactures
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -653,7 +653,8 @@ class pdf_azur extends ModelePDFPropales
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -661,7 +662,7 @@ class pdf_azur extends ModelePDFPropales
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -777,7 +777,8 @@ class pdf_cyan extends ModelePDFPropales
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -785,7 +786,7 @@ class pdf_cyan extends ModelePDFPropales
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -694,9 +694,10 @@ class pdf_eagle_proforma extends ModelePDFCommandes
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) $tvaligne -= ($tvaligne * $object->remise_percent) / 100;
if ($object->remise_percent) $localtax1ligne -= ($localtax1ligne * $object->remise_percent) / 100;
if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
if ($object->remise_percent) $localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -508,9 +508,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$localtax1ligne = $object->lines[$i]->total_localtax1;
$localtax2ligne = $object->lines[$i]->total_localtax2;
if (!empty($object->remise_percent)) {
// TODO remise_percent is an obsolete field for object parent
/*if (!empty($object->remise_percent)) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;
$localtax1rate = (string) $object->lines[$i]->localtax1_tx;

View File

@ -706,7 +706,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if (!empty($object->remise_percent)) {
// TODO remise_percent is an obsolete field for object parent
/*if (!empty($object->remise_percent)) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if (!empty($object->remise_percent)) {
@ -714,7 +715,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
}
if (!empty($object->remise_percent)) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -586,7 +586,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if (!empty($object->remise_percent)) {
// TODO remise_percent is an obsolete field for object parent
/*if (!empty($object->remise_percent)) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if (!empty($object->remise_percent)) {
@ -594,7 +595,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
if (!empty($object->remise_percent)) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -563,7 +563,8 @@ class pdf_aurore extends ModelePDFSupplierProposal
$localtax1_type = $object->lines[$i]->localtax1_type;
$localtax2_type = $object->lines[$i]->localtax2_type;
if ($object->remise_percent) {
// TODO remise_percent is an obsolete field for object parent
/*if ($object->remise_percent) {
$tvaligne -= ($tvaligne * $object->remise_percent) / 100;
}
if ($object->remise_percent) {
@ -571,7 +572,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
if ($object->remise_percent) {
$localtax2ligne -= ($localtax2ligne * $object->remise_percent) / 100;
}
}*/
$vatrate = (string) $object->lines[$i]->tva_tx;

View File

@ -10,7 +10,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -464,7 +464,7 @@ if (!empty($searchCategoryProductList)) {
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);