Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
fappels 2016-05-24 11:11:08 +02:00
commit d5e497386b
453 changed files with 24889 additions and 72127 deletions

View File

@ -50,7 +50,6 @@ env:
matrix:
fast_finish: true
allow_failures:
- php: '7.0'
- php: nightly
# FIXME
#- env: DB=postgresql
@ -79,7 +78,11 @@ before_install:
install:
- |
echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock
composer self-update
composer -n init
composer -n config vendor-dir htdocs/includes
echo
- |
@ -100,13 +103,14 @@ install:
- |
echo "Installing PHP CodeSniffer"
composer require squizlabs/php_codesniffer ^2
composer -n require squizlabs/php_codesniffer ^2
echo
- |
echo "Adding Composer binaries to the path"
echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo
before_script:
- |
@ -269,29 +273,31 @@ script:
set +e
cd htdocs/install
php upgrade.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360.log
php upgrade2.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-2.log
php step5.php 3.5.0 3.6.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade350360-3.log
php upgrade2.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-2.log
php step5.php 3.5.0 3.6.0 > $TRAVIS_BUILD_DIR/upgrade350360-3.log
php upgrade.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370.log
php upgrade2.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-2.log
php step5.php 3.6.0 3.7.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade360370-3.log
php upgrade2.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-2.log
php step5.php 3.6.0 3.7.0 > $TRAVIS_BUILD_DIR/upgrade360370-3.log
php upgrade.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380.log
php upgrade2.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-2.log
php step5.php 3.7.0 3.8.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade370380-3.log
php upgrade2.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-2.log
php step5.php 3.7.0 3.8.0 > $TRAVIS_BUILD_DIR/upgrade370380-3.log
php upgrade.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390.log
php upgrade2.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-2.log
php step5.php 3.8.0 3.9.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade380390-3.log
php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log
php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log
php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log
php upgrade2.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-2.log
php step5.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400-3.log
php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log
php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log
cd -
set +e
echo
#cat $TRAVIS_BUILD_DIR/upgrade390400-2.log
#cat /tmp/dolibarr_install.log
- |
echo "Unit testing"
# Ensure we catch errors. Set this to +e if you want to go to the end to see log file.
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
- |

View File

@ -27,7 +27,7 @@ PHPExcel 1.8.1 LGPL-2.1+ Yes
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP

10
build/composer/README Normal file
View File

@ -0,0 +1,10 @@
To test upgrade of a lib with composer:
composer update --no-dev --no-autoloader --dry-run ccampbell/chromephp
To upgrade a lib with composer:
composer update --no-dev --no-autoloader ccampbell/chromephp

View File

@ -12,15 +12,18 @@
"irc": "irc://chat.freenode.net/dolibarr",
"source": "https://github.com/Dolibarr/dolibarr"
},
"config": {
"vendor-dir": "htdocs/includes"
},
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"ccampbell/chromephp": "^4.1",
"ccampbell/chromephp": "4.1.0",
"ckeditor/ckeditor": "dev-full/stable",
"mike42/escpos-php": "dev-master",
"mike42/escpos-php": "1.2.1",
"mobiledetect/mobiledetectlib": "2.8.17",
"phpoffice/phpexcel": "1.8.1",
"restler/framework": "^3.0",
"restler/framework": "3.0.0-RC6",
"tecnickcom/tcpdf": "6.2.12"
},
"require-dev": {
@ -45,8 +48,5 @@
"ext-xml": "Excel support",
"firephp/firephp-core": "Logging to Firebug console support",
"raven/raven": "Sentry logging server support"
},
"config": {
"vendor-dir": "htdocs/includes"
}
}

64
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "c2b53c577364dbe3a56137043081b511",
"content-hash": "8f7a86cfbc13f45e13b73c49531818cb",
"hash": "f666a32d1a59518b8ecc55899e829e79",
"content-hash": "8d110e7d8fca6eca1aa814ee35d0032b",
"packages": [
{
"name": "ccampbell/chromephp",
@ -56,12 +56,12 @@
"source": {
"type": "git",
"url": "https://github.com/ckeditor/ckeditor-releases.git",
"reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0"
"reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0",
"reference": "e3eb254641c4c349ffc19e49bd4a1a6831b5b6d0",
"url": "https://api.github.com/repos/ckeditor/ckeditor-releases/zipball/4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91",
"reference": "4a7a6d717f9a408fa8f9ea53ef2dba4d64b83e91",
"shasum": ""
},
"type": "library",
@ -89,27 +89,28 @@
"text",
"wysiwyg"
],
"time": "2016-03-31 16:19:25"
"time": "2016-05-12 15:36:04"
},
{
"name": "mike42/escpos-php",
"version": "dev-master",
"version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/mike42/escpos-php.git",
"reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788"
"reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/96f05cbf460f5b67c2184ee4e91aedfbcedeb788",
"reference": "96f05cbf460f5b67c2184ee4e91aedfbcedeb788",
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/cfea4c4fc95516ac953e1e5b623f854632afa2ee",
"reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.5.*"
"phpunit/phpunit": "4.5.*",
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
@ -152,7 +153,7 @@
"print",
"receipt"
],
"time": "2016-03-27 23:08:27"
"time": "2016-04-25 01:14:07"
},
{
"name": "mobiledetect/mobiledetectlib",
@ -267,17 +268,17 @@
},
{
"name": "restler/framework",
"version": "3.0.0",
"version": "3.0.0-RC6",
"target-dir": "Luracast/Restler",
"source": {
"type": "git",
"url": "https://github.com/Luracast/Restler-Framework.git",
"reference": "6ee10b3e5dbc6376916fed55ec2340a37cce436b"
"reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/6ee10b3e5dbc6376916fed55ec2340a37cce436b",
"reference": "6ee10b3e5dbc6376916fed55ec2340a37cce436b",
"url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/bfe1139b233852b745c6a0ec14d7244ceb3b3fc6",
"reference": "bfe1139b233852b745c6a0ec14d7244ceb3b3fc6",
"shasum": ""
},
"require": {
@ -286,23 +287,14 @@
"replace": {
"luracast/restler": "3.*"
},
"require-dev": {
"bshaffer/oauth2-server-php": "v1.0",
"luracast/explorer": "*",
"mustache/mustache": "dev-master",
"rodneyrehm/plist": "dev-master",
"symfony/yaml": "*",
"twig/twig": "v1.13.0",
"zendframework/zendamf": "dev-master"
},
"suggest": {
"bshaffer/oauth2-server-php": "Restler can provide OAuth2 authentication using this library (see require-dev for details)",
"luracast/explorer": "Restler's very own api explorer (see require-dev for details)",
"mustache/mustache": "Restler can render HtmlView using mustache/handlebar templates (see require-dev for details)",
"rodneyrehm/plist": "Restler supports tho Apple plist xml format (see require-dev for details)",
"symfony/yaml": "Restler can produce content in yaml format as well (see require-dev for details)",
"twig/twig": "Restler can render HtmlView using twig templates (see require-dev for details)",
"zendframework/zendamf": "Support for the amf document format (see require-dev for details)"
"bshaffer/oauth2-server-php": "If you want to use OAuth2 for authentication",
"illuminate/view": "If you want to use laravel blade templates with Html format",
"mustache/mustache": "If you want to use mustache/handlebar templates with Html format",
"rodneyrehm/plist": "If you need Apple plist binary/xml format",
"symfony/yaml": "If you need YAML format",
"twig/twig": "If you want to use twig templates with Html format",
"zendframework/zendamf": "If you need AMF format"
},
"type": "library",
"extra": {
@ -323,10 +315,6 @@
{
"name": "Luracast",
"email": "arul@luracast.com"
},
{
"name": "Nick nickl- Lombard",
"email": "github@jigsoft.co.za"
}
],
"description": "Just the Restler Framework without the tests and examples",
@ -337,7 +325,7 @@
"rest",
"server"
],
"time": "2015-08-04 07:52:49"
"time": "2016-02-28 15:57:37"
},
{
"name": "tecnickcom/tcpdf",
@ -408,7 +396,7 @@
"minimum-stability": "stable",
"stability-flags": {
"ckeditor/ckeditor": 20,
"mike42/escpos-php": 20
"restler/framework": 5
},
"prefer-stable": false,
"prefer-lowest": false,

View File

@ -116,8 +116,15 @@ JQUERYFILETREE:
RESTLER:
--------
if ($className == 'Luracast\Restler\string') return;
if ($className == 'Luracast\Restler\mixed') return;
* Add 2 lines into function
private function alias($className, $currentClass)
{
...
to get
private function alias($className, $currentClass)
{
if ($className == 'Luracast\Restler\string') return;
if ($className == 'Luracast\Restler\mixed') return;
...

View File

@ -180,7 +180,7 @@ if (! $sourcecontent)
}
// Define output variables
$outfile='out.'.$classmin.'.class.php';
$outfile=$classmin.'.class.php';
$targetcontent=$sourcecontent;
// Substitute module name
@ -259,7 +259,7 @@ foreach($property as $key => $prop)
if ($addfield)
{
$varprop.="\t\t\$sql.= '".$prop['field'];
if ($i <= count($property)-$no_output_field) $varprop.=",";
if ($i < (count($property)-$no_output_field)) $varprop.=",";
$varprop.="';";
$varprop.="\n";
}
@ -455,9 +455,9 @@ else $error++;
//--------------------------------------------------------------------
$skeletonfiles=array(
$path.'skeleton_script.php' => 'out.'.$classmin.'_script.php',
$path.'skeleton_list.php' => 'out.'.$classmin.'_list.php',
$path.'skeleton_card.php' => 'out.'.$classmin.'_card.php'
$path.'skeleton_script.php' => $classmin.'_script.php',
$path.'skeleton_list.php' => $classmin.'_list.php',
$path.'skeleton_card.php' => $classmin.'_card.php'
);
foreach ($skeletonfiles as $skeletonfile => $outfile)
@ -670,5 +670,5 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n";
print "You can now move generated files to store them into directory /yourmodule/class (for .class.php file) or /yourmodule.\n";
return $error;

View File

@ -266,7 +266,8 @@ if ($resql)
$num = $db->num_rows($resql);
$params='';
if ($search_field1 != '') $params.= '&amp;search_field1='.urlencode($search_field1);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_field1 != '') $params.= '&amp;search_field1='.urlencode($search_field1);
if ($search_field2 != '') $params.= '&amp;search_field2='.urlencode($search_field2);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// Add $param from extra fields
@ -280,7 +281,7 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';

2
htdocs/.gitignore vendored
View File

@ -20,5 +20,5 @@
/allscreens*
/ecommerce/
/cabinetmed*
/conf/conf.php
/webmail*
/conf/conf.php

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 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
@ -48,6 +49,8 @@ if ($user->societe_id > 0)
if (! $user->rights->accounting->chartofaccount)
accessforbidden();
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'sortorder');
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -55,7 +58,7 @@ $page = GETPOST("page", 'int');
if ($page == - 1) {
$page = 0;
}
$offset = $conf->liste_limit * $page;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield)
@ -63,13 +66,31 @@ if (! $sortfield)
if (! $sortorder)
$sortorder = "ASC";
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
$accounting = new AccountingAccount($db);
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
if ($action == 'disable') {
if ($accounting->fetch($id)) {
$result = $accounting->account_desactivate($id);
@ -89,21 +110,18 @@ if ($action == 'disable') {
}
}
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_account = "";
$search_label = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
}
/*
* View
*
*/
llxHeader('', $langs->trans("ListAccounts"));
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
@ -128,8 +146,16 @@ if (strlen(trim($search_pcgtype))) {
if (strlen(trim($search_pcgsubtype))) {
$sql .= " AND aa.pcg_subtype like '%" . $search_pcgsubtype . "%'";
}
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/admin/account.php:: $sql=' . $sql);
@ -138,7 +164,15 @@ $result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
$params='';
if ($search_account != "") $params.= '&amp;search_account='.urlencode($search_account);
if ($search_label != "") $params.= '&amp;search_label='.urlencode($search_label);
if ($search_accountparent != "") $params.= '&amp;search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype != "") $params.= '&amp;search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype != "") $params.= '&amp;search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
$i = 0;
@ -154,13 +188,13 @@ if ($result) {
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $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("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("AccountNumber"), $_SERVER["PHP_SELF"], "aa.account_number", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "aa.label", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $params, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $params, "", 'width="60" align="center"', $sortfield, $sortorder);
print '</tr>';
print '<tr class="liste_titre">';

View File

@ -27,6 +27,18 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
$action = GETPOST('action');
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="f.rowid"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
$langs->load("admin");
$langs->load("compta");
@ -54,6 +66,8 @@ $object = new Fiscalyear($db);
* Actions
*/
/*
* View
*/
@ -66,11 +80,20 @@ $title = $langs->trans('FiscalYears');
llxHeader('', $title, LOG_ERR);
print load_fiche_titre($langs->trans('FiscalYears'));
$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 .= " WHERE f.entity = " . $conf->entity;
$sql.=$db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
if ($result) {
@ -78,6 +101,9 @@ if ($result) {
$num = $db->num_rows($result);
$i = 0;
$title = $langs->trans('FiscalYears');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit, 1);
// Load attribute_label
print '<table class="noborder" width="100%">';

View File

@ -53,6 +53,7 @@ $object = new Fiscalyear($db);
$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'));
/*
* Actions
*/
@ -143,10 +144,8 @@ llxHeader();
$form = new Form($db);
/*
* Action create
*/
if ($action == 'create') {
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewFiscalYear"));
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
@ -172,7 +171,7 @@ if ($action == 'create') {
// Statut
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Statut") . '</td>';
print '<td class="fieldrequired">' . $langs->trans("Status") . '</td>';
print '<td class="valeur">';
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
print '</td></tr>';
@ -205,7 +204,7 @@ if ($action == 'create') {
// Ref
print "<tr>";
print '<td width="25%">' . $langs->trans("Ref") . '</td><td>';
print '<td class="titlefield">' . $langs->trans("Ref") . '</td><td>';
print $object->ref;
print '</td></tr>';

View File

@ -1,31 +1,32 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*
*/
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 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/accountancy/admin/journal.php
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
* \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module
*/
require '../../main.inc.php';
// Class
@ -48,24 +49,44 @@ $list = array (
'ACCOUNTING_PURCHASE_JOURNAL',
'ACCOUNTING_SOCIAL_JOURNAL',
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
);
/*
* Actions
*/
*/
if ($action == 'update') {
$error = 0;
foreach ( $list as $constname ) {
// Save vars
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
// Save bank account journals
$arrayofbankaccount = GETPOST('bank_account', 'array');
foreach($arrayofbankaccount as $key => $code)
{
$bankaccount = new Account($db);
$res = $bankaccount->fetch($key);
if ($res > 0)
{
$bankaccount->accountancy_journal = $code;
$bankaccount->update($user);
}
else
{
$error++;
break;
}
}
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
@ -75,7 +96,7 @@ if ($action == 'update') {
/*
* View
*/
*/
llxHeader();
@ -99,13 +120,13 @@ print "</tr>\n";
foreach ( $list as $key ) {
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
$label = $langs->trans($key);
print '<td width="50%"><label for="' . $key . '">' . $label . '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
@ -118,11 +139,11 @@ print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . '</td>';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
print "</tr>\n";
// Bank account
$sql = "SELECT rowid, label, accountancy_journal";
$sql = "SELECT rowid, label, number, accountancy_journal";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
$sql .= " WHERE entity = " . $conf->entity;
$sql .= " AND clos = 0";
@ -132,29 +153,41 @@ $resql = $db->query($sql);
if ($resql) {
$numr = $db->num_rows($resql);
$i = 0;
if ($numr > 0)
while ( $i < $numr ) {
$objp = $db->fetch_object($resql);
$bankaccountstatic=new Account($db);
while ( $i < $numr ) {
$objp = $db->fetch_object($resql);
$var = ! $var;
$var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">';
$bankaccountstatic->id = $objp->rowid;
$bankaccountstatic->label = $objp->label;
$bankaccountstatic->number = $objp->number;
$bankaccountstatic->accountancy_journal = $objp->accountancy_journal;
// Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal") . ' - ' . $objp->label . '</label></td>';
print '<tr ' . $bc[$var] . ' class="value">';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="' . $objp->label . '" value="' . $objp->accountancy_journal . '" disabled>';
print '</td></tr>';
// Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal");
print ' - '.$bankaccountstatic->getNomUrl(1);
print '</label></td>';
$i ++;
}
} else
// Value
print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">';
print '</td></tr>';
$i ++;
}
$db->free($resql);
}
else
{
dol_print_error($db);
$db->free($resql);
}
print "</table>\n";

View File

@ -79,7 +79,7 @@ if (empty($search_date_start)) {
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "t.rowid";
$sortfield = "t.numero_compte";
$options = '';
$filter = array ();
@ -100,9 +100,11 @@ if (! empty($search_accountancy_code_end)) {
$options .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
}
/*
* Action
*/
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
@ -149,22 +151,34 @@ else {
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
$moreforfilter='';
print '<table class="noborder" width="100%">';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('DateStart') . ': ';
$moreforfilter.=$form->select_date($search_date_start, 'date_start', 0, 0, 1, '', 1, 0, 1);
$moreforfilter.=$langs->trans('DateEnd') . ': ';
$moreforfilter.=$form->select_date($search_date_end, 'date_end', 0, 0, 1, '', 1, 0, 1);
$moreforfilter.='</div>';
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);

View File

@ -87,24 +87,8 @@ $formventilation = new FormVentilation($db);
$formother = new FormOther($db);
$form = new Form($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
}
if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
@ -178,9 +162,30 @@ if (! empty($search_mvt_num)) {
$options .= '&amp;search_mvt_num=' . $search_mvt_num;
}
/*
* Action
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_mvt_num = '';
$search_doc_type = '';
$search_doc_ref = '';
$search_doc_date = '';
$search_accountancy_code = '';
$search_accountancy_code_start = '';
$search_accountancy_code_end = '';
$search_accountancy_aux_code = '';
$search_accountancy_aux_code_start = '';
$search_accountancy_aux_code_end = '';
$search_mvt_label = '';
$search_direction = '';
$search_ledger_code = '';
$search_date_start = '';
$search_date_end = '';
}
if ($action == 'delbookkeeping') {
$import_key = GETPOST('importkey', 'alpha');
@ -193,7 +198,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'delbookkeepingyearconfirm') {
}
if ($action == 'delbookkeepingyearconfirm') {
$delyear = GETPOST('delyear', 'int');
@ -205,7 +211,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'delmouvconfirm') {
}
if ($action == 'delmouvconfirm') {
$mvt_num = GETPOST('mvt_num', 'int');
@ -217,7 +224,8 @@ if ($action == 'delbookkeeping') {
Header("Location: list.php");
exit();
}
} elseif ($action == 'export_csv') {
}
if ($action == 'export_csv') {
include DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php';
@ -228,251 +236,171 @@ if ($action == 'delbookkeeping') {
}
else
{
if (in_array($conf->global->ACCOUNTING_EXPORT_MODELCSV, array(5,6))) // TODO remove the conditional and keep the code in the "else"
{
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines);
if (!empty($accountancyexport->errors)) setEventMessages('', $accountancyexport->errors, 'errors');
else exit;
}
}
// TODO remove next 3 lines and foreach to implement the AccountancyExport method for each model
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
// Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print ' ' . $sep;
print $line->sens . $sep;
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
print $line->doc_ref . $sep;
print length_accountg($line->numero_compte) . $sep;
print length_accounta($line->code_tiers) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print $line->code_journal . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
// Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print $line->piece_num . $sep;
print $line->doc_ref . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print 'E' . $sep;
print length_accountg($line->code_tiers) . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 4) {
// Bob50
print $line->piece_num . $sep;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
if (empty($line->code_tiers)) {
print 'G' . $sep;
print length_accounta($line->numero_compte) . $sep;
} else {
if (substr($line->numero_compte,0,3)=='411') {
print 'C' . $sep;
}
if (substr($line->numero_compte,0,3)=='401') {
print 'F' . $sep;
}
print length_accountg($line->code_tiers) . $sep;
}
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print "\n";
$accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines);
if (!empty($accountancyexport->errors)) {
setEventMessages('', $accountancyexport->errors, 'errors');
}
exit;
}
}
/*
* View
*/
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);
/*
* List
*/
// List
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($nbtotalofrecords < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$delyear = GETPOST('delyear');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$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
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
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"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $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("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, '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 class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
print '<td class="liste_titre">';
print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '<br>';
print $langs->trans('to') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print '<br>';
print $langs->trans('to');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print '<br>';
print $langs->trans('to');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</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" 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 '&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 '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="center">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';
print '<td align="right">';
print price($total_credit);
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$delyear = GETPOST('delyear');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$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
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
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"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $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("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, '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 class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
print '<td class="liste_titre">';
print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print '<br>';
print $langs->trans('to') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print '<br>';
print $langs->trans('to');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
print '<td>';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print '<br>';
print $langs->trans('to');
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</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" colspan="2" class="liste_titre">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td>' . length_accounta($line->code_tiers) . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
print '<td align="center">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
print price($total_debit);
print '</td>';
print '<td align="right">';
print price($total_credit);
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
$db->close();

View File

@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
/*
* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -12,7 +13,7 @@
*
* 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
* 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
@ -20,7 +21,7 @@
*/
/**
* \file htdocs/accountancy/class/accountancyexport.class.php
* \file htdocs/accountancy/class/accountancyexport.class.php
*/
/**
@ -29,30 +30,34 @@
* Manage the different format accountancy export
*/
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
class AccountancyExport
{
/**
*
* @var Type of export
*/
public static $EXPORT_TYPE_NORMAL = 1;
public static $EXPORT_TYPE_CEGID = 2;
public static $EXPORT_TYPE_COALA = 3;
public static $EXPORT_TYPE_BOB50 = 4;
public static $EXPORT_TYPE_CIEL = 5;
public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_NORMAL = 1;
public static $EXPORT_TYPE_CEGID = 2;
public static $EXPORT_TYPE_COALA = 3;
public static $EXPORT_TYPE_BOB50 = 4;
public static $EXPORT_TYPE_CIEL = 5;
public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_EBP = 7;
/**
*
* @var string[] Error codes (or messages)
*/
public $errors = array();
public $errors = array ();
/**
*
* @var string Separator
*/
public $separator = '';
/**
*
* @var string End of line
*/
public $end_line = '';
@ -62,8 +67,7 @@ class AccountancyExport
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB &$db)
{
public function __construct(DoliDB &$db) {
global $conf;
$this->db = &$db;
@ -76,17 +80,17 @@ class AccountancyExport
*
* @return array of type
*/
public static function getType()
{
public static function getType() {
global $langs;
return array (
self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus')
self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
);
}
@ -95,8 +99,7 @@ class AccountancyExport
*
* @return void
*/
public static function downloadFile()
{
public static function downloadFile() {
global $conf;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
@ -107,111 +110,168 @@ class AccountancyExport
*
* @param unknown $TData data
*/
public function export(&$TData)
{
public function export(&$TData) {
global $conf, $langs;
self::downloadFile();
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
case self::$EXPORT_TYPE_NORMAL:
case self::$EXPORT_TYPE_NORMAL :
$this->exportNormal($TData);
break;
case self::$EXPORT_TYPE_CEGID:
case self::$EXPORT_TYPE_CEGID :
$this->exportCegid($TData);
break;
case self::$EXPORT_TYPE_COALA:
case self::$EXPORT_TYPE_COALA :
$this->exportCoala($TData);
break;
case self::$EXPORT_TYPE_BOB50:
case self::$EXPORT_TYPE_BOB50 :
$this->exportBob50($TData);
break;
case self::$EXPORT_TYPE_CIEL:
case self::$EXPORT_TYPE_CIEL :
$this->exportCiel($TData);
break;
case self::$EXPORT_TYPE_QUADRATUS:
case self::$EXPORT_TYPE_QUADRATUS :
$this->exportQuadratus($TData);
break;
default:
case self::$EXPORT_TYPE_EBP :
$this->exportEbp($TData);
break;
default :
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
}
if (empty($this->errors)) self::downloadFile();
}
/**
* Export format : Normal
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportNormal(&$TData)
{
public function exportNormal($objectLines) {
foreach ( $objectLines as $line ) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $this->separator;
print $line->doc_ref . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print length_accounta($line->code_tiers) . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print $line->code_journal . $this->separator;
print $this->end_line;
}
}
/**
* Export format : CEGID
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportCegid(&$TData)
{
public function exportCegid($objectLines) {
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print ' ' . $this->separator;
print $line->sens . $this->separator;
print price($line->montant) . $this->separator;
print dol_trunc($line->label_compte, 32) . $this->separator;
print $line->doc_ref . $this->separator;
print $this->end_line;
}
}
/**
* Export format : COALA
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportCoala(&$TData)
{
public function exportCoala($objectLines) {
// Coala export
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print $line->piece_num . $this->separator;
print $line->doc_ref . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print 'E' . $this->separator;
print length_accountg($line->code_tiers) . $this->separator;
print $this->end_line;
}
}
/**
* Export format : BOB50
*
* @param unknown $TData data
* @param array $objectLines data
*
* @return void
*/
public function exportBob50(&$TData)
{
public function exportBob50($objectLines) {
// Bob50
foreach ( $objectLines as $line ) {
print $line->piece_num . $this->separator;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator;
if (empty($line->code_tiers)) {
print 'G' . $this->separator;
print length_accounta($line->numero_compte) . $this->separator;
} else {
if (substr($line->numero_compte, 0, 3) == '411') {
print 'C' . $this->separator;
}
if (substr($line->numero_compte, 0, 3) == '401') {
print 'F' . $this->separator;
}
print length_accountg($line->code_tiers) . $this->separator;
}
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print dol_trunc($line->label_compte, 32) . $this->separator;
print $this->end_line;
}
}
/**
* Export format : CIEL
*
* @param unknown $TData data
* @param array $TData data
*
* @return void
*/
public function exportCiel(&$TData)
{
public function exportCiel(&$TData) {
global $conf;
$i=1;
$i = 1;
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
foreach ($TData as $data)
{
foreach ( $TData as $data ) {
$code_compta = $data->numero_compte;
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
if (! empty($data->code_tiers))
$code_compta = $data->code_tiers;
$Tab = array();
$Tab = array ();
$Tab['num_ecriture'] = str_pad($i, 5);
$Tab['code_journal'] = str_pad($data->code_journal, 2);
$Tab['date_ecriture'] = $date_ecriture;
$Tab['date_ope'] = dol_print_date($data->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 12), 12);
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 11), 11);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.$data->label_compte, 25), 25);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . $data->label_compte, 25), 25);
$Tab['montant'] = str_pad(abs($data->montant), 13, ' ', STR_PAD_LEFT);
$Tab['type_montant'] = str_pad($data->sens, 1);
$Tab['vide'] = str_repeat(' ', 18);
@ -221,41 +281,42 @@ class AccountancyExport
$Tab['end_line'] = $this->end_line;
print implode($Tab);
$i++;
$i ++;
}
}
/**
* Export format : Quadratus
*
* @param unknown $TData data
* @param array $TData data
*
* @return void
*/
public function exportQuadratus(&$TData)
{
public function exportQuadratus(&$TData) {
global $conf;
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ($TData as $data)
{
foreach ( $TData as $data ) {
$code_compta = $data->numero_compte;
if (!empty($data->code_tiers)) $code_compta = $data->code_tiers;
if (! empty($data->code_tiers))
$code_compta = $data->code_tiers;
$Tab = array();
$Tab = array ();
$Tab['type_ligne'] = 'M';
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8);
$Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2);
$Tab['folio'] = '000';
$Tab['date_ecriture'] = $date_ecriture;
$Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 20), 20);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20);
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
$Tab['montant'] = str_pad(abs($data->montant)*100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['contrepartie'] = str_repeat(' ', 8);
if (!empty($data->date_echeance)) $Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
else $Tab['date_echeance'] = '000000';
if (! empty($data->date_echeance))
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
else
$Tab['date_echeance'] = '000000';
$Tab['lettrage'] = str_repeat(' ', 5);
$Tab['num_piece'] = str_pad(self::trunc($data->piece_num, 5), 5);
$Tab['filler2'] = str_repeat(' ', 20);
@ -263,7 +324,7 @@ class AccountancyExport
$Tab['devis'] = str_pad($conf->currency, 3);
$Tab['code_journal2'] = str_pad(self::trunc($data->code_journal, 3), 3);
$Tab['filler3'] = str_repeat(' ', 3);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_compte, 32), 32);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 32), 32);
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
$Tab['filler4'] = str_repeat(' ', 73);
@ -273,14 +334,45 @@ class AccountancyExport
}
}
/**
* Export format : Normal
*
* @param array $objectLines data
*
* @return void
*/
public function exportEbp($objectLines) {
$this->separator = ',';
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print $date . $this->separator;
print $line->code_journal . $this->separator;
print length_accountg($line->numero_compte) . $this->separator;
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
print '"'.dol_trunc($line->label_compte,40,'right','UTF-8',1).'"' . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1)."'".$this->separator;
print price2num($line->montant).$this->separator;
print $line->sens.$this->separator;
print $date . $this->separator;
print 'EUR';
print $this->end_line;
}
}
/**
*
* @param unknown $str data
* @param integer $size data
*/
public static function trunc($str, $size)
{
public static function trunc($str, $size) {
return dol_trunc($str, $size, 'right', 'UTF-8', 1);
}
}

View File

@ -123,7 +123,7 @@ class FormVentilation extends Form
$options[$select_value_out] = $label;
}
$out .= Form::selectarray($htmlname, $options, $selected, $showempty);
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
$this->db->free($resql);
return $out;
}
@ -264,7 +264,7 @@ class FormVentilation extends Form
// Build select
$out = ajax_combobox($htmlname, $event);
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty);
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
return $out;
}

View File

@ -22,9 +22,9 @@
*/
/**
* \file htdocs/accountancy/journal/purchasesjournal.php
* \ingroup Advanced accountancy
* \brief Page with purchases journal
* \file htdocs/accountancy/journal/purchasesjournal.php
* \ingroup Advanced accountancy
* \brief Page with purchases journal
*/
require '../../main.inc.php';
@ -117,13 +117,14 @@ if ($result) {
$tabfac = array ();
$tabht = array ();
$tabtva = array ();
$def_tva = array ();
$tabttc = array ();
$tabcompany = array ();
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
// contrôles
// contrôles
$compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour;
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
@ -134,11 +135,13 @@ if ($result) {
}
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
//Define array for display vat tx
$def_tva[$obj->rowid]=price($obj->tva_tx);
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["refsologest"] = $obj->ref ;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier ;
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->description;
@ -164,19 +167,21 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$companystatic = new Societe($db);
$invoicestatic = new FactureFournisseur($db);
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
foreach ( $tabttc[$key] as $k => $mt ) {
// get compte id and label
@ -188,7 +193,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
@ -206,7 +211,7 @@ if ($action == 'writebookkeeping') {
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
// get compte id and label
@ -220,7 +225,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -251,7 +256,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_facturefourndet"];
$bookkeeping->code_tiers = '';
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier .' - '. $langs->trans("VAT");
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key];
$bookkeeping->numero_compte = $k;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -282,124 +287,123 @@ $companystatic = new Fournisseur($db);
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$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';
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep;
print $val["ref"];
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep;
print $val["ref"];
print "\n";
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
print "\n";
}
}
} else {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
print "\n";
}
}
} else {
llxHeader('', $langs->trans("PurchasesJournal"));
@ -423,7 +427,11 @@ if ($action == 'export_csv') {
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -468,7 +476,6 @@ if ($action == 'export_csv') {
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
@ -486,8 +493,8 @@ if ($action == 'export_csv') {
print "<td>" . length_accountg($k) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - ' .$invoicestatic->refsupplier .' - '. $accountingaccount->label . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $accountingaccount->label . "</td>";
// print "<td>" . $accountingaccount->label . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
@ -499,8 +506,8 @@ if ($action == 'export_csv') {
print "<tr " . $bc[$var] . " >";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>" ;
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("VAT") . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("VAT"). ' '.$def_tva[$key]. "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
@ -514,11 +521,11 @@ if ($action == 'export_csv') {
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . length_accounta($k)."</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("Code_tiers")."</td>";
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
//print "</td>";
print "<td>" . length_accounta($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers") . "</td>";
// print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
// print "</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Rapha<EFBFBD>l Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,9 +24,9 @@
*/
/**
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
* \file htdocs/accountancy/journal/sellsjournal.php
* \ingroup Advanced accountancy
* \brief Page with sells journal
*/
require '../../main.inc.php';
@ -118,6 +118,7 @@ if ($result) {
$tabfac = array ();
$tabht = array ();
$tabtva = array ();
$def_tva = array ();
$tabttc = array ();
$tabcompany = array ();
@ -140,10 +141,14 @@ if ($result) {
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
//Define array for display vat tx
$def_tva[$obj->rowid]=price($obj->tva_tx);
// Situation invoices handling
$line = new FactureLigne($db);
$line->fetch($obj->rowid);
$prev_progress = $line->get_prev_progress();
$line->fetch($obj->fdid);
$prev_progress = $line->get_prev_progress($obj->fdid);
if ($obj->type == Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
@ -193,14 +198,17 @@ if ($action == 'writebookkeeping') {
$error = 0;
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$companystatic = new Societe($db);
$invoicestatic = new Facture($db);
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@ -211,8 +219,8 @@ $invoicestatic->id = $key;
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = $tabcompany[$key]['code_client'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
//$bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
// $bookkeeping->label_compte = $tabcompany[$key]['name'];
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@ -242,7 +250,7 @@ $invoicestatic->id = $key;
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label);
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -272,7 +280,7 @@ $invoicestatic->id = $key;
$bookkeeping->fk_docdet = $val["fk_facturedet"];
$bookkeeping->code_tiers = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT");
$bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.$def_tva[$key];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? $mt : 0;
@ -296,6 +304,7 @@ $invoicestatic->id = $key;
// Export
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
@ -304,8 +313,7 @@ if ($action == 'export_csv') {
$companystatic = new Client($db);
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
@ -313,9 +321,9 @@ if ($action == 'export_csv') {
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) {
@ -325,8 +333,8 @@ $invoicestatic->id = $key;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
//print utf8_decode($companystatic->name) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep;
// print utf8_decode($companystatic->name) . $sep;
print $val["ref"];
print "\n";
}
@ -341,8 +349,8 @@ $invoicestatic->id = $key;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount_static->label)) . $sep;
//print dol_trunc($accountingaccount_static->label, 32) . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount_static->label)) . $sep;
// print dol_trunc($accountingaccount_static->label, 32) . $sep;
print $val["ref"];
print "\n";
}
@ -357,22 +365,22 @@ $invoicestatic->id = $key;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . $sep;
//print $langs->trans("VAT") . $sep;
print utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
// print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
}
} else {
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), 'day');
@ -380,8 +388,8 @@ $invoicestatic->id = $key;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
// print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
@ -396,8 +404,8 @@ $invoicestatic->id = $key;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. utf8_decode ( dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@ -410,8 +418,8 @@ $invoicestatic->id = $key;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name, 16)) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@ -440,7 +448,11 @@ $invoicestatic->id = $key;
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 || $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabeld="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -496,9 +508,9 @@ $invoicestatic->id = $key;
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
print "<td>" . length_accounta($k);
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"). "</td>";
// print "</td><td>" . $langs->trans("ThirdParty");
// print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . "</td>";
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
}
@ -514,8 +526,8 @@ $invoicestatic->id = $key;
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "</td>";
// print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . utf8_decode(utf8_decode($accountingaccount->label)) . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
@ -529,8 +541,8 @@ $invoicestatic->id = $key;
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . "</td>";
//print "<td>" . $langs->trans("VAT") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ' '.$def_tva[$key]. "</td>";
// print "<td>" . $langs->trans("VAT") . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";

View File

@ -1376,17 +1376,12 @@ else
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1);
}
/*
* Confirm add in spip
*/
// Confirm add in spip
if ($action == 'add_spip')
{
print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
}
/*
* Confirm removed from spip
*/
// Confirm removed from spip
if ($action == 'del_spip')
{
print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
@ -1551,8 +1546,16 @@ else
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
if (! $adht->cotisation)
{
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
}
print '</td></tr>';

View File

@ -722,8 +722,16 @@ if ($rowid > 0)
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
if (! $adht->cotisation)
{
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
}
print '</td></tr>';

View File

@ -49,6 +49,9 @@ $search_zip=GETPOST("search_zip");
$search_town=GETPOST("search_town");
$search_state=GETPOST("search_state");
$search_country=GETPOST("search_country");
$search_phone=GETPOST("search_phone");
$search_phone_perso=GETPOST("search_phone_perso");
$search_phone_mobile=GETPOST("search_phone_mobile");
$type=GETPOST("type");
$search_email=GETPOST("search_email");
$search_categ = GETPOST("search_categ",'int');
@ -104,6 +107,9 @@ $arrayfields=array(
'd.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0),
'd.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
'd.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
'd.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>0),
'd.phone_perso'=>array('label'=>$langs->trans("PhonePerso"), 'checked'=>0),
'd.phone_mobile'=>array('label'=>$langs->trans("PhoneMobile"), 'checked'=>0),
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
@ -151,6 +157,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_town="";
$search_state="";
$search_country='';
$search_phone='';
$search_phone_perso='';
$search_phone_mobile='';
$search_morphy="";
$search_categ="";
$catid="";
@ -290,6 +299,9 @@ if ($resql)
if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip);
if ($search_state != '') $param.= "&search_state=".urlencode($search_state);
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone);
if ($search_phone_perso != '') $param.= "&search_phone_perso=".urlencode($search_phone_perso);
if ($search_phone_mobile != '') $param.= "&search_phone_mobile=".urlencode($search_phone_mobile);
if ($filter) $param.="&filter=".urlencode($filter);
if ($type > 0) $param.="&type=".urlencode($type);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
@ -347,7 +359,7 @@ if ($resql)
print '<tr class="liste_titre">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{
print '<td width="5" align="center">&nbsp;</td>';
print '<td colspan="1" align="center">'.$langs->trans("NumberingShort").'</td>';
}
if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder);
@ -361,6 +373,9 @@ if ($resql)
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
@ -388,6 +403,12 @@ if ($resql)
// Line for filters fields
print '<tr class="liste_titre">';
// Line numbering
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
@ -464,6 +485,24 @@ if ($resql)
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Phone pro
if (! empty($arrayfields['d.phone']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone" value="'.$search_phone.'" size="5"></td>';
}
// Phone perso
if (! empty($arrayfields['d.phone_perso']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone_perso" value="'.$search_phone_perso.'" size="5"></td>';
}
// Phone mobile
if (! empty($arrayfields['d.phone_mobile']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_phone_mobile" value="'.$search_phone_mobile.'" size="5"></td>';
}
// Email
if (! empty($arrayfields['d.email']['checked']))
{
@ -619,14 +658,6 @@ if ($resql)
print $obj->address;
print '</td>';
}
// Town
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['d.zip']['checked']))
{
@ -635,6 +666,14 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Town
if (! empty($arrayfields['d.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
@ -650,6 +689,30 @@ if ($resql)
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone pro
if (! empty($arrayfields['d.phone']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone perso
if (! empty($arrayfields['d.phone_perso']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone_perso;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Phone mobile
if (! empty($arrayfields['d.phone_mobile']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->phone_mobile;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// EMail
if (! empty($arrayfields['d.email']['checked']))
{

View File

@ -551,6 +551,14 @@ if ($id == 25)
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
foreach ($hookmanager->resArray as $item => $value) {
$elementList[$item] = $value;
}
}
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
@ -1553,7 +1561,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db);
foreach ($fieldlist as $field => $value)
{

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$langs->load("errors");
$langs->load("admin");
$mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):(isset($_SESSION['mode'])?$_SESSION['mode']:0);
$mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):0;
$action=GETPOST('action','alpha');
$value=GETPOST('value', 'alpha');
$page_y=GETPOST('page_y','int');
@ -107,8 +107,6 @@ if (GETPOST('buttonreset'))
$form = new Form($db);
$_SESSION["mode"]=$mode;
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url);

View File

@ -263,7 +263,7 @@ if ($action == 'edit') // Edit
print '</td></tr>';
$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td>';
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
print '</td></tr>';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 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
@ -19,11 +20,7 @@
* \defgroup api Module DolibarrApi
* \brief API loader
* Search files htdocs/<module>/class/api_<module>.class.php
* \file htdocs/api/indexphp
*
* @todo User authentication with api_key
*
*
* \file htdocs/api/admin/explorer.php
*/
require_once '../../main.inc.php';
@ -51,7 +48,6 @@ use \Luracast\Restler\Defaults;
$api = new DolibarrApi($db);
$api->r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root
$api->r->addAPIClass('DolibarrApiInit',''); // Just for url root page
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
$api->r->addAuthenticationClass('DolibarrApiAccess','');
@ -149,7 +145,6 @@ llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
@ -158,27 +153,46 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
// Show message
print '<br>';
$message='';
$url='<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword</a>';
$url='<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword[&reset=1]</a>';
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
$message.=img_picto('','object_globe.png').' '.$url;
print $message;
print '<br>';
print '<br>';
$oldclass='';
print $langs->trans("ListOfAvailableAPIs").':<br>';
foreach($listofapis['v1'] as $key => $val)
{
if ($key == 'login') continue;
if ($key)
{
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
$url=$urlwithroot.'/api/index.php/'.$key;
$url.='?api_key=token';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
foreach($val as $method => $val2)
{
$newclass=$val2['className'];
if (preg_match('/restler/i', $newclass)) continue;
if ($oldclass != $newclass)
{
print "\n<br>\n".$langs->trans("Class").': '.$newclass.'<br>'."\n";
$oldclass = $newclass;
}
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
$url=$urlwithroot.'/api/index.php/'.$key;
$url.='?api_key=token';
print img_picto('','object_globe.png').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
}
}
}
print '<br>';
print '<br>';
print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php');
llxFooter();
$db->close();

View File

@ -100,19 +100,6 @@ print '<u>'.$langs->trans("ApiExporerIs").':</u><br>';
$url=DOL_MAIN_URL_ROOT.'/api/admin/explorer.php';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
// API endpoint
/*print '<u>'.$langs->trans("ApiEndPointIs").':</u><br>';
$url=DOL_MAIN_URL_ROOT.'/api/index.php/xxx/list';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
$url=DOL_MAIN_URL_ROOT.'/api/xxx/list.json';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
*/
print '<br>';
print '<br>';
print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php');
llxFooter();
$db->close();

View File

@ -140,89 +140,3 @@ class DolibarrApi
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray,$resource_id,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
}
}
/**
* API init
*
*/
class DolibarrApiInit extends DolibarrApi
{
function __construct() {
global $db;
$this->db = $db;
}
/**
* Login
*
* Log user with username and password
*
* @param string $login Username
* @param string $password User password
* @param int $entity User entity
* @return array Response status and user token
*
* @throws RestException
*/
public function login($login, $password, $entity = 0) {
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
// Authentication mode
if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication = 'http,dolibarr';
// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user))
$dolibarr_auto_user = 'auto';
// Set authmode
$authmode = explode(',', $dolibarr_main_authentication);
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
if (empty($login))
{
throw new RestException(403, 'Access denied');
}
// Generate token for user
$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY,1);
// We store API token into database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET api_key = '".$this->db->escape($token)."'";
$sql.= " WHERE login = '".$this->db->escape($login)."'";
dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log
$result = $this->db->query($sql);
if (!$result)
{
throw new RestException(500, 'Error when updating user :'.$this->db->error_msg);
}
//return token
return array(
'success' => array(
'code' => 200,
'token' => $token,
'message' => 'Welcome ' . $login
)
);
}
/**
* Get status (Dolibarr version)
*
* @access protected
* @class DolibarrApiAccess {@requires admin}
*/
function status() {
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
return array(
'success' => array(
'code' => 200,
'dolibarr_version' => DOL_VERSION
)
);
}
}

View File

@ -0,0 +1,124 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
*/
use Luracast\Restler\Restler;
use Luracast\Restler\RestException;
use Luracast\Restler\Defaults;
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
/**
* API generic (login, status, ...)
*
*/
class GenericApi extends DolibarrApi
{
function __construct() {
global $db;
$this->db = $db;
}
/**
* Login
*
* Log user with username and password
*
* @param string $login Username
* @param string $password User password
* @param int $entity User entity
* @param int $reset Reset token
* @return array Response status and user token
*
* @throws RestException
*/
public function login($login, $password, $entity=0, $reset=0) {
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
// Authentication mode
if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication = 'http,dolibarr';
// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user))
$dolibarr_auto_user = 'auto';
// Set authmode
$authmode = explode(',', $dolibarr_main_authentication);
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
if (empty($login))
{
throw new RestException(403, 'Access denied');
}
$token = 'failedtogenerateorgettoken';
$tmpuser=new User($this->db);
$tmpuser->fetch(0, $login);
// Renew the hash
if (empty($tmpuser->api_key) || $reset)
{
// Generate token for user
$token = dol_hash($login.uniqid().$conf->global->MAIN_API_KEY,1);
// We store API token into database
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
$sql.= " SET api_key = '".$this->db->escape($token)."'";
$sql.= " WHERE login = '".$this->db->escape($login)."'";
dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log
$result = $this->db->query($sql);
if (!$result)
{
throw new RestException(500, 'Error when updating api_key for user :'.$this->db->lasterror());
}
}
else
{
$token = $tmpuser->api_key;
}
//return token
return array(
'success' => array(
'code' => 200,
'token' => $token,
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - Token was generated by a previous call')
)
);
}
/**
* Get status (Dolibarr version)
*
* @access protected
* @class DolibarrApiAccess {@requires admin}
*/
function status() {
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
return array(
'success' => array(
'code' => 200,
'dolibarr_version' => DOL_VERSION
)
);
}
}

View File

@ -60,7 +60,6 @@ use \Luracast\Restler\Defaults;
$api = new DolibarrApi($db);
$api->r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root
$api->r->addAPIClass('DolibarrApiInit',''); // Just for url root page
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
$api->r->addAuthenticationClass('DolibarrApiAccess','');

View File

@ -59,7 +59,7 @@ top_htmlhead('','',0,0,'',$arrayofcss);
<div class="conteneur_img_droite">
<div class="menu_principal hideonsmartphone">
<div class="logo"><?php print '<img class="logopos" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div>
</div>
<div class="contenu">

View File

@ -203,7 +203,7 @@ $langs->load("cashdesk");
?>
<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
<?php
print $langs->trans("DateEcheance").' :';
print $langs->trans("DateDue").' :';
print $form->select_date(-1,'txtDatePaiement',0,0,0,'paymentmode',1,0,1);
print '</div>';
?>

View File

@ -83,7 +83,7 @@ $langs->load("bills");
// Affichage des infos en fonction du mode de paiement
if ( $obj_facturation->getsetPaymentMode() == 'DIF' ) {
echo ('<tr><td class="resume_label">'.$langs->trans("DateEcheance").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
} else {

View File

@ -48,14 +48,13 @@ class Categorie extends CommonObject
const TYPE_CUSTOMER = 2;
const TYPE_MEMBER = 3;
const TYPE_CONTACT = 4;
const TYPE_USER = 4; // categorie contact and user are same
// bank account
const TYPE_ACCOUNT = 5;
const TYPE_USER = 4; // categorie contact and user are same !
const TYPE_ACCOUNT = 5; // bank account
/**
* @var array ID mapping from type string
*
* @note Move to const array when PHP 5.6 will be our minimum target
* @note This array should be remove in future, once previous constants are moved to the string value.
*/
private $MAP_ID = array(
'product' => 0,
@ -1274,14 +1273,12 @@ class Categorie extends CommonObject
* Should be named getListOfCategForObject
*
* @param int $id Id of element
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode
* (0, 1, 2, ...) is deprecated.
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
*
* @return mixed Array of category objects or < 0 if KO
*/
function containing($id,$type,$mode='object')
function containing($id, $type, $mode='object')
{
$cats = array();

View File

@ -29,6 +29,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
$langs->load("categories");
@ -90,6 +91,7 @@ if ($action == 'addthumb' && $_GET["file"])
llxHeader("","",$langs->trans("Categories"));
$form = new Form($db);
$formother = new FormOther($db);
if ($object->id)
{
@ -117,8 +119,8 @@ if ($object->id)
print '<table class="border" width="100%">';
// Path of category
print '<tr><td width="20%" class="notopnoleft">';
$ways = $object->print_all_ways();
print '<tr><td class="titlefield notopnoleft">';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
foreach ($ways as $way)
@ -128,55 +130,17 @@ if ($object->id)
print '</td></tr>';
// Description
print '<tr><td width="20%" class="notopnoleft">';
print '<tr><td class="notopnoleft">';
print $langs->trans("Description").'</td><td>';
print dol_htmlentitiesbr($object->description);
print '</td></tr>';
// Visibility
/* if ($type == 0 && ! empty($conf->global->CATEGORY_ASSIGNED_TO_A_CUSTOMER))
{
if ($object->socid)
{
$soc = new Societe($db);
$soc->fetch($object->socid);
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("AssignedToTheCustomer").'</td><td>';
print $soc->getNomUrl(1);
// Color
print '<tr><td class="notopnoleft">';
print $langs->trans("Color").'</td><td>';
print $formother->showColor($object->color);
print '</td></tr>';
$catsMeres = $object->get_meres ();
if ($catsMeres < 0)
{
dol_print_error();
}
else if (count($catsMeres) > 0)
{
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("CategoryContents").'</td><td>';
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>';
}
}
else
{
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("CategoryContents").'</td><td>';
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>';
}
}
else
{
print '<tr><td width="20%" class="notopnoleft">';
print $langs->trans("CategoryContents").'</td><td>';
print ($object->visible ? $langs->trans("Visible") : $langs->trans("Invisible"));
print '</td></tr>';
}
*/
print "</table>\n";
print "</div>\n";

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
$langs->load("languages");
@ -143,6 +144,7 @@ llxHeader("","",$langs->trans("Translation"));
$form = new Form($db);
$formadmin=new FormAdmin($db);
$formother = new FormOther($db);
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
@ -159,8 +161,8 @@ print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="20%" class="notopnoleft">';
$ways = $object->print_all_ways();
print '<td class="titlefield notopnoleft">';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
foreach ($ways as $way)
@ -171,11 +173,17 @@ print '</td>';
print '</tr>';
// Description
print '<tr><td width="20%" class="notopnoleft">';
print '<tr><td class="notopnoleft tdtop">';
print $langs->trans("Description").'</td><td>';
print dol_htmlentitiesbr($object->description);
print '</td></tr>';
// Color
print '<tr><td class="notopnoleft">';
print $langs->trans("Color").'</td><td>';
print $formother->showColor($object->color);
print '</td></tr>';
print '</table>';
if ($action == 'edit')
@ -194,8 +202,8 @@ if ($action == 'edit')
{
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
print '<tr><td class="fieldtitlecreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$object->multilangs[$key]["label"].'"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create();
print '</td></tr>';
@ -205,7 +213,7 @@ if ($action == 'edit')
}
}
print '<br /><div class="center">';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -225,9 +233,9 @@ else
$s=picto_from_langcode($key);
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$object->multilangs[$key]["note"].'</td></tr>';
print '<tr><td class="fieldtitlecreate>'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
print '<tr><td>'.$langs->trans('Note').'</td><td>'.$object->multilangs[$key]["note"].'</td></tr>';
print '</table>';
}
}
@ -271,11 +279,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Translation').'</td><td>';
print '<tr><td class="fieldtitlecreate fieldrequired">'.$langs->trans('Translation').'</td><td>';
print $formadmin->select_language('','forcelangprod',0,$object->multilangs);
print '</td></tr>';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
$doleditor->Create();
print '</td></tr>';
@ -283,7 +291,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
print '</tr>';
print '</table>';
print '<br><div class="center">';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';

View File

@ -193,10 +193,10 @@ if ($action == 'delete')
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
}
print '<table border="0" width="100%" class="border">';
print '<table width="100%" class="border">';
// Path of category
print '<tr><td width="20%" class="notopnoleft">';
print '<tr><td class="titlefield notopnoleft">';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
print $langs->trans("Ref").'</td><td>';
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';

View File

@ -308,7 +308,7 @@ if ($resql)
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";

View File

@ -233,11 +233,6 @@ if ($id > 0)
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Alias name (commercial, trademark or alias name)
print '<tr><td class="titelfield">'.$langs->trans('AliasNames').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";
// Prospect/Customer
print '<tr><td width="30%">'.$langs->trans('ProspectCustomer').'</td><td width="70%" colspan="3">';
print $object->getLibCustProspStatut();
@ -461,8 +456,8 @@ if ($id > 0)
}
// Categories
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>' . $langs->trans("CustomersCategoriesShort") . '</td>';
print '<td colspan="3">';
print $form->showCategories( $object->id, 'customer', 1 );
print "</td></tr>";

View File

@ -568,15 +568,6 @@ if (empty($reshook))
}
}
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
// prevent browser refresh from reopening proposal several times
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) {
$object->reopen($user, 1);
}
}
// Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
@ -597,17 +588,6 @@ if (empty($reshook))
}
}
// Classify billed
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
{
$result=$object->cloture($user, 4, '');
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
// Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
@ -623,20 +603,6 @@ if (empty($reshook))
}
}
// Close proposal
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
if (! GETPOST('statut')) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
if ($object->statut == Propal::STATUS_VALIDATED) {
$object->cloture($user, GETPOST('statut'), GETPOST('note'));
}
}
}
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';

View File

@ -1536,6 +1536,7 @@ class Commande extends CommonOrder
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_customer = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
$this->socid = $obj->fk_soc;

View File

@ -123,7 +123,7 @@ if ($resql)
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$commandestatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
if ($conf->use_javascript_ajax)
@ -147,7 +147,7 @@ if ($resql)
print '</a>';
print '</td>';
print "</tr>\n";
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
}

View File

@ -45,6 +45,11 @@ if (! $user->rights->banque->consolidate) accessforbidden();
$action=GETPOST('action', 'alpha');
$id=GETPOST('account', 'int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="dateo";
/*
* Actions
@ -147,7 +152,7 @@ $sql.= ", bc.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau';
$sql.= " WHERE rappro=0 AND fk_account=".$acct->id;
$sql.= " ORDER BY dateo ASC";
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= " LIMIT 1000"; // Limit to avoid page overload
/// ajax adjust value date
@ -231,16 +236,19 @@ if ($resql)
print '<br>';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'."\n";
print '<td align="center">'.$langs->trans("DateOperationShort").'</td>';
print '<td align="center">'.$langs->trans("DateValueShort").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="right" width="60" class="nowrap">'.$langs->trans("Debit").'</td>';
print '<td align="right" width="60" class="nowrap">'.$langs->trans("Credit").'</td>';
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
print '<td align="center" width="60" class="nowrap">'.$langs->trans("ToConciliate").'</td>';
$paramlist='';
$paramlist.="&account=".$acct->id;
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'."\n";
print_liste_field_titre($langs->trans("DateOperationShort"),$_SERVER["PHP_SELF"],"b.dateo","",$paramlist,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateValueShort"),$_SERVER["PHP_SELF"],"b.datev","",$paramlist,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"b.fk_type","",$paramlist,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"b.label","",$paramlist,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Debit"),$_SERVER["PHP_SELF"],"b.amount","",$paramlist,' width="60 align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Credit"),$_SERVER["PHP_SELF"],"b.amount","",$paramlist,' width="60 align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"","",$paramlist,' width="80 align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ToConciliate"),$_SERVER["PHP_SELF"],"","",$paramlist,' align="center" width="80" ',$sortfield,$sortorder);
print "</tr>\n";

View File

@ -118,7 +118,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
// Ligne de titre tableau des ecritures
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("DateEcheance").'</td>';
print '<td>'.$langs->trans("DateDue").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td align="right">'.$langs->trans("Debit").'</td>';

View File

@ -760,8 +760,120 @@ class FactureRec extends CommonInvoice
$arraynow=dol_getdate($now);
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
parent::initAsSpecimen($option);
$prodids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE entity IN (".getEntity('product', 1).")";
$resql = $this->db->query($sql);
if ($resql)
{
$num_prods = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_prods)
{
$i++;
$row = $this->db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
// Initialize parameters
$this->id=0;
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->socid = 1;
$this->date = $nownotime;
$this->date_lim_reglement = $nownotime + 3600 * 24 *30;
$this->cond_reglement_id = 1;
$this->cond_reglement_code = 'RECEP';
$this->date_lim_reglement=$this->calculate_date_lim_reglement();
$this->mode_reglement_id = 0; // Not forced to show payment mode CHQ + VIR
$this->mode_reglement_code = ''; // Not forced to show payment mode CHQ + VIR
$this->note_public='This is a comment (public)';
$this->note_private='This is a comment (private)';
$this->note='This is a comment (private)';
$this->fk_incoterms=0;
$this->location_incoterms='';
if (empty($option) || $option != 'nolines')
{
// Lines
$nbp = 5;
$xnbp = 0;
while ($xnbp < $nbp)
{
$line=new FactureLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp;
$line->qty=1;
$line->subprice=100;
$line->tva_tx=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
$line->remise_percent=0;
if ($xnbp == 1) // Qty is negative (product line)
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->qty=-1;
$line->total_ht=-100;
$line->total_ttc=-119.6;
$line->total_tva=-19.6;
}
else if ($xnbp == 2) // UP is negative (free line)
{
$line->subprice=-100;
$line->total_ht=-100;
$line->total_ttc=-119.6;
$line->total_tva=-19.6;
$line->remise_percent=0;
}
else if ($xnbp == 3) // Discount is 50% (product line)
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else // (product line)
{
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$this->lines[$xnbp]=$line;
$xnbp++;
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
}
$this->revenuestamp = 0;
// Add a line "offered"
$line=new FactureLigne($this->db);
$line->desc=$langs->trans("Description")." (offered line)";
$line->qty=1;
$line->subprice=100;
$line->tva_tx=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
$line->remise_percent=100;
$line->total_ht=0;
$line->total_ttc=0; // 90 * 1.196
$line->total_tva=0;
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$xnbp++;
}
$this->usenewprice = 1;
}

View File

@ -205,7 +205,7 @@ $linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs-
// Ref
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';

View File

@ -971,6 +971,17 @@ class Paiement extends CommonObject
$result='';
$label = $langs->trans("ShowPayment").': '.$this->ref;
$arraybill = $this->getBillsArray();
if (count($arraybill) >0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic=new Facture($this->db);
foreach ($arraybill as $billid)
{
$facturestatic->fetch($billid);
$label .='<br> '.$facturestatic->getNomUrl(1).' '.$facturestatic->getLibStatut(2,1);
}
}
$link = '<a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';

View File

@ -40,25 +40,30 @@ $id=GETPOST('id');
llxHeader();
$paiement = new Paiement($db);
$paiement->fetch($id);
$paiement->info($id);
$object = new Paiement($db);
$object->fetch($id);
$object->info($id);
$head = payment_prepare_head($paiement);
$head = payment_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("PaymentCustomerInvoice"), 0, 'payment');
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td valign="top" width="140">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
print '</table>';
print '<br>';
print '<table width="100%"><tr><td>';
dol_print_object_info($paiement);
dol_print_object_info($object);
print '</td></tr></table>';
print '</div>';

View File

@ -202,13 +202,14 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
$paramlist='';
$paramlist.=(GETPOST("orphelins")?"&orphelins=1":"");
$paramlist.=($search_ref?"&search_ref=".urlencode($search_ref):"");
$paramlist.=($search_company?"&search_company=".urlencode($search_company):"");
$paramlist.=($search_amount?"&search_amount=".urlencode($search_amount):"");
$paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):"");
if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss);
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
$param.=(GETPOST("orphelins")?"&orphelins=1":"");
$param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
$param.=($search_company?"&search_company=".urlencode($search_company):"");
$param.=($search_amount?"&search_amount=".urlencode($search_amount):"");
$param.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):"");
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -218,24 +219,24 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit);
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$paramlist,"",$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("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("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("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Dourseanud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2106 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
@ -633,18 +633,18 @@ if (! empty($conf->expensereport->enabled))
$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";
$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 = "SELECT p.rowid, p.ref, u.rowid as userid, 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";
$sql.= " AND p.fk_statut>=5";
$column='pe.datep';
}
@ -654,7 +654,7 @@ if (! empty($conf->expensereport->enabled))
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.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
$sql.= " ORDER BY p.ref";
dol_syslog("get expense report outcome");
@ -677,7 +677,7 @@ if (! empty($conf->expensereport->enabled))
$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";
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/list.php?search_user=".$obj->userid."\">".$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>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
@ -529,7 +529,7 @@ if (! empty($conf->expensereport->enabled))
$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";
$sql.= " AND p.fk_statut>=5";
$column='p.date_valid';
@ -540,7 +540,7 @@ if (! empty($conf->expensereport->enabled))
$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";
$sql.= " AND p.fk_statut>=5";
$column='pe.datep';
}

View File

@ -328,8 +328,7 @@ if (empty($reshook))
$label = $lines[$i]->product_label;
}
if ($conf->global->PRODUIT_DESC_IN_FORM)
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
$desc .= ($lines[$i]->desc && $lines[$i]->desc!=$lines[$i]->libelle)?dol_htmlentitiesbr($lines[$i]->desc):'';
}
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
@ -360,7 +359,6 @@ if (empty($reshook))
$error++;
break;
}
}
}
}

View File

@ -190,7 +190,7 @@ foreach($listofstatus as $status)
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
print "</tr>\n";
}
if ($status==4 && $bool==false) $bool=true;
if ($status==4 && ! $bool) $bool=true;
else $bool=false;
}
if (! empty($conf->use_javascript_ajax))
@ -210,7 +210,7 @@ foreach($listofstatus as $status)
print '<tr '.$bc[$var].'>';
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
if ($status==4 && $bool==false) $bool=true;
if ($status==4 && ! $bool) $bool=true;
else $bool=false;
print "</tr>\n";
}

View File

@ -95,7 +95,7 @@ class box_factures extends ModeleBoxes
$now=dol_now();
$line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)';
while ($line < $num) {
$objp = $db->fetch_object($result);
@ -118,7 +118,7 @@ class box_factures extends ModeleBoxes
$late = '';
if ($facturestatic->hasDelay()) {
$late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
$late = img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
}
$this->info_box_contents[$line][] = array(

View File

@ -95,7 +95,7 @@ class box_factures_fourn extends ModeleBoxes
$num = $db->num_rows($result);
$line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)';
while ($line < $num) {
$objp = $db->fetch_object($result);

View File

@ -88,7 +88,7 @@ class box_factures_fourn_imp extends ModeleBoxes
$num = $db->num_rows($result);
$line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateDue').': %s)';
$facturestatic = new FactureFournisseur($db);

View File

@ -96,7 +96,7 @@ class box_factures_imp extends ModeleBoxes
$now=dol_now();
$line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateDue')).': %s)';
while ($line < $num)
{

View File

@ -3987,7 +3987,7 @@ abstract class CommonObject
function call_trigger($trigger_name, $user)
{
global $langs,$conf;
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);

View File

@ -123,8 +123,6 @@ class Conf
*/
function setValues($db)
{
global $conf;
dol_syslog(get_class($this)."::setValues");
/*
@ -205,17 +203,19 @@ class Conf
$db->free($resql);
}
// Include local constants files and fetch their values to the corresponding database constants
if(! empty($this->global->LOCAL_CONSTS_FILES)) {
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
foreach ($filesList as $file) {
$file=dol_sanitizeFileName($file);
include_once DOL_DOCUMENT_ROOT . "/$file/{$file}_consts.php";
foreach ($file2bddconsts as $key=>$value) {
$conf->global->$key=constant($value);
}
}
}
// Include other local consts.php files and fetch their values to the corresponding database constants
if (! empty($this->global->LOCAL_CONSTS_FILES)) {
$filesList = explode(":", $this->global->LOCAL_CONSTS_FILES);
foreach ($filesList as $file) {
$file=dol_sanitizeFileName($file);
include_once DOL_DOCUMENT_ROOT . "/".$file."/".$file."_consts.php";
foreach ($file2bddconsts as $key=>$value) {
$this->global->$key=constant($value);
}
}
}
//var_dump($this->modules);
//var_dump($this->modules_parts['theme']);
@ -398,7 +398,7 @@ class Conf
unset($this->global->PROJECT_USE_SEARCH_TO_SELECT);
}
if (! empty($conf->productbatch->enabled))
if (! empty($this->productbatch->enabled))
{
$this->global->STOCK_CALCULATE_ON_BILL=0;
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0;
@ -419,7 +419,7 @@ class Conf
$this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
// MAIN_HTML_TITLE
if (! isset($conf->global->MAIN_HTML_TITLE)) $conf->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';
if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';
// conf->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;
@ -446,7 +446,7 @@ class Conf
// conf->mailing->email_from = email pour envoi par Dolibarr des mailings
$this->mailing->email_from=$this->email_from;
if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM;
if (! isset($conf->global->MAIN_EMAIL_ADD_TRACK_ID)) $conf->global->MAIN_EMAIL_ADD_TRACK_ID=1;
if (! isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID=1;
// Format for date (used by default when not found or not searched in lang)
$this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
@ -579,7 +579,7 @@ class Conf
throw new Exception('Log handler does not extend LogHandlerInterface');
}
if (empty($conf->loghandlers[$handler])) $this->loghandlers[$handler]=$loghandlerinstance;
if (empty($this->loghandlers[$handler])) $this->loghandlers[$handler]=$loghandlerinstance;
}
}
}

View File

@ -3145,7 +3145,7 @@ class Form
/**
* Return list of categories having choosed type
*
* @param int $type Type de categories (0=product, 1=supplier, 2=customer, 3=member)
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param string $selected Id of category preselected or 'auto' (autoselect category if there is only one element)
* @param string $htmlname HTML field name
* @param int $maxlength Maximum length for labels
@ -3161,6 +3161,12 @@ class Form
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// For backward compatibility
if (is_numeric($type))
{
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
}
$cat = new Categorie($this->db);
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
@ -4297,7 +4303,7 @@ class Form
}
$return.= '>'.vatrate($rate['libtva']);
//$return.=($rate['code']?' '.$rate['code']:'');
$return.= (empty($defaultcode) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used)
$return.= (empty($rate['code']) && $rate['nprtva']) ? ' *': ''; // We show the * (old behaviour only if new vat code is not used)
$return.= '</option>';
}

View File

@ -302,7 +302,7 @@ class FormOther
/**
* Return select list for categories (to use in form search selectors)
*
* @param int $type Type of categories (0=product, 1=supplier, 2=customer, 3=member, 4=contact)
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param integer $selected Preselected value
* @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized"
@ -315,6 +315,12 @@ class FormOther
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// For backward compatibility
if (is_numeric($type))
{
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
}
// Load list of "categories"
$static_categs = new Categorie($this->db);
$tab_categs = $static_categs->get_full_arbo($type);

View File

@ -77,7 +77,7 @@ class Interfaces
$modules = array();
$orders = array();
$i=0;
$dirtriggers=array_merge(array('/core/triggers'),$conf->modules_parts['triggers']);
foreach($dirtriggers as $reldir)
{
@ -100,9 +100,9 @@ class Interfaces
$part3=$reg[3];
$nbfile++;
$modName = "Interface".ucfirst($reg[3]);
//print "file=$file"; print "modName=$modName"; exit;
//print "file=$file - modName=$modName\n";
if (in_array($modName,$modules))
{
$langs->load("errors");
@ -111,9 +111,17 @@ class Interfaces
}
else
{
include_once $newdir.'/'.$file;
try {
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
include_once $newdir.'/'.$file;
//print 'Done for '.$modName."\n";
}
catch(Exception $e)
{
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERROR);
}
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file)) continue;
// Check if trigger file is for a particular module
@ -142,7 +150,7 @@ class Interfaces
}
asort($orders);
// Loop on each trigger
foreach ($orders as $key => $value)
{

View File

@ -857,9 +857,10 @@ class Translate
//print 'param: '.$key.'-'.$keydatabase.'-'.$this->trans($key); exit;
// Check if a translation is available (this can call getTradFromKey)
if ($this->transnoentitiesnoconv($key) != $key)
$tmp=$this->transnoentitiesnoconv($key);
if ($tmp != $key && $tmp != 'ErrorBadValueForParamNotAString')
{
return $this->transnoentitiesnoconv($key); // Found in language array
return $tmp; // Found in language array
}
// Check in cache

View File

@ -192,8 +192,12 @@ class DoliDBMssql extends DoliDB
function getVersion()
{
$resql=$this->query("SELECT @@VERSION");
$version=$this->fetch_array($resql);
return $version['computed'];
if ($resql)
{
$version=$this->fetch_array($resql);
return $version['computed'];
}
else return '';
}
/**
@ -203,10 +207,7 @@ class DoliDBMssql extends DoliDB
*/
function getDriverInfo()
{
// FIXME: Dummy method
// TODO: Implement
return '';
return 'php mssql driver';
}
/**
@ -359,7 +360,7 @@ class DoliDBMssql extends DoliDB
$query_comp[]=$fld->COLUMN_NAME." IS NOT NULL";
}
}
if ($query_comp)
if (! empty($query_comp))
$query.=" WHERE ".implode(" AND ",$query_comp);
}
}
@ -648,7 +649,7 @@ class DoliDBMssql extends DoliDB
function last_insert_id($tab,$fieldid='rowid')
{
$res = $this->query("SELECT @@IDENTITY as id");
if ($data = $this->fetch_array($res))
if ($res && $data = $this->fetch_array($res))
{
return $data["id"];
}
@ -709,8 +710,12 @@ class DoliDBMssql extends DoliDB
function DDLGetConnectId()
{
$resql=$this->query('SELECT CONNECTION_ID()');
$row=$this->fetch_row($resql);
return $row[0];
if ($resql)
{
$row=$this->fetch_row($resql);
return $row[0];
}
else return '?';
}
/**

View File

@ -549,8 +549,12 @@ class DoliDBMysql extends DoliDB
function DDLGetConnectId()
{
$resql=$this->query('SELECT CONNECTION_ID()');
$row=$this->fetch_row($resql);
return $row[0];
if ($resql)
{
$row=$this->fetch_row($resql);
return $row[0];
}
else return '?';
}

View File

@ -532,8 +532,12 @@ class DoliDBMysqli extends DoliDB
function DDLGetConnectId()
{
$resql=$this->query('SELECT CONNECTION_ID()');
$row=$this->fetch_row($resql);
return $row[0];
if ($resql)
{
$row=$this->fetch_row($resql);
return $row[0];
}
else return '?';
}
/**

View File

@ -874,31 +874,34 @@ class DoliDBPgsql extends DoliDB
*/
function DDLInfoTable($table)
{
$infotables=array();
$infotables=array();
$sql="SELECT ";
$sql.=" infcol.column_name as \"Column\",";
$sql.=" CASE WHEN infcol.character_maximum_length IS NOT NULL THEN infcol.udt_name || '('||infcol.character_maximum_length||')'";
$sql.=" ELSE infcol.udt_name";
$sql.=" END as \"Type\",";
$sql.=" infcol.collation_name as \"Collation\",";
$sql.=" infcol.is_nullable as \"Null\",";
$sql.=" '' as \"Key\",";
$sql.=" infcol.column_default as \"Default\",";
$sql.=" '' as \"Extra\",";
$sql.=" '' as \"Privileges\"";
$sql.=" FROM information_schema.columns infcol";
$sql.=" WHERE table_schema='public' ";
$sql.=" AND table_name='".$table."'";
$sql.=" ORDER BY ordinal_position;";
$sql="SELECT ";
$sql.=" infcol.column_name as \"Column\",";
$sql.=" CASE WHEN infcol.character_maximum_length IS NOT NULL THEN infcol.udt_name || '('||infcol.character_maximum_length||')'";
$sql.=" ELSE infcol.udt_name";
$sql.=" END as \"Type\",";
$sql.=" infcol.collation_name as \"Collation\",";
$sql.=" infcol.is_nullable as \"Null\",";
$sql.=" '' as \"Key\",";
$sql.=" infcol.column_default as \"Default\",";
$sql.=" '' as \"Extra\",";
$sql.=" '' as \"Privileges\"";
$sql.=" FROM information_schema.columns infcol";
$sql.=" WHERE table_schema='public' ";
$sql.=" AND table_name='".$table."'";
$sql.=" ORDER BY ordinal_position;";
dol_syslog($sql,LOG_DEBUG);
$result = $this->query($sql);
while($row = $this->fetch_row($result))
{
$infotables[] = $row;
}
return $infotables;
dol_syslog($sql,LOG_DEBUG);
$result = $this->query($sql);
if ($result)
{
while($row = $this->fetch_row($result))
{
$infotables[] = $row;
}
}
return $infotables;
}
@ -1111,8 +1114,12 @@ class DoliDBPgsql extends DoliDB
function getDefaultCharacterSetDatabase()
{
$resql=$this->query('SHOW SERVER_ENCODING');
$liste=$this->fetch_array($resql);
return $liste['server_encoding'];
if ($resql)
{
$liste=$this->fetch_array($resql);
return $liste['server_encoding'];
}
else return '';
}
/**
@ -1127,7 +1134,7 @@ class DoliDBPgsql extends DoliDB
if ($resql)
{
$i = 0;
while ($obj = $this->fetch_object($resql) )
while ($obj = $this->fetch_object($resql))
{
$liste[$i]['charset'] = $obj->server_encoding;
$liste[$i]['description'] = 'Default database charset';
@ -1148,8 +1155,12 @@ class DoliDBPgsql extends DoliDB
function getDefaultCollationDatabase()
{
$resql=$this->query('SHOW LC_COLLATE');
$liste=$this->fetch_array($resql);
return $liste['lc_collate'];
if ($resql)
{
$liste=$this->fetch_array($resql);
return $liste['lc_collate'];
}
else return '';
}
/**

View File

@ -52,7 +52,10 @@ else header('Cache-Control: no-cache');
$.fn.select2.locales['xx'] = {
formatMatches: function (matches) { return matches + " <?php echo dol_escape_js($langs->trans("Select2ResultFoundUseArrows")); ?>"; },
formatNoMatches: function () { return "<?php echo dol_escape_js($langs->trans("Select2NotFound")); ?>"; },
formatInputTooShort: function (input, min) { var n = min - input.length; return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>"; },
formatInputTooShort: function (input, min) { var n = min - input.length;
if (n > 1) return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacters")); ?>";
else return "<?php echo dol_escape_js($langs->trans("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->trans("Select2MoreCharacter")); ?>"
},
formatLoadMore: function (pageNumber) { return "<?php echo dol_escape_js($langs->trans("Select2LoadingMoreResults")); ?>"; },
formatSearching: function () { return "<?php echo dol_escape_js($langs->trans("Select2SearchInProgress")); ?>"; }
};

View File

@ -37,26 +37,26 @@ function admin_accounting_prepare_head(AccountingAccount $object=null)
$head = array ();
$head[$h][0] = dol_buildpath('/accountancy/admin/index.php', 1);
$head[$h][1] = $langs->trans("Configuration");
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$h ++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/journal.php';
$head[$h][1] = $langs->trans("Journaux");
$head[$h][2] = 'journal';
$h ++;
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/export.php';
$head[$h][1] = $langs->trans("Export");
$head[$h][1] = $langs->trans("ExportOptions");
$head[$h][2] = 'export';
$h ++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_admin', 'remove');
return $head;

View File

@ -441,8 +441,14 @@ function actions_prepare_head($object)
// Tab to link resources
if ($conf->resource->enabled)
{
include_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
$resource=new DolResource($db);
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
$listofresourcelinked = $resource->getElementResources($object->element, $object->id);
$nbResources=count($listofresourcelinked);
$head[$h][1] = $langs->trans("Resources");
if ($nbResources > 0) $head[$h][1].= ' <span class="badge">'.($nbResources).'</span>';
$head[$h][2] = 'resources';
$h++;
}

View File

@ -186,9 +186,9 @@ function societe_prepare_head(Societe $object)
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][1] = $langs->trans("Events");
$head[$h][1].= ' / ';
$head[$h][1].= '/';
}
$head[$h][1].= $langs->trans("Info");
$head[$h][1].= $langs->trans("Agenda");
$head[$h][2] = 'agenda';
$h++;

View File

@ -373,7 +373,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
* @param Societe $targetcompany Target company object
* @param Contact $targetcontact Target contact object
* @param int $usecontact Use contact instead of company
* @param int $mode Address type ('source', 'target', 'targetwithdetails': target but include also phone/fax/email/url)
* @param int $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url)
* @param Object $object Object we want to build document for
* @return string String with full address
*/
@ -420,7 +420,7 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
}
}
if ($mode == 'target' || $mode == 'targetwithdetails')
if ($mode == 'target' || preg_match('/targetwithdetails/',$mode))
{
if ($usecontact)
{
@ -439,19 +439,31 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
$stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
}
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails')
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
{
// Phone
if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
if (! empty($targetcontact->phone_pro) && ! empty($targetcontact->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/',$mode))
{
if (! empty($targetcontact->phone_pro) || ! empty($targetcontact->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcontact->phone_pro)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro);
if (! empty($targetcontact->phone_pro) && ! empty($targetcontact->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcontact->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile);
}
// Fax
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/',$mode))
{
if ($targetcontact->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax);
}
// EMail
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/',$mode))
{
if ($targetcontact->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email);
}
// Web
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/',$mode))
{
if ($targetcontact->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url);
}
}
}
else
@ -460,19 +472,31 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
// Country
if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code))."\n";
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails')
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || preg_match('/targetwithdetails/',$mode))
{
// Phone
if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
if (! empty($targetcompany->phone) && ! empty($targetcompany->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/',$mode))
{
if (! empty($targetcompany->phone) || ! empty($targetcompany->phone_mobile)) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ";
if (! empty($targetcompany->phone)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone);
if (! empty($targetcompany->phone) && ! empty($targetcompany->phone_mobile)) $stringaddress .= " / ";
if (! empty($targetcompany->phone_mobile)) $stringaddress .= $outputlangs->convToOutputCharset($targetcompany->phone_mobile);
}
// Fax
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/',$mode))
{
if ($targetcompany->fax) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcompany->fax);
}
// EMail
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/',$mode))
{
if ($targetcompany->email) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcompany->email);
}
// Web
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
if (! empty($conf->global->MAIN_PDF_ADDALSOTARGETDETAILS) || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/',$mode))
{
if ($targetcompany->url) $stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcompany->url);
}
}
}
@ -507,17 +531,29 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof4);
}
if (! empty($conf->global->MAIN_PROFID5_IN_ADDRESS) && ! empty($targetcompany->idprof5))
{
$tmp=$outputlangs->transcountrynoentities("ProfId5",$targetcompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof5);
}
if (! empty($conf->global->MAIN_PROFID6_IN_ADDRESS) && ! empty($targetcompany->idprof6))
{
$tmp=$outputlangs->transcountrynoentities("ProfId6",$targetcompany->country_code);
if (preg_match('/\((.+)\)/',$tmp,$reg)) $tmp=$reg[1];
$stringaddress.="\n".$tmp.': '.$outputlangs->convToOutputCharset($targetcompany->idprof6);
}
// Public note
if (! empty($conf->global->MAIN_PUBLIC_NOTE_IN_ADDRESS))
{
if ($mode == 'source' && ! empty($sourcecompany->note_public))
{
$stringaddress.="\n".$sourcecompany->note_public;
$stringaddress.="\n".dol_string_nohtmltag($sourcecompany->note_public);
}
if (($mode == 'target' || $mode == 'targetwithdetails') && ! empty($targetcompany->note_public))
if (($mode == 'target' || preg_match('/targetwithdetails/',$mode)) && ! empty($targetcompany->note_public))
{
$stringaddress.="\n".$targetcompany->note_public;
$stringaddress.="\n".dol_string_nohtmltag($targetcompany->note_public);
}
}
}
@ -602,10 +638,10 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
*/
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default_font_size=10)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
global $mysoc, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
$diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE);
$diffsizecontent=(empty($conf->global->PDF_DIFFSIZE_CONTENT)?4:$conf->global->PDF_DIFFSIZE_CONTENT);
$pdf->SetXY($curx, $cury);
@ -683,7 +719,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
if (empty($onlynumber)) {
$pdf->line($curx, $cury + 1, $curx, $cury + 7);
}
}
}
$curx=$savcurx;
$cury+=8;
@ -730,7 +766,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
// Use correct name of bank id according to country
$ibankey = FormBank::getIBANLabel($account);
if (! empty($account->iban))
{
//Remove whitespaces to ensure we are dealing with the format we expect
@ -771,7 +807,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
* @param int $marge_gauche Margin left (no more used)
* @param int $page_hauteur Page height (no more used)
* @param Object $object Object shown in PDF
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both)
* @param int $showdetails Show company adress details into footer (0=Nothing, 1=Show address, 2=Show managers, 3=Both)
* @param int $hidefreetext 1=Hide free text, 0=Show free text
* @return int Return height of bottom margin including footer text
*/
@ -803,7 +839,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// First line of company infos
$line1=""; $line2=""; $line3=""; $line4="";
if ($showdetails == 1 || $showdetails == 3)
if ($showdetails == 1 || $showdetails == 3)
{
// Company name
if ($fromcompany->name)
@ -1606,7 +1642,7 @@ function pdf_getlineqty_keeptoship($object,$i,$outputlangs,$hidedetails=0)
* @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
* @param HookManager $hookmanager Hook manager instance
* @return string
* @return string Value for unit cell
*/
function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = false)
{

View File

@ -465,6 +465,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
}
else
{
$default='515870';
if ($conf->theme == 'md') $default='5A3278';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
@ -479,7 +481,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>515870</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print ' &nbsp; ('.$langs->trans("Default").': <strong>'.$default.'</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
}

View File

@ -26,7 +26,6 @@ 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 ('', '$user->admin', __HANDLER__, 'left', 100__+MAX_llx_menu__, 'home', 'setup', 1__+MAX_llx_menu__, '/admin/index.php?leftmenu=setup', 'Setup', 0, 'admin', '', '', 2, 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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 101__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/company.php?leftmenu=setup', 'MenuCompanySetup', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 102__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/ihm.php?leftmenu=setup', 'GUISetup', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="setup" && $conf->accounting->enabled', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 114__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/translation.php?leftmenu=setup', 'Translation', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="setup"', __HANDLER__, 'left', 103__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/admin/modules.php?leftmenu=setup', 'Modules', 1, 'admin', '', '', 2, 2, __ENTITY__);
@ -210,7 +209,7 @@ 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', 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__);
-- 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', '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', __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__);
-- 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', __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__);
@ -235,6 +234,7 @@ 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->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2447__+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, 24, __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', 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__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="setup" && $conf->accounting->enabled', __HANDLER__, 'left', 115__+MAX_llx_menu__, 'home', '', 100__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'Fiscalyear', 1, 'admin', '', '', 2, 4, __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__);

View File

@ -31,8 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param DoliDB $db Database handler
* @param string $atarget Target
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array $menu Object Menu to return back list of menu entries
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @return int 0
*/
@ -128,7 +128,7 @@ function print_start_menu_entry_auguria($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
}
}

View File

@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
* @param string $atarget Target (Example: '' or '_top')
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
* @param array $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout 1=Disable output (Initialise &$menu only).
* @return int 0
*/
function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
@ -50,6 +50,19 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
if (empty($noout)) print_start_menu_array();
// Show/Hide vertical menu
if (GETPOST('testmenuhider') && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$showmode=1;
$classname = 'class="tmenu"';
$idsel='menu';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
}
// Home
$showmode=1;
$classname="";
@ -345,7 +358,7 @@ function print_start_menu_entry($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
}
}
@ -463,7 +476,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
print '</div>'."\n";
}
if (is_array($moredata) && ! empty($moredata['searchform']))
if (is_array($moredata) && ! empty($moredata['searchform']) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
print "\n";
print "<!-- Begin SearchForm -->\n";
@ -513,11 +526,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/admin/menus.php?mainmenu=home", $langs->trans("Menus"),1);
$newmenu->add("/admin/ihm.php?mainmenu=home", $langs->trans("GUISetup"),1);
if (! empty($conf->accounting->enabled))
{
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=home", $langs->trans("Fiscalyear"),1);
}
$newmenu->add("/admin/translation.php", $langs->trans("Translation"),1);
$newmenu->add("/admin/boxes.php?mainmenu=home", $langs->trans("Boxes"),1);
$newmenu->add("/admin/delais.php?mainmenu=home",$langs->trans("Alerts"),1);
@ -994,8 +1002,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Admin
$langs->load("admin");
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount');
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
}
// Accountancy (simple)

View File

@ -144,7 +144,7 @@ class MenuManager
if ($mode == 'topnb')
{
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1);
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1); // no output
return $this->menu->getNbOfVisibleMenuEntries();
}

View File

@ -304,7 +304,7 @@ function print_start_menu_entry_empty($idsel,$classname,$showmode)
if ($showmode)
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
print '<div class="tmenuleft"></div><div class="tmenucenter">';
print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
}
}

View File

@ -49,7 +49,7 @@ class pdf_proforma extends pdf_einstein
function __construct($db)
{
global $conf,$langs,$mysoc;
parent::__construct($db);
$this->name = "proforma";
@ -64,13 +64,14 @@ class pdf_proforma extends pdf_einstein
* @param Object $object Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @param string $titlekey Translation key to show as title of document
* @return void
*/
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="InvoiceProForma")
{
global $conf,$langs,$hookmanager;
parent::_pagehead($pdf, $object, $showaddress, $outputlangs, "InvoiceProForma");
parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);
}
}

View File

@ -1535,7 +1535,7 @@ class pdf_crabe extends ModelePDFFactures
$posy+=3;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R');
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateDue")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R');
}
if ($object->thirdparty->code_client)

View File

View File

@ -3,6 +3,7 @@
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 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
@ -50,7 +51,7 @@ class modAccounting extends DolibarrModules
$this->description = "Advanced accounting management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'development';
$this->version = 'experimental';
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
$this->special = 0;

View File

@ -165,11 +165,11 @@ class modBanque extends DolibarrModules
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Bordereaux remise Chq/Fact';
$this->export_permission[$r]=array(array("banque","export"));
$this->export_fields_array[$r]=array("bch.rowid"=>"DepositId","bch.number"=>"Numero","bch.ref_ext"=>"RefExt",'ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.num_chq'=>'ChequeOrTransferNumber','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation",
$this->export_fields_array[$r]=array("bch.rowid"=>"DepositId","bch.ref"=>"Numero","bch.ref_ext"=>"RefExt",'ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.num_chq'=>'ChequeOrTransferNumber','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation",
"bch.date_bordereau"=>"Date","bch.amount"=>"Total","bch.nbcheque"=>"NbCheque","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","f.facnumber"=>"InvoiceRef"
);
$this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.num_chq'=>'Text','b.amount'=>'Numeric','b.num_releve'=>'Text','b.datec'=>"Date",
"bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.number"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","f.facnumber"=>"Text"
"bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.ref"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","f.facnumber"=>"Text"
);
$this->export_entities_array[$r]=array('ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.num_chq'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account",
"bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company","f.facnumber"=>"invoice");

View File

@ -83,7 +83,7 @@ class modExpedition extends DolibarrModules
// Constants
$this->const = array();
$r=0;
$this->const[$r][0] = "EXPEDITION_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "rouget";
@ -125,14 +125,14 @@ class modExpedition extends DolibarrModules
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
$this->const[$r][3] = "Enable shipments";
$this->const[$r][4] = 0;
$r++;
// Boxes
$this->boxes = array();
@ -224,8 +224,14 @@ class modExpedition extends DolibarrModules
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$shipment=new Commande($this->db);
$idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,'')));
$contact_arrays=$shipment->liste_type_contact('external','',0,0,'');
if (is_array($contact_arrays) && count($contact_arrays)>0){
$idcontacts=join(',',array_keys($shipment->liste_type_contact('external','',0,0,'')));
} else {
$idcontacts=0;
}
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Shipments'; // Translation key (used only if key ExportDataset_xxx_z not found)
@ -237,7 +243,7 @@ class modExpedition extends DolibarrModules
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.siret'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','c.rowid'=>"shipment",'c.ref'=>"shipment",'c.ref_customer'=>"shipment",'c.fk_soc'=>"shipment",'c.date_creation'=>"shipment",'c.date_delivery'=>"shipment",'c.tracking_number'=>'shipment','c.height'=>"shipment",'c.width'=>"shipment",'c.size'=>'shipment','c.size_units'=>'shipment','c.weight'=>"shipment",'c.weight_units'=>'shipment','c.fk_statut'=>"shipment",'c.note_public'=>"shipment",'ed.rowid'=>'shipment_line','cd.description'=>'shipment_line','ed.qty'=>"shipment_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product','p.weight'=>'product','p.weight_units'=>'product','p.volume'=>'product','p.volume_units'=>'product');
if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r]+=array('sp.rowid'=>'contact','sp.lastname'=>'contact','sp.firstname'=>'contact','sp.note_public'=>'contact');
$this->export_dependencies_array[$r]=array('shipment_line'=>'ed.rowid','product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT))
if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT))
{
$keyforselect='socpeople'; $keyforelement='contact'; $keyforaliasextra='extra3';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';

View File

@ -139,7 +139,7 @@ if ($permission) {
}
?>
<form class="tagtr liste_titre formnoborder">
<form class="tagtr liste_titre liste_titre_add formnoborder">
<div class="tagtd"><?php echo $langs->trans("Nature"); ?></div>
<div class="tagtd"><?php echo $langs->trans("ThirdParty"); ?></div>
<div class="tagtd"><?php echo $langs->trans("Users").'/'.$langs->trans("Contacts"); ?></div>

View File

@ -52,7 +52,7 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
<tr class="liste_titre nodrag nodrop">
<tr class="liste_titre liste_titre_add nodrag nodrop">
<td class="linecoldescription" <?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>

View File

@ -117,7 +117,7 @@ $coldisplay=-1; // We remove first td
}
$coldisplay++;
print '<td align="right"><input type="text" class="flat" size="8" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
print '<td align="right"><input type="text" class="flat" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"';
if ($this->situation_counter > 1) print ' readonly';
print '></td>';

View File

@ -705,7 +705,9 @@ class Expedition extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref));
if ($result < 0) {
$error++; break;
$error++;
$this->errors[]=$mouvS->error;
break;
}
}
else
@ -713,17 +715,12 @@ class Expedition extends CommonObject
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch);
// ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock);
if ($result < 0) {
$error++; break;
}
// We update content of table llx_product_batch (will be rename into llx_product_stock_batch inantoher version)
// We can set livraison_batch to deprecated and adapt livraison to handle batch too (mouvS->_create also calls mouvS->_create_batch)
if (! empty($conf->productbatch->enabled))
{
$result=$mouvS->livraison_batch($obj->fk_origin_stock, $qty); // ->fk_origin_stock = id into table llx_product_batch (will be rename into llx_product_stock_batch in another version)
if ($result < 0) { $error++; $this->errors[]=$mouvS->error; break; }
$error++;
$this->errors[]=$mouvS->error;
break;
}
}
}

View File

@ -333,7 +333,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -390,6 +390,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
else
{
$mesg=$mailfile->error;
setEventMessages($mesg, null, 'errors');
}
// END - Send mail
}
@ -438,7 +439,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -542,7 +543,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -583,7 +584,6 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
else
{
setEventMessages($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo), null, 'errors');
$mesg="Impossible d'envoyer l'email.";
}
// END - Send mail
}
@ -627,7 +627,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -667,6 +667,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
else
{
$mesg="Impossible d'envoyer l'email.";
setEventMessages($mesg, null, 'errors');
}
// END - Send mail
}
@ -756,7 +757,7 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
if ($result > 0)
{
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
{
// Send mail
@ -806,9 +807,8 @@ if ($action == 'set_paid' && $id > 0 && $user->rights->expensereport->to_paid)
endif;
else:
$mesg="Impossible d'envoyer l'email.";
$mesg="Impossible d'envoyer l'email.";
setEventMessages($mesg, null, 'errors');
endif;
// END - Send mail
}
@ -921,7 +921,7 @@ if ($action == 'confirm_delete_line' && GETPOST("confirm") == "yes")
$total_ht = $object_ligne->total_ht;
$total_tva = $object_ligne->total_tva;
$result=$object->deleteline(GETPOST("rowid"));
$result=$object->deleteline(GETPOST("rowid"), $user);
if ($result >= 0)
{
if ($result > 0)
@ -961,7 +961,6 @@ if ($action == "updateligne" )
$rowid = $_POST['rowid'];
$type_fees_id = GETPOST('fk_c_type_fees');
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
$projet_id = $fk_projet;
$comments = GETPOST('comments');
$qty = GETPOST('qty');
@ -983,6 +982,7 @@ if ($action == "updateligne" )
if (! $error)
{
// TODO Use update method of ExpenseReportLine
$result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id);
if ($result >= 0)
{
@ -1078,29 +1078,6 @@ $formfile = new FormFile($db);
$formproject = new FormProjets($db);
$projecttmp = new Project($db);
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN))
{
if(!empty($_GET['mesg']))
{
$text_mesg = explode(",",$_GET['mesg']);
foreach($text_mesg as $text)
{
$mesg.= "- ".$langs->trans($text)."<br />";
}
print "<div class=\"error\" style=\"font-size:15px;background-color:#FFB3B3;\">";
print $langs->trans("LINE_NOT_ADDED")."<br />";
print $mesg;
print "</div>";
}
else
{
if ($mesg) print "<div class=\"error\" style=\"font-size:16px;background-color:red;\">".$mesg."</div>";
}
}
// Create
if ($action == 'create')
{

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -140,6 +141,7 @@ class ExpenseReport extends CommonObject
$sql.= ",paid";
$sql.= ",note_public";
$sql.= ",note_private";
$sql.= ",entity";
$sql.= ") VALUES(";
$sql.= "'(PROV)'";
$sql.= ", ".$this->total_ht;
@ -156,6 +158,7 @@ class ExpenseReport extends CommonObject
$sql.= ", 0";
$sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null");
$sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
$sql.= ", ".$conf->entity;
$sql.= ")";
dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);

View File

@ -120,7 +120,7 @@ if ($resql)
foreach ($listofstatus as $status)
{
$dataseries[]=array('label'=>$fichinterstatic->LibStatut($status,$bool,1),'data'=>(isset($vals[$status.$bool])?(int) $vals[$status.$bool]:0));
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
if ($conf->use_javascript_ajax)
@ -144,7 +144,7 @@ if ($resql)
print '</a>';
print '</td>';
print "</tr>\n";
if ($status==3 && $bool==false) $bool=true;
if ($status==3 && ! $bool) $bool=true;
else $bool=false;
}
}

View File

@ -231,7 +231,7 @@ if ($object->id > 0)
// Categories
if (! empty($conf->categorie->enabled))
{
print '<tr><td>' . $langs->trans("Categories") . '</td>';
print '<tr><td>' . $langs->trans("SuppliersCategoriesShort") . '</td>';
print '<td colspan="3">';
print $form->showCategories($object->id, 'supplier', 1);
print "</td></tr>";

View File

@ -1126,7 +1126,7 @@ class CommandeFournisseur extends CommonOrder
// insert products details into database
for ($i=0;$i<$num;$i++)
{
$result = $this->addline(
$result = $this->addline( // This include test on qty if option SUPPLIERORDER_WITH_NOPRICEDEFINED is not set
$this->lines[$i]->desc,
$this->lines[$i]->subprice,
$this->lines[$i]->qty,
@ -1306,11 +1306,11 @@ class CommandeFournisseur extends CommonOrder
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null)
{
global $langs,$mysoc, $conf;
global $langs,$mysoc,$conf;
$error = 0;
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2. $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit");
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $fourn_ref, $remise_percent, $price_base_type, $pu_ttc, $type, $fk_unit");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
@ -1350,40 +1350,45 @@ class CommandeFournisseur extends CommonOrder
{
$this->db->begin();
if ($fk_prod_fourn_price > 0)
if ($fk_product > 0)
{
$prod = new Product($this->db, $fk_product);
if ($prod->fetch($fk_product) > 0)
if (empty($conf->global->SUPPLIERORDER_WITH_NOPRICEDEFINED))
{
$result=$prod->get_buyprice($fk_prod_fourn_price,$qty,$fk_product,$fourn_ref);
if ($result > 0)
// Check quantity is enough
dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref);
$prod = new Product($this->db, $fk_product);
if ($prod->fetch($fk_product) > 0)
{
$label = $prod->libelle;
$pu = $prod->fourn_pu;
$ref = $prod->ref_fourn;
$product_type = $prod->type;
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, $fourn_ref); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref
if ($result > 0)
{
$label = $prod->libelle;
$pu = $prod->fourn_pu;
$ref = $prod->ref_fourn;
$product_type = $prod->type;
}
if ($result == 0 || $result == -1)
{
$langs->load("errors");
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
return -1;
}
if ($result < -1)
{
$this->error=$prod->error;
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR);
return -1;
}
}
if ($result == 0 || $result == -1)
{
$langs->load("errors");
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_DEBUG);
return -1;
}
if ($result < -1)
{
else
{
$this->error=$prod->error;
$this->db->rollback();
dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR);
return -1;
}
}
else
{
$this->error=$prod->error;
return -1;
}
}
else
{
@ -1449,7 +1454,6 @@ class CommandeFournisseur extends CommonOrder
$sql.= ", ".$multicurrency_total_ttc;
$sql.= ")";
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
$resql=$this->db->query($sql);
//print $sql;
if ($resql)

View File

@ -216,7 +216,7 @@ class ProductFournisseur extends Product
$this->db->begin();
if ($this->product_fourn_price_id)
if ($this->product_fourn_price_id > 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " SET fk_user = " . $user->id." ,";
@ -237,7 +237,7 @@ class ProductFournisseur extends Product
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
// TODO Add price_base_type and price_ttc
dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG);
dol_syslog(get_class($this).'::update_buyprice update knowing id of line = product_fourn_price_id = '.$this->product_fourn_price_id, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -249,7 +249,7 @@ class ProductFournisseur extends Product
if (empty($error))
{
$this->db->commit();
return 0;
return $this->product_fourn_price_id;
}
else
{
@ -267,94 +267,88 @@ class ProductFournisseur extends Product
else
{
// Delete price for this quantity
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price";
$sql.= " WHERE fk_soc = ".$fourn->id." AND ref_fourn = '".$this->db->escape($ref_fourn)."' AND quantity = ".$qty." AND entity = ".$conf->entity;
dol_syslog(get_class($this).'::update_buyprice', LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
// Add price for this quantity to supplier
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)";
$sql.= " values('".$this->db->idate($now)."',";
$sql.= " ".$this->id.",";
$sql.= " ".$fourn->id.",";
$sql.= " '".$this->db->escape($ref_fourn)."',";
$sql.= " ".$user->id.",";
$sql.= " ".$buyprice.",";
$sql.= " ".$qty.",";
$sql.= " ".$remise_percent.",";
$sql.= " ".$remise.",";
$sql.= " ".$unitBuyPrice.",";
$sql.= " ".$tva_tx.",";
$sql.= " ".$charges.",";
$sql.= " ".$unitCharges.",";
$sql.= " ".$availability.",";
$sql.= " ".$newnpr.",";
$sql.= $conf->entity.",";
$sql.= $delivery_time_days.",";
$sql.= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'");
$sql.=")";
dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG);
if (! $this->db->query($sql))
{
$error++;
}
if (! $error && !empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG))
{
// Add record into log table
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price_log(";
$sql.= "datec, fk_product_fournisseur,fk_user,price,quantity)";
$sql.= "values('".$this->db->idate($now)."',";
$sql.= " ".$this->product_fourn_id.",";
$sql.= " ".$user->id.",";
$sql.= " ".price2num($buyprice).",";
$sql.= " ".$qty;
$sql.=")";
$resql=$this->db->query($sql);
if (! $resql)
{
$error++;
}
}
if (! $error)
{
// Call trigger
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$user);
if ($result < 0) $error++;
dol_syslog(get_class($this) . '::update_buyprice without knowing id of line, so we delete from company, quantity and supplier_ref and insert again', LOG_DEBUG);
// Delete price for this quantity
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "product_fournisseur_price";
$sql .= " WHERE fk_soc = " . $fourn->id . " AND ref_fourn = '" . $this->db->escape($ref_fourn) . "' AND quantity = " . $qty . " AND entity = " . $conf->entity;
$resql = $this->db->query($sql);
if ($resql) {
// Add price for this quantity to supplier
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price(";
$sql .= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days,supplier_reputation)";
$sql .= " values('" . $this->db->idate($now) . "',";
$sql .= " " . $this->id . ",";
$sql .= " " . $fourn->id . ",";
$sql .= " '" . $this->db->escape($ref_fourn) . "',";
$sql .= " " . $user->id . ",";
$sql .= " " . $buyprice . ",";
$sql .= " " . $qty . ",";
$sql .= " " . $remise_percent . ",";
$sql .= " " . $remise . ",";
$sql .= " " . $unitBuyPrice . ",";
$sql .= " " . $tva_tx . ",";
$sql .= " " . $charges . ",";
$sql .= " " . $unitCharges . ",";
$sql .= " " . $availability . ",";
$sql .= " " . $newnpr . ",";
$sql .= $conf->entity . ",";
$sql .= $delivery_time_days . ",";
$sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'");
$sql .= ")";
$idinserted = 0;
$resql = $this->db->query($sql);
if ($resql) {
$idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price");
}
else {
$error++;
}
if (! $error && ! empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
// Add record into log table
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_fournisseur_price_log(";
$sql .= "datec, fk_product_fournisseur,fk_user,price,quantity)";
$sql .= "values('" . $this->db->idate($now) . "',";
$sql .= " " . $this->product_fourn_id . ",";
$sql .= " " . $user->id . ",";
$sql .= " " . price2num($buyprice) . ",";
$sql .= " " . $qty;
$sql .= ")";
$resql = $this->db->query($sql);
if (! $resql) {
$error++;
}
}
if (! $error) {
// Call trigger
$result = $this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE', $user);
if ($result < 0)
$error++;
// End call triggers
if (empty($error))
{
$this->db->commit();
return 0;
}
else
{
$this->db->rollback();
return -1;
}
}
else
{
$this->error=$this->db->error()." sql=".$sql;
$this->db->rollback();
return -2;
}
}
else
{
$this->error=$this->db->error()." sql=".$sql;
$this->db->rollback();
return -1;
}
}
if (empty($error)) {
$this->db->commit();
return $idinserted;
} else {
$this->db->rollback();
return -1;
}
} else {
$this->error = $this->db->lasterror() . " sql=" . $sql;
$this->db->rollback();
return -2;
}
} else {
$this->error = $this->db->lasterror() . " sql=" . $sql;
$this->db->rollback();
return - 1;
}
}
}
/**

View File

@ -381,6 +381,7 @@ if ($id > 0 || ! empty($ref))
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product=p.rowid";
$sql.= " WHERE l.fk_commande = ".$commande->id;
if(empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND l.product_type = 0";
$sql.= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
$sql.= " ORDER BY p.ref, p.label";

View File

@ -1005,7 +1005,7 @@ else
print '<td>'.$langs->trans("User").'</td>';
print '<td>';
print $userRequest->getNomUrl(1);
print $userRequest->getNomUrl(1, 'leave');
print '</td></tr>';
// Type

View File

@ -3,6 +3,7 @@
* Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -117,7 +118,7 @@ class Holiday extends CommonObject
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
global $conf;
$error=0;
$now=dol_now();
@ -137,7 +138,8 @@ class Holiday extends CommonObject
$sql.= "statut,";
$sql.= "fk_validator,";
$sql.= "fk_type,";
$sql.= "fk_user_create";
$sql.= "fk_user_create,";
$sql.= "entity";
$sql.= ") VALUES (";
$sql.= "'".$this->fk_user."',";
$sql.= " '".$this->db->idate($now)."',";
@ -148,7 +150,8 @@ class Holiday extends CommonObject
$sql.= " '1',";
$sql.= " '".$this->fk_validator."',";
$sql.= " '".$this->fk_type."',";
$sql.= " ".$user->id;
$sql.= " ".$user->id.",";
$sql.= " ".$conf->entity;
$sql.= ")";
$this->db->begin();

View File

@ -288,7 +288,7 @@ print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreateCP"),$_SERVER["PHP_SELF"],"cp.date_create","",'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Employe"),$_SERVER["PHP_SELF"],"cp.fk_user","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"cp.fk_user","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ValidatorCP"),$_SERVER["PHP_SELF"],"cp.fk_validator","",'','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],'','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],'','','','align="right"',$sortfield,$sortorder);
@ -405,7 +405,7 @@ if (! empty($holiday->holiday))
print $holidaystatic->getNomUrl(1);
print '</td>';
print '<td style="text-align: center;">'.dol_print_date($date,'day').'</td>';
print '<td>'.$userstatic->getNomUrl('1').'</td>';
print '<td>'.$userstatic->getNomUrl('1', 'leave').'</td>';
print '<td>'.$approbatorstatic->getNomUrl('1').'</td>';
print '<td>';
$label=$alltypeleaves[$infos_CP['fk_type']]['label'];

View File

@ -189,7 +189,7 @@ if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
$userstatic->firstname=$obj->firstname;
print '<tr '.$bc[$var].'>';
print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1).'</td>';
print '<td>'.$userstatic->getNomUrl(1, 'leave').'</td>';
print '<td>'.$typeleaves[$obj->fk_type]['label'].'</td>';
$starthalfday=($obj->halfday == -1 || $obj->halfday == 2)?'afternoon':'morning';

View File

@ -1,6 +1,21 @@
CKEditor 4 Changelog
====================
## CKEditor 4.5.9
Fixed Issues:
* [#10685](http://dev.ckeditor.com/ticket/10685): Fixed: Unreadable toolbar icons after updating to the new editor version. Fixed with [6876179](https://github.com/ckeditor/ckeditor-dev/commit/6876179db4ee97e786b07b8fd72e6b4120732185) in [ckeditor-dev](https://github.com/ckeditor/ckeditor-dev) and [6c9189f4](https://github.com/ckeditor/ckeditor-presets/commit/6c9189f46392d2c126854fe8889b820b8c76d291) in [ckeditor-presets](https://github.com/ckeditor/ckeditor-presets).
* [#14573](https://dev.ckeditor.com/ticket/14573): Fixed: Missing [Widget](http://ckeditor.com/addon/widget) drag handler CSS when there are multiple editor instances.
* [#14620](https://dev.ckeditor.com/ticket/14620): Fixed: Setting both the `min-height` style for the `<body>` element and the `height` style for the `<html>` element breaks the [Auto Grow](http://ckeditor.com/addon/autogrow) plugin.
* [#14538](http://dev.ckeditor.com/ticket/14538): Fixed: Keyboard focus goes into an embedded `<iframe>` element.
* [#14602](http://dev.ckeditor.com/ticket/14602): Fixed: The [`dom.element.removeAttribute()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-removeAttribute) method does not remove all attributes if no parameter is given.
* [#8679](http://dev.ckeditor.com/ticket/8679): Fixed: Better focus indication and ability to style the selected color in the [color picker dialog](http://ckeditor.com/addon/colordialog).
* [#11697](http://dev.ckeditor.com/ticket/11697): Fixed: Content is replaced ignoring the letter case setting in the [Find and Replace](http://ckeditor.com/addon/find) dialog window.
* [#13886](http://dev.ckeditor.com/ticket/13886): Fixed: Invalid handling of the [`CKEDITOR.style`](http://docs.ckeditor.com/#!/api/CKEDITOR.style) instance with the `styles` property by [`CKEDITOR.filter`](http://docs.ckeditor.com/#!/api/CKEDITOR.filter).
* [#14535](http://dev.ckeditor.com/ticket/14535): Fixed: CSS syntax corrections. Thanks to [mdjdenormandie](https://github.com/mdjdenormandie)!
* [#14312](http://dev.ckeditor.com/ticket/14312): [IE] Fixed: Artifact is visible after pasting any text.
## CKEditor 4.5.8
New Features:

Some files were not shown because too many files have changed in this diff Show More