Merge pull request #1 from Dolibarr/develop

Update my fork from original
This commit is contained in:
abcnet-lu 2016-02-03 08:55:50 +01:00
commit a6ab581683
75 changed files with 3727 additions and 2401 deletions

View File

@ -289,16 +289,30 @@ script:
- | - |
echo "Unit testing" echo "Unit testing"
# Ensure we catch errors # Ensure we catch errors. Set this to +e if you want to go to this end to see log file.
set -e set -e
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
set +e set +e
echo
- |
#echo "Output dolibarr.log"
#echo cat documents/dolibarr.log
after_script:
- |
# Dolibarr log file
#echo "After script"
#cat documents/dolibarr.log
after_success: after_success:
- |
echo Success
after_failure: after_failure:
- | - |
echo Failure
# This part of code seems to be never executed, error or not ???
echo "Debugging informations" echo "Debugging informations"
# Upgrade log files # Upgrade log files
cat *.log cat *.log
@ -314,5 +328,3 @@ after_failure:
echo echo
fi fi
after_script:

View File

@ -356,6 +356,12 @@ source_file = htdocs/langs/en_US/withdrawals.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.websites]
file_filter = htdocs/langs/<lang>/withdrawals.lang
source_file = htdocs/langs/en_US/withdrawals.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.workflow] [dolibarr.workflow]
file_filter = htdocs/langs/<lang>/workflow.lang file_filter = htdocs/langs/<lang>/workflow.lang
source_file = htdocs/langs/en_US/workflow.lang source_file = htdocs/langs/en_US/workflow.lang

View File

@ -115,6 +115,7 @@ NEW: Use new select2 component for juridical status, country and state selection
NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available.
NEW: Uniformize form creation of proposal to add public and private notes during creation like for order and invoice. NEW: Uniformize form creation of proposal to add public and private notes during creation like for order and invoice.
NEW: More robust antiXSS engine. NEW: More robust antiXSS engine.
NEW: Compatibility with Mysql 5.7+
For developers: For developers:
NEW: The search box and the bookmarks are now rendered by the menu manager. NEW: The search box and the bookmarks are now rendered by the menu manager.

View File

@ -17,17 +17,16 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/account.php * \file htdocs/accountancy/admin/account.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief List accounting account * \brief List accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -44,12 +43,12 @@ $search_pcgtype = GETPOST("search_pcgtype");
$search_pcgsubtype = GETPOST("search_pcgsubtype"); $search_pcgsubtype = GETPOST("search_pcgsubtype");
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'sortorder'); $sortorder = GETPOST("sortorder", 'sortorder');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOST("page", 'int'); $page = GETPOST("page", 'int');
if ($page == - 1) { if ($page == - 1) {
$page = 0; $page = 0;
@ -90,11 +89,11 @@ if ($action == 'disable') {
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{ {
$search_account=""; $search_account = "";
$search_label=""; $search_label = "";
$search_accountparent=""; $search_accountparent = "";
$search_pcgtype=""; $search_pcgtype = "";
$search_pcgsubtype=""; $search_pcgsubtype = "";
} }
/* /*
@ -156,7 +155,7 @@ if ($result) {
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -167,23 +166,22 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_pcgsubtype" value="' . $search_pcgsubtype . '"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">'; print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;'; print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$var = false; $var = false;
$accountstatic=new AccountingAccount($db); $accountstatic = new AccountingAccount($db);
while ( $i < min($num, $limit) ) while ( $i < min($num, $limit) ) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$accountstatic->id=$obj->rowid; $accountstatic->id = $obj->rowid;
$accountstatic->label=$obj->label; $accountstatic->label = $obj->label;
$accountstatic->account_number=$obj->account_number; $accountstatic->account_number = $obj->account_number;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td>' . $accountstatic->getNomUrl(1) . '</td>'; print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
@ -217,7 +215,7 @@ if ($result) {
print '</td>' . "\n"; print '</td>' . "\n";
print "</tr>\n"; print "</tr>\n";
$var=!$var; $var = ! $var;
$i ++; $i ++;
} }

View File

@ -18,18 +18,18 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/card.php * \file htdocs/accountancy/admin/card.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Card accounting account * \brief Card accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$error=0; $error = 0;
// Langs // Langs
$langs->load("bills"); $langs->load("bills");
@ -42,14 +42,13 @@ $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel'); $cancel = GETPOST('cancel');
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
// Action // Action
if ($action == 'add') if ($action == 'add') {
{
if (! $cancel) { if (! $cancel) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
@ -80,9 +79,7 @@ if ($action == 'add')
} }
} }
Header("Location: account.php"); Header("Location: account.php");
} } else if ($action == 'edit') {
else if ($action == 'edit')
{
if (! GETPOST('cancel', 'alpha')) { if (! GETPOST('cancel', 'alpha')) {
$result = $accounting->fetch($id); $result = $accounting->fetch($id);
@ -111,9 +108,7 @@ else if ($action == 'edit')
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit(); exit();
} }
} } else if ($action == 'delete') {
else if ($action == 'delete')
{
$result = $accounting->fetch($id); $result = $accounting->fetch($id);
if (! empty($accounting->id)) { if (! empty($accounting->id)) {
@ -137,8 +132,7 @@ llxheader('', $langs->trans('AccountAccounting'));
$form = new Form($db); $form = new Form($db);
$htmlacc = new FormVentilation($db); $htmlacc = new FormVentilation($db);
if ($action == 'create') if ($action == 'create') {
{
print load_fiche_titre($langs->trans('NewAccount')); print load_fiche_titre($langs->trans('NewAccount'));
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
@ -177,9 +171,7 @@ if ($action == 'create')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else if ($id) {
else if ($id)
{
$rowid = $id; $rowid = $id;
$account = $accounting->fetch($rowid); $account = $accounting->fetch($rowid);
@ -188,8 +180,7 @@ else if ($id)
$head = accounting_prepare_head($accounting); $head = accounting_prepare_head($accounting);
if ($action == 'update') if ($action == 'update') {
{
$soc = new Societe($db); $soc = new Societe($db);
if ($object->socid) { if ($object->socid) {
$soc->fetch($object->socid); $soc->fetch($object->socid);
@ -232,9 +223,7 @@ else if ($id)
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else {
else
{
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>'; $linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr'); dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
@ -297,9 +286,7 @@ else if ($id)
print '</div>'; print '</div>';
} }
} } else {
else
{
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@ -21,16 +21,15 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/export.php * \file htdocs/accountancy/admin/export.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
$langs->load("compta"); $langs->load("compta");
$langs->load("bills"); $langs->load("bills");
@ -38,8 +37,8 @@ $langs->load("admin");
$langs->load("accountancy"); $langs->load("accountancy");
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
@ -83,7 +82,7 @@ if ($action == 'update') {
$error ++; $error ++;
} }
foreach ($main_option as $constname) { foreach ( $main_option as $constname ) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
@ -91,7 +90,7 @@ if ($action == 'update') {
} }
} }
foreach ($model_option as $constname) { foreach ( $model_option as $constname ) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
@ -114,12 +113,11 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup'); print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head(); $head = admin_accounting_prepare_head();
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@ -140,29 +138,25 @@ $var = ! $var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>'; print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
if (! $conf->use_javascript_ajax) if (! $conf->use_javascript_ajax) {
{
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("NotAvailableWhenAjaxDisabled"); print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>"; print "</td>";
} } else {
else
{
print '<td>'; print '<td>';
$listformat=array( $listformat = array (
'csv'=>$langs->trans("csv"), 'csv' => $langs->trans("csv"),
'txt'=>$langs->trans("txt") 'txt' => $langs->trans("txt")
); );
print $form->selectarray("format",$listformat,$conf->global->ACCOUNTING_EXPORT_FORMAT,0); print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
print '</td>'; print '</td>';
} }
print "</td></tr>"; print "</td></tr>";
$num = count($main_option); $num = count($main_option);
if ($num) if ($num) {
{ foreach ( $main_option as $key ) {
foreach ($main_option as $key) {
$var = ! $var; $var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';
@ -195,21 +189,18 @@ $var = ! $var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>'; print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
if (! $conf->use_javascript_ajax) if (! $conf->use_javascript_ajax) {
{
print '<td class="nowrap">'; print '<td class="nowrap">';
print $langs->trans("NotAvailableWhenAjaxDisabled"); print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>"; print "</td>";
} } else {
else
{
print '<td>'; print '<td>';
$listmodelcsv=array( $listmodelcsv = array (
'1'=>$langs->trans("Modelcsv_normal"), '1' => $langs->trans("Modelcsv_normal"),
'2'=>$langs->trans("Modelcsv_CEGID"), '2' => $langs->trans("Modelcsv_CEGID"),
'3'=>$langs->trans("Modelcsv_COALA") '3' => $langs->trans("Modelcsv_COALA")
); );
print $form->selectarray("modelcsv",$listmodelcsv,$conf->global->ACCOUNTING_EXPORT_MODELCSV,0); print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
print '</td>'; print '</td>';
} }
@ -223,15 +214,15 @@ print "<br>\n";
*/ */
$num2 = count($model_option); $num2 = count($model_option);
if ($num2) if ($num2) {
{
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>'; print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n"; print "</tr>\n";
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>'; if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1)
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
foreach ($model_option as $key) { foreach ( $model_option as $key ) {
$var = ! $var; $var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';

View File

@ -16,34 +16,37 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear.php * \file htdocs/accountancy/admin/fiscalyear.php
* \ingroup fiscal year * \ingroup fiscal year
* \brief Setup page to configure fiscal year * \brief Setup page to configure fiscal year
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$action=GETPOST('action'); $action = GETPOST('action');
$langs->load("admin"); $langs->load("admin");
$langs->load("compta"); $langs->load("compta");
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$error=0; $error = 0;
// List of statut // List of statut
static $tmpstatut2label=array( static $tmpstatut2label = array (
'0'=>'OpenFiscalYear', '0' => 'OpenFiscalYear',
'1'=>'CloseFiscalYear' '1' => 'CloseFiscalYear'
); );
$statut2label=array(''); $statut2label = array (
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); ''
);
foreach ( $tmpstatut2label as $key => $val )
$statut2label[$key] = $langs->trans($val);
$errors=array(); $errors = array ();
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
@ -55,67 +58,59 @@ $object = new Fiscalyear($db);
* View * View
*/ */
$max=100; $max = 100;
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('FiscalYears'); $title = $langs->trans('FiscalYears');
llxHeader('',$title,LOG_ERR); llxHeader('', $title, LOG_ERR);
print load_fiche_titre($langs->trans('FiscalYears')); print load_fiche_titre($langs->trans('FiscalYears'));
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_fiscalyear as f";
$sql.= " WHERE f.entity = ".$conf->entity; $sql .= " WHERE f.entity = " . $conf->entity;
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{ $var = false;
$var=false; $num = $db->num_rows($result);
$num = $db->num_rows($result);
$i = 0; $i = 0;
// Load attribute_label // Load attribute_label
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>'; print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>' . $langs->trans("Label") . '</td>';
print '<td>'.$langs->trans("DateStart").'</td>'; print '<td>' . $langs->trans("DateStart") . '</td>';
print '<td>'.$langs->trans("DateEnd").'</td>'; print '<td>' . $langs->trans("DateEnd") . '</td>';
print '<td align="right">'.$langs->trans("Statut").'</td>'; print '<td align="right">' . $langs->trans("Statut") . '</td>';
print '</tr>'; print '</tr>';
if ($num) if ($num) {
{ $fiscalyearstatic = new Fiscalyear($db);
$fiscalyearstatic=new Fiscalyear($db);
while ($i < $num && $i < $max) while ( $i < $num && $i < $max ) {
{ $obj = $db->fetch_object($result);
$obj = $db->fetch_object($result); $fiscalyearstatic->id = $obj->rowid;
$fiscalyearstatic->id=$obj->rowid; print '<tr ' . $bc[$var] . '>';
print '<tr '.$bc[$var].'>'; print '<td><a href="fiscalyear_card.php?id=' . $obj->rowid . '">' . img_object($langs->trans("ShowFiscalYear"), "technic") . ' ' . $obj->rowid . '</a></td>';
print '<td><a href="fiscalyear_card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowFiscalYear"),"technic").' '.$obj->rowid.'</a></td>'; print '<td align="left">' . $obj->label . '</td>';
print '<td align="left">'.$obj->label.'</td>'; print '<td align="left">' . dol_print_date($db->jdate($obj->date_start), 'day') . '</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->date_start),'day').'</td>'; print '<td align="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
print '<td align="left">'.dol_print_date($db->jdate($obj->date_end),'day').'</td>'; print '<td align="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
print '<td align="right">'.$fiscalyearstatic->LibStatut($obj->statut,5).'</td>'; print '</tr>';
print '</tr>'; $var = ! $var;
$var=!$var; $i ++;
$i++; }
} } else {
print '<tr ' . $bc[$var] . '><td colspan="5">' . $langs->trans("None") . '</td></tr>';
} }
else
{
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table>'; print '</table>';
} } else {
else
{
dol_print_error($db); dol_print_error($db);
} }
@ -123,7 +118,7 @@ dol_fiche_end();
// Buttons // Buttons
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="fiscalyear_card.php?action=create">'.$langs->trans("NewFiscalYear").'</a>'; print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
print '</div>'; print '</div>';
llxFooter(); llxFooter();

View File

@ -16,145 +16,123 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show a fiscal year * \brief Page to show a fiscal year
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("compta"); $langs->load("compta");
// Security check // Security check
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$error=0; $error = 0;
$action = GETPOST('action','alpha'); $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm','alpha'); $confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id','int'); $id = GETPOST('id', 'int');
// List of statut // List of statut
static $tmpstatut2label=array( static $tmpstatut2label = array (
'0'=>'OpenFiscalYear', '0' => 'OpenFiscalYear',
'1'=>'CloseFiscalYear' '1' => 'CloseFiscalYear'
); );
$statut2label=array(''); $statut2label = array (
foreach ($tmpstatut2label as $key => $val) $statut2label[$key]=$langs->trans($val); ''
);
foreach ( $tmpstatut2label as $key => $val )
$statut2label[$key] = $langs->trans($val);
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
$date_start=dol_mktime(0,0,0,GETPOST('fiscalyearmonth','int'),GETPOST('fiscalyearday','int'),GETPOST('fiscalyearyear','int')); $date_start = dol_mktime(0, 0, 0, GETPOST('fiscalyearmonth', 'int'), GETPOST('fiscalyearday', 'int'), GETPOST('fiscalyearyear', 'int'));
$date_end=dol_mktime(0,0,0,GETPOST('fiscalyearendmonth','int'),GETPOST('fiscalyearendday','int'),GETPOST('fiscalyearendyear','int')); $date_end = dol_mktime(0, 0, 0, GETPOST('fiscalyearendmonth', 'int'), GETPOST('fiscalyearendday', 'int'), GETPOST('fiscalyearendyear', 'int'));
/* /*
* Actions * Actions
*/ */
if ($action == 'confirm_delete' && $confirm == "yes") if ($action == 'confirm_delete' && $confirm == "yes") {
{ $result = $object->delete($id);
$result=$object->delete($id); if ($result >= 0) {
if ($result >= 0) header("Location: fiscalyear.php");
{ exit();
header("Location: fiscalyear.php"); } else {
exit; setEventMessages($object->error, $object->errors, 'errors');
} }
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
} }
else if ($action == 'add') else if ($action == 'add') {
{ if (! GETPOST('cancel', 'alpha')) {
if (! GETPOST('cancel','alpha')) $error = 0;
{
$error=0;
$object->date_start = $date_start; $object->date_start = $date_start;
$object->date_end = $date_end; $object->date_end = $date_end;
$object->label = GETPOST('label','alpha'); $object->label = GETPOST('label', 'alpha');
$object->statut = GETPOST('statut','int'); $object->statut = GETPOST('statut', 'int');
$object->datec = dol_now(); $object->datec = dol_now();
if (empty($object->date_start) && empty($object->date_end)) if (empty($object->date_start) && empty($object->date_end)) {
{ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $error ++;
$error++; }
} if (empty($object->label)) {
if (empty($object->label)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
{ $error ++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); }
$error++;
}
if (! $error) if (! $error) {
{
$db->begin(); $db->begin();
$id = $object->create($user); $id = $object->create($user);
if ($id > 0) if ($id > 0) {
{ $db->commit();
$db->commit();
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit; exit();
} } else {
else $db->rollback();
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action='create'; $action = 'create';
} }
} } else {
else $action = 'create';
{ }
$action='create'; } else {
} header("Location: ./fiscalyear.php");
} exit();
else }
{
header("Location: ./fiscalyear.php");
exit;
}
} }
// Update record // Update record
else if ($action == 'update') else if ($action == 'update') {
{ if (! GETPOST('cancel', 'alpha')) {
if (! GETPOST('cancel','alpha')) $result = $object->fetch($id);
{
$result = $object->fetch($id);
$object->date_start = empty($_POST["fiscalyear"])?'':$date_start; $object->date_start = empty($_POST["fiscalyear"]) ? '' : $date_start;
$object->date_end = empty($_POST["fiscalyearend"])?'':$date_end; $object->date_end = empty($_POST["fiscalyearend"]) ? '' : $date_end;
$object->label = GETPOST('label','alpha'); $object->label = GETPOST('label', 'alpha');
$object->statut = GETPOST('statut','int'); $object->statut = GETPOST('statut', 'int');
$result = $object->update($user); $result = $object->update($user);
if ($result > 0) if ($result > 0) {
{ header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit();
exit; } else {
} setEventMessages($object->error, $object->errors, 'errors');
else }
{ } else {
setEventMessages($object->error, $object->errors, 'errors'); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
} exit();
} }
else
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
} }
/* /*
@ -167,176 +145,165 @@ $form = new Form($db);
/* /*
* Action create * Action create
*/ */
if ($action == 'create') if ($action == 'create') {
{ print load_fiche_titre($langs->trans("NewFiscalYear"));
print load_fiche_titre($langs->trans("NewFiscalYear"));
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>'; print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>';
// Date start // Date start
print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>';
print $form->select_date(($date_start?$date_start:''),'fiscalyear'); print $form->select_date(($date_start ? $date_start : ''), 'fiscalyear');
print '</td></tr>'; print '</td></tr>';
// Date end // Date end
print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("DateEnd") . '</td><td>';
print $form->select_date(($date_end?$date_end:-1),'fiscalyearend'); print $form->select_date(($date_end ? $date_end : - 1), 'fiscalyearend');
print '</td></tr>'; print '</td></tr>';
// Statut // Statut
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("Statut").'</td>'; print '<td class="fieldrequired">' . $langs->trans("Statut") . '</td>';
print '<td class="valeur">'; print '<td class="valeur">';
print $form->selectarray('statut',$statut2label,GETPOST('statut')); print $form->selectarray('statut', $statut2label, GETPOST('statut'));
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else if ($id) {
else if ($id) $result = $object->fetch($id);
{ if ($result > 0) {
$result = $object->fetch($id); $head = fiscalyear_prepare_head($object);
if ($result > 0)
{
$head = fiscalyear_prepare_head($object);
if ($action == 'edit') if ($action == 'edit') {
{ dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="' . $id . '">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print "<tr>"; print "<tr>";
print '<td width="20%">'.$langs->trans("Ref").'</td><td>'; print '<td width="20%">' . $langs->trans("Ref") . '</td><td>';
print $object->rowid; print $object->rowid;
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
print '<input name="label" class="flat" size="32" value="'.$object->label.'">';
print '</td></tr>';
// Date start
print '<tr><td class="fieldrequired">'.$langs->trans("DateStart").'</td><td>';
print $form->select_date($object->date_start?$object->date_start:-1,'fiscalyear');
print '</td></tr>';
// Date end
print '<tr><td class="fieldrequired">'.$langs->trans("DateEnd").'</td><td>';
print $form->select_date($object->date_end?$object->date_end:-1,'fiscalyearend');
print '</td></tr>';
// Statut
print '<tr><td>'.$langs->trans("Statut").'</td><td>';
print $form->selectarray('statut',$statut2label,$object->statut);
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '<br><div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
dol_fiche_end();
}
else
{
/*
* Confirm delete
*/
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteFiscalYear"),$langs->trans("ConfirmDeleteFiscalYear"),"confirm_delete");
}
dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/fiscalyear.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td width="50%">';
print $object->rowid;
print '</td><td width="25%">';
print $linkback;
print '</td></tr>';
// Label // Label
print '<tr><td valign="top">'; print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td><td>';
print $form->editfieldkey("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32'); print '<input name="label" class="flat" size="32" value="' . $object->label . '">';
print '</td><td colspan="2">'; print '</td></tr>';
print $form->editfieldval("Label",'label',$object->label,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'alpha:32');
print "</td></tr>";
// Date start // Date start
print '<tr><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("DateStart") . '</td><td>';
print $form->editfieldkey("Date",'date_start',$object->date_start,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker'); print $form->select_date($object->date_start ? $object->date_start : - 1, 'fiscalyear');
print '</td><td colspan="2">'; print '</td></tr>';
print $form->editfieldval("Date",'date_start',$object->date_start,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td></tr>';
// Date end // Date end
print '<tr><td>'; print '<tr><td class="fieldrequired">' . $langs->trans("DateEnd") . '</td><td>';
print $form->editfieldkey("Date",'date_end',$object->date_end,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker'); print $form->select_date($object->date_end ? $object->date_end : - 1, 'fiscalyearend');
print '</td><td colspan="2">'; print '</td></tr>';
print $form->editfieldval("Date",'date_end',$object->date_end,$object,$conf->global->MAIN_EDIT_ALSO_INLINE,'datepicker');
print '</td></tr>';
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>' . $langs->trans("Statut") . '</td><td>';
print $form->selectarray('statut', $statut2label, $object->statut);
print '</td></tr>';
print "</table>"; print '</table>';
dol_fiche_end(); print '<br><div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
print '</div>';
/* print '</form>';
* Barre d'actions
*/
print '<div class="tabsAction">'; dol_fiche_end();
} else {
/*
* Confirm delete
*/
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete");
}
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>'; dol_fiche_head($head, 'card', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>'; print '<table class="border" width="100%">';
print '</div>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/fiscalyear.php">' . $langs->trans("BackToList") . '</a>';
}
} // Ref
else print '<tr><td width="25%">' . $langs->trans("Ref") . '</td><td width="50%">';
{ print $object->rowid;
dol_print_error($db); print '</td><td width="25%">';
} print $linkback;
print '</td></tr>';
// Label
print '<tr><td valign="top">';
print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print '</td><td colspan="2">';
print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print "</td></tr>";
// Date start
print '<tr><td>';
print $form->editfieldkey("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td><td colspan="2">';
print $form->editfieldval("Date", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td></tr>';
// Date end
print '<tr><td>';
print $form->editfieldkey("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td><td colspan="2">';
print $form->editfieldval("Date", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker');
print '</td></tr>';
// Statut
print '<tr><td>' . $langs->trans("Status") . '</td><td colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
print "</table>";
dol_fiche_end();
/*
* Barre d'actions
*/
print '<div class="tabsAction">';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
print '</div>';
}
} else {
dol_print_error($db);
}
} }
llxFooter(); llxFooter();

View File

@ -16,30 +16,28 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show info of a fiscal year * \brief Page to show info of a fiscal year
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$langs->load("admin"); $langs->load("admin");
$langs->load("compta"); $langs->load("compta");
// Security check // Security check
if (! $user->admin) accessforbidden(); if (! $user->admin)
accessforbidden();
$id = GETPOST('id','int'); $id = GETPOST('id', 'int');
// View // View
llxHeader(); llxHeader();
if ($id) if ($id) {
{
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
$object->fetch($id); $object->fetch($id);
$object->info($id); $object->info($id);
@ -48,11 +46,11 @@ if ($id)
dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron'); dol_fiche_head($head, 'info', $langs->trans("FiscalYearCard"), 0, 'cron');
print '<table width="100%"><tr><td>'; print '<table width="100%"><tr><td>';
dol_print_object_info($object); dol_print_object_info($object);
print '</td></tr></table>'; print '</td></tr></table>';
print '</div>'; print '</div>';
} }
llxFooter(); llxFooter();

View File

@ -19,17 +19,16 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/importaccounts.php * \file htdocs/accountancy/admin/importaccounts.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page import accounting account * \brief Page import accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// langs // langs
$langs->load("compta"); $langs->load("compta");
@ -38,8 +37,8 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
llxHeader('', $langs->trans("ImportAccount")); llxHeader('', $langs->trans("ImportAccount"));
@ -92,9 +91,9 @@ if ($_POST["action"] == 'import') {
} }
/* /*
* list accounting account from product * list accounting account from product
* *
*/ */
$page = GETPOST("page"); $page = GETPOST("page");
if ($page < 0) if ($page < 0)
$page = 0; $page = 0;

View File

@ -23,11 +23,10 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/index.php * \file htdocs/accountancy/admin/index.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
@ -41,16 +40,16 @@ $langs->load("admin");
$langs->load("accountancy"); $langs->load("accountancy");
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_* // Other parameters ACCOUNTING_*
$list = array ( $list = array (
'ACCOUNTING_LIMIT_LIST_VENTILATION', 'ACCOUNTING_LIMIT_LIST_VENTILATION',
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT' 'ACCOUNTING_LENGTH_AACCOUNT'
); );
@ -72,27 +71,26 @@ $list_account = array (
* Actions * Actions
*/ */
$accounting_mode = defined('ACCOUNTING_MODE')?ACCOUNTING_MODE:'RECETTES-DEPENSES'; $accounting_mode = defined('ACCOUNTING_MODE') ? ACCOUNTING_MODE : 'RECETTES-DEPENSES';
if ($action == 'update') if ($action == 'update') {
{ $error = 0;
$error = 0;
$accounting_modes = array( $accounting_modes = array (
'RECETTES-DEPENSES', 'RECETTES-DEPENSES',
'CREANCES-DETTES' 'CREANCES-DETTES'
); );
$accounting_mode = GETPOST('accounting_mode','alpha'); $accounting_mode = GETPOST('accounting_mode', 'alpha');
if (in_array($accounting_mode,$accounting_modes)) { if (in_array($accounting_mode, $accounting_modes)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
$error++; $error ++;
} }
} else { } else {
$error++; $error ++;
} }
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
@ -105,30 +103,27 @@ if ($action == 'update')
$error ++; $error ++;
} }
foreach ($list as $constname) { foreach ( $list as $constname ) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error ++;
} }
} }
foreach ($list_account as $constname) { foreach ( $list_account as $constname ) {
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++; $error ++;
} }
} }
if (! $error) if (! $error) {
{ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else {
} setEventMessages($langs->trans("Error"), null, 'errors');
else }
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} }
if ($action == 'setlistsorttodo') { if ($action == 'setlistsorttodo') {
@ -163,16 +158,15 @@ if ($action == 'setlistsortdone') {
llxHeader(); llxHeader();
$form = new Form($db); $form = new Form($db);
$formaccountancy = New FormVentilation($db); $formaccountancy = new FormVentilation($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup'); print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head($accounting); $head = admin_accounting_prepare_head($accounting);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron'); dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
@ -182,24 +176,24 @@ print '<table class="noborder" width="100%">';
// Cas du parametre ACCOUNTING_MODE // Cas du parametre ACCOUNTING_MODE
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('OptionMode').'</td><td>'.$langs->trans('Description').'</td>'; print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode != 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeTrue').'</td>'; print '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_mode" value="RECETTES-DEPENSES"' . ($accounting_mode != 'CREANCES-DETTES' ? ' checked' : '') . '> ' . $langs->trans('OptionModeTrue') . '</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionModeTrueDesc')); print '<td colspan="2">' . nl2br($langs->trans('OptionModeTrueDesc'));
// Write info on way to count VAT // Write info on way to count VAT
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) // if (! empty($conf->global->MAIN_MODULE_COMPTABILITE))
//{ // {
// // print "<br>\n"; // // print "<br>\n";
// // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite')); // // print nl2br($langs->trans('OptionModeTrueInfoModuleComptabilite'));
//} // }
//else // else
//{ // {
// // print "<br>\n"; // // print "<br>\n";
// // print nl2br($langs->trans('OptionModeTrueInfoExpert')); // // print nl2br($langs->trans('OptionModeTrueInfoExpert'));
//} // }
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode == 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeVirtual').'</td>'; print '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_mode" value="CREANCES-DETTES"' . ($accounting_mode == 'CREANCES-DETTES' ? ' checked' : '') . '> ' . $langs->trans('OptionModeVirtual') . '</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionModeVirtualDesc'))."</td></tr>\n"; print '<td colspan="2">' . nl2br($langs->trans('OptionModeVirtualDesc')) . "</td></tr>\n";
print "</table>\n"; print "</table>\n";
@ -259,31 +253,29 @@ print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>'; print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n"; print "</tr>\n";
foreach ($list as $key) foreach ( $list as $key ) {
{ $var = ! $var;
$var=!$var;
print '<tr '.$bc[$var].' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>'; print '<td><label for="' . $key . '">' . $label . '</label></td>';
// Value // Value
print '<td>'; print '<td>';
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">'; print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td></tr>'; print '</td></tr>';
} }
foreach ($list_account as $key) foreach ( $list_account as $key ) {
{ $var = ! $var;
$var=!$var;
print '<tr '.$bc[$var].' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>'; print '<td><label for="' . $key . '">' . $label . '</label></td>';
// Value // Value
print '<td>'; print '<td>';
@ -323,7 +315,7 @@ print "</table>\n";
dol_fiche_end(); dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>'; print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
print '</form>'; print '</form>';

View File

@ -22,24 +22,23 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/journal.php * \file htdocs/accountancy/admin/journal.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
$langs->load("accountancy"); $langs->load("accountancy");
// Security check // Security check
if (!$user->admin) if (! $user->admin)
accessforbidden(); accessforbidden();
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
@ -82,8 +81,8 @@ llxHeader();
$form = new Form($db); $form = new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup'); print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head(null); $head = admin_accounting_prepare_head(null);
@ -115,10 +114,8 @@ foreach ( $list as $key ) {
print "</table>\n"; print "</table>\n";
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>'; print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>';
@ -126,39 +123,37 @@ print "</tr>\n";
// Bank account // Bank account
$sql = "SELECT rowid, label, accountancy_journal"; $sql = "SELECT rowid, label, accountancy_journal";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
$sql.= " WHERE entity = ".$conf->entity; $sql .= " WHERE entity = " . $conf->entity;
$sql.= " AND clos = 0"; $sql .= " AND clos = 0";
$sql.= " ORDER BY label"; $sql .= " ORDER BY label";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$numr = $db->num_rows($resql); $numr = $db->num_rows($resql);
$i = 0; $i = 0;
if ($numr > 0) if ($numr > 0)
while ($i < $numr) while ( $i < $numr ) {
{ $objp = $db->fetch_object($resql);
$objp = $db->fetch_object($resql);
$var = ! $var; $var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';
// Param // Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>'; print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>';
// Value // Value
print '<td>'; print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>'; print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>';
print '</td></tr>'; print '</td></tr>';
$i++; $i ++;
} }
} } else
else dol_print_error($db); dol_print_error($db);
$db->free($resql); $db->free($resql);
print "</table>\n"; print "</table>\n";
@ -169,6 +164,5 @@ print '<div class="center"><input type="submit" class="button" value="' . $langs
print '</form>'; print '</form>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -20,20 +20,24 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/productaccount.php * \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief To define accounting account on product / service <<<<<<< HEAD
* \brief To define accounting account on product / service
=======
* \brief Onglet de gestion de parametrages des ventilations
>>>>>>> refs/remotes/origin/3.9
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
// Langs // Langs
$langs->load("companies"); $langs->load("companies");
@ -42,8 +46,12 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
// Security check // Security check
if (!$user->admin) accessforbidden(); if (! $user->admin) {
if (empty($conf->accounting->enabled)) accessforbidden(); accessforbidden();
}
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
// search & action GETPOST // search & action GETPOST
$action = GETPOST('action'); $action = GETPOST('action');
@ -73,14 +81,16 @@ $pagenext = $page + 1;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;
if (! $sortfield) if (! $sortfield) {
$sortfield = "p.ref"; $sortfield = "p.ref";
if (! $sortorder) }
if (! $sortorder) {
$sortorder = "ASC"; $sortorder = "ASC";
}
// Sales or Purchase mode ? // Sales or Purchase mode ?
if ($action == 'update') { if ($action == 'update') {
@ -115,11 +125,11 @@ if ($action == 'update') {
$cpt = 0; $cpt = 0;
foreach ( $chk_prod as $productid ) { foreach ( $chk_prod as $productid ) {
$accounting_account_id=GETPOST('codeventil_'.$productid); $accounting_account_id = GETPOST('codeventil_' . $productid);
$result=$accounting->fetch($accounting_account_id,null,1); $result = $accounting->fetch($accounting_account_id, null, 1);
if ($result<0) { if ($result < 0) {
//setEventMessages(null, $accounting->errors, 'errors'); // setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>'; $msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else { } else {
@ -146,7 +156,6 @@ if ($action == 'update') {
$msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; $msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
} }
$msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; $msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
} }
} }
@ -236,10 +245,10 @@ if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
print load_fiche_titre($langs->trans("InitAccountancy"),'','title_setup'); print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br>'; print '<br>';
print $langs->trans("InitAccountancyDesc").'<br>'; print $langs->trans("InitAccountancyDesc") . '<br>';
print '<br>'; print '<br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
@ -272,14 +281,14 @@ if ($result) {
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
/* /*
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre($langs->trans("Accountancy_code_buy")); print_liste_field_titre($langs->trans("Accountancy_code_buy"));
} else { } else {
print_liste_field_titre($langs->trans("Accountancy_code_sell")); print_liste_field_titre($langs->trans("Accountancy_code_sell"));
} }
*/ */
print_liste_field_titre($langs->trans("AccountAccounting")); print_liste_field_titre($langs->trans("AccountAccounting"));
print_liste_field_titre($langs->trans("Modify") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>','','','','','align="center"'); print_liste_field_titre($langs->trans("Modify") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -345,26 +354,23 @@ if ($result) {
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>'; print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
// Accounting account buy // Accounting account buy
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
{
// print '<td align="left">' . $obj->accountancy_code_buy . '</td>'; // print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
// TODO: replace by select // TODO: replace by select
// print '<td align="left">' . $compta_prodbuy . '</td>'; // print '<td align="left">' . $compta_prodbuy . '</td>';
// TODO: we shoul set a user defined value to adjust user square / wide screen size // TODO: we shoul set a user defined value to adjust user square / wide screen size
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="left">'; print '<td align="left">';
print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1); print $form->select_account($compta_prodbuy_id, 'codeventil_' . $product_static->id, 1);
print '</td>'; print '</td>';
} } else {
else
{
// Accounting account sell // Accounting account sell
// print '<td align="left">' . $obj->accountancy_code_sell . '</td>'; // print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
// TODO: replace by select // TODO: replace by select
// TODO: we shoul set a user defined value to adjust user square / wide screen size // TODO: we shoul set a user defined value to adjust user square / wide screen size
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="left">'; print '<td align="left">';
print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1); print $form->select_account($compta_prodsell_id, 'codeventil_' . $product_static->id, 1);
print '</td>'; print '</td>';
} }

View File

@ -20,16 +20,15 @@
*/ */
/** /**
* \file htdocs/accountancy/bookkeeping/balancebymonth.php * \file htdocs/accountancy/bookkeeping/balancebymonth.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Balance by month * \brief Balance by month
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs // Langs
$langs->load("main"); $langs->load("main");

View File

@ -18,15 +18,14 @@
*/ */
/** /**
* \file htdocs/accountancy/bookkeeping/card.php * \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page to show account * \brief Page to show account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.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 . '/accountancy/class/html.formventilation.class.php';
// Langs // Langs
@ -34,8 +33,9 @@ $langs->load("accountancy");
// Security check // Security check
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if ($user->societe_id > 0) if ($user->societe_id > 0) {
accessforbidden(); accessforbidden();
}
$action = GETPOST('action'); $action = GETPOST('action');
$piece_num = GETPOST("piece_num"); $piece_num = GETPOST("piece_num");
@ -44,150 +44,150 @@ $mesg = '';
$account_number = GETPOST('account_number'); $account_number = GETPOST('account_number');
$code_tiers = GETPOST('code_tiers'); $code_tiers = GETPOST('code_tiers');
if ($code_tiers==-1) { if ($code_tiers == - 1) {
$code_tiers=null; $code_tiers = null;
} }
$label_compte = GETPOST('label_compte'); $label_compte = GETPOST('label_compte');
$debit = price2num(GETPOST('debit')); $debit = price2num(GETPOST('debit'));
$credit = price2num(GETPOST('credit')); $credit = price2num(GETPOST('credit'));
$save=GETPOST('save'); $save = GETPOST('save');
if (!empty($save)) { if (! empty($save)) {
$action='add'; $action = 'add';
} }
$update=GETPOST('update'); $update = GETPOST('update');
if (!empty($update)) { if (! empty($update)) {
$action='confirm_update'; $action = 'confirm_update';
} }
if ($action == "confirm_update") { if ($action == "confirm_update") {
$error = 0; $error = 0;
if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
$book->numero_compte = $account_number;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (floatval($debit)!=0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
if (floatval($credit)!=0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update($user);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = '';
}
}
}
}
else if ($action == "add") {
$error = 0;
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors'); setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++; $error ++;
} }
if (empty($error)) { if (empty($error)) {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
$book->numero_compte = $account_number;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (floatval($debit) != 0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
if (floatval($credit) != 0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update($user);
if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors');
} else {
setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = '';
}
}
}
}
else if ($action == "add") {
$error = 0;
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$book->numero_compte = $account_number; $book->numero_compte = $account_number;
$book->code_tiers = $code_tiers; $book->code_tiers = $code_tiers;
$book->label_compte = $label_compte; $book->label_compte = $label_compte;
$book->debit = $debit; $book->debit = $debit;
$book->credit = $credit; $book->credit = $credit;
$book->doc_date = GETPOST('doc_date'); $book->doc_date = GETPOST('doc_date');
$book->doc_type = GETPOST('doc_type'); $book->doc_type = GETPOST('doc_type');
$book->piece_num = $piece_num; $book->piece_num = $piece_num;
$book->doc_ref = GETPOST('doc_ref'); $book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal'); $book->code_journal = GETPOST('code_journal');
$book->fk_doc = GETPOST('fk_doc'); $book->fk_doc = GETPOST('fk_doc');
$book->fk_docdet = GETPOST('fk_docdet'); $book->fk_docdet = GETPOST('fk_docdet');
if (floatval($debit) != 0.0) { if (floatval($debit) != 0.0) {
$book->montant = $debit; $book->montant = $debit;
$book->sens = 'D'; $book->sens = 'D';
} }
if (floatval($credit) != 0.0) { if (floatval($credit) != 0.0) {
$book->montant = $credit; $book->montant = $credit;
$book->sens = 'C'; $book->sens = 'C';
} }
$result = $book->createStd($user); $result = $book->createStd($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
setEventMessages($langs->trans('Saved'), null, 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = ''; $action = '';
} }
} }
} }
else if ($action == "confirm_delete") { else if ($action == "confirm_delete") {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$result = $book->fetch($id); $result = $book->fetch($id);
$piece_num = $book->piece_num; $piece_num = $book->piece_num;
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
$result = $book->delete($user); $result = $book->delete($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} }
} }
$action = ''; $action = '';
} }
else if ($action == "confirm_create") { else if ($action == "confirm_create") {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$book->label_compte = ''; $book->label_compte = '';
$book->debit = 0; $book->debit = 0;
$book->credit = 0; $book->credit = 0;
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear')); $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
$book->doc_type = GETPOST('doc_type'); $book->doc_type = GETPOST('doc_type');
$book->piece_num = GETPOST('next_num_mvt'); $book->piece_num = GETPOST('next_num_mvt');
$book->doc_ref = GETPOST('doc_ref'); $book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal'); $book->code_journal = GETPOST('code_journal');
$book->fk_doc = 0; $book->fk_doc = 0;
$book->fk_docdet = 0; $book->fk_docdet = 0;
$book->montant = 0; $book->montant = 0;
$result = $book->createStd($user); $result = $book->createStd($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
setEventMessages($langs->trans('Saved'), null, 'mesgs'); setEventMessages($langs->trans('Saved'), null, 'mesgs');
$action = ''; $action = '';
$piece_num = $book->piece_num; $piece_num = $book->piece_num;
} }
} }
llxHeader(); llxHeader();
@ -199,115 +199,115 @@ $formventilation = new FormVentilation($db);
* Confirmation to delete the command * Confirmation to delete the command
*/ */
if ($action == 'delete') { if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1); $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm; print $formconfirm;
} }
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("CreateMvts")); print load_fiche_titre($langs->trans("CreateMvts"));
$code_journal_array = array ( $code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL, $conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL, $conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL, $conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
$conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL, $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_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'; $sql = 'SELECT DISTINCT accountancy_journal FROM ' . MAIN_DB_PREFIX . 'bank_account WHERE clos=0';
$resql=$db->query($sql); $resql = $db->query($sql);
if (!$resql) { if (! $resql) {
setEventMessages($db->lasterror,null,'errors'); setEventMessages($db->lasterror, null, 'errors');
} else { } else {
while ($obj_bank=$db->fetch_object($resql)) { while ( $obj_bank = $db->fetch_object($resql) ) {
if (!empty($obj_bank->accountancy_journal)) { if (! empty($obj_bank->accountancy_journal)) {
$code_journal_array[$obj_bank->accountancy_journal]=$obj_bank->accountancy_journal; $code_journal_array[$obj_bank->accountancy_journal] = $obj_bank->accountancy_journal;
} }
} }
} }
$book = new BookKeeping($db); $book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt(); $next_num_mvt = $book->getNextNumMvt();
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n"; print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n"; print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>'; print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>'; print '<td>' . $next_num_mvt . '</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>'; print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>'; print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>'; print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>'; print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>'; print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>'; print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>'; print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>'; print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">'; print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="' . $langs->trans("Cancel") . '" class="button" onclick="history.go(-1)" />';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} else { } else {
$book = new BookKeeping($db); $book = new BookKeeping($db);
$result = $book->fetchPerMvt($piece_num); $result = $book->fetchPerMvt($piece_num);
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} }
if (! empty($book->piece_num)) { if (! empty($book->piece_num)) {
print load_fiche_titre($langs->trans("UpdateMvts")); print load_fiche_titre($langs->trans("UpdateMvts"), '<a href="list.php">' . $langs->trans('BackToList') . '</a>');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr class="pair">'; print '<tr class="pair">';
print '<td>' . $langs->trans("NumMvts") . '</td>'; print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>'; print '<td>' . $book->piece_num . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>'; print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>'; print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>'; print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>'; print '<td>' . $book->code_journal . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>'; print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>'; print '<td>' . $book->doc_ref . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>'; print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>'; print '<td>' . $book->doc_type . '</td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
$result = $book->fetch_all_per_mvt($piece_num); $result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) { if ($result < 0) {
setEventMessages($book->error, $book->errors, 'errors'); setEventMessages($book->error, $book->errors, 'errors');
} else { } else {
print load_fiche_titre($langs->trans("ListeMvts")); print load_fiche_titre($langs->trans("ListeMvts"));
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n"; print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
@ -317,100 +317,103 @@ if ($action == 'create') {
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n"; print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n"; print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
if (count($book->linesmvt) > 0) { if (count($book->linesmvt) > 0) {
$total_debit=0; $total_debit = 0;
$total_credit=0; $total_credit = 0;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte")); print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("Code_tiers")); print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte")); print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit")); print_liste_field_titre($langs->trans("Debit"));
print_liste_field_titre($langs->trans("Credit")); print_liste_field_titre($langs->trans("Credit"));
print_liste_field_titre($langs->trans("Amount")); print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("Sens")); print_liste_field_titre($langs->trans("Sens"));
print_liste_field_titre(''); print_liste_field_titre('');
print "</tr>\n"; print "</tr>\n";
foreach ( $book->linesmvt as $line ) { foreach ( $book->linesmvt as $line ) {
$var = ! $var; $var = ! $var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
$total_debit+=$line->debit; $total_debit += $line->debit;
$total_credit+=$line->credit; $total_credit += $line->credit;
if ($action == 'update' && $line->id == $id) {
if ($action == 'update' && $line->id == $id) {
print '<td>'; print '<td>';
print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1,''); print $formventilation->select_account($line->numero_compte, 'account_number', 0, array (), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers',1); print $formventilation->select_auxaccount($line->code_tiers, 'code_tiers', 1);
print '</td>'; print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>'; print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>'; print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>'; print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n"; print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">'; print '<input type="submit" class="button" name="update" value="' . $langs->trans("Update") . '">';
print '</td>'; print '</td>';
} else { } else {
print '<td>' . $line->numero_compte . '</td>'; print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>'; print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->debit . '</td>'; print '<td>' . $line->debit . '</td>';
print '<td>' . $line->credit . '</td>'; print '<td>' . $line->credit . '</td>';
print '<td>' . $line->montant . '</td>'; print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
print '<a href="./card.php?action=update&amp;id=' . $line->id . '&amp;piece_num=' . $line->piece_num . '">'; print '<a href="./card.php?action=update&amp;id=' . $line->id . '&amp;piece_num=' . $line->piece_num . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;'; print '</a>&nbsp;';
print '<a href="./card.php?action=delete&amp;id=' . $line->id . '&amp;piece_num=' . $line->piece_num . '">'; print '<a href="./card.php?action=delete&amp;id=' . $line->id . '&amp;piece_num=' . $line->piece_num . '">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} }
print "</tr>\n"; print "</tr>\n";
}
if ($total_debit!=$total_credit) {
setEventMessages(null, array('MvtNotCorrectlyBalanced',$total_credit,$total_debit),'errors');
} }
if ($action == "" || $action == 'add') { if ($total_debit != $total_credit) {
$var = ! $var; setEventMessages(null, array (
print "<tr $bc[$var]>"; 'MvtNotCorrectlyBalanced',
$total_credit,
$total_debit
), 'errors');
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>'; print '<td>';
print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, '');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $formventilation->select_auxaccount($code_tiers, 'code_tiers',1); print $formventilation->select_auxaccount($code_tiers, 'code_tiers', 1);
print '</td>'; print '</td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>'; print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>'; print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>'; print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '"></td>'; print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '"></td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} }
} }
} else { } else {
print load_fiche_titre($langs->trans("NoRecords")); print load_fiche_titre($langs->trans("NoRecords"));
} }
} }
llxFooter(); llxFooter();

View File

@ -46,10 +46,10 @@ $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST(
$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) { if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt")) {
$action='delbookkeepingyear'; $action = 'delbookkeepingyear';
} }
if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) { if (GETPOST("button_export_csv_x") || GETPOST("button_export_csv")) {
$action='export_csv'; $action = 'export_csv';
} }
$search_accountancy_code = GETPOST("search_accountancy_code"); $search_accountancy_code = GETPOST("search_accountancy_code");
@ -79,8 +79,6 @@ $search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
$object = new BookKeeping($db); $object = new BookKeeping($db);
@ -114,9 +112,8 @@ if (empty($search_date_start)) {
} }
if ($sortorder == "") if ($sortorder == "")
$sortorder = "ASC"; $sortorder = "ASC";
if ($sortfield == "") if ($sortfield == "")
$sortfield = "t.rowid"; $sortfield = "t.rowid";
$options = ''; $options = '';
$filter = array (); $filter = array ();
@ -181,7 +178,6 @@ if (! empty($search_mvt_num)) {
$options .= '&amp;search_mvt_num=' . $search_mvt_num; $options .= '&amp;search_mvt_num=' . $search_mvt_num;
} }
/* /*
* Action * Action
*/ */
@ -218,18 +214,18 @@ if ($action == 'delbookkeeping') {
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
//if (!empty($options)) { // if (!empty($options)) {
// Header("Location: list.php?".urldecode($options)); // Header("Location: list.php?".urldecode($options));
//} else { // } else {
Header("Location: list.php"); Header("Location: list.php");
//} // }
exit(); exit();
} }
} elseif ($action == 'export_csv') { } elseif ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping'; $journal = 'bookkepping';
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($result < 0) { if ($result < 0) {
@ -238,31 +234,29 @@ if ($action == 'delbookkeeping') {
foreach ( $object->lines as $line ) { foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
{
$sep = ";"; $sep = ";";
// Model Cegid Expert Export // Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep; print $date . $sep;
print $line->code_journal . $sep; print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep; print length_accountg($line->numero_compte) . $sep;
print ' '. $sep; print ' ' . $sep;
print $line->sens . $sep; print $line->sens . $sep;
print price($line->montant) . $sep; print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep; print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep; print $line->doc_ref . $sep;
/*print $line->piece_num . $sep; /*print $line->piece_num . $sep;
print length_accounta($line->code_tiers) . $sep; print length_accounta($line->code_tiers) . $sep;
print . $sep; print . $sep;
print price($line->debit) . $sep; print price($line->debit) . $sep;
print price($line->credit) . $sep;*/ print price($line->credit) . $sep;*/
print "\n"; print "\n";
} } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
//Std export // Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); $date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep; print $date . $sep;
print $line->doc_ref . $sep; print $line->doc_ref . $sep;
@ -272,14 +266,14 @@ if ($action == 'delbookkeeping') {
print price($line->credit) . $sep; print price($line->credit) . $sep;
/*print $line->piece_num . $sep; /*print $line->piece_num . $sep;
print $line->label_compte . $sep; print $line->label_compte . $sep;
print price($line->montant) . $sep; print price($line->montant) . $sep;
print $line->sens . $sep;*/ print $line->sens . $sep;*/
print $line->code_journal . $sep; print $line->code_journal . $sep;
print "\n"; print "\n";
}elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) { } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
//Coala export // Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep; print $date . $sep;
print $line->code_journal . $sep; print $line->code_journal . $sep;
@ -297,7 +291,7 @@ if ($action == 'delbookkeeping') {
else { else {
$title_page=$langs->trans("Bookkeeping") .' '. dol_print_date($search_date_start).'-'.dol_print_date($search_date_end); $title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
llxHeader('', $title_page); llxHeader('', $title_page);
@ -324,15 +318,21 @@ else {
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question=array(); $form_question = array ();
$delyear=GETPOST('delyear'); $delyear = GETPOST('delyear');
if (empty($delyear)) { if (empty($delyear)) {
$delyear=dol_print_date(dol_now(),'%Y'); $delyear = dol_print_date(dol_now(), '%Y');
} }
$year_array=$formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear',0,'array'); $year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$form_question['delyear']=array('name'=>'delyear','type'=>'select','label'=>$langs->trans('DelYear'),'values'=>$year_array,'default'=>$delyear); $form_question['delyear'] = array (
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm; print $formconfirm;
@ -351,33 +351,32 @@ else {
print '</form>';*/ print '</form>';*/
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">'."\n"; print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>'; print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>'; print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a>';
//print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>'; // print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>'; print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>'; print '</div>';
/*print '<div class="liste_titre">'; /*print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': '; print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': '; print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1); print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>'; print '</div>';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</div>'; print '</div>';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</div>';*/ print '</div>';*/
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -389,8 +388,8 @@ else {
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); // print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder); // print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n"; print "</tr>\n";
@ -404,37 +403,37 @@ else {
print '<br>'; print '<br>';
print $langs->trans('To') . ': '; print $langs->trans('To') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1); print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
//print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1); // print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
print '</td>'; print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>'; print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>'; print '<td>';
//print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': '; // print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $langs->trans('From'); print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
//print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': '; // print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print '<br>'; print '<br>';
print $langs->trans('To'); print $langs->trans('To');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>'; print '</td>';
//print '<td><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>'; // print '<td><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>';
print '<td>'; print '<td>';
//print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; // print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $langs->trans('From'); print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
//print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': '; // print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print '<br>'; print '<br>';
print $langs->trans('To'); print $langs->trans('To');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>'; print '</td>';
//print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>'; // print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="'.$search_mvt_label.'"/>'; print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
//print '<td>&nbsp;</td>'; // print '<td>&nbsp;</td>';
//print '<td>&nbsp;</td>'; // print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>'; print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">'; print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
@ -446,14 +445,14 @@ else {
$var = True; $var = True;
$total_debit=0; $total_debit = 0;
$total_credit=0; $total_credit = 0;
foreach ( $object->lines as $line ) { foreach ( $object->lines as $line ) {
$var = ! $var; $var = ! $var;
$total_debit+=$line->debit; $total_debit += $line->debit;
$total_credit+=$line->credit; $total_credit += $line->credit;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
@ -465,12 +464,12 @@ else {
print '<td>' . $line->label_compte . '</td>'; print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>'; print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>'; print '<td align="right">' . price($line->credit) . '</td>';
//print '<td align="right">' . price($line->montant) . '</td>'; // print '<td align="right">' . price($line->montant) . '</td>';
//print '<td align="center">' . $line->sens . '</td>'; // print '<td align="center">' . $line->sens . '</td>';
print '<td align="right">' . $line->code_journal . '</td>'; print '<td align="right">' . $line->code_journal . '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>'; print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num .$options.'&page='.$page.'">' . img_delete() . '</a>'; print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -40,30 +40,30 @@ $sortfield = GETPOST("sortfield");
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_doc_type=GETPOST('search_doc_type','alpha'); $search_doc_type = GETPOST('search_doc_type', 'alpha');
$search_doc_date=dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int')); $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
$search_doc_ref=GETPOST('search_doc_ref','alpha'); $search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$search_numero_compte=GETPOST('search_numero_compte','alpha'); $search_numero_compte = GETPOST('search_numero_compte', 'alpha');
$search_numero_compte_start=GETPOST('search_numero_compte_start','alpha'); $search_numero_compte_start = GETPOST('search_numero_compte_start', 'alpha');
if ($search_numero_compte_start==-1) { if ($search_numero_compte_start == - 1) {
$search_numero_compte_start=''; $search_numero_compte_start = '';
} }
$search_numero_compte_end=GETPOST('search_numero_compte_end','alpha'); $search_numero_compte_end = GETPOST('search_numero_compte_end', 'alpha');
if ($search_numero_compte_end==-1) { if ($search_numero_compte_end == - 1) {
$search_numero_compte_end=''; $search_numero_compte_end = '';
} }
$search_code_tiers=GETPOST('search_code_tiers','alpha'); $search_code_tiers = GETPOST('search_code_tiers', 'alpha');
$search_code_tiers_start=GETPOST('search_code_tiers_start','alpha'); $search_code_tiers_start = GETPOST('search_code_tiers_start', 'alpha');
if ($search_code_tiers_start==-1) { if ($search_code_tiers_start == - 1) {
$search_code_tiers_start=''; $search_code_tiers_start = '';
} }
$search_code_tiers_end=GETPOST('search_code_tiers_end','alpha'); $search_code_tiers_end = GETPOST('search_code_tiers_end', 'alpha');
if ($search_code_tiers_end==-1) { if ($search_code_tiers_end == - 1) {
$search_code_tiers_end=''; $search_code_tiers_end = '';
} }
$search_label_compte=GETPOST('search_label_compte','alpha'); $search_label_compte = GETPOST('search_label_compte', 'alpha');
$search_sens=GETPOST('search_sens','alpha'); $search_sens = GETPOST('search_sens', 'alpha');
$search_code_journal=GETPOST('search_code_journal','alpha'); $search_code_journal = GETPOST('search_code_journal', 'alpha');
$object = new BookKeeping($db); $object = new BookKeeping($db);
$form = new Form($db); $form = new Form($db);
@ -74,6 +74,7 @@ if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y')); $search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y')); $search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
} }
if ($sortorder == "") if ($sortorder == "")
$sortorder = "ASC"; $sortorder = "ASC";
if ($sortfield == "") if ($sortfield == "")
@ -171,7 +172,7 @@ if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
print_barre_liste($langs->trans("Bookkeeping") .' '. dol_print_date($search_date_start).'-'.dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); print_barre_liste($langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end), $page, $_SERVER['PHP_SELF'], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
@ -181,16 +182,16 @@ print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end'); print $form->select_date($search_date_end, 'date_end');
print '</div>'; print '</div>';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $langs->trans('From').' '.$langs->trans('AccountAccounting') . ': '; print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_start,'search_numero_compte_start', 1, array (), 1, 1,''); print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
print $langs->trans('To').' '.$langs->trans('AccountAccounting') . ': '; print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_end,'search_numero_compte_end', 1, array (), 1, 1,''); print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
print '</div>'; print '</div>';
print '<div class="liste_titre">'; print '<div class="liste_titre">';
print $langs->trans('From').' '.$langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_start,'search_code_tiers_start', 1); print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
print $langs->trans('To').' '.$langs->trans('ThirdPartyAccount') . ': '; print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_end,'searchcode_tiers_end', 1); print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
print '</div>'; print '</div>';
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
@ -213,31 +214,31 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=4 class="flat" name="search_piece_num" value="'.$search_piece_num.'"/>'; print '<input type="text" size=4 class="flat" name="search_piece_num" value="' . $search_piece_num . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=7 class="flat" name="search_doc_type" value="'.$search_doc_type.'"/>'; print '<input type="text" size=7 class="flat" name="search_doc_type" value="' . $search_doc_type . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_date($search_doc_date,'doc_date',0, 0, 1); print $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_doc_ref" value="'.$search_doc_ref.'"/>'; print '<input type="text" size=6 class="flat" name="search_doc_ref" value="' . $search_doc_ref . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_numero_compte" value="'.$search_numero_compte.'"/>'; print '<input type="text" size=6 class="flat" name="search_numero_compte" value="' . $search_numero_compte . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_code_tiers" value="'.$search_code_tiers.'"/>'; print '<input type="text" size=6 class="flat" name="search_code_tiers" value="' . $search_code_tiers . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_label_compte" value="'.$search_label_compte.'"/>'; print '<input type="text" size=6 class="flat" name="search_label_compte" value="' . $search_label_compte . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -250,11 +251,11 @@ print '<td class="liste_titre">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=2 class="flat" name="search_sens" value="'.$search_sens.'"/>'; print '<input type="text" size=2 class="flat" name="search_sens" value="' . $search_sens . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" size=3 class="flat" name="search_code_journal" value="'.$search_code_journal.'"/>'; print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';

View File

@ -18,9 +18,9 @@
*/ */
/** /**
* \file htdocs/accountancy/class/accountancysystem.class.php * \file htdocs/accountancy/class/accountancysystem.class.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief File of class to manage accountancy systems * \brief File of class to manage accountancy systems
*/ */
/** /**

View File

@ -20,9 +20,9 @@
*/ */
/** /**
* \file htdocs/accountancy/class/accountingaccount.class.php * \file htdocs/accountancy/class/accountingaccount.class.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Fichier de la classe des comptes comptable * \brief Fichier de la classe des comptes comptable
*/ */
/** /**
@ -33,10 +33,8 @@ class AccountingAccount extends CommonObject
var $db; var $db;
var $error; var $error;
var $errors; var $errors;
var $id; var $id;
var $rowid; var $rowid;
var $datec; // Creation date var $datec; // Creation date
var $fk_pcg_version; var $fk_pcg_version;
var $pcg_type; var $pcg_type;
@ -51,35 +49,33 @@ class AccountingAccount extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) function __construct($db) {
{
$this->db = $db; $this->db = $db;
} }
/** /**
* Load record in memory * Load record in memory
* *
* @param int $rowid Id * @param int $rowid Id
* @param string $account_number Account number * @param string $account_number Account number
* @param int $limittocurentchart 1=Do not load record if it is into another accounting system * @param int $limittocurentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid = null, $account_number = null, $limittocurentchart=0) function fetch($rowid = null, $account_number = null, $limittocurentchart = 0) {
{
global $conf; global $conf;
if ($rowid || $account_number) { if ($rowid || $account_number) {
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active"; $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account WHERE"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account WHERE";
if ($rowid) { if ($rowid) {
$sql .= " rowid = '" . $rowid . "'"; $sql .= " rowid = '" . $rowid . "'";
} elseif ($account_number) { } elseif ($account_number) {
$sql .= " account_number = '" . $account_number . "'"; $sql .= " account_number = '" . $account_number . "'";
} }
if (!empty($limittocurentchart)) { if (! empty($limittocurentchart)) {
$sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; $sql .= ' AND fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
} }
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -106,22 +102,21 @@ class AccountingAccount extends CommonObject
return 0; return 0;
} }
} else { } else {
$this->error="Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
$this->errors[] = "Error " . $this->db->lasterror(); $this->errors[] = "Error " . $this->db->lasterror();
} }
} }
return -1; return - 1;
} }
/** /**
* Insert line in accounting_account * Insert line in accounting_account
* *
* @param User $user Use making action * @param User $user Use making action
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) function create($user, $notrigger = 0) {
{
global $conf; global $conf;
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
@ -144,8 +139,8 @@ class AccountingAccount extends CommonObject
if (isset($this->active)) if (isset($this->active))
$this->active = trim($this->active); $this->active = trim($this->active);
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_account(";
@ -188,17 +183,17 @@ class AccountingAccount extends CommonObject
if (! $error) { if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_account");
// if (! $notrigger) { // if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
// // Call triggers // // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db); // $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; } // if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers // // End call triggers
// } // }
} }
// Commit or rollback // Commit or rollback
@ -218,11 +213,10 @@ class AccountingAccount extends CommonObject
/** /**
* Update record * Update record
* *
* @param User $user Use making update * @param User $user Use making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user) function update($user) {
{
$this->db->begin(); $this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
@ -252,10 +246,9 @@ class AccountingAccount extends CommonObject
/** /**
* Check usage of accounting code * Check usage of accounting code
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function checkUsage() function checkUsage() {
{
global $langs; global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
@ -284,12 +277,11 @@ class AccountingAccount extends CommonObject
/** /**
* Delete object in database * Delete object in database
* *
* @param User $user User that deletes * @param User $user User that deletes
* @param int $notrigger 0=triggers after, 1=disable triggers * @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) function delete($user, $notrigger = 0) {
{
$error = 0; $error = 0;
$result = $this->checkUsage(); $result = $this->checkUsage();
@ -298,19 +290,19 @@ class AccountingAccount extends CommonObject
$this->db->begin(); $this->db->begin();
// if (! $error) { // if (! $error) {
// if (! $notrigger) { // if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
// // Call triggers // // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db); // $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf); // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; } // if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers // // End call triggers
// } // }
// } // }
if (! $error) { if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account"; $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_account";
@ -342,27 +334,29 @@ class AccountingAccount extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto = 0) {
{
global $langs; global $langs;
$result=''; $result = '';
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$this->id.'">'; $link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id . '">';
$linkend='</a>'; $linkend = '</a>';
$picto='billr'; $picto = 'billr';
$label=$langs->trans("Show").': '.$this->account_number.' - '.$this->label; $label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label;
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend); if ($withpicto)
if ($withpicto && $withpicto != 2) $result.=' '; $result .= ($link . img_object($label, $picto) . $linkend);
if ($withpicto != 2) $result.=$link.$this->account_number.$linkend; if ($withpicto && $withpicto != 2)
$result .= ' ';
if ($withpicto != 2)
$result .= $link . $this->account_number . $linkend;
return $result; return $result;
} }
@ -372,8 +366,7 @@ class AccountingAccount extends CommonObject
* @param int $id of record * @param int $id of record
* @return void * @return void
*/ */
function info($id) function info($id) {
{
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
$sql .= ' WHERE a.rowid = ' . $id; $sql .= ' WHERE a.rowid = ' . $id;
@ -407,11 +400,10 @@ class AccountingAccount extends CommonObject
/** /**
* Account desactivate * Account desactivate
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_desactivate($id) function account_desactivate($id) {
{
$result = $this->checkUsage(); $result = $this->checkUsage();
if ($result > 0) { if ($result > 0) {
@ -419,7 +411,7 @@ class AccountingAccount extends CommonObject
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
$sql .= "SET active = '0'"; $sql .= "SET active = '0'";
$sql .= " WHERE rowid = ".$this->db->escape($id); $sql .= " WHERE rowid = " . $this->db->escape($id);
dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -440,16 +432,15 @@ class AccountingAccount extends CommonObject
/** /**
* Account activate * Account activate
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_activate($id) function account_activate($id) {
{
$this->db->begin(); $this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
$sql .= "SET active = '1'"; $sql .= "SET active = '1'";
$sql .= " WHERE rowid = ".$this->db->escape($id); $sql .= " WHERE rowid = " . $this->db->escape($id);
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -218,7 +218,7 @@ class BookKeeping extends CommonObject
$this->date_create = $now; $this->date_create = $now;
} }
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element." ("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
$sql .= "doc_date"; $sql .= "doc_date";
$sql .= ", doc_type"; $sql .= ", doc_type";
@ -291,7 +291,6 @@ class BookKeeping extends CommonObject
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
} }
if (! $error) { if (! $error) {
if (! $notrigger) { if (! $notrigger) {
@ -320,13 +319,12 @@ class BookKeeping extends CommonObject
/** /**
* Create object into database * Create object into database
* *
* @param User $user User that creates * @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* *
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
public function createStd(User $user, $notrigger = false) public function createStd(User $user, $notrigger = false) {
{
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0; $error = 0;
@ -379,74 +377,70 @@ class BookKeeping extends CommonObject
$this->piece_num = trim($this->piece_num); $this->piece_num = trim($this->piece_num);
} }
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
// Insert request // Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'doc_date,'; $sql .= 'doc_date,';
$sql.= 'doc_type,'; $sql .= 'doc_type,';
$sql.= 'doc_ref,'; $sql .= 'doc_ref,';
$sql.= 'fk_doc,'; $sql .= 'fk_doc,';
$sql.= 'fk_docdet,'; $sql .= 'fk_docdet,';
$sql.= 'code_tiers,'; $sql .= 'code_tiers,';
$sql.= 'numero_compte,'; $sql .= 'numero_compte,';
$sql.= 'label_compte,'; $sql .= 'label_compte,';
$sql.= 'debit,'; $sql .= 'debit,';
$sql.= 'credit,'; $sql .= 'credit,';
$sql.= 'montant,'; $sql .= 'montant,';
$sql.= 'sens,'; $sql .= 'sens,';
$sql.= 'fk_user_author,'; $sql .= 'fk_user_author,';
$sql.= 'import_key,'; $sql .= 'import_key,';
$sql.= 'code_journal,'; $sql .= 'code_journal,';
$sql.= 'piece_num'; $sql .= 'piece_num';
$sql .= ') VALUES ('; $sql .= ') VALUES (';
$sql .= ' '.(! isset($this->doc_date) || dol_strlen($this->doc_date)==0?'NULL':"'".$this->db->idate($this->doc_date)."'").','; $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_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
$sql .= ' '.(! isset($this->doc_ref)?'NULL':"'".$this->db->escape($this->doc_ref)."'").','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
$sql .= ' '.(empty($this->fk_doc)?'0':$this->fk_doc).','; $sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
$sql .= ' '.(empty($this->fk_docdet)?'0':$this->fk_docdet).','; $sql .= ' ' . (empty($this->fk_docdet) ? '0' : $this->fk_docdet) . ',';
$sql .= ' '.(! isset($this->code_tiers)?'NULL':"'".$this->db->escape($this->code_tiers)."'").','; $sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ',';
$sql .= ' '.(! isset($this->numero_compte)?'NULL':"'".$this->db->escape($this->numero_compte)."'").','; $sql .= ' ' . (! isset($this->numero_compte) ? 'NULL' : "'" . $this->db->escape($this->numero_compte) . "'") . ',';
$sql .= ' '.(! isset($this->label_compte)?'NULL':"'".$this->db->escape($this->label_compte)."'").','; $sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ',';
$sql .= ' '.(! isset($this->debit)?'NULL':"'".$this->debit."'").','; $sql .= ' ' . (! isset($this->debit) ? 'NULL' : "'" . $this->debit . "'") . ',';
$sql .= ' '.(! isset($this->credit)?'NULL':"'".$this->credit."'").','; $sql .= ' ' . (! isset($this->credit) ? 'NULL' : "'" . $this->credit . "'") . ',';
$sql .= ' '.(! isset($this->montant)?'NULL':"'".$this->montant."'").','; $sql .= ' ' . (! isset($this->montant) ? 'NULL' : "'" . $this->montant . "'") . ',';
$sql .= ' '.(! isset($this->sens)?'NULL':"'".$this->db->escape($this->sens)."'").','; $sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
$sql .= ' '.$user->id.','; $sql .= ' ' . $user->id . ',';
$sql .= ' '.(! isset($this->import_key)?'NULL':"'".$this->db->escape($this->import_key)."'").','; $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->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
$sql .= ' '.(! isset($this->piece_num)?'NULL':$this->piece_num); $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num);
$sql .= ')'; $sql .= ')';
$this->db->begin(); $this->db->begin();
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { if (! $resql) {
$error ++; $error ++;
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
} }
if (!$error) { if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) { if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
//// Call triggers // // Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user); // $result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++; // if ($result < 0) $error++;
//// End call triggers // // End call triggers
} }
} }
@ -581,12 +575,16 @@ class BookKeeping extends CommonObject
$sqlwhere = array (); $sqlwhere = array ();
if (count($filter) > 0) { if (count($filter) > 0) {
foreach ( $filter as $key => $value ) { foreach ( $filter as $key => $value ) {
if ($key=='t.doc_date') { if ($key == 't.doc_date') {
$sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '=\'' . $this->db->idate($value) . '\'';
} elseif($key=='t.doc_date>=' || $key=='t.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\''; $sqlwhere[] = $key . '\'' . $this->db->idate($value) . '\'';
} elseif($key=='t.fk_doc' || $key=='t.fk_docdet' ||$key=='t.piece_num') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.code_tiers>=' || $key == 't.code_tiers<=') {
$sqlwhere[] = $key . '\'' . $this->db->escape($value) . '\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key . '=' . $value; $sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.code_tiers' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $this->db->escape($value) . '%\'';
} else { } else {
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
} }
@ -815,8 +813,8 @@ class BookKeeping extends CommonObject
/** /**
* Delete bookkepping by importkey * Delete bookkepping by importkey
* *
* @param string $importkey Import key * @param string $importkey Import key
* @return int Result * @return int Result
*/ */
function deleteByImportkey($importkey) { function deleteByImportkey($importkey) {
$this->db->begin(); $this->db->begin();
@ -845,8 +843,8 @@ class BookKeeping extends CommonObject
/** /**
* Delete bookkepping by year * Delete bookkepping by year
* *
* @param string $delyear year to delete * @param string $delyear year to delete
* @return int Result * @return int Result
*/ */
function deleteByYear($delyear) { function deleteByYear($delyear) {
$this->db->begin(); $this->db->begin();
@ -854,7 +852,7 @@ class BookKeeping extends CommonObject
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
$sql = "DELETE"; $sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE YEAR(doc_date) = ".$delyear; $sql .= " WHERE YEAR(doc_date) = " . $delyear;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -875,8 +873,8 @@ class BookKeeping extends CommonObject
/** /**
* Delete bookkepping by piece number * Delete bookkepping by piece number
* *
* @param int $piecenum peicenum to delete * @param int $piecenum peicenum to delete
* @return int Result * @return int Result
*/ */
function deleteMvtNum($piecenum) { function deleteMvtNum($piecenum) {
$this->db->begin(); $this->db->begin();
@ -884,7 +882,7 @@ class BookKeeping extends CommonObject
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
$sql = "DELETE"; $sql = "DELETE";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = ".$piecenum; $sql .= " WHERE piece_num = " . $piecenum;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -997,7 +995,7 @@ class BookKeeping extends CommonObject
$this->doc_type = $obj->doc_type; $this->doc_type = $obj->doc_type;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
return - 1; return - 1;
} }
@ -1069,7 +1067,7 @@ class BookKeeping extends CommonObject
} }
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::fetch_per_mvt " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::fetch_all_per_mvt " . $this->error, LOG_ERR);
return - 1; return - 1;
} }
@ -1079,11 +1077,10 @@ class BookKeeping extends CommonObject
/** /**
* Export bookkeping * Export bookkeping
* *
* @param string $model Model * @param string $model Model
* @return int Result * @return int Result
*/ */
function export_bookkeping($model = 'ebp') function export_bookkeping($model = 'ebp') {
{
$sql = "SELECT rowid, doc_date, doc_type,"; $sql = "SELECT rowid, doc_date, doc_type,";
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,"; $sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
$sql .= " numero_compte, label_compte, debit, credit,"; $sql .= " numero_compte, label_compte, debit, credit,";
@ -1123,9 +1120,7 @@ class BookKeeping extends CommonObject
$this->db->free($resql); $this->db->free($resql);
return $num; return $num;
} } else {
else
{
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR);
return - 1; return - 1;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> /* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,13 +19,13 @@
*/ */
/** /**
* \file htdocs/accountancy/class/html.formventilation.class.php * \file htdocs/accountancy/class/html.formventilation.class.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
*/ */
/** /**
* Class to manage generation of HTML components for bank module * Class to manage generation of HTML components for bank module
*/ */
class FormVentilation extends Form class FormVentilation extends Form
{ {
@ -33,23 +33,23 @@ class FormVentilation extends Form
var $error; var $error;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) { public function __construct($db) {
$this->db = $db; $this->db = $db;
} }
/** /**
* Return select filter with date of transaction * Return select filter with date of transaction
* *
* @param string $htmlname Name of select field * @param string $htmlname Name of select field
* @param string $selectedkey Value * @param string $selectedkey Value
* @return string HTML edit field * @return string HTML edit field
*/ */
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
$sql .= ' ORDER BY import_key DESC'; $sql .= ' ORDER BY import_key DESC';
$out = '<SELECT name="' . $htmlname . '">'; $out = '<SELECT name="' . $htmlname . '">';
@ -68,7 +68,7 @@ class FormVentilation extends Form
$selected = ' selected '; $selected = ' selected ';
} }
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key,'dayhourtext') . '</OPTION>'; $out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key, 'dayhourtext') . '</OPTION>';
$i ++; $i ++;
} }
@ -84,22 +84,22 @@ class FormVentilation extends Form
} }
/** /**
* Return list of accounts with label by chart of accounts * Return list of accounts with label by chart of accounts
* *
* @param string $selectid Preselected chart of accounts * @param string $selectid Preselected chart of accounts
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param array $event Event options
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number * @param int $select_out set value returned by select 0=rowid (default), 1=account_number
* @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* *
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
global $conf; global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
$out = ''; $out = '';
@ -119,7 +119,7 @@ class FormVentilation extends Form
if ($showempty) if ($showempty)
$out .= '<option value="-1"></option>'; $out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50'; $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
$i = 0; $i = 0;
if ($num) { if ($num) {
@ -135,8 +135,8 @@ class FormVentilation extends Form
$select_value_out = $obj->rowid; $select_value_out = $obj->rowid;
if ($select_out == 1) if ($select_out == 1)
$select_value_out = $obj->account_number; $select_value_out = $obj->account_number;
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number // Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning // Because same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $select_value_in) { if (($selectid != '') && $selectid == $select_value_in) {
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>'; // $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>'; $out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
@ -158,14 +158,14 @@ class FormVentilation extends Form
} }
/** /**
* Return list of accounts with label by class of accounts * Return list of accounts with label by class of accounts
* *
* @param string $selectid Preselected pcg_type * @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param array $event Event options
* *
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
global $conf; global $conf;
@ -213,14 +213,14 @@ class FormVentilation extends Form
} }
/** /**
* Return list of accounts with label by sub_class of accounts * Return list of accounts with label by sub_class of accounts
* *
* @param string $selectid Preselected pcg_type * @param string $selectid Preselected pcg_type
* @param string $htmlname Name of field in html form * @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field * @param int $showempty Add an empty field
* @param array $event Event options * @param array $event Event options
* *
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
global $conf; global $conf;
@ -322,8 +322,7 @@ class FormVentilation extends Form
} }
$this->db->free($resql); $this->db->free($resql);
// Build select
//Build select
if (count($aux_account) > 0) { if (count($aux_account) > 0) {
$out .= ajax_combobox($htmlname, $event); $out .= ajax_combobox($htmlname, $event);
@ -375,22 +374,22 @@ class FormVentilation extends Form
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " ORDER BY doc_date"; $sql .= " ORDER BY doc_date";
dol_syslog(get_class($this) . "::".__METHOD__, LOG_DEBUG); dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
while ( $obj = $this->db->fetch_object($resql) ) { while ( $obj = $this->db->fetch_object($resql) ) {
$selected_html = ''; $selected_html = '';
if ($selected > 0 && $obj->dtyear == $selected) if ($selected > 0 && $obj->dtyear == $selected)
$selected_html = ' selected'; $selected_html = ' selected';
if ($output_format == 'html' || $output_format == 'options') { if ($output_format == 'html' || $output_format == 'options') {
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>'; $out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
} elseif ($output_format == 'array') { } elseif ($output_format == 'array') {
$out_array[$obj->dtyear] = $obj->dtyear; $out_array[$obj->dtyear] = $obj->dtyear;
} }
} }
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
return - 1; return - 1;
} }
$this->db->free($resql); $this->db->free($resql);

View File

@ -18,16 +18,15 @@
*/ */
/** /**
* \file htdocs/accountancy/customer/card.php * \file htdocs/accountancy/customer/card.php
* \ingroup Accountancy * \ingroup Accountancy
* \brief Card customer ventilation * \brief Card customer ventilation
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// Langs // Langs
$langs->load("bills"); $langs->load("bills");
@ -41,12 +40,11 @@ $id = GETPOST('id');
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
/* /*
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
if (! GETPOST('cancel', 'alpha')) if (! GETPOST('cancel', 'alpha')) {
{
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
@ -107,9 +105,9 @@ if (! empty($id)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print load_fiche_titre($langs->trans('CustomersVentilation'),'','title_setup'); print load_fiche_titre($langs->trans('CustomersVentilation'), '', 'title_setup');
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -127,7 +125,7 @@ if (! empty($id)) {
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';

View File

@ -21,16 +21,15 @@
*/ */
/** /**
* \file htdocs/accountancy/customer/index.php * \file htdocs/accountancy/customer/index.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Home customer ventilation * \brief Home customer ventilation
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -45,7 +44,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->ventilation->read) if (! $user->rights->accounting->ventilation->read)
accessforbidden(); accessforbidden();
// Filter // Filter
$year = $_GET["year"]; $year = $_GET["year"];
if ($year == 0) { if ($year == 0) {
$year_current = strftime("%Y", time()); $year_current = strftime("%Y", time());
@ -88,6 +87,50 @@ if ($action == 'validatehistory') {
$db->commit(); $db->commit();
setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
} }
} elseif ($action == 'fixaccountancycode') {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Done'), 'mesgs');
}
} elseif ($action == 'cleanaccountancycode') {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Done'), 'mesgs');
}
} }
/* /*
@ -101,7 +144,11 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
print '<b>' . $langs->trans("DescVentilCustomer") . '</b>'; print '<b>' . $langs->trans("DescVentilCustomer") . '</b>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>'; print '<div class="inline-block divButAction">';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
print '</div>';
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " , " . MAIN_DB_PREFIX . "facture as f"; $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
@ -172,8 +219,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var; $var = ! $var;
print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>'; print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -21,17 +21,16 @@
*/ */
/** /**
* \file htdocs/accountancy/customer/lines.php * \file htdocs/accountancy/customer/lines.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page of detail of the lines of ventilation of invoices customers * \brief Page of detail of the lines of ventilation of invoices customers
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
// Langs // Langs
$langs->load("bills"); $langs->load("bills");
@ -40,35 +39,36 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$account_parent = GETPOST('account_parent'); $account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount'); $changeaccount = GETPOST('changeaccount');
//Search Getpost // Search Getpost
$search_ref = GETPOST('search_ref','alpha'); $search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice','alpha'); $search_invoice = GETPOST('search_invoice', 'alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat','alpha'); $search_vat = GETPOST('search_vat', 'alpha');
//Getpost Order and column and limit page // Getpost Order and column and limit page
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page','int'); $page = GETPOST('page', 'int');
if ($page < 0) $page = 0; if ($page < 0)
$page = 0;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;
if (! $sortfield)
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid"; $sortfield = "f.datef, f.facnumber, l.rowid";
if (! $sortorder) { if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
@ -87,13 +87,13 @@ $formventilation = new FormVentilation($db);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{ {
$search_ref=''; $search_ref = '';
$search_invoice=''; $search_invoice = '';
$search_label=''; $search_label = '';
$search_desc=''; $search_desc = '';
$search_amount=''; $search_amount = '';
$search_account=''; $search_account = '';
$search_vat=''; $search_vat = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0) { if (is_array($changeaccount) && count($changeaccount) > 0) {
@ -126,7 +126,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched")); llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript"> print '<script type="text/javascript">
$(function () { $(function () {
$(\'#select-all\').click(function(event) { $(\'#select-all\').click(function(event) {
// Iterate each checkbox // Iterate each checkbox
@ -147,7 +147,6 @@ print '<script type="text/javascript">
* Action * Action
*/ */
/* /*
* Customer Invoice lines * Customer Invoice lines
*/ */
@ -177,8 +176,7 @@ if (strlen(trim($search_amount))) {
if (strlen(trim($search_account))) { if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'"; $sql .= " AND aa.account_number like '%" . $search_account . "%'";
} }
if (strlen(trim($search_vat))) if (strlen(trim($search_vat))) {
{
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; $sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
} }
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
@ -186,14 +184,15 @@ if (! empty($conf->multicompany->enabled)) {
} }
// Count total nb of records with no order and no limits // Count total nb of records with no order and no limits
$nbtotalofrecords = 0; $nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
{
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($resql); if ($resql)
else dol_print_error($db); $nbtotalofrecords = $db->num_rows($resql);
else
dol_print_error($db);
} }
$sql.= $db->order($sortfield,$sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($limit + 1,$offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -201,15 +200,21 @@ if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
$param=""; $param = "";
if ($search_facture) $param.="&search_facture=".$search_facture; if ($search_facture)
if ($search_ref) $param.="&search_ref=".$search_ref; $param .= "&search_facture=" . $search_facture;
if ($search_label) $param.="&search_label=".$search_label; if ($search_ref)
if ($search_desc) $param.="&search_desc=".$search_desc; $param .= "&search_ref=" . $search_ref;
if ($search_account) $param.="&search_account=".$search_account; if ($search_label)
if ($filter) $param.="&filter=".$filter; $param .= "&search_label=" . $search_label;
if ($search_desc)
$param .= "&search_desc=" . $search_desc;
if ($search_account)
$param .= "&search_account=" . $search_account;
if ($filter)
$param .= "&filter=" . $filter;
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines,$nbtotalofrecords); print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>'; print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
@ -220,16 +225,16 @@ if ($result) {
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>'; print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"'); print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -237,13 +242,13 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>'; print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print "</td></tr>\n"; print "</td></tr>\n";
$facture_static = new Facture($db); $facture_static = new Facture($db);
$product_static = new Product($db); $product_static = new Product($db);
@ -292,10 +297,9 @@ if ($result) {
print "</table></form>"; print "</table></form>";
if ($num_lines > $conf->liste_limit) if ($num_lines > $conf->liste_limit) {
{ print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '');
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num_lines,$nbtotalofrecords,''); }
}
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -20,9 +20,9 @@
*/ */
/** /**
* \file htdocs/accountancy/customer/list.php * \file htdocs/accountancy/customer/list.php
* \ingroup Accountancy * \ingroup Accountancy
* \brief Ventilation page from customers invoices * \brief Ventilation page from customers invoices
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -58,16 +58,16 @@ $btn_ventil = GETPOST('ventil', 'alpha');
// Getpost Order and column and limit page // Getpost Order and column and limit page
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page','int'); $page = GETPOST('page', 'int');
if ($page < 0) if ($page < 0)
$page = 0; $page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -88,9 +88,8 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT,1); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_p = $accounting->fetch('',$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT,1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
@ -130,7 +129,7 @@ print '<script type="text/javascript">
* Action * Action
*/ */
if ($action == 'ventil' && !empty($btn_ventil)) { if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil) && ! empty($mesCasesCochees)) { if (! empty($codeventil) && ! empty($mesCasesCochees)) {
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
@ -149,7 +148,7 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) { if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>'; print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else { } else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>'; print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
} }
@ -169,9 +168,9 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -241,7 +240,7 @@ if ($result) {
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
@ -282,7 +281,6 @@ if ($result) {
$code_sell_p_notset = ''; $code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_sell)) { if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
} else { } else {
@ -332,7 +330,8 @@ if ($result) {
print '<td align="right">'; print '<td align="right">';
print price($objp->total_ht); print price($objp->total_ht);
print '</td>'; print '</td>';
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red'; if ($objp->vat_tx_l != $objp->vat_tx_p)
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
print '<td style="' . $code_vat_differ . '" align="center">'; print '<td style="' . $code_vat_differ . '" align="center">';
print price($objp->tva_tx_line); print price($objp->tva_tx_line);
print '</td>'; print '</td>';

View File

@ -23,31 +23,30 @@
*/ */
/** /**
* \file htdocs/accountancy/journal/bankjournal.php * \file htdocs/accountancy/journal/bankjournal.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page with bank journal * \brief Page with bank journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
// Langs // Langs
$langs->load("companies"); $langs->load("companies");
@ -57,7 +56,7 @@ $langs->load("bank");
$langs->load('bills'); $langs->load('bills');
$langs->load("accountancy"); $langs->load("accountancy");
$id_bank_account = GETPOST('id_account','int'); $id_bank_account = GETPOST('id_account', 'int');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
@ -73,7 +72,7 @@ $now = dol_now();
if ($user->societe_id > 0 && empty($id_bank_account)) if ($user->societe_id > 0 && empty($id_bank_account))
accessforbidden(); accessforbidden();
/* /*
* View * View
*/ */
$year_current = strftime("%Y", dol_now()); $year_current = strftime("%Y", dol_now());
@ -102,7 +101,7 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
$sql .= " WHERE ba.rowid=".$id_bank_account; $sql .= " WHERE ba.rowid=" . $id_bank_account;
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND ba.entity = " . $conf->entity; $sql .= " AND ba.entity = " . $conf->entity;
} }
@ -122,8 +121,8 @@ $paymentsalstatic = new PaymentSalary($db);
// Get code of finance journal // Get code of finance journal
$bank_code_journal = new Account($db); $bank_code_journal = new Account($db);
$result=$bank_code_journal->fetch($id_bank_account); $result = $bank_code_journal->fetch($id_bank_account);
$journal=$bank_code_journal->accountancy_journal; $journal = $bank_code_journal->accountancy_journal;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -143,11 +142,10 @@ if ($result) {
$tabtype = array (); $tabtype = array ();
$i = 0; $i = 0;
while ( $i < $num ) while ( $i < $num ) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$tabcompany[$obj->rowid] = array( $tabcompany[$obj->rowid] = array (
'id' => $obj->socid, 'id' => $obj->socid,
'name' => $obj->name, 'name' => $obj->name,
'code_client' => $obj->code_compta 'code_client' => $obj->code_compta
@ -162,7 +160,7 @@ if ($result) {
if ($obj->typeop == '(BankTransfert)') if ($obj->typeop == '(BankTransfert)')
$compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH; $compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH;
// Variable bookkeeping // Variable bookkeeping
$tabpay[$obj->rowid]["date"] = $obj->do; $tabpay[$obj->rowid]["date"] = $obj->do;
$tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type;
$tabpay[$obj->rowid]["ref"] = $obj->label; $tabpay[$obj->rowid]["ref"] = $obj->label;
@ -175,39 +173,28 @@ if ($result) {
$links = $object->get_url($obj->rowid); $links = $object->get_url($obj->rowid);
// get_url may return -1 which is not traversable // get_url may return -1 which is not traversable
if (is_array($links)) if (is_array($links)) {
{ foreach ( $links as $key => $val ) {
foreach ( $links as $key => $val )
{
$tabtype[$obj->rowid] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment') if ($links[$key]['type'] == 'payment') {
{
$paymentstatic->id = $links[$key]['url_id']; $paymentstatic->id = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2);
} } else if ($links[$key]['type'] == 'payment_supplier') {
else if ($links[$key]['type'] == 'payment_supplier')
{
$paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
} } else if ($links[$key]['type'] == 'company') {
else if ($links[$key]['type'] == 'company')
{
$societestatic->id = $links[$key]['url_id']; $societestatic->id = $links[$key]['url_id'];
$societestatic->name = $links[$key]['label']; $societestatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount; $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
} } else if ($links[$key]['type'] == 'user') {
else if ($links[$key]['type'] == 'user')
{
$userstatic->id = $links[$key]['url_id']; $userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label']; $userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
// $tabtp[$obj->rowid][$compta_user] += $obj->amount; // $tabtp[$obj->rowid][$compta_user] += $obj->amount;
} } else if ($links[$key]['type'] == 'sc') {
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id']; $chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id'];
@ -216,9 +203,7 @@ if ($result) {
if ($reg[1] == 'socialcontribution') if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution'; $reg[1] = 'SocialContribution';
$chargestatic->lib = $langs->trans($reg[1]); $chargestatic->lib = $langs->trans($reg[1]);
} } else {
else
{
$chargestatic->lib = $links[$key]['label']; $chargestatic->lib = $links[$key]['label'];
} }
$chargestatic->ref = $chargestatic->lib; $chargestatic->ref = $chargestatic->lib;
@ -231,45 +216,35 @@ if ($result) {
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
$sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) if ($resultmid) {
{
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
} }
} } else if ($links[$key]['type'] == 'payment_donation') {
else if ($links[$key]['type'] == 'payment_donation')
{
$paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation"); $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentDonation");
$tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount; $tabtp[$obj->rowid][$accountancy_account_pay_donation] += $obj->amount;
} } else if ($links[$key]['type'] == 'payment_vat') {
else if ($links[$key]['type'] == 'payment_vat')
{
$paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat"); $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount; $tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
} } else if ($links[$key]['type'] == 'payment_salary') {
else if ($links[$key]['type'] == 'payment_salary')
{
$paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label']; $paymentsalstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
$tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount;
} } else if ($links[$key]['type'] == 'banktransfert') {
else if ($links[$key]['type'] == 'banktransfert')
{
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount; $tabtp[$obj->rowid][$cpttva] += $obj->amount;
} }
/*else { /*else {
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
}*/ }*/
} }
} }
@ -277,7 +252,7 @@ if ($result) {
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i++; $i ++;
} }
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -288,16 +263,13 @@ if ($result) {
*/ */
// Write bookkeeping // Write bookkeeping
if ($action == 'writebookkeeping') if ($action == 'writebookkeeping') {
{ $now = dol_now();
$now=dol_now();
$error = 0; $error = 0;
foreach ( $tabpay as $key => $val ) foreach ( $tabpay as $key => $val ) {
{
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) foreach ( $tabbq[$key] as $k => $mt ) {
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -313,7 +285,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create=$now; $bookkeeping->date_create = $now;
if ($tabtype[$key] == 'payment') { if ($tabtype[$key] == 'payment') {
@ -339,7 +311,8 @@ if ($action == 'writebookkeeping')
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid) {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->ref_supplier.' ('.$objmid->ref.')';; $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
;
} }
} }
@ -350,8 +323,7 @@ if ($action == 'writebookkeeping')
} }
} }
// Third party // Third party
foreach ( $tabtp[$key] as $k => $mt ) foreach ( $tabtp[$key] as $k => $mt ) {
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -365,7 +337,7 @@ if ($action == 'writebookkeeping')
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->date_create=$now; $bookkeeping->date_create = $now;
if ($tabtype[$key] == 'sc') { if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
@ -396,7 +368,7 @@ if ($action == 'writebookkeeping')
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid) {
$objmid = $db->fetch_object($resultmid); $objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->ref_supplier.' ('.$objmid->ref.')'; $bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
} }
$bookkeeping->code_tiers = $k; $bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
@ -434,20 +406,19 @@ if ($action == 'writebookkeeping')
} }
} }
// Export // Export
if ($action == 'export_csv') if ($action == 'export_csv') {
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db); $companystatic = new Client($db);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export // Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{ {
$sep = ";"; $sep = ";";
foreach ($tabpay as $key => $val) foreach ( $tabpay as $key => $val ) {
{
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
@ -470,12 +441,9 @@ if ($action == 'export_csv')
} }
// Third party // Third party
if (is_array ( $tabtp[$key])) if (is_array($tabtp[$key])) {
{ foreach ( $tabtp[$key] as $k => $mt ) {
foreach ( $tabtp[$key] as $k => $mt ) if ($mt) {
{
if ($mt)
{
print $date . $sep; print $date . $sep;
print $journal . $sep; print $journal . $sep;
if ($val["lib"] == '(SupplierInvoicePayment)') { if ($val["lib"] == '(SupplierInvoicePayment)') {
@ -491,13 +459,8 @@ if ($action == 'export_csv')
print "\n"; print "\n";
} }
} }
} } else {
else foreach ( $tabbq[$key] as $k => $mt ) {
{
foreach ( $tabbq[$key] as $k => $mt )
{
if (1)
{
print $date . $sep; print $date . $sep;
print $journal . $sep; print $journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep; print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
@ -510,9 +473,8 @@ if ($action == 'export_csv')
} }
} }
} }
} } else {
} else // Model Classic Export // Model Classic Export
{
foreach ( $tabpay as $key => $val ) { foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
@ -531,10 +493,8 @@ if ($action == 'export_csv')
} }
// Third party // Third party
if (is_array ( $tabtp[$key])) if (is_array($tabtp[$key])) {
{ foreach ( $tabtp[$key] as $k => $mt ) {
foreach ( $tabtp[$key] as $k => $mt )
{
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
@ -545,28 +505,21 @@ if ($action == 'export_csv')
print "\n"; print "\n";
} }
} }
} } else {
else foreach ( $tabbq[$key] as $k => $mt ) {
{ print '"' . $date . '"' . $sep;
foreach ( $tabbq[$key] as $k => $mt ) print '"' . $val["ref"] . '"' . $sep;
{ print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
if (1) print '"' . $langs->trans("Bank") . '"' . $sep;
{ print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print '"' . $val["ref"] . '"' . $sep; print "\n";
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . $langs->trans("Bank") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
} }
} }
} }
} }
} }
else else {
{
$form = new Form($db); $form = new Form($db);
llxHeader('', $langs->trans("FinanceJournal")); llxHeader('', $langs->trans("FinanceJournal"));
@ -576,9 +529,10 @@ else
$description = $langs->trans("DescFinanceJournal") . '<br>'; $description = $langs->trans("DescFinanceJournal") . '<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); $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);
$varlink = 'id_account='.$id_bank_account; $varlink = 'id_account=' . $id_bank_account;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); 'action' => ''
), '', $varlink);
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
@ -620,12 +574,14 @@ else
foreach ( $tabpay as $key => $val ) { foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
if ($val["lib"] == '(SupplierInvoicePayment)') if ($val["lib"] == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('SupplierInvoicePayment'); $reflabel = $langs->trans('SupplierInvoicePayment');
if ($val["lib"] == '(CustomerInvoicePayment)') }
if ($val["lib"] == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('CustomerInvoicePayment'); $reflabel = $langs->trans('CustomerInvoicePayment');
}
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
@ -639,8 +595,7 @@ else
} }
// Third party // Third party
if (is_array ( $tabtp[$key])) if (is_array($tabtp[$key])) {
{
foreach ( $tabtp[$key] as $k => $mt ) { foreach ( $tabtp[$key] as $k => $mt ) {
if ($k != 'type') { if ($k != 'type') {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
@ -654,11 +609,8 @@ else
print "</tr>"; print "</tr>";
} }
} }
} } else {
else foreach ( $tabbq[$key] as $k => $mt ) {
{
foreach ( $tabbq[$key] as $k => $mt )
{
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>" . $reflabel . "</td>";
@ -677,5 +629,4 @@ else
llxFooter(); llxFooter();
} }
$db->close(); $db->close();

View File

@ -19,11 +19,10 @@
*/ */
/** /**
* \file htdocs/accountancy/journal/index.php * \file htdocs/accountancy/journal/index.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Index * \brief Index
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Langs // Langs

View File

@ -22,21 +22,20 @@
*/ */
/** /**
* \file htdocs/accountancy/journal/purchasesjournal.php * \file htdocs/accountancy/journal/purchasesjournal.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page with purchases journal * \brief Page with purchases journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -60,8 +59,6 @@ if ($user->societe_id > 0)
$action = GETPOST('action'); $action = GETPOST('action');
/* /*
* Actions * Actions
*/ */
@ -137,7 +134,7 @@ if ($result) {
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
$tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier.' ('.$obj->ref.')'; $tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->description; $tabfac[$obj->rowid]["description"] = $obj->description;
$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid; $tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
@ -257,7 +254,6 @@ if ($action == 'writebookkeeping') {
} }
} }
/* /*
* View * View
*/ */
@ -265,14 +261,14 @@ if ($action == 'writebookkeeping') {
$companystatic = new Fournisseur($db); $companystatic = new Fournisseur($db);
// Export // Export
if ($action == 'export_csv') if ($action == 'export_csv') {
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export // Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{ {
$sep = ";"; $sep = ";";
@ -325,8 +321,8 @@ if ($action == 'export_csv')
print "\n"; print "\n";
} }
} }
} else // Model Classic Export } else {
{ // Model Classic Export
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
@ -336,8 +332,8 @@ if ($action == 'export_csv')
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
@ -385,12 +381,16 @@ if ($action == 'export_csv')
$exportlink = ''; $exportlink = '';
$builddate = time(); $builddate = time();
$description = $langs->trans("DescPurchasesJournal") . '<br>'; $description = $langs->trans("DescPurchasesJournal") . '<br>';
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
else } else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
}
$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); $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' => '')); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
@ -440,8 +440,8 @@ if ($action == 'export_csv')
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k);
if ($mt) { if ($mt) {
print "<tr " . $bc[$var] . " >"; print "<tr " . $bc[$var] . " >";

View File

@ -24,21 +24,20 @@
*/ */
/** /**
* \file htdocs/accountancy/journal/sellsjournal.php * \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page with sells journal * \brief Page with sells journal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -62,8 +61,6 @@ if ($user->societe_id > 0)
$action = GETPOST('action'); $action = GETPOST('action');
/* /*
* View * View
*/ */
@ -105,10 +102,9 @@ if (! empty($conf->multicompany->enabled)) {
} }
$sql .= " AND f.fk_statut > 0"; $sql .= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} } else {
else { $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
} }
$sql .= " AND fd.product_type IN (0,1)"; $sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) if ($date_start && $date_end)
@ -147,7 +143,7 @@ if ($result) {
$line = new FactureLigne($db); $line = new FactureLigne($db);
$line->fetch($obj->rowid); $line->fetch($obj->rowid);
$prev_progress = $line->get_prev_progress(); $prev_progress = $line->get_prev_progress();
if ($obj->type==Facture::TYPE_SITUATION) { if ($obj->type == Facture::TYPE_SITUATION) {
// Avoid divide by 0 // Avoid divide by 0
if ($obj->situation_percent == 0) { if ($obj->situation_percent == 0) {
$situation_ratio = 0; $situation_ratio = 0;
@ -191,15 +187,12 @@ if ($result) {
*/ */
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') if ($action == 'writebookkeeping') {
{
$now = dol_now(); $now = dol_now();
$error = 0; $error = 0;
foreach ($tabfac as $key => $val) foreach ( $tabfac as $key => $val ) {
{ foreach ( $tabttc[$key] as $k => $mt ) {
foreach ($tabttc[$key] as $k => $mt)
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -225,7 +218,7 @@ if ($action == 'writebookkeeping')
} }
// Product / Service // Product / Service
foreach ($tabht[$key] as $k => $mt) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
@ -258,10 +251,8 @@ if ($action == 'writebookkeeping')
// VAT // VAT
// var_dump($tabtva); // var_dump($tabtva);
foreach ($tabtva[$key] as $k => $mt) foreach ( $tabtva[$key] as $k => $mt ) {
{ if ($mt) {
if ($mt)
{
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
@ -294,16 +285,16 @@ if ($action == 'writebookkeeping')
} }
// Export // Export
if ($action == 'export_csv') if ($action == 'export_csv') {
{
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db); $companystatic = new Client($db);
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export // Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{ {
$sep = ";"; $sep = ";";
@ -328,14 +319,15 @@ if ($action == 'export_csv')
// Product / Service // Product / Service
foreach ( $tabht[$key] as $k => $mt ) { foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) { $accountingaccount_static = new AccountingAccount($db);
if ($accountingaccount_static->fetch(null, $k)) {
print $date . $sep; print $date . $sep;
print $sell_journal . $sep; print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep; print length_accountg(html_entity_decode($k)) . $sep;
print $sep; print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep; print dol_trunc($accountingaccount_static->label, 32) . $sep;
print $val["ref"]; print $val["ref"];
print "\n"; print "\n";
} }
@ -356,11 +348,9 @@ if ($action == 'export_csv')
} }
} }
} }
} } else {
else // Model Classic Export // Model Classic Export
{ foreach ( $tabfac as $key => $val ) {
foreach ($tabfac as $key => $val)
{
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client']; $companystatic->client = $tabcompany[$key]['code_client'];
@ -378,8 +368,7 @@ if ($action == 'export_csv')
} }
// Product / Service // Product / Service
foreach ($tabht[$key] as $k => $mt) foreach ( $tabht[$key] as $k => $mt ) {
{
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k);
@ -395,8 +384,7 @@ if ($action == 'export_csv')
} }
// VAT // VAT
foreach ($tabtva[$key] as $k => $mt) foreach ( $tabtva[$key] as $k => $mt ) {
{
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
@ -426,7 +414,9 @@ if ($action == 'export_csv')
else else
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
$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); $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' => '')); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />'; print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
@ -468,8 +458,7 @@ if ($action == 'export_csv')
$invoicestatic = new Facture($db); $invoicestatic = new Facture($db);
$companystatic = new Client($db); $companystatic = new Client($db);
foreach ($tabfac as $key => $val) foreach ( $tabfac as $key => $val ) {
{
$invoicestatic->id = $key; $invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"]; $invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"]; $invoicestatic->type = $val["type"];
@ -477,8 +466,7 @@ if ($action == 'export_csv')
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) foreach ( $tabttc[$key] as $k => $mt ) {
{
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
@ -494,8 +482,7 @@ if ($action == 'export_csv')
print "</tr>"; print "</tr>";
// Product / Service // Product / Service
foreach ($tabht[$key] as $k => $mt) foreach ( $tabht[$key] as $k => $mt ) {
{
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k); $accountingaccount->fetch(null, $k);
@ -512,8 +499,7 @@ if ($action == 'export_csv')
} }
// VAT // VAT
foreach ($tabtva[$key] as $k => $mt) foreach ( $tabtva[$key] as $k => $mt ) {
{
if ($mt) { if ($mt) {
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";

View File

@ -22,16 +22,15 @@
* *
*/ */
/** /**
* \file htdocs/accountancy/supplier/card.php * \file htdocs/accountancy/supplier/card.php
* \ingroup Accountancy * \ingroup Accountancy
* \brief Card supplier ventilation * \brief Card supplier ventilation
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
// Langs // Langs
$langs->load("bills"); $langs->load("bills");
@ -46,8 +45,7 @@ if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
if (! GETPOST('cancel', 'alpha')) if (! GETPOST('cancel', 'alpha')) {
{
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $codeventil; $sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;
@ -106,9 +104,9 @@ if (! empty($id)) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print load_fiche_titre($langs->trans('SuppliersVentilation'),'','title_setup'); print load_fiche_titre($langs->trans('SuppliersVentilation'), '', 'title_setup');
dol_fiche_head(); dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -128,7 +126,7 @@ if (! empty($id)) {
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';

View File

@ -19,16 +19,15 @@
*/ */
/** /**
* \file htdocs/accountancy/supplier/index.php * \file htdocs/accountancy/supplier/index.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Home supplier ventilation * \brief Home supplier ventilation
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -43,7 +42,7 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->ventilation->read) if (! $user->rights->accounting->ventilation->read)
accessforbidden(); accessforbidden();
// Filter // Filter
$year = $_GET["year"]; $year = $_GET["year"];
if ($year == 0) { if ($year == 0) {
$year_current = strftime("%Y", time()); $year_current = strftime("%Y", time());
@ -84,6 +83,50 @@ if ($action == 'validatehistory') {
$db->commit(); $db->commit();
setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); setEventMessages($langs->trans('Dispatched'), null, 'mesgs');
} }
} elseif ($action == 'fixaccountancycode') {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Done'), 'mesgs');
}
} elseif ($action == 'cleanaccountancycode') {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
$sql1 .= " SET fd.fk_code_ventilation = 0";
$sql1 .= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
$sql1 .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
$sql1 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "')";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
} else {
$db->commit();
setEventMessage($langs->trans('Done'), 'mesgs');
}
} }
/* /*
@ -98,7 +141,11 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("SuppliersVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear); print load_fiche_titre($langs->trans("SuppliersVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear);
print '<b>' . $langs->trans("DescVentilSupplier") . '</b>'; print '<b>' . $langs->trans("DescVentilSupplier") . '</b>';
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=validatehistory">' . $langs->trans("ValidateHistory") . '</a></div>'; print '<div class="inline-block divButAction">';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=fixaccountancycode">' . $langs->trans("CleanFixHistory", $year_current) . '</a>';
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
print '</div>';
$y = $year_current; $y = $year_current;
@ -158,8 +205,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var; $var = ! $var;
print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>'; print '<tr ' . $bc[$var] . '><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -20,18 +20,17 @@
*/ */
/** /**
* \file htdocs/accountancy/supplier/lines.php * \file htdocs/accountancy/supplier/lines.php
* \ingroup Accounting Expert * \ingroup Accounting Expert
* \brief Page of detail of the lines of ventilation of invoices suppliers * \brief Page of detail of the lines of ventilation of invoices suppliers
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -41,43 +40,38 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$account_parent = GETPOST('account_parent'); $account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount'); $changeaccount = GETPOST('changeaccount');
//Search Getpost // Search Getpost
$search_ref = GETPOST('search_ref','alpha'); $search_ref = GETPOST('search_ref', 'alpha');
$search_invoice = GETPOST('search_invoice','alpha'); $search_invoice = GETPOST('search_invoice', 'alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat','alpha'); $search_vat = GETPOST('search_vat', 'alpha');
//Getpost Order and column and limit page // Getpost Order and column and limit page
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page','int'); $page = GETPOST('page', 'int');
if ($page < 0) $page = 0; if ($page < 0)
$page = 0;
$offset = $conf->liste_limit * $page; $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
{
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else {
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) if (! $sortfield)
{ $sortfield = "f.datef, f.ref, l.rowid";
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
}
else
{
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
}
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
if (! $sortorder) if (! $sortorder) {
{ if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0)
{
$sortorder = " DESC "; $sortorder = " DESC ";
} }
} }
@ -93,13 +87,13 @@ $formventilation = new FormVentilation($db);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{ {
$search_ref=''; $search_ref = '';
$search_invoice=''; $search_invoice = '';
$search_label=''; $search_label = '';
$search_desc=''; $search_desc = '';
$search_amount=''; $search_amount = '';
$search_account=''; $search_account = '';
$search_vat=''; $search_vat = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0) { if (is_array($changeaccount) && count($changeaccount) > 0) {
@ -132,7 +126,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched")); llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
print '<script type="text/javascript"> print '<script type="text/javascript">
$(function () { $(function () {
$(\'#select-all\').click(function(event) { $(\'#select-all\').click(function(event) {
// Iterate each checkbox // Iterate each checkbox
@ -149,7 +143,6 @@ print '<script type="text/javascript">
}); });
</script>'; </script>';
/* /*
* Supplier Invoice lines * Supplier Invoice lines
*/ */
@ -179,15 +172,14 @@ if (strlen(trim($search_amount))) {
if (strlen(trim($search_account))) { if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'"; $sql .= " AND aa.account_number like '%" . $search_account . "%'";
} }
if (strlen(trim($search_vat))) if (strlen(trim($search_vat))) {
{
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; $sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
} }
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
} }
$sql.= $db->order($sortfield,$sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($limit + 1,$offset); $sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1); dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1);
$result = $db->query($sql); $result = $db->query($sql);
@ -203,21 +195,21 @@ if ($result) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>'; print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre(''); print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"'); print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>'; print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
@ -228,9 +220,9 @@ if ($result) {
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>'; print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print "</td></tr>\n"; print "</td></tr>\n";
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
$product_static = new Product($db); $product_static = new Product($db);
@ -278,7 +270,6 @@ if ($result) {
print $db->error(); print $db->error();
} }
print "</table></form>"; print "</table></form>";
llxFooter(); llxFooter();

View File

@ -20,9 +20,9 @@
*/ */
/** /**
* \file htdocs/accountancy/supplier/list.php * \file htdocs/accountancy/supplier/list.php
* \ingroup Accountancy * \ingroup Accountancy
* \brief Ventilation page from suppliers invoices * \brief Ventilation page from suppliers invoices
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -66,9 +66,9 @@ if ($page < 0)
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;
@ -94,8 +94,8 @@ $formventilation = new FormVentilation($db);
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
// TODO: we should need to check if result is a really exist accountaccount rowid..... // TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT,1); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
$aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT,1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
@ -133,7 +133,7 @@ print '<script type="text/javascript">
* Action * Action
*/ */
if ($action == 'ventil' && !empty($btn_ventil)) { if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) { if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
@ -173,9 +173,9 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} else { } else {
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
} }
$offset = $limit * $page; $offset = $limit * $page;

View File

@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
@ -25,4 +24,4 @@ if ($prefix)
$filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format; $filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format;
else else
$filename = "journal_" . $journal . $date_export . "." . $format; $filename = "journal_" . $journal . $date_export . "." . $format;
header('Content-Disposition: attachment;filename='.$filename); header('Content-Disposition: attachment;filename=' . $filename);

View File

@ -78,6 +78,11 @@ else if ($action == 'update')
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
} }
} }
else if ($action == 'updateengine')
{
// TODO Update engines.
}
// define constants for models generator that need parameters // define constants for models generator that need parameters
if ($action == 'setModuleOptions') if ($action == 'setModuleOptions')
@ -190,6 +195,10 @@ $var=true;
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>'; print '<td>'.$langs->trans("Name").'</td>';
@ -282,11 +291,18 @@ if ($resql)
} }
print "</table>\n"; print "</table>\n";
if (empty($conf->use_javascript_ajax))
{
// TODO Implement code behind action updateengine
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
}
print '</form>';
print "<br>"; print "<br>";
/* /*
* Autres options * Other options
*
*/ */
print load_fiche_titre($langs->trans("OtherOptions"),'',''); print load_fiche_titre($langs->trans("OtherOptions"),'','');

File diff suppressed because it is too large Load Diff

View File

@ -186,10 +186,13 @@ class FactureRec extends Facture
/** /**
* Recupere l'objet facture et ses lignes de factures * Recupere l'objet facture et ses lignes de factures
* *
* @param int $rowid Id de la facture a recuperer * @param int $rowid Id of object to load
* @return int >0 si ok, <0 si ko * @param string $ref Reference of invoice
* @param string $ref_ext External reference of invoice
* @param int $ref_int Internal reference of other object
* @return int >0 if OK, <0 if KO, 0 if not found
*/ */
function fetch($rowid) function fetch($rowid, $ref='', $ref_ext='', $ref_int='')
{ {
$sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise'; $sql = 'SELECT f.titre,f.fk_soc,f.amount,f.tva,f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
$sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.date_lim_reglement as dlr';
@ -203,8 +206,13 @@ class FactureRec extends Facture
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'";
$sql.= ' WHERE f.rowid='.$rowid; $sql.= ' WHERE f.rowid='.$rowid;
if ($ref) $sql.= " AND f.titre='".$this->db->escape($ref)."'";
/* This field are not used for template invoice
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
*/
dol_syslog("FactureRec::Fetch rowid=".$rowid."", LOG_DEBUG); dol_syslog(get_class($this)."::fetch rowid=".$rowid, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
@ -353,32 +361,49 @@ class FactureRec extends Facture
/** /**
* Delete current invoice * Delete template invoice
* *
* @return int <0 if KO, >0 if OK * @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/ */
function delete() function delete($rowid=0, $notrigger=0, $idwarehouse=-1)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$this->id; if (empty($rowid)) $rowid=$this->id;
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
$error=0;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid;
dol_syslog($sql); dol_syslog($sql);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid;
dol_syslog($sql); dol_syslog($sql);
if ($this->db->query($sql)) if (! $this->db->query($sql))
{
return 1;
}
else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -1; $error=-1;
} }
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -2; $error=-2;
}
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return $error;
} }
} }
@ -507,22 +532,30 @@ class FactureRec extends Facture
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto Add picto into link
* @param string $option Sur quoi pointe le lien ('', 'withdraw') * @param string $option Where point the link
* @return string Chaine avec URL * @param int $max Maxlength of ref
* @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
{ {
global $langs; global $langs;
$result=''; $result='';
$label=$langs->trans("ShowInvoice").': '.$this->ref; $label=$langs->trans("ShowInvoice").': '.$this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $url = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id;
$linkend='</a>';
if ($short) return $url;
$picto='bill'; $picto='bill';
$link = '<a href="'.$url.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';

View File

@ -1803,7 +1803,7 @@ class Facture extends CommonInvoice
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate))) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate)))
{ {
$this->error='Permission denied'; $this->error='Permission denied';
dol_syslog(get_class($this)."::validate ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
return -1; return -1;
} }

View File

@ -201,8 +201,13 @@ if ($action == 'valide')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs->trans("BackToList") . '</a>';
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->ref.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Date payment // Date payment
print '<tr><td>'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">';

View File

@ -103,7 +103,7 @@ class Paiement extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->ref; $this->ref = $obj->ref?$obj->ref:$obj->rowid;
$this->date = $this->db->jdate($obj->dp); $this->date = $this->db->jdate($obj->dp);
$this->datepaye = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement; $this->numero = $obj->num_paiement;

View File

@ -53,8 +53,9 @@ $companystatic=new Societe($db);
$search_ref=GETPOST("search_ref","int"); $search_ref=GETPOST("search_ref","int");
$search_account=GETPOST("search_account","int"); $search_account=GETPOST("search_account","int");
$search_paymenttype=GETPOST("search_paymenttype"); $search_paymenttype=GETPOST("search_paymenttype");
$search_amount=GETPOST("search_amount"); $search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be able to search on "< x"
$search_company=GETPOST("search_company"); $search_company=GETPOST("search_company",'alpha');
$search_payment_num=GETPOST('search_payment_num','alpha');
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
@ -72,6 +73,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_account=""; $search_account="";
$search_amount=""; $search_amount="";
$search_paymenttype=""; $search_paymenttype="";
$search_payment_num="";
$search_company=""; $search_company="";
$day=''; $day='';
$year=''; $year='';
@ -165,9 +167,10 @@ else
{ {
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
} }
if ($search_ref) $sql .=natural_search('p.ref', $search_ref); if ($search_ref) $sql .=natural_search('p.ref', $search_ref);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_payment_num != '') $sql .=" AND p.num_paiement = '".$db->escape($search_payment_num)."'";
if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'";
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);
// Add where from hooks // Add where from hooks
@ -209,6 +212,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$paramlist,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$paramlist,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$paramlist,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$paramlist,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$paramlist,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$paramlist,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder);
@ -237,6 +241,9 @@ if ($resql)
print '<td>'; print '<td>';
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1); $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
print '</td>'; print '</td>';
print '<td align="left">';
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.$search_payment_num.'">';
print '</td>';
print '<td>'; print '<td>';
$form->select_comptes($search_account,'search_account',0,'',1); $form->select_comptes($search_account,'search_account',0,'',1);
print '</td>'; print '</td>';
@ -279,7 +286,7 @@ if ($resql)
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).' '.$objp->num_paiement.'</td>'; print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).'</td><td>'.$objp->num_paiement.'</td>';
print '<td>'; print '<td>';
if ($objp->bid) if ($objp->bid)
{ {

View File

@ -621,6 +621,87 @@ if (! empty($conf->salaries->enabled))
print '</tr>'; print '</tr>';
} }
/*
* Expense
*/
if (! empty($conf->expensereport->enabled))
{
$langs->load('trips');
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
$sql.= " AND p.fk_statut>5";
$column='p.date_valid';
} else {
$sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
$sql.= " AND p.fk_statut=6";
$column='pe.datep';
}
print '<tr><td colspan="4">'.$langs->trans("ExpenseReport").'</td></tr>';
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY p.rowid, p.ref, u.firstname, u.lastname, dm";
$sql.= " ORDER BY p.ref";
dol_syslog("get expense report outcome");
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{
$num = $db->num_rows($result);
$var=true;
if ($num)
{
while ($obj = $db->fetch_object($result))
{
$total_ht -= $obj->amount_ht;
$total_ttc -= $obj->amount_ttc;
$subtotal_ht += $obj->amount_ht;
$subtotal_ttc += $obj->amount_ttc;
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/card.php?id=".$obj->rowid."\">".$obj->ref.' ('.$obj->firstname." ".$obj->lastname.")</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price(-$obj->amount_ht).'</td>';
print '<td align="right">'.price(-$obj->amount_ttc).'</td>';
print '</tr>';
}
}
else
{
$var = !$var;
print "<tr ".$bc[$var]."><td>&nbsp;</td>";
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
}
}
else
{
dol_print_error($db);
}
print '<tr class="liste_total">';
if ($modecompta == 'CREANCES-DETTES')
print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>';
print '<td colspan="3" align="right">'.price(-$subtotal_ttc).'</td>';
print '</tr>';
}
/* /*
* Donation * Donation

View File

@ -521,6 +521,58 @@ if (! empty($conf->salaries->enabled))
} }
} }
if (! empty($conf->expensereport->enabled))
{
$langs->load('trips');
if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
$sql.= " AND p.fk_statut>5";
$column='p.date_valid';
} else {
$sql = "SELECT date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity = ".getEntity('expensereport',1);
$sql.= " AND p.fk_statut=6";
$column='pe.datep';
}
$sql.= " GROUP BY dm";
dol_syslog("get expense report outcome");
$result=$db->query($sql);
$subtotal_ht = 0;
$subtotal_ttc = 0;
if ($result)
{
$num = $db->num_rows($result);
if ($num)
{
while ($obj = $db->fetch_object($result))
{
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
$decaiss[$obj->dm] += $obj->amount_ht;
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
$decaiss_ttc[$obj->dm] += $obj->amount_ttc;
}
}
}
else
{
dol_print_error($db);
}
}
/* /*
* Donation get dunning paiement * Donation get dunning paiement
*/ */

View File

@ -512,10 +512,12 @@ else
$(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'"); $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'");
$(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'");
$(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); console.log("Set state_id to '.dol_escape_js($objsoc->state_id).'");
$(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'"); $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'").trigger("change");
$(\'input[name="email"]\').val("'.dol_escape_js($objsoc->email).'"); /* set country at end because it will trigger page refresh */
}); console.log("Set country id to '.dol_escape_js($objsoc->country_id).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */
});
})'."\n"; })'."\n";
print '</script>'."\n"; print '</script>'."\n";
} }
@ -750,11 +752,14 @@ else
}); });
$("#copyaddressfromsoc").click(function() { $("#copyaddressfromsoc").click(function() {
$(\'textarea[name="address"]\').text("'.dol_escape_js($objsoc->address).'"); $(\'textarea[name="address"]\').val("'.dol_escape_js($objsoc->address).'");
$(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'"); $(\'input[name="zipcode"]\').val("'.dol_escape_js($objsoc->zip).'");
$(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'"); $(\'input[name="town"]\').val("'.dol_escape_js($objsoc->town).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'"); console.log("Set state_id to '.dol_escape_js($objsoc->state_id).'");
$(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'"); $(\'select[name="state_id"]\').val("'.dol_escape_js($objsoc->state_id).'").trigger("change");
/* set country at end because it will trigger page refresh */
console.log("Set country id to '.dol_escape_js($objsoc->country_id).'");
$(\'select[name="country_id"]\').val("'.dol_escape_js($objsoc->country_id).'").trigger("change"); /* trigger required to update select2 components */
}); });
})'."\n"; })'."\n";
print '</script>'."\n"; print '</script>'."\n";

View File

@ -5100,7 +5100,68 @@ class Form
print '</div>'; print '</div>';
} }
if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto)) if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled))
{
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedFichinter') . '</a>';
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#orderlist").toggle();
jQuery("#linktoorder").toggle();
});
});
</script>
';
print '<div id="orderlist"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, f.rowid, f.ref";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
$sql .= ", " . MAIN_DB_PREFIX . "fichinter as f";
$sql .= ' WHERE f.fk_soc = s.rowid';
$resqlorderlist = $this->db->query($sql);
if ($resqlorderlist)
{
$num = $this->db->num_rows($resqlorderlist);
$i = 0;
print '<br><form action="" method="POST" name="LinkedFichinter">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Company") . '</td>';
print '</tr>';
while ($i < $num)
{
$objp = $this->db->fetch_object($resqlorderlist);
$var = ! $var;
print '<tr ' . $bc [$var] . '>';
print '<td aling="left">';
print '<input type="radio" name="LinkedFichinter" value=' . $objp->rowid . '>';
print '<td align="center">' . $objp->ref . '</td>';
print '<td>' . $objp->name . '</td>';
print '</td>';
print '</tr>';
$i ++;
}
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
print '</form>';
$this->db->free($resqlorderlist);
} else {
dol_print_error($this->db);
}
print '</div>';
}
if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto))
&& ! empty($conf->fournisseur->enabled)) && ! empty($conf->fournisseur->enabled))
{ {
$linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>'; $linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#linktoorder" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';

View File

@ -55,7 +55,7 @@ class Menu
* @param string $titre Label of menu to add * @param string $titre Label of menu to add
* @param integer $level Level of menu to add * @param integer $level Level of menu to add
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey) * @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
* @param string $target Target lien * @param string $target Target link
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...) * @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...) * @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
* @param int $position Position (not used yet) * @param int $position Position (not used yet)
@ -74,7 +74,7 @@ class Menu
* @param string $titre Label of menu to add * @param string $titre Label of menu to add
* @param integer $level Level of menu to add * @param integer $level Level of menu to add
* @param int $enabled Menu active or not * @param int $enabled Menu active or not
* @param string $target Target lien * @param string $target Target link
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...) * @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...) * @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
* @param int $position Position (not used yet) * @param int $position Position (not used yet)

View File

@ -5113,21 +5113,24 @@ function printCommonFooter($zone='private')
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n"; if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
print "\n"; print "\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n"; if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n";
print '<!-- If page_y set, we set scollbar with it -->'."\n"; print '<!-- If page_y set, we set scollbar with it -->'."\n";
print "page_y=getParameterByName('page_y', 0);"; print "page_y=getParameterByName('page_y', 0);";
print "if (page_y > 0) $('html, body').scrollTop(page_y);"; print "if (page_y > 0) $('html, body').scrollTop(page_y);";
print '<!-- Set handler to add page_y param on some a href links -->'."\n"; print '<!-- Set handler to add page_y param on some a href links -->'."\n";
print 'jQuery(".reposition").click(function() { print 'jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop(); var page_y = $(document).scrollTop();
/* alert(page_y); */ /* alert(page_y); */
this.href=this.href+\'&page_y=\'+page_y; this.href=this.href+\'&page_y=\'+page_y;
});'."\n"; });'."\n";
print '});'."\n"; print '});'."\n";
print '</script>'."\n"; print '</script>'."\n";
}
// Google Analytics (need Google module) // Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))

View File

@ -894,7 +894,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if ($where) $sql.=$where; if ($where) $sql.=$where;
if ($sqlwhere) $sql.=' AND '.$sqlwhere; if ($sqlwhere) $sql.=' AND '.$sqlwhere;
dol_syslog("functions2::get_next_value", LOG_DEBUG); dol_syslog("functions2::get_next_value mode=".$mode."", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -208,22 +208,40 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2302__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/reglement.php?leftmenu=tax_vat', 'List', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__);
-- Ventilation (accounting) -- Accounting Expert
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'ventil_customer', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=ventil_customer', 'CustomersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 8, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=accounting', 'MenuAccountancy', 0, 'accountancy', '(! empty($conf->accounting->enabled) || $user->rights->accounting->ventilation->read || $user->rights->accounting->ventilation->dispatch || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); -- Dispatch
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->supplier_invoice->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 6__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=ventil_supplier', 'SuppliersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 9, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->supplier_invoice->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 2400__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=dispatch_supplier', 'SuppliersVentilation', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->supplier_invoice->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 5, __ENTITY__);
-- Rapports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="dispatch_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__); -- Journals
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'journal', 2400__+MAX_llx_menu__, '/accountancy/journal/index.php?leftmenu=journal', 'Journaux', 1, 'accountancy', '$user->rights->accounting->comptarapport->lire', '', 0, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -- General Ledger
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2431__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -- Reports
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2442__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 19, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2443__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2444__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 21, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __ENTITY__);
-- Admin
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'home', '', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'admin', '$user->rights->accounting->fiscalyear', '', 0, 24, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'home', '', 2400__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'admin', '$user->rights->accounting->chartofaccount', '', 0, 25, __ENTITY__);
-- Rapports compta simple
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
-- Book Keeping -- Book Keeping

View File

@ -294,38 +294,34 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account
{ {
$newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire); $newmenu->add('',$langs->trans("Journaux"),0,$user->rights->accounting->comptarapport->lire,'','accountancy','accounting');
if ($leftmenu == 'journal') $sql = "SELECT rowid, label, accountancy_journal";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql);
if ($resql)
{ {
$sql = "SELECT rowid, label, accountancy_journal"; $numr = $db->num_rows($resql);
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $i = 0;
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " AND clos = 0";
$sql.= " ORDER BY label";
$resql = $db->query($sql); if ($numr > 0)
if ($resql) while ($i < $numr)
{ {
$numr = $db->num_rows($resql); $objp = $db->fetch_object($resql);
$i = 0; $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire,'','accountancy','accounting');
$i++;
if ($numr > 0)
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
$newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire);
$i++;
}
} }
else dol_print_error($db);
$db->free($resql);
// Add other journal
$newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire);
$newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire);
} }
else dol_print_error($db);
$db->free($resql);
// Add other journal
$newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire);
$newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire);
} }
if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP

View File

@ -109,16 +109,21 @@ class pdf_standard extends ModeleExpenseReport
$this->posxtype=105; $this->posxtype=105;
$this->posxprojet=125; $this->posxprojet=125;
$this->posxtva=145; $this->posxtva=145;
$this->posxup=162; $this->posxup = 162;
$this->posxqty=176; $this->posxqty = 176;
$this->postotalttc=186; $this->postotalttc = 186;
if ($this->page_largeur < 210) // To work with US executive format if (empty($conf->projet->enabled)) {
{ $this->posxtva-=20;
$this->posxdate-=20; $this->posxup-=20;
$this->posxtype-=20; $this->posxqty-=20;
$this->posxprojet-=20; $this->postotalttc-=20;
$this->posxtva-=20; }
$this->posxup-=20; if ($this->page_largeur < 210) { // To work with US executive format
$this->posxdate-=20;
$this->posxtype-=20;
$this->posxprojet-=20;
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20; $this->posxqty-=20;
$this->postotalttc-=20; $this->postotalttc-=20;
} }
@ -335,10 +340,12 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetXY($this->posxtype, $curY); $pdf->SetXY($this->posxtype, $curY);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C'); $pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
// Project if (! empty($conf->projet->enabled)) {
$pdf->SetFont('','', $default_font_size - 1); // Project
$pdf->SetXY($this->posxprojet, $curY); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C'); $pdf->SetXY($this->posxprojet, $curY);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
}
// VAT Rate // VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
@ -765,23 +772,24 @@ class pdf_standard extends ModeleExpenseReport
// Type // Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height); $pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtype-1, $tab_top+1); $pdf->SetXY($this->posxtype - 1, $tab_top + 1);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C'); $pdf->MultiCell($this->posxprojet - $this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
// Project if (!empty($conf->projet->enabled)) {
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height); // Project
$pdf->SetXY($this->posxprojet-1, $tab_top+1); $pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C'); $pdf->SetXY($this->posxprojet - 1, $tab_top + 1);
$pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C');
}
// VAT // VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
{ $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->SetXY($this->posxtva - 1, $tab_top + 1);
$pdf->SetXY($this->posxtva-1, $tab_top+1); $pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); }
}
// Unit price // Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1); $pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C'); $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');

View File

@ -118,8 +118,9 @@ class modProductBatch extends DolibarrModules
$sql = array(); $sql = array();
if(! empty($conf->cashdesk->enabled)) { if (! empty($conf->cashdesk->enabled)) {
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) { if (empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
} }
} }

View File

@ -210,9 +210,9 @@ class modUser extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs'; $this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
$this->export_permission[$r]=array(array("user","user","export")); $this->export_permission[$r]=array(array("user","user","export"));
$this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"); $this->export_fields_array[$r]=array('u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion','u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId");
$this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"); $this->export_TypeFields_array[$r]=array('u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text','u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date','u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname");
$this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"); $this->export_entities_array[$r]=array('u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user','u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member");
if (empty($conf->adherent->enabled)) if (empty($conf->adherent->enabled))
{ {
unset($this->export_fields_array[$r]['u.fk_member']); unset($this->export_fields_array[$r]['u.fk_member']);

View File

@ -252,6 +252,10 @@ if (! empty($conf->margin->enabled))
jQuery("input[name='np_marginRate']:first").val(''); jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val(''); jQuery("input[name='np_markRate']:first").val('');
}); });
jQuery("#remise_percent").keyup(function() {
jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val('');
});
jQuery("#buying_price").keyup(function() { jQuery("#buying_price").keyup(function() {
jQuery("input[name='np_marginRate']:first").val(''); jQuery("input[name='np_marginRate']:first").val('');
jQuery("input[name='np_markRate']:first").val(''); jQuery("input[name='np_markRate']:first").val('');

View File

@ -1652,7 +1652,7 @@ else
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td style="text-align:center;">'.$langs->trans('Piece').'</td>'; print '<td style="text-align:center;">'.$langs->trans('Piece').'</td>';
print '<td style="text-align:center;">'.$langs->trans('Date').'</td>'; print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
print '<td>'.$langs->trans('Project').'</td>'; if (! empty($conf->projet->enabled)) print '<td>'.$langs->trans('Project').'</td>';
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>'; print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
print '<td style="text-align:left;">'.$langs->trans('Description').'</td>'; print '<td style="text-align:left;">'.$langs->trans('Description').'</td>';
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>'; print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
@ -1680,14 +1680,17 @@ else
print img_picto($langs->trans("Document"), "object_generic"); print img_picto($langs->trans("Document"), "object_generic");
print ' <span>'.$piece_comptable.'</span></td>'; print ' <span>'.$piece_comptable.'</span></td>';
print '<td style="text-align:center;">'.dol_print_date($db->jdate($objp->date), 'day').'</td>'; print '<td style="text-align:center;">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
print '<td>'; if (! empty($conf->projet->enabled))
if ($objp->projet_id > 0)
{ {
$projecttmp->id=$objp->projet_id; print '<td>';
$projecttmp->ref=$objp->projet_ref; if ($objp->projet_id > 0)
print $projecttmp->getNomUrl(1); {
$projecttmp->id=$objp->projet_id;
$projecttmp->ref=$objp->projet_ref;
print $projecttmp->getNomUrl(1);
}
print '</td>';
} }
print '</td>';
print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper($objp->type_fees_libelle)).'</td>'; print '<td style="text-align:center;">'.$langs->trans("TF_".strtoupper($objp->type_fees_libelle)).'</td>';
print '<td style="text-align:left;">'.$objp->comments.'</td>'; print '<td style="text-align:left;">'.$objp->comments.'</td>';
print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>'; print '<td style="text-align:right;">'.vatrate($objp->vatrate,true).'</td>';
@ -1729,9 +1732,12 @@ else
print '</td>'; print '</td>';
// Select project // Select project
print '<td>'; if (! empty($conf->projet->enabled))
$formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 1, 1); {
print '</td>'; print '<td>';
$formproject->select_projects(-1, $objp->fk_projet,'fk_projet', 0, 0, 1, 1);
print '</td>';
}
// Select type // Select type
print '<td style="text-align:center;">'; print '<td style="text-align:center;">';
@ -1790,7 +1796,7 @@ else
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2"></td>'; print '<td colspan="2"></td>';
//print '<td style="text-align:center;">'.$langs->trans('Date').'</td>'; //print '<td style="text-align:center;">'.$langs->trans('Date').'</td>';
print '<td>'.$langs->trans('Project').'</td>'; if (! empty($conf->projet->enabled)) print '<td>'.$langs->trans('Project').'</td>';
print '<td align="center">'.$langs->trans('Type').'</td>'; print '<td align="center">'.$langs->trans('Type').'</td>';
print '<td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('Description').'</td>';
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>'; print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
@ -1810,9 +1816,12 @@ else
print '</td>'; print '</td>';
// Select project // Select project
print '<td>'; if (! empty($conf->projet->enabled))
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1); {
print '</td>'; print '<td>';
$formproject->select_projects(-1, $fk_projet, 'fk_projet', 0, 0, 1, 1);
print '</td>';
}
// Select type // Select type
print '<td align="center">'; print '<td align="center">';
@ -1829,7 +1838,6 @@ else
$defaultvat=-1; $defaultvat=-1;
if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none';
print '<select class="flat" name="vatrate">'; print '<select class="flat" name="vatrate">';
print '<option name="none" value="" selected>';
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', true); print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', true);
print '</select>'; print '</select>';
print '</td>'; print '</td>';
@ -2087,7 +2095,28 @@ if($user->rights->expensereport->export && $object->fk_statut>0 && $action != 'e
print '</div>'; print '</div>';
if ($action != 'create' && $action != 'edit' && ($id || $ref))
{
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
// Link invoice to intervention
if (GETPOST('LinkedFichinter')) {
$object->fetch($id);
$object->fetch_thirdparty();
$result = $object->add_object_linked('fichinter', GETPOST('LinkedFichinter'));
}
// Linked object block
$somethingshown = $form->showLinkedObjectBlock($object);
// Show links to link elements
$linktoelements=array();
if($conf->global->EXPENSES_LINK_TO_INTERVENTION) $linktoelements[]='fichinter';
$linktoelem='';
$linktoelem = $form->showLinkToObjectBlock($object,$linktoelements);
if ($linktoelem) print '<br>'.$linktoelem;
}
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -35,7 +35,7 @@ $id = GETPOST('id','int');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter'); $result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
$object = new Fichinter($db); $object = new Fichinter($db);

View File

@ -584,8 +584,3 @@ ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN doc_ref varchar(300) NOT NU
ALTER TABLE llx_holiday ADD COLUMN tms timestamp; ALTER TABLE llx_holiday ADD COLUMN tms timestamp;
ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_holiday ADD COLUMN entity integer DEFAULT 1 NOT NULL;
-- VAT rates Luxembourg
UPDATE llx_c_tva SET taux='17' WHERE rowid=1401 AND fk_pays=140;
UPDATE llx_c_tva SET taux='14' WHERE rowid=1402 AND fk_pays=140;
UPDATE llx_c_tva SET taux='8' WHERE rowid=1403 AND fk_pays=140;
UPDATE llx_c_tva SET note='VAT intermediary rate' WHERE rowid=1403 AND fk_pays=140;

View File

@ -41,3 +41,42 @@ ALTER TABLE llx_facture ADD INDEX idx_facture_fk_statut (fk_statut);
UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_status as cls WHERE cls.rowid = p.fk_opp_status) WHERE p.opp_percent IS NULL AND p.fk_opp_status IS NOT NULL; UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_status as cls WHERE cls.rowid = p.fk_opp_status) WHERE p.opp_percent IS NULL AND p.fk_opp_status IS NOT NULL;
CREATE TABLE llx_website
(
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
entity integer DEFAULT 1,
shortname varchar(24) NOT NULL,
description varchar(255),
status integer,
date_creation datetime,
date_modification datetime,
tms timestamp
) ENGINE=innodb;
ALTER TABLE llx_website ADD UNIQUE INDEX uk_website_shortname (shortname, entity);
CREATE TABLE llx_website_page
(
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
fk_website integer,
pageurl varchar(16) NOT NULL,
title varchar(255),
description varchar(255),
keywords varchar(255),
content text,
status integer,
date_creation datetime,
date_modification datetime,
tms timestamp
) ENGINE=innodb;
ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pageurl);
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);

View File

@ -16,8 +16,5 @@
-- --
-- =========================================================================== -- ===========================================================================
ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pageurl); ALTER TABLE llx_website ADD UNIQUE INDEX uk_website_shortname (shortname, entity);
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);

View File

@ -20,7 +20,7 @@
CREATE TABLE llx_website CREATE TABLE llx_website
( (
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
entity integer, entity integer DEFAULT 1,
shortname varchar(24) NOT NULL, shortname varchar(24) NOT NULL,
description varchar(255), description varchar(255),
status integer, status integer,

View File

@ -20,4 +20,3 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid); ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);

View File

@ -396,6 +396,21 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
migrate_reload_menu($db,$langs,$conf,$versionto); migrate_reload_menu($db,$langs,$conf,$versionto);
} }
// Scripts for last version
$afterversionarray=explode('.','3.9.9');
$beforeversionarray=explode('.','4.0.9');
if (versioncompare($versiontoarray,$afterversionarray) >= 0 && versioncompare($versiontoarray,$beforeversionarray) <= 0)
{
// Reload modules (this must be always and only into last targeted version)
$listofmodule=array(
'MAIN_MODULE_FACTURE'=>'newboxdefonly',
);
migrate_reload_modules($db,$langs,$conf,$listofmodule);
// Reload menus (this must be always and only into last targeted version)
migrate_reload_menu($db,$langs,$conf,$versionto);
}
print '<tr><td colspan="4"><br>'.$langs->trans("MigrationFinished").'</td></tr>'; print '<tr><td colspan="4"><br>'.$langs->trans("MigrationFinished").'</td></tr>';
// On commit dans tous les cas. // On commit dans tous les cas.

View File

@ -221,3 +221,4 @@ OtherCountriesCustomersReport=Foreign customers report
BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Based on the two first letters of the VAT number being different from your own company's country code BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Based on the two first letters of the VAT number being different from your own company's country code
SameCountryCustomersWithVAT=National customers report SameCountryCustomersWithVAT=National customers report
BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Based on the two first letters of the VAT number being the same as your own company's country code
LinkedFichinter=Link to an intervention

View File

@ -122,3 +122,4 @@ LoginUsingOpenID=Use OpenID to login
WeeklyHours=Weekly hours WeeklyHours=Weekly hours
ColorUser=Color of the user ColorUser=Color of the user
DisabledInMonoUserMode=Disabled in maintenance mode DisabledInMonoUserMode=Disabled in maintenance mode
UserAccountancyCode=User accountancy code

View File

@ -0,0 +1,5 @@
# Dolibarr language file - Source file is en_US - website
Shortname=Code
WebsiteSetupDesc=Create here as much entry as number of different websites you need. Then go into menu Websites to edit them.
DeleteWebsite=Delete website
ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its pages and content will also be removed.

View File

@ -1,4 +1,4 @@
# Dolibarr language file - Source file is en_US - admin # Dolibarr language file - Source file is en_US - workflow
WorkflowSetup=Workflow module setup WorkflowSetup=Workflow module setup
WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in. WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in.
ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules.

View File

@ -221,3 +221,4 @@ OtherCountriesCustomersReport=Rapport client étranger
BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant différent du code de pays de votre propre entreprise BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant différent du code de pays de votre propre entreprise
SameCountryCustomersWithVAT=Rapport clients nationaux SameCountryCustomersWithVAT=Rapport clients nationaux
BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant les mêmes que le code pays de votre propre entreprise BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry=Basé sur les deux premières lettres du numéro de TVA étant les mêmes que le code pays de votre propre entreprise
LinkedFichinter=Lier à une intervention

View File

@ -1943,12 +1943,15 @@ if (! function_exists("llxFooter"))
if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent; if (! empty($delayedhtmlcontent)) print $delayedhtmlcontent;
// Wrapper to show tooltips // Wrapper to show tooltips
print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n"; if ($conf->use_javascript_ajax)
print '<script type="text/javascript"> {
jQuery(document).ready(function () { print "\n<!-- JS CODE TO ENABLE tipTip on all object with class classfortooltip -->\n";
jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50}); print '<script type="text/javascript">
}); jQuery(document).ready(function () {
</script>' . "\n"; jQuery(".classfortooltip").tipTip({maxWidth: "'.dol_size(600,'width').'px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});
});
</script>' . "\n";
}
// A div for the address popup // A div for the address popup
print "\n<!-- A div to allow dialog popup -->\n"; print "\n<!-- A div to allow dialog popup -->\n";

View File

@ -4068,8 +4068,7 @@ class Product extends CommonObject
{ {
global $conf, $db; global $conf, $db;
// FIXME USing * into select is forbidden $sql = "SELECT rowid, level, fk_level, var_percent, var_min_percent FROM ".MAIN_DB_PREFIX."product_pricerules";
$sql = "SELECT * FROM ".MAIN_DB_PREFIX."product_pricerules";
$query = $db->query($sql); $query = $db->query($sql);
$rules = array(); $rules = array();

View File

@ -314,6 +314,7 @@ else
setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
} }
if ($search_categ > 0) $param.="&amp;search_categ=".$search_categ;
if ($sref) $param="&amp;sref=".$sref; if ($sref) $param="&amp;sref=".$sref;
if ($search_ref_supplier) $param="&amp;search_ref_supplier=".$search_ref_supplier; if ($search_ref_supplier) $param="&amp;search_ref_supplier=".$search_ref_supplier;
if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".$sbarcode:""); if ($sbarcode) $param.=($sbarcode?"&amp;sbarcode=".$sbarcode:"");

View File

@ -23,9 +23,16 @@
*/ */
require ("../main.inc.php"); require ("../main.inc.php");
//require_once (DOL_DOCUMENT_ROOT."/websites/class/website.class.php");
$langs->load("externalsite"); $langs->load("externalsite");
top_htmlhead("",""); top_htmlhead("","");
top_menu("","","_top"); top_menu("","","_top");
/*
$website = new Website($db);
$listofwebsites = $website->fetchAll();
*/
print 'rrr';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -13,59 +13,154 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/ */
/** /**
* \file htdocs/externalsite/frames.php * \file htdocs/admin/website.php
* \ingroup externalsite * \ingroup website
* \brief Page that build two frames: One for menu, the other for the target page to show * \brief Page to setup the module Website
* \author Laurent Destailleur
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("externalsite"); $langs->load("admin");
$langs->load("other");
$langs->load("website");
if (empty($conf->global->EXTERNALSITE_URL)) if (! $user->admin) accessforbidden();
$action = GETPOST('action','alpha');
$conf->dol_hide_leftmenu = 1;
$website='website1';
/*
* Actions
*/
// Action mise a jour ou ajout d'une constante
if ($action == 'update')
{ {
llxHeader();
print '<div class="error">'.$langs->trans('ExternalSiteModuleNotComplete').'</div>';
llxFooter();
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} }
$mainmenu=GETPOST('mainmenu', 'alpha');
$leftmenu=GETPOST('leftmenu', 'alpha');
$idmenu=GETPOST('idmenu', 'int');
$theme=GETPOST('theme', 'alpha');
$codelang=GETPOST('lang', 'alpha');
print "
<html>
<head>
<title>Dolibarr frame for external web site</title>
</head>
<frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".($heightforframes+50).",*\" border=0 framespacing=0 frameborder=0>
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
<frame name=\"main\" src=\"".$conf->global->EXTERNALSITE_URL."\">
<noframes>
<body>
</body>
</noframes>
</frameset>
<noframes>
<body>
<br><div class=\"center\">
Sorry, your browser is too old or not correctly configured to view this area.<br>
Your browser must support frames.<br>
</div>
</body>
</noframes>
</html>
";
/*
* View
*/
$_SESSION['website_mode'] = 'edit';
$form = new Form($db);
$help_url='';
llxHeader('',$langs->trans("WebsiteSetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("WebsiteSetup"),$linkback,'title_setup');
$head = array();
/*
* Edit mode
*/
if ($_SESSION['website_mode'] == 'edit')
{
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'general', $langs->trans("Page").': '.$langs->trans("Home"), 0, 'globe');
print load_fiche_titre($langs->trans("SEO"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
print '<tr><td>';
print $langs->trans('WEBSITE_PAGEURL');
print '</td><td>';
print '/public/websites/'.$website.'/index.php?page=home';
print '</td></tr>';
print '<tr><td>';
print $langs->trans('WEBSITE_TITLE');
print '</td><td>';
print '<input type="text" class="flat" size="96" name="WEBSITE_TITLE" value="'.dol_escape_htmltag($obj->WEBSITE_TITLE).'">';
print '</td></tr>';
print '<tr><td>';
print $langs->trans('WEBSITE_DESCRIPTION');
print '</td><td>';
print '<input type="text" class="flat" size="96" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($obj->WEBSITE_DESCRIPTION).'">';
print '</td></tr>';
print '<tr><td>';
print $langs->trans('WEBSITE_KEYWORDS');
print '</td><td>';
print '<input type="text" class="flat" size="128" name="WEBSITE_KEYWORDS" value="'.dol_escape_htmltag($obj->WEBSITE_KEYWORDS).'">';
print '</td></tr>';
print '</table>';
print '<br>';
/*
* Editing global variables not related to a specific theme
*/
print load_fiche_titre($langs->trans("Other"),'','');
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('WEBSITE_HEADER',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
$doleditor->Create();
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('WEBSITE_CONTENT',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
$doleditor->Create();
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('WEBSITE_FOOTER',$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,5,60);
$doleditor->Create();
dol_fiche_end();
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>';
}
llxFooter();
$db->close();

View File

@ -0,0 +1,65 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/externalsite/frames.php
* \ingroup externalsite
* \brief Page that build two frames: One for menu, the other for the target page to show
* \author Laurent Destailleur
*/
require '../main.inc.php';
$langs->load("website");
$mainmenu=GETPOST('mainmenu', 'alpha');
$leftmenu=GETPOST('leftmenu', 'alpha');
$idmenu=GETPOST('idmenu', 'int');
$theme=GETPOST('theme', 'alpha');
$codelang=GETPOST('lang', 'alpha');
print "
<html>
<head>
<title>Dolibarr frame for web site menu</title>
</head>
<frameset ".(empty($conf->global->MAIN_MENU_INVERT)?"rows":"cols")."=\"".($heightforframes+50).",*\" border=0 framespacing=0 frameborder=0>
<frame name=\"barre\" src=\"frametop.php?mainmenu=".$mainmenu."&leftmenu=".$leftmenu."&idmenu=".$idmenu.($theme?'&theme='.$theme:'').($codelang?'&lang='.$codelang:'')."&nobackground=1\" noresize scrolling=\"NO\" noborder>
<frame name=\"main\" src=\"framebottom.php\">
<noframes>
<body>
</body>
</noframes>
</frameset>
<noframes>
<body>
<br><div class=\"center\">
Sorry, your browser is too old or not correctly configured to view this area.<br>
Your browser must support frames.<br>
</div>
</body>
</noframes>
</html>
";

View File

@ -853,8 +853,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
// Test RULE ES-ES // Test RULE ES-ES
$vat1=get_default_localtax($companyes,$companyes,1,0); $vat1=get_default_localtax($companyes,$companyes,1,0);
$vat2=get_default_localtax($companyes,$companyes,2,0); $vat2=get_default_localtax($companyes,$companyes,2,0);
$this->assertEquals(5.2,$vat1); $this->assertEquals($vat1, 5.2);
$this->assertEquals(-19,$vat2); $this->assertStringStartsWith((string) $vat2, '-19:-15:-9'); // Can be -19 (old version) or '-19:-15:-9' (new setup)
// Test RULE ES-IT // Test RULE ES-IT
$vat1=get_default_localtax($companyes,$companyit,1,0); $vat1=get_default_localtax($companyes,$companyit,1,0);

View File

@ -130,10 +130,10 @@ class ModulesTest extends PHPUnit_Framework_TestCase
$modulelist=array('Accounting','Adherent','Agenda','Banque','Barcode','Bookmark', $modulelist=array('Accounting','Adherent','Agenda','Banque','Barcode','Bookmark',
'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','DocumentGeneration','Don','DynamicPrices', 'CashDesk','Categorie','ClickToDial','Commande','Comptabilite','Contrat','Cron','Deplacement','DocumentGeneration','Don','DynamicPrices',
'ECM','Expedition','Export','ExternalRss','ExternalSite', 'ECM','Expedition','Export','ExternalRss','ExternalSite',
'Facture','Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','Import','Label','Ldap', 'Facture','Fckeditor','Ficheinter','Fournisseur','FTP','GeoIPMaxmind','Gravatar','Holiday','HRM','Import','Incoterm','Label','Ldap','Loan',
'Mailing','MailmanSpip','Margin', 'Mailing','MailmanSpip','Margin',
'Notification','OpenSurvey','Paybox','Paypal','Prelevement','Product','ProductBatch','Projet','Propale', 'Notification','Oauth','OpenSurvey','Paybox','Paypal','Prelevement','Product','ProductBatch','Projet','Propale','ReceiptPrinter','Resource',
'Salaries','Service','Skype','Societe','Stock','WebServicesClient','Syslog','Tax','User','WebServices','Workflow'); 'Salaries','Service','Skype','Societe','Stock','SupplierProposal','Syslog','Tax','User','WebServices','WebServicesClient','Websites','Workflow');
foreach($modulelist as $modlabel) foreach($modulelist as $modlabel)
{ {
require_once(DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php'); require_once(DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php');
@ -142,7 +142,7 @@ class ModulesTest extends PHPUnit_Framework_TestCase
$result=$mod->remove(); $result=$mod->remove();
$result=$mod->init(); $result=$mod->init();
$this->assertLessThan($result, 0, $modlabel); $this->assertLessThan($result, 0, $modlabel);
print __METHOD__." result=".$result."\n"; print __METHOD__." test remove/init for module ".$modlabel.", result=".$result."\n";
} }
return 0; return 0;