Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
0c772945b6
@ -730,7 +730,7 @@ class AccountingAccount extends CommonObject
|
||||
* @param Product $product Product object sell or buy
|
||||
* @param Facture|FactureFournisseur $facture Facture
|
||||
* @param FactureLigne|SupplierInvoiceLine $factureDet Facture Det
|
||||
* @param array $accountingAccount Array of Account account
|
||||
* @param array $accountingAccount Array of Accounting account
|
||||
* @param string $type Customer / Supplier
|
||||
* @return array|int Accounting accounts suggested or < 0 if technical error.
|
||||
*/
|
||||
@ -868,20 +868,44 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
// Manage Deposit
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
if (getDolGlobalString('ACCOUNTING_ACCOUNT_' . strtoupper($type) . '_DEPOSIT')) {
|
||||
if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
if (isset($result) && $result < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
// For credit note invoice, if origin invoice is a deposit invoice, force also on specific customer/supplier deposit account
|
||||
if (!empty($facture->fk_facture_source)) {
|
||||
$invoiceSource = new $facture($this->db);
|
||||
$invoiceSource->fetch($facture->fk_facture_source);
|
||||
|
||||
if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) {
|
||||
$accountdeposittoventilated = new self($this->db);
|
||||
if ($type == 'customer') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
|
||||
} elseif ($type == 'supplier') {
|
||||
$accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1);
|
||||
}
|
||||
$code_l = $accountdeposittoventilated->ref;
|
||||
$code_p = '';
|
||||
$code_t = '';
|
||||
$suggestedid = $accountdeposittoventilated->rowid;
|
||||
$suggestedaccountingaccountfor = 'deposit';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If $suggestedid could not be guessed yet, we set it from the generic default accounting code $code_l
|
||||
|
||||
@ -142,7 +142,7 @@ if ($action == 'validatehistory') {
|
||||
}*/
|
||||
|
||||
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -237,7 +237,8 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -229,7 +229,7 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -579,6 +579,7 @@ if ($result) {
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -140,7 +140,7 @@ if ($action == 'validatehistory') {
|
||||
}*/
|
||||
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -233,7 +233,10 @@ if ($action == 'validatehistory') {
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facture_static->date = $objp->datef;
|
||||
$facture_static->ref_supplier = $objp->ref_supplier;
|
||||
$facture_static->label = $objp->invoice_label;
|
||||
$facture_static->date = $db->jdate($objp->datef);
|
||||
$facture_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facture_static_det->id = $objp->rowid;
|
||||
$facture_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -232,7 +232,7 @@ if (empty($chartaccountcode)) {
|
||||
}
|
||||
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype, f.fk_facture_source,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
@ -592,6 +592,7 @@ if ($result) {
|
||||
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||
$facturefourn_static->fk_facture_source = $objp->fk_facture_source;
|
||||
|
||||
$facturefourn_static_det->id = $objp->rowid;
|
||||
$facturefourn_static_det->total_ht = $objp->total_ht;
|
||||
|
||||
@ -30,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php';
|
||||
*/
|
||||
class mod_project_universal extends ModeleNumRefProjects
|
||||
{
|
||||
/**
|
||||
* @var DoliDB $db
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @var string
|
||||
|
||||
@ -127,6 +127,11 @@ abstract class ModeleNumRefProjects
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string $version
|
||||
*/
|
||||
public $version;
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
|
||||
@ -138,7 +138,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
|
||||
return 0;
|
||||
}
|
||||
|
||||
$date = $supplier_proposal->datep;
|
||||
$date = $supplier_proposal->date;
|
||||
$customercode = $objsoc->code_client;
|
||||
$numFinal = get_next_value($db, $mask, 'supplier_proposal', 'ref', '', $customercode, $date);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user