Correct travis & licence
This commit is contained in:
parent
3b8a3ccb14
commit
0721974c05
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
@ -15,9 +15,7 @@
|
|||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -211,7 +211,7 @@ if ($action == 'create') {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$book = new BookKeeping($db);
|
$book = new BookKeeping($db);
|
||||||
$next_num_mvt = $book->next_num_mvt();
|
$next_num_mvt = $book->getNextNumMvt();
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
||||||
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
||||||
|
|||||||
@ -2,11 +2,11 @@
|
|||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
@ -21,14 +21,14 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/bookkeeping.class.php
|
* \file htdocs/accountancy/class/bookkeeping.class.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Fichier de la classe des comptes comptable
|
* \brief File of class to manage book keeping
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class BookKeeping
|
* Class to manage accountancy book keeping
|
||||||
* \brief Classe permettant la gestion des comptes generaux de compta
|
|
||||||
*/
|
*/
|
||||||
class BookKeeping {
|
class BookKeeping
|
||||||
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $id;
|
var $id;
|
||||||
var $doc_date;
|
var $doc_date;
|
||||||
@ -50,48 +50,27 @@ class BookKeeping {
|
|||||||
var $linesexport = array ();
|
var $linesexport = array ();
|
||||||
var $linesmvt = array ();
|
var $linesmvt = array ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur de la classe
|
* Constructor
|
||||||
* \param DB handler acces base de donnees
|
*
|
||||||
* \param id id compte (0 par defaut)
|
* @param DoliDB $db Database handler
|
||||||
*/
|
*/
|
||||||
function BookKeeping($db) {
|
function __construct($db)
|
||||||
$this->db = $db;
|
{
|
||||||
}
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load record in memory
|
* Load a line into memory from database
|
||||||
*/
|
*
|
||||||
function fetch_per_mvt($piecenum) {
|
* @param int $id id of line to get
|
||||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
* @return int <0 if KO, >0 if OK
|
||||||
$sql .= " piece_num = '" . $piecenum . "'";
|
*/
|
||||||
|
function fetch($id)
|
||||||
dol_syslog(get_class($this) . "fetch_per_mvt sql=" . $sql, LOG_DEBUG);
|
{
|
||||||
$result = $this->db->query($sql);
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
if ($result) {
|
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers, ";
|
||||||
$obj = $this->db->fetch_object($result);
|
$sql .= " numero_compte, label_compte, debit, credit, ";
|
||||||
|
|
||||||
$this->piece_num = $obj->piece_num;
|
|
||||||
$this->code_journal = $obj->code_journal;
|
|
||||||
$this->doc_date = $this->db->jdate($obj->doc_date);
|
|
||||||
$this->doc_ref = $obj->doc_ref;
|
|
||||||
$this->doc_type = $obj->doc_type;
|
|
||||||
} else {
|
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
|
||||||
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR);
|
|
||||||
return - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Load record in memory
|
|
||||||
*/
|
|
||||||
function fetch($id) {
|
|
||||||
$sql = "SELECT rowid, doc_date, doc_type, ";
|
|
||||||
$sql .= "doc_ref, fk_doc, fk_docdet, code_tiers, ";
|
|
||||||
$sql .= "numero_compte, label_compte, debit, credit, ";
|
|
||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num ";
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
||||||
$sql .= " WHERE rowid = '" . $id . "'";
|
$sql .= " WHERE rowid = '" . $id . "'";
|
||||||
@ -117,7 +96,9 @@ class BookKeeping {
|
|||||||
$this->sens = $obj->sens;
|
$this->sens = $obj->sens;
|
||||||
$this->code_journal = $obj->code_journal;
|
$this->code_journal = $obj->code_journal;
|
||||||
$this->piece_num = $obj->piece_num;
|
$this->piece_num = $obj->piece_num;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::fetch " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::fetch " . $this->error, LOG_ERR);
|
||||||
return - 1;
|
return - 1;
|
||||||
@ -127,32 +108,73 @@ class BookKeeping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return next num mvt
|
* Load an accounting document into memory from database
|
||||||
*/
|
*
|
||||||
function next_num_mvt() {
|
* @param int $piecenum Accounting document to get
|
||||||
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch_per_mvt($piecenum)
|
||||||
|
{
|
||||||
|
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||||
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||||
|
$sql .= " WHERE piece_num = '" . $piecenum . "'";
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "next_num_mvt sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "fetch_per_mvt sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
return $obj->max;
|
$this->piece_num = $obj->piece_num;
|
||||||
|
$this->code_journal = $obj->code_journal;
|
||||||
|
$this->doc_date = $this->db->jdate($obj->doc_date);
|
||||||
|
$this->doc_ref = $obj->doc_ref;
|
||||||
|
$this->doc_type = $obj->doc_type;
|
||||||
} else {
|
} else {
|
||||||
$this->error = "Error " . $this->db->lasterror();
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR);
|
||||||
return - 1;
|
return - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load record in memory
|
* Return next number movement
|
||||||
*/
|
*
|
||||||
function fetch_all_per_mvt($piecenum) {
|
* @return string Last number
|
||||||
$sql = "SELECT rowid, doc_date, doc_type, ";
|
*/
|
||||||
$sql .= "doc_ref, fk_doc, fk_docdet, code_tiers, ";
|
function getNextNumMvt() {
|
||||||
$sql .= "numero_compte, label_compte, debit, credit, ";
|
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num ";
|
|
||||||
|
dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG);
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
return $obj->max;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this) . "::getNextNumMvt " . $this->error, LOG_ERR);
|
||||||
|
return - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all informations of accountancy document
|
||||||
|
*
|
||||||
|
* @param int $piecenum id of line to get
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function fetch_all_per_mvt($piecenum)
|
||||||
|
{
|
||||||
|
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||||
|
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||||
|
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||||
|
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
||||||
$sql .= " WHERE piece_num = '" . $piecenum . "'";
|
$sql .= " WHERE piece_num = '" . $piecenum . "'";
|
||||||
|
|
||||||
@ -224,12 +246,14 @@ class BookKeeping {
|
|||||||
|
|
||||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||||
$resqlnum = $this->db->query($sqlnum);
|
$resqlnum = $this->db->query($sqlnum);
|
||||||
if ($resqlnum) {
|
if ($resqlnum)
|
||||||
|
{
|
||||||
$objnum = $this->db->fetch_object($resqlnum);
|
$objnum = $this->db->fetch_object($resqlnum);
|
||||||
$this->piece_num = $objnum->piece_num;
|
$this->piece_num = $objnum->piece_num;
|
||||||
}
|
}
|
||||||
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
dol_syslog(get_class($this) . ":: create this->piece_num=" . $this->piece_num, LOG_DEBUG);
|
||||||
if (empty($this->piece_num)) {
|
if (empty($this->piece_num))
|
||||||
|
{
|
||||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
$sqlnum .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
|
||||||
|
|
||||||
@ -317,18 +341,18 @@ class BookKeeping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create object into database
|
* Create object into database
|
||||||
*
|
*
|
||||||
* @param User $user that creates
|
* @param User $user Object user that create
|
||||||
* @param int $notrigger triggers after, 1=disable triggers
|
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
|
||||||
* @return int <0 if KO, Id of created object if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function create_std($user, $notrigger = 0) {
|
function create_std($user, $notrigger = 0)
|
||||||
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
if (isset($this->doc_type))
|
if (isset($this->doc_type))
|
||||||
$this->doc_type = trim($this->doc_type);
|
$this->doc_type = trim($this->doc_type);
|
||||||
if (isset($this->doc_ref))
|
if (isset($this->doc_ref))
|
||||||
@ -360,12 +384,11 @@ class BookKeeping {
|
|||||||
if (isset($this->piece_num))
|
if (isset($this->piece_num))
|
||||||
$this->piece_num = trim($this->piece_num);
|
$this->piece_num = trim($this->piece_num);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add control on parameters values
|
// Put here code to add control on parameters values
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping(";
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping(";
|
||||||
|
|
||||||
$sql .= "doc_date,";
|
$sql .= "doc_date,";
|
||||||
$sql .= "doc_type,";
|
$sql .= "doc_type,";
|
||||||
$sql .= "doc_ref,";
|
$sql .= "doc_ref,";
|
||||||
@ -444,18 +467,18 @@ class BookKeeping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update object into database
|
* Update object into database
|
||||||
*
|
*
|
||||||
* @param User $user that modifies
|
* @param User $user Object user that create
|
||||||
* @param int $notrigger triggers after, 1=disable triggers
|
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update($user = 0, $notrigger = 0) {
|
function update($user = 0, $notrigger = 0)
|
||||||
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|
||||||
if (isset($this->doc_type))
|
if (isset($this->doc_type))
|
||||||
$this->doc_type = trim($this->doc_type);
|
$this->doc_type = trim($this->doc_type);
|
||||||
if (isset($this->doc_ref))
|
if (isset($this->doc_ref))
|
||||||
@ -487,8 +510,8 @@ class BookKeeping {
|
|||||||
if (isset($this->piece_num))
|
if (isset($this->piece_num))
|
||||||
$this->piece_num = trim($this->piece_num);
|
$this->piece_num = trim($this->piece_num);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
@ -550,11 +573,11 @@ class BookKeeping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete object in database
|
* Delete object in database
|
||||||
*
|
*
|
||||||
* @param User $user that deletes
|
* @param User $user Object user that create
|
||||||
* @param int $notrigger triggers after, 1=disable triggers
|
* @param int $notrigger 1=Does not execute triggers, 0 otherwise
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger = 0) {
|
function delete($user, $notrigger = 0) {
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
@ -652,7 +675,9 @@ class BookKeeping {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class BookKeepingLine {
|
|
||||||
|
class BookKeepingLine
|
||||||
|
{
|
||||||
var $id;
|
var $id;
|
||||||
var $doc_date;
|
var $doc_date;
|
||||||
var $doc_type;
|
var $doc_type;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* 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
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user