Merge pull request #10520 from aspangaro/develop

NEW: Add subledger in various payment
This commit is contained in:
Laurent Destailleur 2019-02-12 13:20:58 +01:00 committed by GitHub
commit 6f6a767255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 24 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -71,6 +71,8 @@ class PaymentVarious extends CommonObject
public $accountancy_code; public $accountancy_code;
public $subledger_account;
/** /**
* @var int ID * @var int ID
*/ */
@ -139,6 +141,7 @@ class PaymentVarious extends CommonObject
$sql.= " label='".$this->db->escape($this->label)."',"; $sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',"; $sql.= " note='".$this->db->escape($this->note)."',";
$sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',"; $sql.= " accountancy_code='".$this->db->escape($this->accountancy_code)."',";
$sql.= " subledger_account='".$this->db->escape($this->subledger_account)."',";
$sql.= " fk_projet='".$this->db->escape($this->fk_project)."',"; $sql.= " fk_projet='".$this->db->escape($this->fk_project)."',";
$sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").","; $sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").",";
$sql.= " fk_user_author=".$this->fk_user_author.","; $sql.= " fk_user_author=".$this->fk_user_author.",";
@ -196,6 +199,7 @@ class PaymentVarious extends CommonObject
$sql.= " v.label,"; $sql.= " v.label,";
$sql.= " v.note,"; $sql.= " v.note,";
$sql.= " v.accountancy_code,"; $sql.= " v.accountancy_code,";
$sql.= " v.subledger_account,";
$sql.= " v.fk_projet as fk_project,"; $sql.= " v.fk_projet as fk_project,";
$sql.= " v.fk_bank,"; $sql.= " v.fk_bank,";
$sql.= " v.fk_user_author,"; $sql.= " v.fk_user_author,";
@ -215,25 +219,26 @@ class PaymentVarious extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->tms = $this->db->jdate($obj->tms); $this->tms = $this->db->jdate($obj->tms);
$this->datep = $this->db->jdate($obj->datep); $this->datep = $this->db->jdate($obj->datep);
$this->datev = $this->db->jdate($obj->datev); $this->datev = $this->db->jdate($obj->datev);
$this->sens = $obj->sens; $this->sens = $obj->sens;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->type_payment = $obj->fk_typepayment; $this->type_payment = $obj->fk_typepayment;
$this->num_payment = $obj->num_payment; $this->num_payment = $obj->num_payment;
$this->label = $obj->label; $this->label = $obj->label;
$this->note = $obj->note; $this->note = $obj->note;
$this->accountancy_code = $obj->accountancy_code; $this->subledger_account = $obj->subledger_account;
$this->fk_project = $obj->fk_project; $this->accountancy_code = $obj->accountancy_code;
$this->fk_bank = $obj->fk_bank; $this->fk_project = $obj->fk_project;
$this->fk_user_author = $obj->fk_user_author; $this->fk_bank = $obj->fk_bank;
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_author = $obj->fk_user_author;
$this->fk_account = $obj->fk_account; $this->fk_user_modif = $obj->fk_user_modif;
$this->fk_type = $obj->fk_type; $this->fk_account = $obj->fk_account;
$this->rappro = $obj->rappro; $this->fk_type = $obj->fk_type;
$this->rappro = $obj->rappro;
} }
$this->db->free($resql); $this->db->free($resql);
@ -298,6 +303,7 @@ class PaymentVarious extends CommonObject
$this->amount=''; $this->amount='';
$this->label=''; $this->label='';
$this->accountancy_code=''; $this->accountancy_code='';
$this->subledger_account='';
$this->note=''; $this->note='';
$this->fk_bank=''; $this->fk_bank='';
$this->fk_user_author=''; $this->fk_user_author='';
@ -360,6 +366,7 @@ class PaymentVarious extends CommonObject
if ($this->note) $sql.= ", note"; if ($this->note) $sql.= ", note";
$sql.= ", label"; $sql.= ", label";
$sql.= ", accountancy_code"; $sql.= ", accountancy_code";
$sql.= ", subledger_account";
$sql.= ", fk_projet"; $sql.= ", fk_projet";
$sql.= ", fk_user_author"; $sql.= ", fk_user_author";
$sql.= ", datec"; $sql.= ", datec";
@ -376,6 +383,7 @@ class PaymentVarious extends CommonObject
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'"; if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
$sql.= ", '".$this->db->escape($this->label)."'"; $sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", '".$this->db->escape($this->accountancy_code)."'"; $sql.= ", '".$this->db->escape($this->accountancy_code)."'";
$sql.= ", '".$this->db->escape($this->subledger_account)."'";
$sql.= ", ".($this->fk_project > 0? $this->fk_project : 0); $sql.= ", ".($this->fk_project > 0? $this->fk_project : 0);
$sql.= ", ".$user->id; $sql.= ", ".$user->id;
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -48,9 +48,10 @@ $backtopage = GETPOST('backtopage', 'alpha');
$accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; $accountid=GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
$label=GETPOST("label", "alpha"); $label=GETPOST("label", "alpha");
$sens=GETPOST("sens", "int"); $sens=GETPOST("sens", "int");
$amount=GETPOST("amount"); $amount=GETPOST("amount", "alpha");
$paymenttype=GETPOST("paymenttype"); $paymenttype=GETPOST("paymenttype", "int");
$accountancy_code=GETPOST("accountancy_code", "int"); $accountancy_code=GETPOST("accountancy_code", "int");
$subledger_account=GETPOST("subledger_account", "int");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
// Security check // Security check
@ -112,7 +113,10 @@ if (empty($reshook))
$object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0; $object->type_payment=GETPOST("paymenttype", 'int') > 0 ? GETPOST("paymenttype", "int") : 0;
$object->num_payment=GETPOST("num_payment", 'alpha'); $object->num_payment=GETPOST("num_payment", 'alpha');
$object->fk_user_author=$user->id; $object->fk_user_author=$user->id;
$object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "int") : ""; $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "int") : "";
$object->subledger_account=GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "int") : "";
$object->sens=GETPOST('sens'); $object->sens=GETPOST('sens');
$object->fk_project= GETPOST('fk_project', 'int'); $object->fk_project= GETPOST('fk_project', 'int');
@ -325,6 +329,28 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Subledger account
if (! empty($conf->accounting->enabled))
{
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td>';
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{
print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, '');
}
else
{
print '<input type="text" name="subledger_account" value="'.$subledger_account.'">';
}
print '</td></tr>';
}
else // For external software
{
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="subledger_account" value="'.$subledger_account.'">';
print '</td></tr>';
}
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
@ -447,6 +473,13 @@ if ($id)
} }
print '</td></tr>'; print '</td></tr>';
// Subledger account
print '<tr><td class="nowrap">';
print $langs->trans("SubledgerAccount");
print '</td><td>';
print $object->subledger_account;
print '</td></tr>';
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($object->fk_account > 0) if ($object->fk_account > 0)

View File

@ -94,3 +94,4 @@ ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL; ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL;
ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32);

View File

@ -1,5 +1,5 @@
-- =================================================================== -- ===================================================================
-- Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> -- Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
-- --
-- This program is free software; you can redistribute it and/or modify -- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by -- it under the terms of the GNU General Public License as published by
@ -30,6 +30,7 @@ create table llx_payment_various
amount double(24,8) DEFAULT 0 NOT NULL, amount double(24,8) DEFAULT 0 NOT NULL,
fk_typepayment integer NOT NULL, fk_typepayment integer NOT NULL,
accountancy_code varchar(32), accountancy_code varchar(32),
subledger_account varchar(32),
fk_projet integer DEFAULT NULL, fk_projet integer DEFAULT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id entity integer DEFAULT 1 NOT NULL, -- multi company id
note text, note text,