Merge branch 'Upstream/develop'

This commit is contained in:
aspangaro 2014-09-02 20:47:27 +02:00
commit e4f51d8f7a
48 changed files with 514 additions and 443 deletions

View File

@ -105,6 +105,8 @@ For users:
- Fix: debian script syntax error
- Fix: error "menu param is not inside list" into pos module.
- Fix: Salary payments are not reflected on the reporting sheets
- Fix: Unsubscribe emailing not working
- Fix: Trigger on create category call failed because user is not passed on card
***** ChangeLog for 3.6 compared to 3.5.* *****
For users:
@ -236,9 +238,9 @@ Fix: Link product, In list view and label product.
Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to.
Fix: When disabled, all fields to add time into task line must be disabled.
Fix: Missing include files.lib.php in some pages that use dol_delete_recursive
Fix: Missing include files.lib.php in some pages ti use dol_delete_recursive.
Fix: [ bug #1558 ] Product/service edit page title shows new Ref instead of old ref.
Fix: [ bug #1553 ] Saving User displays setup removes menu.
Fix: [ bug #1544 ] Can remove date from invoice
***** ChangeLog for 3.5.4 compared to 3.5.3 *****
Fix: Hide title of event when agenda module disabled.

View File

@ -1,5 +1,5 @@
<?PHP
/*
/*
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
@ -34,7 +34,7 @@ if (! $res && file_exists("../../../main.inc.php"))
$res = @include ("../../../main.inc.php");
if (! $res)
die("Include of main fails");
// Class
dol_include_once("/core/lib/report.lib.php");
dol_include_once("/core/lib/date.lib.php");
@ -73,13 +73,13 @@ $resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
/*
* view
*/
print '<br><br>';
print '<table class="noborder" width="100%">';
print '<td align="left">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
@ -88,13 +88,13 @@ if ($resql) {
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
$var = True;
while ( $i < min($num, 250) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0)
@ -102,7 +102,7 @@ if ($resql) {
else
$compta_prodsell = (! empty($conf->global->COMPTA_SERVICE_SOLD_ACCOUNT) ? $conf->global->COMPTA_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0)
@ -110,12 +110,12 @@ if ($resql) {
else
$compta_prodbuy = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
// Ref produit
$product_static->ref = $objp->p . ref;
$product_static->ref = $objp->ref;
$product_static->id = $objp->rowid;
$product_static->type = $objp->type;
print '<td>';
@ -127,13 +127,13 @@ if ($resql) {
print '<td align="left">' . $obj->ref . '</td>';
print '<td align="left">' . $obj->label . '</td>';
print '<td align="left">' . $obj->description . '</td>';
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
print '<td align="left">' . $compta_prodbuy . '</td>';
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
print '<td align="left">' . $compta_prodsell . '</td>';
print "</tr>\n";
$i ++;
}

View File

@ -24,10 +24,10 @@
*/
/**
* \class AccountancySystem
* \brief Classe to manage accountancy systems
* Class to manage accountancy systems
*/
class AccountancySystem {
class AccountancySystem
{
var $db;
var $error;
var $rowid;
@ -37,7 +37,7 @@ class AccountancySystem {
var $label;
var $account_number;
var $account_parent;
/**
* Constructor
*
@ -46,7 +46,7 @@ class AccountancySystem {
function __construct($db) {
$this->db = $db;
}
/**
* Insert accountancy system name into database
*
@ -55,16 +55,16 @@ class AccountancySystem {
*/
function create($user) {
$now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " (date_creation, fk_user_author, numero,intitule)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->intitule . "')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
if ($id > 0) {
$this->id = $id;
$result = $this->id;
@ -78,7 +78,7 @@ class AccountancySystem {
$this->error = "AccountancySystem::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
}

View File

@ -24,10 +24,10 @@
*/
/**
* \class AccountingAccount
* \brief Classe permettant la gestion des comptes generaux de compta
* Classe permettant la gestion des comptes generaux de compta
*/
class AccountingAccount {
class AccountingAccount
{
var $db;
var $id;
var $rowid;
@ -41,7 +41,7 @@ class AccountingAccount {
var $fk_user_author;
var $fk_user_modif;
var $active;
/**
* \brief Constructeur de la classe
* \param DB handler acces base de donnees
@ -49,11 +49,11 @@ class AccountingAccount {
*/
function __construct($db, $rowid = '') {
$this->db = $db;
if ($rowid != '')
return $this->fetch($rowid);
}
/**
* \brief Load record in memory
*/
@ -65,7 +65,7 @@ class AccountingAccount {
} elseif ($account_number) {
$sql .= " account_number = '" . $account_number . "'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -74,7 +74,7 @@ class AccountingAccount {
return null;
}
}
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->datec = $obj->datec;
@ -88,10 +88,10 @@ class AccountingAccount {
$this->fk_user_author = $obj->fk_user_author;
$this->fk_user_modif = $obj->fk_user_modif;
$this->active = $obj->active;
return $obj->rowid;
}
/**
* \brief insert line in accountingaccount
* \param user utilisateur qui effectue l'insertion
@ -99,7 +99,7 @@ class AccountingAccount {
function create($user, $notrigger = 0) {
global $conf, $langs;
$error = 0;
// Clean parameters
if (isset($this->fk_pcg_version))
$this->fk_pcg_version = trim($this->fk_pcg_version);
@ -117,13 +117,13 @@ class AccountingAccount {
$this->fk_user_author = trim($this->fk_user_author);
if (isset($this->active))
$this->active = trim($this->active);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accountingaccount(";
$sql .= "datec";
$sql .= ", entity";
$sql .= ", fk_pcg_version";
@ -134,9 +134,9 @@ class AccountingAccount {
$sql .= ", label";
$sql .= ", fk_user_author";
$sql .= ", active";
$sql .= ") VALUES (";
$sql .= " '" . $this->db->idate($now) . "'";
$sql .= ", " . $conf->entity;
$sql .= ", " . (! isset($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
@ -147,25 +147,25 @@ class AccountingAccount {
$sql .= ", " . (! isset($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . $user->id;
$sql .= ", " . (! isset($this->active) ? 'NULL' : "'" . $this->db->escape($this->active) . "'");
$sql .= ")";
$this->db->begin();
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accountingaccount");
if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
@ -174,7 +174,7 @@ class AccountingAccount {
// // End call triggers
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -188,7 +188,7 @@ class AccountingAccount {
return $this->id;
}
}
/**
* Update record
*
@ -197,9 +197,9 @@ class AccountingAccount {
*/
function update($user) {
global $langs;
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount ";
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
$sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null");
@ -209,9 +209,9 @@ class AccountingAccount {
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = '" . $this->active . "'";
$sql .= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@ -223,7 +223,7 @@ class AccountingAccount {
return - 1;
}
}
/**
* Check usage of accounting code
*
@ -232,16 +232,16 @@ class AccountingAccount {
*/
function checkUsage() {
global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
$sql .= "UNION";
$sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num > 0) {
@ -255,7 +255,7 @@ class AccountingAccount {
return - 1;
}
}
/**
* Delete object in database
*
@ -266,18 +266,18 @@ class AccountingAccount {
function delete($user, $notrigger = 0) {
global $conf, $langs;
$error = 0;
$result = $this->checkUsage();
if ($result > 0) {
$this->db->begin();
if (! $error) {
if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
@ -286,11 +286,11 @@ class AccountingAccount {
// // End call triggers
}
}
if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accountingaccount";
$sql .= " WHERE rowid=" . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql);
$resql = $this->db->query($sql);
if (! $resql) {
@ -298,7 +298,7 @@ class AccountingAccount {
$this->errors[] = "Error " . $this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -315,7 +315,7 @@ class AccountingAccount {
return - 1;
}
}
/**
* Information on record
*
@ -326,10 +326,10 @@ class AccountingAccount {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as a';
$sql .= ' WHERE a.rowid = ' . $id;
dol_syslog(get_class($this) . '::info sql=' . $sql);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
@ -352,7 +352,7 @@ class AccountingAccount {
dol_print_error($this->db);
}
}
/**
* Account desactivate
*
@ -361,19 +361,19 @@ class AccountingAccount {
*/
function account_desactivate($id) {
global $langs;
$result = $this->checkUsage();
if ($result > 0) {
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount ";
$sql .= "SET active = '0'";
$sql .= " WHERE rowid = ".$this->db->escape($id);
dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$this->db->commit();
return 1;
@ -386,7 +386,7 @@ class AccountingAccount {
return - 1;
}
}
/**
* Account activate
*
@ -395,13 +395,13 @@ class AccountingAccount {
*/
function account_activate($id) {
global $langs;
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount ";
$sql .= "SET active = '1'";
$sql .= " WHERE rowid = ".$this->db->escape($id);
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.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
* it under the terms of the GNU General Public License as published by
@ -49,7 +49,7 @@ class BookKeeping
var $piece_num;
var $linesexport = array ();
var $linesmvt = array ();
/**
* Constructor
*
@ -59,7 +59,7 @@ class BookKeeping
{
$this->db = $db;
}
/**
* Load a line into memory from database
*
@ -74,14 +74,14 @@ class BookKeeping
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sql .= " WHERE rowid = '" . $id . "'";
dol_syslog(get_class($this) . "fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->doc_date = $this->db->jdate($obj->doc_date);
$this->doc_type = $obj->doc_type;
$this->doc_ref = $obj->doc_ref;
@ -103,10 +103,10 @@ class BookKeeping
dol_syslog(get_class($this) . "::fetch " . $this->error, LOG_ERR);
return - 1;
}
return 1;
}
/**
* Load an accounting document into memory from database
*
@ -118,12 +118,12 @@ class BookKeeping
$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) . "fetch_per_mvt sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$this->piece_num = $obj->piece_num;
$this->code_journal = $obj->code_journal;
$this->doc_date = $this->db->jdate($obj->doc_date);
@ -134,10 +134,10 @@ class BookKeeping
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR);
return - 1;
}
return 1;
}
/**
* Return next number movement
*
@ -145,14 +145,14 @@ class BookKeeping
*/
function getNextNumMvt() {
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
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
@ -162,7 +162,7 @@ class BookKeeping
return - 1;
}
}
/**
* Load all informations of accountancy document
*
@ -177,17 +177,17 @@ class BookKeeping
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sql .= " WHERE piece_num = '" . $piecenum . "'";
dol_syslog(get_class($this) . "fetch_all_per_mvt sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
while ( $obj = $this->db->fetch_object($result) ) {
$line = new BookKeepingLine();
$line->id = $obj->rowid;
$line->doc_date = $this->db->jdate($obj->doc_date);
$line->doc_type = $obj->doc_type;
$line->doc_ref = $obj->doc_ref;
@ -202,7 +202,7 @@ class BookKeeping
$line->sens = $obj->sens;
$line->code_journal = $obj->code_journal;
$line->piece_num = $obj->piece_num;
$this->linesmvt[] = $line;
}
} else {
@ -210,40 +210,43 @@ class BookKeeping
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR);
return - 1;
}
return 1;
}
/**
* \brief Insert line into bookkeeping
* \param user User who inserted operation
* Insert line into bookkeeping
*
* @param User $user User who inserted operation
* @return $result Result
*/
function create() {
function create($user='')
{
global $conf, $user, $langs;
$this->piece_num = 0;
// first check if line not yet in bookkeeping
$sql = "SELECT count(*)";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
$sql .= " AND fk_docdet = " . $this->fk_docdet;
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$row = $this->db->fetch_array($resql);
if ($row[0] == 0) {
// Determine piece_num
$sqlnum = "SELECT piece_num";
$sqlnum .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'";
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum)
@ -256,7 +259,7 @@ class BookKeeping
{
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum) {
@ -268,11 +271,11 @@ class BookKeeping
if (empty($this->piece_num)) {
$this->piece_num = 1;
}
$now = dol_now();
if (empty($this->date_create))
$this->date_create = $now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, ";
$sql .= "doc_type, doc_ref,fk_doc,fk_docdet,code_tiers,numero_compte,label_compte,";
$sql .= "debit,credit,montant,sens,fk_user_author,import_key,code_journal,piece_num)";
@ -280,12 +283,12 @@ class BookKeeping
$sql .= $this->fk_docdet . ",'" . $this->code_tiers . "','" . $this->numero_compte . "','" . $this->db->escape($this->label_compte) . "',";
$sql .= $this->debit . "," . $this->credit . "," . $this->montant . ",'" . $this->sens . "'," . $user->id . ", '";
$sql .= $this->date_create . "','" . $this->code_journal . "'," . $this->piece_num . ")";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_bookkeeping");
if ($id > 0) {
$this->id = $id;
$result = 0;
@ -305,27 +308,30 @@ class BookKeeping
$result = - 5;
dol_syslog("BookKeeping::Create Erreur $result SELECT Mysql");
}
return $result;
}
/**
* \brief Delete bookkepping by importkey
* Delete bookkepping by importkey
*
* @param string $importkey Import key
* @return int Result
*/
function delete_by_importkey($importkey) {
$this->db->begin();
// first check if line not yet in bookkeeping
$sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping ";
$sql .= " WHERE import_key = '" . $importkey . "'";
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -339,7 +345,7 @@ class BookKeeping
return 1;
}
}
/**
* Create object into database
*
@ -351,7 +357,7 @@ class BookKeeping
{
global $conf, $langs;
$error = 0;
// Clean parameters
if (isset($this->doc_type))
$this->doc_type = trim($this->doc_type);
@ -383,10 +389,10 @@ class BookKeeping
$this->code_journal = trim($this->code_journal);
if (isset($this->piece_num))
$this->piece_num = trim($this->piece_num);
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping(";
$sql .= "doc_date,";
@ -405,9 +411,9 @@ class BookKeeping
$sql .= "import_key,";
$sql .= "code_journal,";
$sql .= "piece_num";
$sql .= ") VALUES (";
$sql .= " " . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : $this->db->idate($this->doc_date)) . ",";
$sql .= " " . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ",";
$sql .= " " . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ",";
@ -424,25 +430,25 @@ class BookKeeping
$sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ",";
$sql .= " " . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ",";
$sql .= " " . (! isset($this->piece_num) ? 'NULL' : "'" . $this->piece_num . "'") . "";
$sql .= ")";
$this->db->begin();
dol_syslog(get_class($this) . "::create_std sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_bookkeeping");
if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
@ -451,7 +457,7 @@ class BookKeeping
// // End call triggers
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -465,7 +471,7 @@ class BookKeeping
return $this->id;
}
}
/**
* Update object into database
*
@ -477,7 +483,7 @@ class BookKeeping
{
global $conf, $langs;
$error = 0;
// Clean parameters
if (isset($this->doc_type))
$this->doc_type = trim($this->doc_type);
@ -509,13 +515,13 @@ class BookKeeping
$this->code_journal = trim($this->code_journal);
if (isset($this->piece_num))
$this->piece_num = trim($this->piece_num);
// Check parameters
// Put here code to add a control on parameters values
// Update request
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql .= " doc_date=" . (dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ",";
$sql .= " doc_type=" . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ",";
$sql .= " doc_ref=" . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ",";
@ -532,23 +538,23 @@ class BookKeeping
$sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ",";
$sql .= " code_journal=" . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ",";
$sql .= " piece_num=" . (isset($this->piece_num) ? $this->piece_num : "null") . "";
$sql .= " WHERE rowid=" . $this->id;
$this->db->begin();
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
if (! $error) {
if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
@ -557,7 +563,7 @@ class BookKeeping
// // End call triggers
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -571,7 +577,7 @@ class BookKeeping
return 1;
}
}
/**
* Delete object in database
*
@ -583,24 +589,24 @@ class BookKeeping
{
global $conf, $langs;
$error = 0;
$this->db->begin();
if (! $error)
{
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ACCOUNTING_NUMPIECE_DELETE',$user);
if ($result < 0) $error++;
if ($result < 0) $error++;
// End call triggers
}
}
if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE rowid=" . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql);
$resql = $this->db->query($sql);
if (! $resql) {
@ -608,7 +614,7 @@ class BookKeeping
$this->errors[] = "Error " . $this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
@ -624,9 +630,12 @@ class BookKeeping
return 1;
}
}
/**
* \brief Delete bookkepping by importkey
* Delete bookkepping by importkey
*
* @param string $model Model
* @return int Result
*/
function export_bookkeping($model = 'ebp')
{
@ -635,20 +644,20 @@ class BookKeeping
$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";
$resql = $this->db->query($sql);
dol_syslog(get_class($this) . "::export_bookkeping sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$this->linesexport = array ();
$num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) {
$line = new BookKeepingLine();
$line->id = $obj->rowid;
$line->doc_date = $this->db->jdate($obj->doc_date);
$line->doc_type = $obj->doc_type;
$line->doc_ref = $obj->doc_ref;
@ -663,11 +672,11 @@ class BookKeeping
$line->sens = $obj->sens;
$line->code_journal = $obj->code_journal;
$line->piece_num = $obj->piece_num;
$this->linesexport[] = $line;
}
$this->db->free($resql);
return $num;
}
else
@ -679,6 +688,9 @@ class BookKeeping
}
}
/**
* Class BookKeepingLine
*/
class BookKeepingLine
{
var $id;

View File

@ -19,10 +19,10 @@
/**
* \file htdocs/accountancy/class/html.formventilation.class.php
* \ingroup Accounting Expert
* \ingroup Accounting Expert
* \brief File of class with all html predefined components
*/
/**
* Class to manage generation of HTML components for bank module
*/
@ -30,7 +30,7 @@ class FormVentilation extends Form
{
var $db;
var $error;
/**
* Constructor
*
@ -48,33 +48,33 @@ class FormVentilation extends Form
* @param string $selectedkey Value
* @return string HTML edit field
*/
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey)
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey='')
{
global $langs;
$date_array = array ();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
$sql .= ' ORDER BY import_key DESC';
$out = '<SELECT name="' . $htmlname . '">';
dol_syslog(get_class($this) . "::select_bookkeeping_importkey sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$num = $this->db->num_rows($resql);
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$selected = '';
if ($selectedkey == $obj->import_key) {
$selected = ' selected="selected" ';
}
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . $obj->import_key . '</OPTION>';
$i ++;
}
} else {
@ -82,12 +82,12 @@ class FormVentilation extends Form
dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
return - 1;
}
$out .= '</SELECT>';
return $out;
}
/**
* Return list of accounts with label by chart of accounts
*
@ -95,38 +95,38 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
*
*
* @return string String with HTML select
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array())
{
global $conf, $user, $langs;
$out = '';
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
$sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->account_number . ' - ' . $obj->label;
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
// Bacause same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $obj->rowid) {
@ -148,7 +148,7 @@ class FormVentilation extends Form
$this->db->free($resql);
return $out;
}
/**
* Return list of accounts with label by class of accounts
*
@ -156,25 +156,25 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
*
*
* @return string String with HTML select
*/
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array())
{
global $conf, $user, $langs;
$out = '';
$sql = "SELECT DISTINCT pcg_type ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount ";
$sql .= " ORDER BY pcg_type";
dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
@ -184,7 +184,7 @@ class FormVentilation extends Form
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->pcg_type;
if (($selectid != '') && $selectid == $obj->pcg_type) {
$out .= '<option value="' . $obj->pcg_type . '" selected="selected">' . $label . '</option>';
} else {
@ -202,7 +202,7 @@ class FormVentilation extends Form
$this->db->free($resql);
return $out;
}
/**
* Return list of accounts with label by sub_class of accounts
*
@ -210,25 +210,25 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
*
*
* @return string String with HTML select
*/
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array())
{
global $conf, $user, $langs;
$out = '';
$sql = "SELECT DISTINCT pcg_subtype ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount ";
$sql .= " ORDER BY pcg_subtype";
dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$out .= ajax_combobox($htmlname, $event);
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
if ($showempty)
$out .= '<option value="-1"></option>';
@ -238,7 +238,7 @@ class FormVentilation extends Form
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->pcg_subtype;
if (($selectid != '') && $selectid == $obj->pcg_subtype) {
$out .= '<option value="' . $obj->pcg_subtype . '" selected="selected">' . $label . '</option>';
} else {

View File

@ -38,7 +38,7 @@ if (! $res && file_exists("../../../main.inc.php"))
$res = @include ("../../../main.inc.php");
if (! $res)
die("Include of main fails");
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -79,7 +79,7 @@ if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->access)
accessforbidden();
/*
* View
*/
@ -135,28 +135,28 @@ $paymentsalstatic = new PaymentSalary($db);
dol_syslog("accountancy/journal/bankjournal.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
// Variables
$cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$tabpay = array ();
$tabbq = array ();
$tabtp = array ();
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
'code_client' => $obj->code_compta
);
$tabtype = array ();
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
// Controls
$compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)')
@ -165,7 +165,7 @@ if ($result) {
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
// Variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
@ -177,11 +177,11 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
}
$links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val ) {
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
@ -190,16 +190,16 @@ if ($result) {
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
$societestatic->nom = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
@ -210,14 +210,14 @@ if ($result) {
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
@ -225,7 +225,7 @@ if ($result) {
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
} else if ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
@ -237,7 +237,7 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cptsociale] += $obj->amount;
} else if ($links[$key]['type'] == 'banktransfert') {
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
}
@ -246,9 +246,9 @@ if ($result) {
}*/
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++;
}
} else {
@ -274,14 +274,14 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $compte->intitule;
$bookkeeping->montant = ($mt < 0 ? price - ($mt) : $mt);
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0 ? price - ($mt) : 0);
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
if ($tabtype[$key] == 'payment') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -294,7 +294,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->doc_ref = $objmid->facnumber;
}
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
@ -307,7 +307,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->doc_ref = $objmid->facnumber;
}
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
@ -316,7 +316,7 @@ if ($action == 'writeBookKeeping') {
}
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
@ -324,17 +324,17 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->montant = ($mt < 0 ? price - ($mt) : $mt);
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? price - ($mt) : 0);
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -349,7 +349,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
@ -364,7 +364,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_SUPPLIER;
} else if ($tabtype[$key] == 'company') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -379,11 +379,11 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
} else {
$bookkeeping->doc_ref = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
@ -391,7 +391,7 @@ if ($action == 'writeBookKeeping') {
}
}
}
if (empty($error)) {
setEventMessage($langs->trans('Success'), 'mesgs');
}
@ -399,20 +399,20 @@ if ($action == 'writeBookKeeping') {
// export csv
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=journal_banque.csv');
$companystatic = new Client($db);
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
// Bank
print $date . $sep;
print $conf->global->ACCOUNTING_BANK_JOURNAL . $sep;
@ -425,7 +425,7 @@ if ($action == 'export_csv') {
print $sep;
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
@ -449,13 +449,13 @@ if ($action == 'export_csv') {
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
@ -464,13 +464,13 @@ if ($action == 'export_csv') {
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $companystatic->name . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
@ -481,11 +481,11 @@ if ($action == 'export_csv') {
}
}
} else {
$form = new Form($db);
llxHeader('', $langs->trans("BankJournal"));
$nom = $langs->trans("BankJournal");
$nomlink = '';
$periodlink = '';
@ -494,11 +494,11 @@ if ($action == 'export_csv') {
$description = $langs->trans("DescBankJournal") . '<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
@ -512,12 +512,12 @@ if ($action == 'export_csv') {
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
/*
* Show result array
*/
print '<br><br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -528,18 +528,18 @@ if ($action == 'export_csv') {
print "<td>" . $langs->trans("PaymentMode") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
if ($val["lib"] == '(SupplierInvoicePayment)')
$reflabel = $langs->trans('SupplierInvoicePayment');
if ($val["lib"] == '(CustomerInvoicePayment)')
$reflabel = $langs->trans('CustomerInvoicePayment');
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
if (1) {
@ -554,7 +554,7 @@ if ($action == 'export_csv') {
print "</tr>";
}
}
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
@ -569,12 +569,12 @@ if ($action == 'export_csv') {
print "</tr>";
}
}
$var = ! $var;
}
print "</table>";
// End of page
llxFooter();
}

View File

@ -38,7 +38,7 @@ if (! $res && file_exists("../../../main.inc.php"))
$res = @include ("../../../main.inc.php");
if (! $res)
die("Include of main fails");
// Class
dol_include_once("/core/lib/report.lib.php");
dol_include_once("/core/lib/date.lib.php");
@ -127,24 +127,24 @@ $paymentvatstatic = new TVA($db);
dol_syslog("accountancy/journal/cashjournal.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
// les variables
$cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$tabpay = array ();
$tabbq = array ();
$tabtp = array ();
$tabcompany = array ();
$tabtype = array ();
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
// controls
$compta_bank = $obj->account_number;
if ($obj->label == '(SupplierInvoicePayment)')
@ -153,9 +153,9 @@ if ($result) {
$compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli);
if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
// variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["ref"] = $obj->label;
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
@ -165,11 +165,11 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
}
$links = $object->get_url($obj->rowid);
foreach ( $links as $key => $val ) {
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
@ -178,16 +178,16 @@ if ($result) {
$paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} else if ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
$societestatic->nom = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} else if ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
@ -198,7 +198,7 @@ if ($result) {
}
$chargestatic->ref = $chargestatic->lib;
$tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30);
$sqlmid = 'SELECT cchgsoc.accountancy_code';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
@ -212,7 +212,7 @@ if ($result) {
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
}
} else if ($links[$key]['type'] == 'payment_vat') {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
@ -226,9 +226,9 @@ if ($result) {
}*/
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++;
}
} else {
@ -254,14 +254,14 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $compte->intitule;
$bookkeeping->montant = ($mt < 0 ? price - ($mt) : $mt);
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0 ? price - ($mt) : 0);
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
if ($tabtype[$key] == 'payment') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -274,7 +274,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->doc_ref = $objmid->facnumber;
}
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
@ -287,7 +287,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->doc_ref = $objmid->facnumber;
}
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
@ -296,7 +296,7 @@ if ($action == 'writeBookKeeping') {
}
// third party
foreach ( $tabtp[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
@ -304,17 +304,17 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->montant = ($mt < 0 ? price - ($mt) : $mt);
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? price - ($mt) : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0 ? $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL;
if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -329,7 +329,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
} else if ($tabtype[$key] == 'payment_supplier') {
$sqlmid = 'SELECT facf.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid";
@ -344,7 +344,7 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_SUPPLIER;
} else if ($tabtype[$key] == 'company') {
$sqlmid = 'SELECT fac.facnumber';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -359,11 +359,11 @@ if ($action == 'writeBookKeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
} else {
$bookkeeping->doc_ref = $k;
$bookkeeping->numero_compte = $conf->global->COMPTA_ACCOUNT_CUSTOMER;
}
$result = $bookkeeping->create();
if ($result < 0) {
$error ++;
@ -371,7 +371,7 @@ if ($action == 'writeBookKeeping') {
}
}
}
if (empty($error)) {
setEventMessage($langs->trans('Success'), 'mesgs');
}
@ -379,19 +379,19 @@ if ($action == 'writeBookKeeping') {
// export csv
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_SEPARATORCSV;
header('Content-Type: text/csv');
header('Content-Disposition:attachment;filename=journal_caisse.csv');
if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert
{
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Cash
print $date . $sep;
print $conf->global->ACCOUNTING_CASH_JOURNAL . $sep;
foreach ( $tabbq[$key] as $k => $mt ) {
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
@ -401,7 +401,7 @@ if ($action == 'export_csv') {
print utf8_decode($langs->trans("CashPayment")) . $sep;
print $val["ref"] . $sep;
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
@ -427,7 +427,7 @@ if ($action == 'export_csv') {
$date = dol_print_date($db->jdate($val["date"]), 'day');
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
@ -436,7 +436,7 @@ if ($action == 'export_csv') {
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
}
print "\n";
// Third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
@ -452,11 +452,11 @@ if ($action == 'export_csv') {
}
}
} else {
$form = new Form($db);
llxHeader('', $langs->trans("CashJournal"), '');
$nom = $langs->trans("CashJournal");
$nomlink = '';
$periodlink = '';
@ -465,11 +465,11 @@ if ($action == 'export_csv') {
$description = $langs->trans("DescCashJournal") . '<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''));
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
@ -483,12 +483,12 @@ if ($action == 'export_csv') {
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
/*
* Show result array
*/
print '<br><br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@ -497,13 +497,13 @@ if ($action == 'export_csv') {
print "<td>" . $langs->trans("Account") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Cash
foreach ( $tabbq[$key] as $k => $mt ) {
if (1) {
@ -516,26 +516,26 @@ if ($action == 'export_csv') {
print "</tr>";
}
}
// third party
foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>";
print "<td>" . length_accounta($k) . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
}
$var = ! $var;
}
print "</table>";
// End of page
llxFooter();
}

View File

@ -204,9 +204,9 @@ else
// Add vat rates examples specific to country
$vat_rates=array();
$sql.="SELECT taux as vat_rate";
$sql="SELECT taux as vat_rate";
$sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
$sql.=" WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND taux != 0";
$sql.=" WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND t.taux <> 0";
$sql.=" ORDER BY t.taux ASC";
$resql=$db->query($sql);
if ($resql)

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
@ -9,7 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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 3 of the License, or
* (at your option) any later version.
*

View File

@ -249,18 +249,23 @@ else if ($action == 'setmode' && $user->rights->facture->creer) {
dol_print_error($db, $object->error);
}
else if ($action == 'setinvoicedate' && $user->rights->facture->creer) {
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
{
$object->fetch($id);
$old_date_lim_reglement = $object->date_lim_reglement;
$object->date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
if (empty($date))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
exit;
}
$object->date=$date;
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement)
$object->date_lim_reglement = $new_date_lim_reglement;
if ($object->date_lim_reglement < $object->date)
$object->date_lim_reglement = $object->date;
if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement;
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
$result = $object->update($user);
if ($result < 0)
dol_print_error($db, $object->error);
if ($result < 0) dol_print_error($db, $object->error);
}
else if ($action == 'setconditions' && $user->rights->facture->creer) {
@ -268,18 +273,14 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) {
$object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0)
dol_print_error($db, $object->error);
if ($result < 0) dol_print_error($db, $object->error);
$old_date_lim_reglement = $object->date_lim_reglement;
$new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement)
$object->date_lim_reglement = $new_date_lim_reglement;
if ($object->date_lim_reglement < $object->date)
$object->date_lim_reglement = $object->date;
if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement;
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
$result = $object->update($user);
if ($result < 0)
dol_print_error($db, $object->error);
if ($result < 0) dol_print_error($db, $object->error);
}
else if ($action == 'setpaymentterm' && $user->rights->facture->creer) {
@ -940,7 +941,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
{
// Don't add lines with qty 0 when coming from a shipment including all order lines
if($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
$label=(! empty($lines[$i]->label)?$lines[$i]->label:'');
$desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle);
@ -1159,12 +1160,12 @@ else if ($action == 'addline' && $user->rights->facture->creer)
// We define price for product
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
{
$pu_ht = $prod->multiprices [$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level];
$price_min = $prod->multiprices_min [$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level];
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
//$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
//$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{

View File

@ -508,7 +508,7 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function security_prepare_head()
{

View File

@ -360,7 +360,7 @@ function show_array_last_actions_done($max=5)
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function agenda_prepare_head()
{
@ -405,7 +405,7 @@ function agenda_prepare_head()
* Prepare array with list of tabs
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function actions_prepare_head($object)
{

View File

@ -31,7 +31,7 @@
*
* @param string $selected Preselecte value
* @param string $htmlname HTML name of input field
* @param string $url Url for request: /chemin/fichier.php
* @param string $url Url for request: /path/page.php. Must return a json array ('key'=>id, 'value'=>String shown into input field once selected, 'label'=>String shown into combo list)
* @param string $urloption More parameters on URL request
* @param int $minLength Minimum number of chars to trigger that Ajax search
* @param int $autoselect Automatic selection if just one value
@ -98,26 +98,30 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
$("input#search_'.$htmlname.'").autocomplete({
source: function( request, response ) {
$.get("'.$url.($urloption?'?'.$urloption:'').'", { '.$htmlname.': request.term }, function(data){
response($.map( data, function( item ) {
if (autoselect == 1 && data.length == 1) {
$("#search_'.$htmlname.'").val(item.value);
$("#'.$htmlname.'").val(item.key).trigger("change");
}
var label = item.label.toString();
var update = {};
if (options.update) {
$.each(options.update, function(key, value) {
update[key] = item[value];
});
}
var textarea = {};
if (options.update_textarea) {
$.each(options.update_textarea, function(key, value) {
textarea[key] = item[value];
});
}
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
}));
if (data != null)
{
response($.map( data, function(item) {
if (autoselect == 1 && data.length == 1) {
$("#search_'.$htmlname.'").val(item.value);
$("#'.$htmlname.'").val(item.key).trigger("change");
}
var label = item.label.toString();
var update = {};
if (options.update) {
$.each(options.update, function(key, value) {
update[key] = item[value];
});
}
var textarea = {};
if (options.update_textarea) {
$.each(options.update_textarea, function(key, value) {
textarea[key] = item[value];
});
}
return { label: label, value: item.value, id: item.key, update: update, textarea: textarea, disabled: item.disabled }
}));
}
else console.error("Error: Ajax url '.$url.($urloption?'?'.$urloption:'').' has returned an empty page. Should be an empty json array.");
}, "json");
},
dataType: "json",

View File

@ -28,7 +28,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function bank_prepare_head($object)
{

View File

@ -27,7 +27,7 @@
*
* @param Object $object Object related to tabs
* @param string $type Type of category
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function categories_prepare_head($object,$type)
{

View File

@ -26,7 +26,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function contact_prepare_head($object)
{

View File

@ -26,7 +26,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function contract_prepare_head($object)
{

View File

@ -27,7 +27,7 @@
* Prepare array with list of different ecm main dashboard
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function ecm_prepare_dasboard_head($object)
{
@ -64,7 +64,7 @@ function ecm_prepare_dasboard_head($object)
* Prepare array with list of tabs
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function ecm_prepare_head($object)
{
@ -84,7 +84,7 @@ function ecm_prepare_head($object)
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function ecm_file_prepare_head($object)
{
@ -104,7 +104,7 @@ function ecm_file_prepare_head($object)
* Prepare array with list of tabs
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function ecm_prepare_head_fm($object)
{

View File

@ -25,7 +25,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function emailing_prepare_head($object)
{

View File

@ -28,7 +28,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function fichinter_prepare_head($object)
{

View File

@ -25,7 +25,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function fiscalyear_prepare_head($object)
{

View File

@ -29,7 +29,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function facturefourn_prepare_head($object)
{
@ -92,7 +92,7 @@ function facturefourn_prepare_head($object)
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function ordersupplier_prepare_head($object)
{

View File

@ -29,7 +29,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function commande_prepare_head($object)
{

View File

@ -269,7 +269,9 @@ function pdf_getPDFFontSize($outputlangs)
*/
function pdf_getHeightForLogo($logo, $url = false)
{
$height=22; $maxwidth=130;
global $conf;
$height=(empty($conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT)?22:$conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT);
$maxwidth=130;
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$tmp=dol_getImageSize($logo, $url);
if ($tmp['height'])

View File

@ -29,7 +29,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function prelevement_prepare_head($object)
{

View File

@ -29,7 +29,7 @@
*
* @param Object $object Object related to tabs
* @param User $user Object user
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function product_prepare_head($object, $user)
{

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function project_prepare_head($object)
{
@ -113,7 +113,7 @@ function project_prepare_head($object)
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function task_prepare_head($object)
{
@ -170,7 +170,7 @@ function task_prepare_head($object)
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function project_admin_prepare_head()
{

View File

@ -27,7 +27,7 @@
* Prepare array with list of tabs
*
* @param object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function propal_prepare_head($object)
{

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function shipping_prepare_head($object)
{
@ -85,7 +85,7 @@ function shipping_prepare_head($object)
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function delivery_prepare_head($object)
{

View File

@ -25,7 +25,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function stock_prepare_head($object)
{

View File

@ -29,7 +29,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function tax_prepare_head($object)
{

View File

@ -25,7 +25,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function trip_prepare_head($object)
{

View File

@ -27,7 +27,7 @@
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function user_prepare_head($object)
{
@ -178,7 +178,7 @@ function group_prepare_head($object)
/**
* Prepare array with list of tabs
*
* @return array Array of tabs to shoc
* @return array Array of tabs to show
*/
function user_admin_prepare_head()
{

View File

@ -26,8 +26,8 @@
require_once DOL_DOCUMENT_ROOT .'/core/modules/propale/modules_propale.php';
/** \class mod_propale_marbre
* \brief Class to manage customer order numbering rules Marbre
/**
* Class to manage customer order numbering rules Marbre
*/
class mod_propale_marbre extends ModeleNumRefPropales
{
@ -124,7 +124,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
}
else
{
dol_syslog("mod_propale_marbre::getNextValue", LOG_DEBUG);
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
return -1;
}
@ -134,7 +134,7 @@ class mod_propale_marbre extends ModeleNumRefPropales
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
else $num = sprintf("%04s",$max+1);
dol_syslog("mod_propale_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
dol_syslog(get_class($this)."::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}

View File

@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/propale/modules_propale.php';
/**
* \class mod_propale_saphir
* \brief Class of file that contains the numbering module rules Saphir
* Class of file that contains the numbering module rules Saphir
*/
class mod_propale_saphir extends ModeleNumRefPropales
{

View File

@ -278,7 +278,7 @@ class Fichinter extends CommonObject
$sql.= " f.datec,";
$sql.= " f.date_valid as datev,";
$sql.= " f.tms as datem,";
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams";
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) $sql.= " WHERE f.ref='".$this->db->escape($ref)."'";
else $sql.= " WHERE f.rowid=".$rowid;
@ -304,6 +304,7 @@ class Fichinter extends CommonObject
$this->note_public = $obj->note_public;
$this->note_private = $obj->note_private;
$this->modelpdf = $obj->model_pdf;
$this->fk_contrat = $obj->fk_contrat;
$this->extraparams = (array) json_decode($obj->extraparams, true);

View File

@ -210,7 +210,8 @@ class CommandeFournisseur extends CommonOrder
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
$sql.= " l.localtax1_tx, l. localtax2_tx, l.total_localtax1, l.total_localtax2,";
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,";
$sql.= " l.date_start, l.date_end";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= " WHERE l.fk_commande = ".$this->id;
@ -258,6 +259,9 @@ class CommandeFournisseur extends CommonOrder
$line->ref_fourn = $objp->ref_supplier; // TODO deprecated
$line->ref_supplier = $objp->ref_supplier; // Reference supplier
$line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end);
$this->lines[$i] = $line;
$i++;
@ -1721,9 +1725,11 @@ class CommandeFournisseur extends CommonOrder
* @param int $info_bits Miscellaneous informations
* @param int $type Type of line (0=product, 1=service)
* @param int $notrigger Disable triggers
* @param timestamp $date_start Date start of service
* @param timestamp $date_end Date end of service
* @return int < 0 if error, > 0 if ok
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false)
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='')
{
global $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
@ -1784,10 +1790,8 @@ class CommandeFournisseur extends CommonOrder
$sql.= ",localtax1_type='".$localtax1_type."'";
$sql.= ",localtax2_type='".$localtax2_type."'";
$sql.= ",qty='".price2num($qty)."'";
/*if ($date_end) { $sql.= ",date_start='$date_end'"; }
else { $sql.=',date_start=null'; }
if ($date_end) { $sql.= ",date_end='$date_end'"; }
else { $sql.=',date_end=null'; }*/
$sql.= ",date_start=".(! empty($date_start)?"'".$this->db->idate($date_start)."'":"null");
$sql.= ",date_end=".(! empty($date_end)?"'".$this->db->idate($date_end)."'":"null");
$sql.= ",info_bits='".$info_bits."'";
$sql.= ",total_ht='".price2num($total_ht)."'";
$sql.= ",total_tva='".price2num($total_tva)."'";
@ -2008,7 +2012,7 @@ class CommandeFournisseur extends CommonOrder
/**
* Classe de gestion des lignes de commande
*/
class CommandeFournisseurLigne
class CommandeFournisseurLigne extends CommonOrderLine
{
// From llx_commandedet
var $qty;
@ -2029,6 +2033,8 @@ class CommandeFournisseurLigne
var $total_ttc;
var $info_bits;
var $special_code;
var $date_start;
var $date_end;
// From llx_product
var $libelle; // Label produit
@ -2061,7 +2067,8 @@ class CommandeFournisseurLigne
$sql.= ' cd.remise, cd.remise_percent, cd.subprice,';
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
$sql.= ' cd.total_localtax1, cd.total_localtax2,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,';
$sql.= ' cd.date_start, cd.date_end';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
$sql.= ' WHERE cd.rowid = '.$rowid;
@ -2092,6 +2099,9 @@ class CommandeFournisseurLigne
$this->product_libelle = $objp->product_libelle;
$this->product_desc = $objp->product_desc;
$this->date_start = $this->db->jdate($objp->date_start);
$this->date_end = $this->db->jdate($objp->date_end);
$this->db->free($result);
return 1;
}

View File

@ -80,6 +80,9 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
//Date prefix
$date_pf = '';
// Load object
if ($id > 0 || ! empty($ref))
{
@ -191,6 +194,8 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
// Set if we used free entry or predefined product
$predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$date_start=dol_mktime(GETPOST('date_start'.$date_pf.'hour'), GETPOST('date_start'.$date_pf.'min'), 0, GETPOST('date_start'.$date_pf.'month'), GETPOST('date_start'.$date_pf.'day'), GETPOST('date_start'.$date_pf.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$date_pf.'hour'), GETPOST('date_end'.$date_pf.'min'), 0, GETPOST('date_end'.$date_pf.'month'), GETPOST('date_end'.$date_pf.'day'), GETPOST('date_end'.$date_pf.'year'));
if (GETPOST('prod_entry_mode') == 'free')
{
$idprod=0;
@ -276,7 +281,12 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
$productsupplier->fourn_ref,
$remise_percent,
'HT',
$type
$pu_ttc,
$type,
'',
'',
$date_start,
$date_end
);
}
if ($idprod == -2 || $idprod == 0)
@ -314,14 +324,14 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
{
$price_base_type = 'HT';
$ht = price2num($_POST['price_ht']);
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type);
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type,'','', $date_start, $date_end);
}
else
{
$ttc = price2num($_POST['price_ttc']);
$ht = $ttc / (1 + ($tauxtva / 100));
$price_base_type = 'HT';
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type);
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end);
}
}
@ -393,6 +403,9 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer
if (!$res) dol_print_error($db);
}
$date_start=dol_mktime(GETPOST('date_start'.$date_pf.'hour'), GETPOST('date_start'.$date_pf.'min'), 0, GETPOST('date_start'.$date_pf.'month'), GETPOST('date_start'.$date_pf.'day'), GETPOST('date_start'.$date_pf.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$date_pf.'hour'), GETPOST('date_end'.$date_pf.'min'), 0, GETPOST('date_end'.$date_pf.'month'), GETPOST('date_end'.$date_pf.'day'), GETPOST('date_end'.$date_pf.'year'));
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$mysoc,$object->thirdparty);
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$mysoc,$object->thirdparty);
@ -407,7 +420,10 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer
$localtax2_tx,
'HT',
0,
isset($_POST["type"])?$_POST["type"]:$line->product_type
isset($_POST["type"])?$_POST["type"]:$line->product_type,
false,
$date_start,
$date_end
);
unset($_POST['qty']);
unset($_POST['type']);
@ -417,6 +433,8 @@ else if ($action == 'update_line' && $user->rights->fournisseur->commande->creer
unset($_POST['np_desc']);
unset($_POST['pu']);
unset($_POST['tva_tx']);
unset($_POST['date_start']);
unset($_POST['date_end']);
unset($localtax1_tx);
unset($localtax2_tx);
if ($result >= 0)
@ -1745,6 +1763,12 @@ elseif (! empty($object->id))
$doleditor=new DolEditor('eldesc',$line->description,'',200,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70);
$doleditor->Create();
print '<br>';
print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' ';
print $form->select_date($date_start,'date_start'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'');
print ' '.$langs->trans('to').' ';
print $form->select_date($date_end,'date_end'.$date_pf,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,'');
print '</td>';
print '<td>';
print $form->load_tva('tva_tx',$line->tva_tx,$object->thirdparty,$mysoc);

View File

@ -466,7 +466,7 @@ if (empty($reshook))
if ($result > 0)
{
header('Location: '.DOL_URL_ROOT.'/product/liste.php?delprod='.urlencode($object->ref));
header('Location: '.DOL_URL_ROOT.'/product/liste.php?type='.$object->type.'&delprod='.urlencode($object->ref));
exit;
}
else

View File

@ -3,6 +3,7 @@
* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -85,7 +86,7 @@ if (! empty($tag) && ($unsuscrib=='1'))
$resql=$db->query($sql);
//Update status communication of contact prospect
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT sc.rowid FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.tag = '".$db->escape($tag)."' AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
dol_syslog("public/emailing/mailing-unsubscribe.php : Mail unsubcribe contact : ".$sql, LOG_DEBUG);
$resql=$db->query($sql);

View File

@ -18,7 +18,7 @@
*/
/**
* \file htdocs/product/ajax/products.php
* \file htdocs/product/ajax/company.php
* \brief File to return Ajax response on product list request
*/

View File

@ -586,6 +586,10 @@ div.login {
height: 16px;
}
#securitycode {
min-width: 60px;
}
img.login, img.printer, img.entity {
margin:2px 0px 0px 0px;
text-decoration:none;

View File

@ -552,6 +552,9 @@ form#login {
background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
}
#securitycode {
min-width: 60px;
}
#img_securitycode {
border: 1px solid #DDDDDD;
}

View File

@ -578,6 +578,9 @@ form#login {
background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
}
#securitycode {
min-width: 60px;
}
#img_securitycode {
border: 1px solid #DDDDDD;
}

View File

@ -651,6 +651,9 @@ form#login {
background-image: -ms-linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
background-image: linear-gradient(top, rgba(240,240,240,.3) 0%, rgba(192,192,192,.3) 100%);
}
#securitycode {
min-width: 60px;
}
#img_securitycode {
border: 1px solid #DDDDDD;
}

View File

@ -861,6 +861,9 @@ div#login_left, div#login_right {
table.login_table tr td table.none tr td {
padding: 2px;
}
#securitycode {
min-width: 60px;
}
#img_securitycode {
border: 1px solid #DDDDDD;
}

View File

@ -35,7 +35,7 @@ $langs->load("accountancy");
// Security check
if (!$user->admin)
accessforbidden();
// Date range
$year = GETPOST("year");
if (empty($year)) {
@ -105,9 +105,8 @@ $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) .
$description = $langs->trans("DescThirdPartyReport");
$builddate = time();
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
$moreparam=array('action' => '');
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam);
print '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />';
@ -157,16 +156,16 @@ $resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
// export csv
if (GETPOST('action') == 'export_csv') {
header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=export_csv.csv');
$obj = $db->fetch_object($resql);
$var = ! $var;
print '"' . $obj->compta . '",';
print '"' . $obj->address . '",';
print '"' . $obj->zip . '",';
@ -177,15 +176,15 @@ if ($resql) {
print "\n";
$i ++;
}
/*
* View
*/
$thirdpartystatic = new Societe($db);
print '<br><br>';
print '<table class="noborder" width="100%">';
print "</table>\n";
print '</td><td valign="top" width="70%" class="notopnoleftnoright"></td>';
@ -201,13 +200,13 @@ if ($resql) {
print '<td align="left">' . $langs->trans("Contact") . '</td>';
print '<td align="left">' . $langs->trans("Phone") . '</td>';
print '<td align="left">' . $langs->trans("Fax") . '</td></tr>';
$var = True;
while ( $obj = $db->fetch_object($resql) ) {
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>';
$thirdpartystatic->id = $obj->rowid;
@ -227,10 +226,10 @@ if ($resql) {
print '<td align="left">' . $obj->phone . '</td>';
print '<td align="left">' . $obj->fax . '</td>';
print "</tr>\n";
$i ++;
}
print "</table>";
$db->free($resql);
} else {