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

This commit is contained in:
Laurent Destailleur 2017-05-10 23:25:11 +02:00
commit 94353deb75
24 changed files with 432 additions and 243 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* 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
@ -18,9 +18,9 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/card.php
* \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Advanced accountancy
* \brief Page to show book-entry
* \brief Page to show book-entry
*/
require '../../main.inc.php';
@ -28,9 +28,14 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
// Langs
$langs->load("accountancy");
$langs->load("bank");
$langs->load("bills");
$langs->load("trips");
// Security check
$id = GETPOST('id', 'int');
@ -211,6 +216,7 @@ llxHeader();
$html = new Form($db);
$formventilation = new FormVentilation($db);
$formaccountancy = new FormAccounting($db);
/*
* Confirmation to delete the command
@ -223,26 +229,6 @@ if ($action == 'delete') {
if ($action == 'create') {
print load_fiche_titre($langs->trans("CreateMvts"));
$code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
$conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
);
$sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0';
$resql = $db->query($sql);
if (! $resql) {
setEventMessages($db->lasterror, null, 'errors');
} else {
while ( $obj_bank = $db->fetch_object($resql) ) {
if (! empty($obj_bank->accountancy_journal)) {
$code_journal_array[$obj_bank->accountancy_journal] = $obj_bank->accountancy_journal;
}
}
}
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
if (empty($next_num_mvt))
@ -270,9 +256,10 @@ if ($action == 'create') {
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
print '<td>';
print $formaccountancy->select_journal('', 'code_journal', '', 0, '', 1, 1, 1, 1);
print '</td></tr>';
print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>';
@ -308,25 +295,46 @@ if ($action == 'create') {
print '<div class="fichecenter">';
print '<table class="border" width="100%">';
print '<tr class="pair">';
print '<td class="titlefield">' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>';
print '</tr>';
print '<td>';
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch('',$book->code_journal);
print $accountingjournal->getNomUrl(0,1,1,'',1);
print '</td></tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>';
print '</tr>';
$typelabel = $book->doc_type;
if ($typelabel == 'bank') {
$typelabel = $langs->trans('Bank');
}
if ($typelabel == 'customer_invoice') {
$typelabel = $langs->trans('CustomerInvoice');
}
if ($typelabel == 'supplier_invoice') {
$typelabel = $langs->trans('SupplierInvoice');
}
if ($typelabel == 'expense_report') {
$typelabel = $langs->trans('ExpenseReport');
}
print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>';
print '<td>' . $typelabel . '</td>';
print '</tr>';
print '</table>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
// Langs
$langs->load("accountancy");
@ -443,7 +444,11 @@ foreach ($object->lines as $line ) {
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="center">' . $line->code_journal . '</td>';
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch('',$line->code_journal);
print '<td align="center">' . $accountingjournal->getNomUrl(0,0,0,'',0) . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';

View File

@ -48,64 +48,114 @@ class AccountingJournal extends CommonObject
}
/**
* Load an object from database
*
* @param int $id Id of record to load
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
* Load an object from database
*
* @param int $rowid Id of record to load
* @param string $journal_code Journal code
* @return int <0 if KO, Id of record if OK and found
*/
function fetch($rowid = null, $journal_code = null)
{
$sql = "SELECT rowid, code, label, nature, active";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ( $result )
if ($rowid || $journal_code)
{
$obj = $this->db->fetch_object($result);
$sql = "SELECT rowid, code, label, nature, active";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
$sql .= " WHERE";
if ($rowid) {
$sql .= " rowid = '" . $rowid . "'";
} elseif ($journal_code) {
$sql .= " code = '" . $journal_code . "'";
}
$this->id = $obj->rowid;
dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
$this->code = $obj->code;
$this->ref = $obj->code;
$this->label = $obj->label;
$this->nature = $obj->nature;
$this->active = $obj->active;
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
return 1;
}
else
{
$this->error=$this->db->lasterror();
return -1;
$this->code = $obj->code;
$this->ref = $obj->code;
$this->label = $obj->label;
$this->nature = $obj->nature;
$this->active = $obj->active;
return $this->id;
} else {
return 0;
}
}
else
{
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror();
}
}
return -1;
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $withlabel 0=No label, 1=Include label of journal
* @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0) {
global $langs;
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0)
{
global $langs, $conf, $user;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = '';
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/journals_card.php?id=' . $this->id . '">';
$linkend = '</a>';
$url = DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35';
$picto = 'billr';
$label='';
$label = $langs->trans("Show") . ': ' . $this->code . ' - ' . $this->label;
$label = '<u>' . $langs->trans("ShowAccountingJournal") . '</u>';
if (! empty($this->code))
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
if (! empty($this->label))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
if ($moretitle) $label.=' - '.$moretitle;
if ($withpicto)
$result .= ($link . img_object($label, $picto) . $linkend);
if ($withpicto && $withpicto != 2)
$result .= ' ';
if ($withpicto != 2)
$result .= $link . $this->code . ' - ' . $this->label . $linkend;
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowAccoutingJournal");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart='<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($nourl)
{
$linkstart = '';
$linkclose = '';
$linkend = '';
}
$label_link = $this->code;
if ($withlabel) $label_link .= ' - ' . $this->label;
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
return $result;
}
@ -136,19 +186,19 @@ class AccountingJournal extends CommonObject
if ($mode == 0)
{
$prefix='';
if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew');
if ($nature == 3) return $langs->trans('AccountingJournalTypeBank');
if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase');
if ($nature == 1) return $langs->trans('AccountingJournalTypeSale');
if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation');
if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1');
}
if ($mode == 1)
{
if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew');
if ($nature == 3) return $langs->trans('AccountingJournalTypeBank');
if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase');
if ($nature == 1) return $langs->trans('AccountingJournalTypeSale');
if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation');
if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1');
}
}
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -436,7 +436,6 @@ if ($virtualdiffersfromphysical)
print '<br />';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Inventory").'</td>'."\n";
@ -444,8 +443,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<td align="center" width="100">&nbsp;</td>'."\n";
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
@ -458,8 +456,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
@ -472,8 +469,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
@ -488,7 +484,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '</table>';
}
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -510,8 +505,6 @@ if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULAT
print "</td>\n</tr>\n";
}
print '<tr class="oddeven">';
print '<td width="60%">'.$langs->trans("UserWarehouseAutoCreate").'</td>';
print '<td width="160" align="right">';
@ -524,8 +517,6 @@ print '</form>';
print "</td>\n";
print "</tr>\n";
print '<tr class="oddeven">';
print '<td width="60%">'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';

View File

@ -112,8 +112,7 @@ if ($catname || $id > 0)
$var=true;
foreach ($cats as $cat)
{
$var = ! $var;
print "\t<tr ".$bc[$var].">\n";
print "\t".'<tr class="oddeven">'."\n";
print "\t\t<td>";
$categstatic->id=$cat->id;
$categstatic->ref=$cat->label;

View File

@ -289,11 +289,9 @@ else
print "</tr>\n";
if (count($cats) > 0)
{
$var=true;
foreach ($cats as $cat)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print "\t\t".'<td class="nowrap">';
print "<a href='viewcat.php?id=".$cat->id."&amp;type=".$type."'>".$cat->label."</a>";
print "</td>\n";
@ -360,11 +358,9 @@ if ($object->type == Categorie::TYPE_PRODUCT)
if (count($prods) > 0)
{
$var=true;
foreach ($prods as $prod)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $prod->getNomUrl(1);
print "</td>\n";
@ -411,12 +407,9 @@ if ($object->type == Categorie::TYPE_SUPPLIER)
if (count($socs) > 0)
{
$var=true;
foreach ($socs as $soc)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $soc->getNomUrl(1);
print "</td>\n";
@ -464,14 +457,13 @@ if($object->type == Categorie::TYPE_CUSTOMER)
if (count($socs) > 0)
{
$i = 0;
$var=true;
foreach ($socs as $key => $soc)
{
if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself
$i++;
print "\t<tr ".$bc[$var].">\n";
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $soc->getNomUrl(1);
print "</td>\n";
@ -520,11 +512,9 @@ if ($object->type == Categorie::TYPE_MEMBER)
if (count($prods) > 0)
{
$var=true;
foreach ($prods as $key => $member)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
$member->ref=$member->login;
print $member->getNomUrl(1,0);
@ -574,12 +564,11 @@ if($object->type == Categorie::TYPE_CONTACT)
if (count($contacts) > 0)
{
$i = 0;
$var=true;
foreach ($contacts as $key => $contact)
{
$i++;
print "\t<tr ".$bc[$var].">\n";
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $contact->getNomUrl(1,'category');
print "</td>\n";
@ -629,11 +618,9 @@ if ($object->type == Categorie::TYPE_ACCOUNT)
if (count($accounts) > 0)
{
$var=true;
foreach ($accounts as $key => $account)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $account->getNomUrl(1,0);
print "</td>\n";
@ -684,11 +671,9 @@ if ($object->type == Categorie::TYPE_PROJECT)
if (count($projects) > 0)
{
$var=true;
foreach ($projects as $key => $project)
{
print "\t<tr ".$bc[$var].">\n";
{
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap" valign="top">';
print $project->getNomUrl(1,0);
print "</td>\n";

View File

@ -788,8 +788,7 @@ if ($id > 0)
while ($i < $num && $i < $MAXLIST) {
$objp = $db->fetch_object($resql);
$var = ! $var;
print "<tr " . $bc[$var] . ">";
print '<tr class="oddeven">';
print '<td class="nowrap">';
$sendingstatic->id = $objp->id;
$sendingstatic->ref = $objp->ref;

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* 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
@ -479,7 +479,6 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
$resql = $db->query($sql);
if ($resql)
{
$var=false;
$num = $db->num_rows($resql);
$i = 0;
@ -544,7 +543,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$result = $db->query($sql);
if ($result)
{
$var=false;
$num = $db->num_rows($result);
$i = 0;
@ -633,11 +631,10 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
$staticcontrat=new Contrat($db);
$var=false;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print "<tr ".$bc[$var]."><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), 'contract')." ".$obj->ref."</a></td>";
print '<tr class="oddeven"><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."</a></td>';
print '<td>';
$companystatic->id=$objp->rowid;
$companystatic->name=$objp->name;
@ -686,8 +683,6 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
$i = 0;
if ($num > 0)
{
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>';
@ -785,8 +780,6 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$i = 0;
if ($num > 0)
{
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th class="liste_titre" colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>';

View File

@ -293,7 +293,6 @@ print '<td align="right">%</td>';
print '</tr>';
$oldyear=0;
$var=true;
foreach ($data as $val)
{
$year = $val['year'];
@ -301,7 +300,7 @@ foreach ($data as $val)
{ // If we have empty year
$oldyear--;
print '<tr '.$bc[$var].' height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>';
print '<td align="right"></td>';
@ -311,7 +310,7 @@ foreach ($data as $val)
print '<td align="right"></td>';
print '</tr>';
}
print '<tr '.$bc[$var].' height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['nb_diff']).'</td>';

View File

@ -36,7 +36,9 @@ require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$langs->load("banks");
$langs->load("bills");
@ -99,7 +101,7 @@ if ($action == 'add')
$account_number = GETPOST('account_number','alpha');
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
$object->accountancy_journal = trim($_POST["accountancy_journal"]);
$object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]);
$object->solde = $_POST["solde"];
$object->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
@ -197,7 +199,7 @@ if ($action == 'update')
$account_number = GETPOST('account_number', 'int');
if ($account_number <= 0) { $object->account_number = ''; } else { $object->account_number = $account_number; }
$object->accountancy_journal = trim($_POST["accountancy_journal"]);
$object->fk_accountancy_journal = trim($_POST["fk_accountancy_journal"]);
$object->currency_code = trim($_POST["account_currency_code"]);
@ -278,6 +280,7 @@ $form = new Form($db);
$formbank = new FormBank($db);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
if (! empty($conf->accounting->enabled)) $formaccountancy2 = New FormAccounting($db);
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
@ -534,7 +537,9 @@ if ($action == 'create')
if (! empty($conf->accounting->enabled))
{
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal', 'alpha'):$object->accountancy_journal).'"></td></tr>';
print '<td>';
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1);
print '</td></tr>';
}
print '</table>';
@ -677,7 +682,14 @@ else
if (! empty($conf->accounting->enabled))
{
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'.$object->accountancy_journal.'</td></tr>';
print '<td>';
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($object->fk_accountancy_journal);
print $accountingjournal->getNomUrl(0,1,1,'',1);
print '</td></tr>';
}
// Other attributes
@ -980,8 +992,10 @@ else
// Accountancy journal
if (! empty($conf->accounting->enabled))
{
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td><input type="text" name="accountancy_journal" value="'.(isset($_POST["accountancy_journal"])?GETPOST("accountancy_journal"):$object->accountancy_journal).'"></td></tr>';
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>';
print $formaccountancy2->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, '', 1, 1);
print '</td></tr>';
}
print '</table>';

View File

@ -160,7 +160,7 @@ class Account extends CommonObject
* @var string
*/
public $account_number;
public $accountancy_journal;
public $fk_accountancy_journal;
/**
* Currency code
@ -471,9 +471,9 @@ class Account extends CommonObject
if ($accline->insert() > 0) {
if ($categorie) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_account (";
$sql .= "fk_account, fk_categorie";
if ($categorie>0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (";
$sql .= "lineid, fk_categ;
$sql .= ") VALUES (";
$sql .= " ".$accline->id.", ".$categorie;
$sql .= ")";
@ -545,7 +545,7 @@ class Account extends CommonObject
$sql.= ", label";
$sql.= ", entity";
$sql.= ", account_number";
$sql.= ", accountancy_journal";
$sql.= ", fk_accountancy_journal";
$sql.= ", bank";
$sql.= ", code_banque";
$sql.= ", code_guichet";
@ -569,7 +569,7 @@ class Account extends CommonObject
$sql.= ", '".$this->db->escape($this->label)."'";
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->escape($this->account_number)."'";
$sql.= ", '".$this->db->escape($this->accountancy_journal)."'";
$sql.= ", '".$this->db->escape($this->fk_accountancy_journal)."'";
$sql.= ", '".$this->db->escape($this->bank)."'";
$sql.= ", '".$this->code_banque."'";
$sql.= ", '".$this->code_guichet."'";
@ -702,7 +702,7 @@ class Account extends CommonObject
$sql.= ",rappro = ".$this->rappro;
$sql.= ",url = ".($this->url?"'".$this->url."'":"null");
$sql.= ",account_number = '".$this->account_number."'";
$sql.= ",accountancy_journal = '".$this->accountancy_journal."'";
$sql.= ",fk_accountancy_journal = '".$this->fk_accountancy_journal."'";
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
$sql.= ",code_banque='".$this->code_banque."'";
@ -847,7 +847,7 @@ class Account extends CommonObject
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
$sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
$sql.= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
$sql.= " ba.account_number, ba.accountancy_journal, ba.currency_code,";
$sql.= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,";
$sql.= " ba.min_allowed, ba.min_desired, ba.comment,";
$sql.= " ba.datec as date_creation, ba.tms as date_update,";
$sql.= ' c.code as country_code, c.label as country,';
@ -897,7 +897,7 @@ class Account extends CommonObject
$this->country = $obj->country;
$this->account_number = $obj->account_number;
$this->accountancy_journal = $obj->accountancy_journal;
$this->fk_accountancy_journal = $obj->fk_accountancy_journal;
$this->currency_code = $obj->currency_code;
$this->account_currency_code = $obj->currency_code;
@ -1259,7 +1259,7 @@ class Account extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$langs->load("accountancy");
$label .= '<br><b>' . $langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
$label .= '<br><b>' . $langs->trans('AccountancyJournal') . ':</b> ' . $this->accountancy_journal;
$label .= '<br><b>' . $langs->trans('AccountancyJournal') . ':</b> ' . $this->fk_accountancy_journal;
}
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';

View File

@ -29,6 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$langs->load("banks");
$langs->load("categories");
@ -88,7 +90,7 @@ $arrayfields=array(
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
'b.accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
@ -141,7 +143,7 @@ $title=$langs->trans('BankAccounts');
// Load array of financial accounts (opened by default)
$accounts = array();
$sql = "SELECT rowid, label, courant, rappro, account_number, accountancy_journal, datec as date_creation, tms as date_update";
$sql = "SELECT rowid, label, courant, rappro, account_number, fk_accountancy_journal, datec as date_creation, tms as date_update";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -323,7 +325,7 @@ if (! empty($arrayfields['b.account_number']['checked']))
print '</td>';
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
@ -403,7 +405,7 @@ if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titr
if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.accountancy_journal','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.fk_accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.fk_accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.fk_accountancy_journal','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -488,16 +490,23 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['b.account_number']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
print '<td>'.length_accountg($acc->account_number).'</td>';
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$acc->account_number);
print '<td>'.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
print '<td>'.length_accountg($acc->accountancy_journal).'</td>';
if (! $i) $totalarray['nbfield']++;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($acc->fk_accountancy_journal);
print '<td>'.$accountingjournal->getNomUrl(0,1,1,'',1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Transactions to reconcile

View File

@ -89,7 +89,7 @@ $variousstatic = new PaymentVarious($db);
$accountstatic = new Account($db);
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.accountancy_journal, ba.label as blabel,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
@ -217,7 +217,7 @@ if ($result)
$accountstatic->ref=$obj->bref;
$accountstatic->number=$obj->bnumber;
$accountstatic->accountancy_number=$obj->account_number;
$accountstatic->accountancy_journal=$obj->accountancy_journal;
$accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal;
$accountstatic->label=$obj->blabel;
print $accountstatic->getNomUrl(1);
}

View File

@ -25,12 +25,14 @@
/**
* Class to manage generation of HTML components for accounting management
*/
class FormAccounting
class FormAccounting extends Form
{
private $options_cache = array();
var $db;
var $error;
/**
* Constructor
*
@ -41,6 +43,89 @@ class FormAccounting
$this->db = $db;
}
/**
* Return list of journals with label by nature
*
* @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form
* @param int $nature Limit the list to a particular type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
* @param int $showempty Add an empty field
* @param array $event Event options
* @param int $select_in 0=selectid value is the journal rowid (default) or 1=selectid is journal code
* @param int $select_out Set value returned by select. 0=rowid (default), 1=code
* @param string $morecss More css non HTML object
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
*
* @return string String with HTML select
*/
function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='')
{
global $conf;
$out = '';
$options = array();
if ($usecache && ! empty($this->options_cache[$usecache]))
{
$options = $this->options_cache[$usecache];
$selected=$selectid;
}
else
{
$sql = "SELECT rowid, code, label, nature, entity, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_journal";
$sql.= " WHERE active = 1";
$sql.= " AND entity = ".$conf->entity;
//if ($nature && is_numeric($nature)) $sql .= " AND nature = ".$nature;
$sql.= " ORDER BY code";
dol_syslog(get_class($this) . "::select_journal", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::select_journal ".$this->error, LOG_ERR);
return -1;
}
$out = ajax_combobox($htmlname, $event);
$selected = 0;
while ($obj = $this->db->fetch_object($resql))
{
$label = $obj->code . ' - ' . $obj->label;
$select_value_in = $obj->rowid;
$select_value_out = $obj->rowid;
// Try to guess if we have found default value
if ($select_in == 1) {
$select_value_in = $obj->code;
}
if ($select_out == 1) {
$select_value_out = $obj->code;
}
// Remember guy's we store in database llx_accounting_bookkeeping the code of accounting_journal and not the rowid
if ($selectid != '' && $selectid == $select_value_in) {
//var_dump("Found ".$selectid." ".$select_value_in);
$selected = $select_value_out;
}
$options[$select_value_out] = $label;
}
$this->db->free($resql);
if ($usecache)
{
$this->options_cache[$usecache] = $options;
}
}
$out .= Form::selectarray($htmlname, $options, $select, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
return $out;
}
/**
* Return list of accounting category.
* Use mysoc->country_id or mysoc->country_code so they must be defined.

View File

@ -126,7 +126,9 @@ class FormFile
{
$out .= '<input type="hidden" name="max_file_size" value="'.($max*1024).'">';
}
$out .= '<input class="flat minwidth400" type="file" name="userfile"';
$out .= '<input class="flat minwidth400" type="file"';
$out .= ((empty($conf->global->MAIN_USE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout == 'phone')?' name="userfile"':' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>';
$out .= ' ';

View File

@ -131,18 +131,15 @@ class doc_generic_project_odt extends ModelePDFProjects
);
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{
$extrafieldkey=$object->element;
$extrafieldkey=$object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
$object->fetch_optionals($object->id,$extralabels);
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
}
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
$object->fetch_optionals($object->id,$extralabels);
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
return $resarray;
}
@ -185,39 +182,50 @@ class doc_generic_project_odt extends ModelePDFProjects
function get_substitutionarray_project_contacts($contact,$outputlangs)
{
global $conf;
$pc='projcontacts_'; // prefix to avoid typos
// adding phone numbers if external
$phone_pro = '';
$phone_perso = '';
$phone_mobile = '';
$ret = array(
$pc.'id'=>$contact['id'],
$pc.'rowid'=>$contact['rowid'],
$pc.'role'=>$contact['libelle'],
$pc.'lastname'=>$contact['lastname'],
$pc.'firstname'=>$contact['firstname'],
$pc.'civility'=>$contact['civility'],
$pc.'fullcivname'=>$contact['fullname'],
$pc.'socname'=>$contact['socname'],
$pc.'email'=>$contact['email']
);
$ct = new Contact($this->db);
if ($contact['source']=='external') {
$ret[$pc.'isInternal'] = ''; // not internal
$ct = new Contact($this->db);
$ct->fetch($contact['id']);
$phone_pro = $ct->phone_pro;
$phone_perso = $ct->phone_perso;
$phone_mobile = $ct->phone_mobile;
$ret[$pc.'phone_pro'] = $ct->phone_pro;
$ret[$pc.'phone_perso'] = $ct->phone_perso;
$ret[$pc.'phone_mobile'] = $ct->phone_mobile;
// fetch external user extrafields
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($ct->table_element, true);
$extrafields_num = $ct->fetch_optionals($ct->id, $extralabels);
//dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: ===== Number of Extrafields found: ".$extrafields_num, LOG_DEBUG);
foreach($ct->array_options as $efkey => $efval) {
dol_syslog(get_class($this)."::get_substitutionarray_project_contacts: +++++ Extrafield ".$efkey." => ".$efval, LOG_DEBUG);
$ret[$pc.$efkey] = $efval; // add nothing else because it already comes as 'options_XX'
}
} elseif ($contact['source']=='internal') {
$ret[$pc.'isInternal'] = '1'; // this is an internal user
$ct = new User($this->db);
$ct->fetch($contact['id']);
$phone_pro = $ct->office_phone;
$phone_mobile = $ct->user_mobile;
$ret[$pc.'phone_pro'] = $ct->office_phone;
$ret[$pc.'phone_perso'] = '';
$ret[$pc.'phone_mobile'] = $ct->user_mobile;
// do internal users have extrafields ?
}
return array(
'projcontacts_id'=>$contact['id'],
'projcontacts_rowid'=>$contact['rowid'],
'projcontacts_role'=>$contact['libelle'],
'projcontacts_lastname'=>$contact['lastname'],
'projcontacts_firstname'=>$contact['firstname'],
'projcontacts_fullcivname'=>$contact['fullname'],
'projcontacts_socname'=>$contact['socname'],
'projcontacts_email'=>$contact['email'],
'projcontacts_phone_pro'=>$phone_pro,
'projcontacts_phone_perso'=>$phone_perso,
'projcontacts_phone_mobile'=>$phone_mobile
);
return $ret;
}
/**

View File

@ -326,7 +326,7 @@ class Fichinter extends CommonObject
function fetch($rowid,$ref='')
{
$sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,";
$sql.= " f.datec, f.dateo, f.datee, f.datet,";
$sql.= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$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, fk_contrat";
@ -360,6 +360,8 @@ class Fichinter extends CommonObject
$this->modelpdf = $obj->model_pdf;
$this->fk_contrat = $obj->fk_contrat;
$this->user_creation= $obj->fk_user_author;
$this->extraparams = (array) json_decode($obj->extraparams, true);
if ($this->statut == 0) $this->brouillon = 1;
@ -537,7 +539,30 @@ class Fichinter extends CommonObject
}
}
/**
* Returns amount based on user thm
*
* @return float amount
*/
function getAmount() {
global $db;
$amount = 0;
$this->author = new User($db);
$this->author->fetch($this->user_creation);
$thm = $this->author->thm;
foreach($this->lines as &$line) {
$amount+=$line->qty * $thm;
}
return $amount;
}
/**
* Returns the label status
*

View File

@ -640,7 +640,7 @@ class FactureFournisseur extends CommonInvoice
function fetch_lines()
{
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql.= ', f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc';
@ -649,6 +649,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ' WHERE fk_facture_fourn='.$this->id;
$sql.= ' ORDER BY f.rang, f.rowid';
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$resql_rows = $this->db->query($sql);
if ($resql_rows)
@ -687,6 +688,7 @@ class FactureFournisseur extends CommonInvoice
$line->total_tva = $obj->total_tva;
$line->total_localtax1 = $obj->total_localtax1;
$line->total_localtax2 = $obj->total_localtax2;
$line->fk_facture_fourn = $obj->fk_facture_fourn;
$line->total_ttc = $obj->total_ttc;
$line->fk_product = $obj->fk_product;
$line->product_type = $obj->product_type;

View File

@ -264,4 +264,11 @@ UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2;
UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3;
ALTER TABLE llx_bank_account CHANGE COLUMN accountancy_journal fk_accountancy_journal integer;
--ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);

View File

@ -23,6 +23,6 @@ create table llx_accounting_journal
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
label varchar(128) NOT NULL,
nature smallint DEFAULT 0 NOT NULL, -- type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
nature smallint DEFAULT 1 NOT NULL, -- type of journals (1:various operations / 2:sale / 3:purchase / 4:bank / 9: has-new)
active smallint DEFAULT 0
)ENGINE=innodb;

View File

@ -19,3 +19,5 @@
ALTER TABLE llx_bank_account ADD UNIQUE uk_bank_account_label (label,entity);
-- ALTER TABLE llx_bank_account ADD CONSTRAINT bank_fk_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);

View File

@ -24,39 +24,39 @@
create table llx_bank_account
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
tms timestamp,
ref varchar(12) NOT NULL,
label varchar(30) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_user_author integer,
fk_user_modif integer,
bank varchar(60),
code_banque varchar(128),
code_guichet varchar(6),
number varchar(255),
cle_rib varchar(5),
bic varchar(11),
iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
country_iban varchar(2), -- deprecated
cle_iban varchar(2),
domiciliation varchar(255),
state_id integer DEFAULT NULL,
fk_pays integer NOT NULL,
proprio varchar(60),
owner_address varchar(255),
courant smallint DEFAULT 0 NOT NULL,
clos smallint DEFAULT 0 NOT NULL,
rappro smallint DEFAULT 1,
url varchar(128),
account_number varchar(32), -- bank accountancy number
accountancy_journal varchar(16) DEFAULT NULL, -- bank accountancy journal
currency_code varchar(3) NOT NULL,
min_allowed integer DEFAULT 0,
min_desired integer DEFAULT 0,
comment text, -- TODO rename in note_private
note_public text,
model_pdf varchar(255),
import_key varchar(14)
rowid integer AUTO_INCREMENT PRIMARY KEY,
datec datetime,
tms timestamp,
ref varchar(12) NOT NULL,
label varchar(30) NOT NULL,
entity integer DEFAULT 1 NOT NULL, -- multi company id
fk_user_author integer,
fk_user_modif integer,
bank varchar(60),
code_banque varchar(128),
code_guichet varchar(6),
number varchar(255),
cle_rib varchar(5),
bic varchar(11),
iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
country_iban varchar(2), -- deprecated
cle_iban varchar(2),
domiciliation varchar(255),
state_id integer DEFAULT NULL,
fk_pays integer NOT NULL,
proprio varchar(60),
owner_address varchar(255),
courant smallint DEFAULT 0 NOT NULL,
clos smallint DEFAULT 0 NOT NULL,
rappro smallint DEFAULT 1,
url varchar(128),
account_number varchar(32), -- bank accountancy number
fk_accountancy_journal integer, -- bank accountancy journal
currency_code varchar(3) NOT NULL,
min_allowed integer DEFAULT 0,
min_desired integer DEFAULT 0,
comment text, -- TODO rename in note_private
note_public text,
model_pdf varchar(255),
import_key varchar(14)
)ENGINE=innodb;

View File

@ -61,7 +61,8 @@ ChangeAndLoad=Change and load
Addanaccount=Add an accounting account
AccountAccounting=Accounting account
AccountAccountingShort=Account
ShowAccoutingAccount=Show accounting account
ShowAccountingAccount=Show accounting account
ShowAccountingJournal=Show accounting journal
AccountAccountingSuggest=Accounting account suggested
MenuDefaultAccounts=Default accounts
MenuVatAccounts=Vat accounts

View File

@ -333,7 +333,8 @@ $listofreferent=array(
'class'=>'Fichinter',
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>1,
'disableamount'=>0,
'margin'=>'minus',
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
'lang'=>'interventions',
'buttonnew'=>'AddIntervention',
@ -559,6 +560,7 @@ foreach ($listofreferent as $key => $value)
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'projet_task')
{
if ($idofelementuser)
@ -583,6 +585,7 @@ foreach ($listofreferent as $key => $value)
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
elseif ($tablename == 'projet_task')
{
@ -948,6 +951,7 @@ foreach ($listofreferent as $key => $value)
$total_ht_by_line=null;
$othermessage='';
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
elseif (in_array($tablename, array('projet_task')))
{
@ -988,6 +992,7 @@ foreach ($listofreferent as $key => $value)
{
$total_ttc_by_line=null;
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
else if($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount();
elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
elseif ($tablename == 'projet_task')
{