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

This commit is contained in:
altairis 2019-10-23 17:30:38 +02:00
commit d5d3c978d0
1084 changed files with 18726 additions and 11275 deletions

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ htdocs/includes/autoload.php
htdocs/includes/bin/ htdocs/includes/bin/
htdocs/includes/composer/ htdocs/includes/composer/
/.pydevproject /.pydevproject
/dolibarr_genesis.mp4

View File

@ -17,7 +17,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
EvalMath 1.0 BSD Yes Safe math expressions evaluation EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package) GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.83 MIT License Yes Detect mobile devices browsers Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser ParseDown 1.6 MIT License Yes Markdown parser
@ -33,7 +33,7 @@ Restler 3.0.0RC6 LGPL-3+ Yes
Sabre 3.2.2 BSD Yes DAV support Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.41 MIT licence Yes Library for Stripe module Stripe 6.41 MIT licence Yes Library for Stripe module
TCPDF 6.2.25 LGPL-3+ Yes PDF generation TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries: JS libraries:

View File

@ -23,10 +23,82 @@ Following changes may create regressions for some external modules, but were nec
* If you have developed your own emailing target selector and used parent::add_to_target(...), you must now use parent::addToTargets(...) * If you have developed your own emailing target selector and used parent::add_to_target(...), you must now use parent::addToTargets(...)
* Removed function dol_micro_time. Use native PHP microtime instead. * Removed function dol_micro_time. Use native PHP microtime instead.
* The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE. * The trigger BON_PRELEVEMENT_CREATE has been renamed into DIRECT_DEBIT_ORDER_CREATE.
* The constant INVOICE_SHOW_POS_IN_EXPORT has been renamed into INVOICE_SHOW_POS.
* If your logo was visible on the menu bar, you must upload a new logo into 'Home-Setup-Company/Organization' to have it visible agin in menu.
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
The unit were not saved correctly in database making calculation on shipments wrong.
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to one of this version.
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
FIX: #11702
FIX: #11861 No consistent code to manage measuring units
FIX: #11942
FIX: #12026
FIX: #12040
FIX: #12041
FIX: #12054
FIX: #12083
FIX: #12088
FIX: CVE-2019-17578 CVE-2019-17577 CVE-2019-17576
FIX: Clean the + of categories on the product view only in POS module
FIX: access to public interface when origin email has an alias.
FIX: Alias name is not into the email recipient label.
FIX: allow standalone credit note even if no invoice
FIX: an admin can not access his own permissions after enabling advanced
FIX: an admin can not access his own permissions after enabling advanced permissions
FIX: Attachement of linked files on ticket when sending a message
FIX: avoid non numeric warning
FIX: Bad currency var used in stripe for connect
FIX: Bad list of ticket on public interface for ticket emailcollector
FIX: Can't modify vendor invoice if transfered into accountancy
FIX: change product type must be allowed if we activate hidden conf
FIX: colspan on VAT quadri report
FIX: CSS
FIX: Debug feature orderstoinvoice for suppliers
FIX: do not output return code on screen after a select of bank account
FIX: Edit of ticket module parameters erased others
FIX: empty cache when we want to load specific warehouses in select
FIX: escape email alias
FIX: expedition.class.php
FIX: Export of leave request show the number of open days
FIX: Filtering the HTTP Header "Accept-Language".
FIX: Filter on project on ticket list
FIX: Filter "Open all" of ticket was ko.
FIX: Force downlaod of file with .noexe as octet-stream mime type
FIX: form not closed.
FIX: hidden conf to prevent from changing product_type
FIX: If product account not suggested during bind, it is not preselected
FIX: If we share invoice, we need to see discount created from a deposit on each entity
FIX: Import of product using units
FIX: label of thirdparty is wrong on open project list
FIX: Look and feel v10
FIX: missing begin()
FIX: missing "$this->id" in "fetch" function
FIX: navigation on ticket tab of projects
FIX: new invoice with generic thirdparty in takepos
FIX: Pb in units of shipments
FIX: regression with option to hide picto on top menu
FIX: selection of project i am contact of.
FIX: Send email from expense report card.
FIX: shipping card: missing user error messages when classifying closed or billed
FIX: SQL injection on qty
FIX: stripe payment when there is a quote into address
FIX: Substitution of __PROJECT_XXX__ not done
FIX: TakePOS no invoice validation control and good payment translate
FIX: the access of the bank account of one user
FIX: top menu right padding
FIX: Update of leave request when CSRF with token is on
FIX: Var not enough sanitized
FIX: wrong test
FIX: XSS
FIX: Payment from POS ware not recorded.
FIX: Can validate invoice with amount including tax of zero for the case of having a final invoice with
VAT that includes a deposit without vat.
***** ChangeLog for 10.0.2 compared to 10.0.1 ***** ***** ChangeLog for 10.0.2 compared to 10.0.1 *****
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4
FIX: #11401 Adherent unknown language key FIX: #11401 Adherent unknown language key
FIX: #11422 Can't edit his own events with standard rights FIX: #11422 Can't edit his own events with standard rights

10
build/gource/README.md Normal file
View File

@ -0,0 +1,10 @@
# Command to run gource on Dolibarr git project.
cd ~/git/dolibarr
gource -a 0.5 -c 4 -i 0 --max-files 0 --dir-name-depth 2 --max-file-lag 0.1 --max-user-speed 150 --user-friction 1 --user-scale 3 --file-filter svgs --file-filter _source --file-filter tests --file-show-filter htdocs --date-format "%d %b %Y" -logo doc/images/appicon_64.png --highlight-users --highlight-colour FFFF88 -s 0.5 -1280x720 -r 25 -title 'Dolibarr ERP CRM Genesis' --stop-at-end --filename-time 2 --user-image-dir build/gource/avatars --hide filenames
# To build a mp4 video
# Change -crf 1 to -crf 50 for max compression (best is 5)
cd ~/git/dolibarr
gource -a 0.5 -c 4 -i 0 --max-files 0 --dir-name-depth 2 --max-file-lag 0.1 --max-user-speed 150 --user-friction 1 --user-scale 3 --file-filter svgs --file-filter _source --file-filter tests --file-show-filter htdocs --date-format "%d %b %Y" -logo doc/images/appicon_64.png --highlight-users --highlight-colour FFFF88 -s 0.4 -1280x720 -r 25 -title 'Dolibarr ERP CRM Genesis' --stop-at-end --filename-time 2 --user-image-dir build/gource/avatars --hide filenames -o - | ffmpeg -y -r 25 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset slow -pix_fmt yuv420p -crf 5 -threads 0 -bf 0 dolibarr_genesis.mp4

1
build/gource/avatars/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/*.png

View File

@ -0,0 +1 @@
Directory that will be filled with avatars images of developers for gource

49
build/gource/getavatars.pl Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/perl
#fetch Gravatars
use strict;
use warnings;
use LWP::Simple;
use Digest::MD5 qw(md5_hex);
my $size = 90;
my $output_dir = './avatars';
die("no .git/ directory found in current path\n") unless -d './avatars';
mkdir($output_dir) unless -d $output_dir;
open(GITLOG, q/git log --pretty=format:"%ae|%an" |/) or die("failed to read git-log: $!\n");
my %processed_authors;
while(<GITLOG>) {
chomp;
my($email, $author) = split(/\|/, $_);
next if $processed_authors{$author}++;
my $author_image_file = $output_dir . '/' . $author . '.png';
#skip images we have
next if -e $author_image_file;
#try and fetch image
my $grav_url = "http://www.gravatar.com/avatar/".md5_hex(lc $email)."?d=404&size=".$size;
warn "fetching image for '$author' $email ($grav_url)...\n";
my $rc = getstore($grav_url, $author_image_file);
sleep(1);
if($rc != 200) {
unlink($author_image_file);
next;
}
}
close GITLOG;

View File

@ -26,15 +26,13 @@
"require" : { "require" : {
"php" : ">=5.3.0", "php" : ">=5.3.0",
"ext-curl" : "*", "ext-curl" : "*",
"ccampbell/chromephp" : "4.1.0", "ckeditor/ckeditor" : "4.12.1",
"ckeditor/ckeditor" : "4.6.2",
"mike42/escpos-php" : "1.2.1", "mike42/escpos-php" : "1.2.1",
"mobiledetect/mobiledetectlib" : "2.8.17", "mobiledetect/mobiledetectlib" : "2.8.33",
"phpoffice/phpexcel" : "1.8.1", "phpoffice/phpexcel" : "1.8.1",
"restler/framework" : "3.0.0-RC6", "restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "^6.2", "tecnickcom/tcpdf" : "^6.2",
"atgp/factur-x" : "^1.0", "luracast/restler" : "^3.0"
"luracast/restler": "^3.0"
}, },
"require-dev" : { "require-dev" : {
"jakub-onderka/php-parallel-lint" : "^0", "jakub-onderka/php-parallel-lint" : "^0",

665
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -67,7 +67,7 @@ define('QR_FIND_FROM_RANDOM', false);
zapfdingbats.php (for special chars like form checkboxes) zapfdingbats.php (for special chars like form checkboxes)
* Optionnaly, made freemono the default monotype font if we removed courier * Optionnaly, made freemono the default monotype font if we removed courier
In htdocs/includes/tcpdf/tcpdf.php In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier'; - protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono'; + protected $default_monospaced_font = 'freemono';
@ -137,20 +137,7 @@ with:
RESTLER: RESTLER:
-------- --------
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
* Add 2 lines into file AutoLoader.php to complete 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;
...
Change also content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
+With swagger 2: +With swagger 2:

View File

@ -116,7 +116,6 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)]; $contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
if ( $contact->create($user) ) if ( $contact->create($user) )
{ {
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -2,10 +2,14 @@
namespace Dolibarr; namespace Dolibarr;
global $globalaaa; global $globalaaa;
$globalaaa = 'globalaaa'; $globalaaa = 'globalaaa';
/**
* faaa
*
* @return string
*/
function faaa() function faaa()
{ {
return 'faaa'; return 'faaa';
@ -15,6 +19,10 @@ class Aaa
{ {
const AAA='aaa'; const AAA='aaa';
/**
* do
* @return void
*/
public function do() public function do()
{ {
echo 'doaaa'."\n"; echo 'doaaa'."\n";

View File

@ -1,11 +1,12 @@
<?php <?php
global $globalbbb; global $globalbbb;
$globalbbb = 'globalbbb'; $globalbbb = 'globalbbb';
/**
* fbbb
* @return string
*/
function fbbb() function fbbb()
{ {
return 'fbbb'; return 'fbbb';
@ -14,6 +15,11 @@ function fbbb()
class Bbb class Bbb
{ {
const BBB='bbb'; const BBB='bbb';
/**
* do
* @return void
*/
public function do() public function do()
{ {
global $globalaaa, $globalbbb; global $globalaaa, $globalbbb;

View File

@ -201,7 +201,7 @@
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. --> <!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"> <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties> <properties>
<property name="ignoreBlankLines" value="true"/> <property name="ignoreBlankLines" value="false"/>
</properties> </properties>
</rule> </rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile"> <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile">
@ -213,6 +213,8 @@
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"> <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />

View File

@ -311,7 +311,7 @@ foreach my $file (keys %filelist) {
# Quote column names # Quote column names
s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i); s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
# Remap colums with names of existing system attribute # Remap columns with names of existing system attribute
if (/"oid"/i) { if (/"oid"/i) {
s/"oid"/"_oid"/g; s/"oid"/"_oid"/g;
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue."; print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";

View File

@ -17,14 +17,14 @@ fi
# To detec # To detec
if [ "x$1" = "xlist" ] if [ "x$1" = "xlist" ]
then then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep CRLF find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'htdocs\/includes' | grep CRLF # find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep -v 'htdocs\/includes' | grep CRLF
fi fi
# To convert # To convert
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep CRLF | awk -F':' '{ print $1 }' ` for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF | awk -F':' '{ print $1 }' `
do do
echo "Fix file $fic" echo "Fix file $fic"
dos2unix "$fic" dos2unix "$fic"

View File

@ -36,6 +36,7 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$massaction = GETPOST('massaction', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'accountingaccountlist'; // To manage different context of search $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'accountingaccountlist'; // To manage different context of search
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
@ -100,7 +101,7 @@ if (empty($reshook))
$search_array_options=array(); $search_array_options=array();
} }
if (GETPOST('change_chart', 'alpha')) if (GETPOST('change_chart', 'alpha') && (GETPOST('valid_change_chart', 'int') || empty($conf->use_javascript_ajax)))
{ {
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
@ -236,6 +237,24 @@ if ($resql)
if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype); if ($search_pcgsubtype) $param.= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
if (! empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to update a flag when we select "Change plan" -->
<script type="text/javascript">
$(document).ready(function () {
$("#searchFormList").on("submit", function (e) {
console.log("chartofaccounts focus = "+$("#chartofaccounts").is(":focus"));
console.log("change_chart focus = "+$("#change_chart").is(":focus"));
if ($("#change_chart").is(":focus"))
{
console.log("We set valid_change_chart to 1");
$("#valid_change_chart").val(1);
}
return true;
});
});
</script>';
}
print '<form method="POST" 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.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -278,7 +297,8 @@ if ($resql)
else dol_print_error($db); else dol_print_error($db);
print "</select>"; print "</select>";
print ajax_combobox("chartofaccounts"); print ajax_combobox("chartofaccounts");
print '<input type="submit" class="button" name="change_chart" tabindex="-1" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="submit" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<input type="hidden" name="valid_change_chart" id="valid_change_chart" value="0">';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
@ -286,6 +306,9 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = '';
$massactionbutton = '';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";

View File

@ -677,7 +677,6 @@ if ($id)
{ {
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; $showfield=1;
$class="left"; $class="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};

View File

@ -273,7 +273,6 @@ if ($action == 'create') {
print '</form>'; print '</form>';
} }
elseif ($id > 0 || $ref) { elseif ($id > 0 || $ref) {
$result = $object->fetch($id, $ref, 1); $result = $object->fetch($id, $ref, 1);
if ($result > 0) { if ($result > 0) {

View File

@ -130,7 +130,6 @@ if (! empty($cat_id))
} }
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%"); print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
print '<br>'; print '<br>';
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>'; /*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
@ -153,7 +152,6 @@ print '</form>';
if ($action == 'display' || $action == 'delete') { if ($action == 'display' || $action == 'delete') {
print "<table class='noborder' width='100%'>\n"; print "<table class='noborder' width='100%'>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>"; print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";

View File

@ -170,7 +170,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
} }
if (isset($_POST["code"])) if (isset($_POST["code"]))
{ {
if ($_POST["code"]=='0') if ($_POST["code"]=='0')
{ {
$ok=0; $ok=0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors'); setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
@ -468,7 +468,7 @@ if ($id)
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left"; $class="left";
if ($fieldlist[$field]=='type') { if ($fieldlist[$field]=='type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") { if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else { } else {
$valuetoshow=$langs->trans("Type"); $valuetoshow=$langs->trans("Type");
@ -501,7 +501,7 @@ if ($id)
if ($fieldlist[$field]=='range_account') { if ($fieldlist[$field]=='range_account') {
$valuetoshow=$langs->trans("Comment"); $valuetoshow=$langs->trans("Comment");
} }
if ($fieldlist[$field]=='category_type') { if ($fieldlist[$field]=='category_type') {
$valuetoshow=$langs->trans("Calculated"); $valuetoshow=$langs->trans("Calculated");
} }
@ -742,7 +742,6 @@ if ($id)
{ {
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; $showfield=1;
$class="left"; $class="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};

View File

@ -99,7 +99,6 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
foreach ($list_account_main as $key) { foreach ($list_account_main as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);

View File

@ -83,7 +83,6 @@ if (GETPOST('change_chart', 'alpha'))
$chartofaccounts = GETPOST('chartofaccounts', 'int'); $chartofaccounts = GETPOST('chartofaccounts', 'int');
if (! empty($chartofaccounts)) { if (! empty($chartofaccounts)) {
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
$error ++; $error ++;
} }
@ -144,7 +143,6 @@ print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
foreach ($list_account_main as $key) { foreach ($list_account_main as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
@ -172,7 +170,6 @@ print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
foreach ($list_account as $key) { foreach ($list_account as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);

View File

@ -114,7 +114,7 @@ if ($action == 'update') {
$error ++; $error ++;
} }
} }
} }
if (! $error) { if (! $error) {
// reload // reload
@ -203,7 +203,6 @@ print "</tr>\n";
$num = count($main_option); $num = count($main_option);
if ($num) { if ($num) {
foreach ($main_option as $key) { foreach ($main_option as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param

View File

@ -45,7 +45,7 @@ $langs->loadLangs(array("admin","compta"));
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we should be able to see fiscal year. if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year.
accessforbidden(); accessforbidden();
$error = 0; $error = 0;
@ -112,7 +112,7 @@ if ($result)
$i = 0; $i = 0;
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear); $addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
$title = $langs->trans('AccountingPeriods'); $title = $langs->trans('AccountingPeriods');

View File

@ -33,7 +33,7 @@ $langs->loadLangs(array("admin","compta"));
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (empty($user->rights->accounting->fiscalyear)) if (empty($user->rights->accounting->fiscalyear->write))
accessforbidden(); accessforbidden();
$error = 0; $error = 0;
@ -300,7 +300,7 @@ if ($action == 'create')
dol_fiche_end(); dol_fiche_end();
if (! empty($user->rights->accounting->fiscalyear)) if (! empty($user->rights->accounting->fiscalyear->write))
{ {
/* /*
* Barre d'actions * Barre d'actions

View File

@ -32,7 +32,7 @@ $langs->loadLangs(array("admin","compta"));
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->fiscalyear) if (! $user->rights->accounting->fiscalyear->write)
accessforbidden(); accessforbidden();
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');

View File

@ -82,18 +82,17 @@ if ($action == 'update') {
} }
} }
// TO DO Mutualize code for yes/no constants
if ($action == 'setlistsorttodo') { if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int'); $setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setlistsortdone') { if ($action == 'setlistsortdone') {
@ -101,11 +100,11 @@ if ($action == 'setlistsortdone') {
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setmanagezero') { if ($action == 'setmanagezero') {
@ -113,11 +112,11 @@ if ($action == 'setmanagezero') {
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setdisabledirectinput') { if ($action == 'setdisabledirectinput') {
@ -125,11 +124,11 @@ if ($action == 'setdisabledirectinput') {
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setenabledraftexport') { if ($action == 'setenabledraftexport') {
@ -137,11 +136,11 @@ if ($action == 'setenabledraftexport') {
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setenablesubsidiarylist') { if ($action == 'setenablesubsidiarylist') {
@ -212,7 +211,7 @@ if (! empty($user->admin))
{ {
// TO DO Mutualize code for yes/no constants // TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>'; print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . '</td>';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsorttodo&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsorttodo&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
@ -224,7 +223,7 @@ if (! empty($user->admin))
} }
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>'; print '<td>' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . '</td>';
if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsortdone&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setlistsortdone&value=0">';
@ -237,7 +236,7 @@ if (! empty($user->admin))
} }
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL") . '</td>'; print '<td>' . $langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL") . '</td>';
if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenabledraftexport&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenabledraftexport&value=0">';
@ -250,7 +249,7 @@ if (! empty($user->admin))
} }
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr>';
print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>'; print '<td>' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . '</td>';
if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setdisabledirectinput&value=0">';
@ -263,7 +262,7 @@ if (! empty($user->admin))
} }
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr>';
print '<td>' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . '</td>'; print '<td>' . $langs->trans("ACCOUNTANCY_COMBO_FOR_AUX") . '</td>';
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenablesubsidiarylist&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setenablesubsidiarylist&value=0">';
@ -276,7 +275,7 @@ if (! empty($user->admin))
} }
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; print '<tr>';
print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>'; print '<td>' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . '</td>';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setmanagezero&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?action=setmanagezero&value=0">';

View File

@ -609,7 +609,6 @@ if ($id)
$langs->load("accountancy"); $langs->load("accountancy");
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
$showfield=1; $showfield=1;
$class="left"; $class="left";
$valuetoshow=$obj->{$fieldlist[$field]}; $valuetoshow=$obj->{$fieldlist[$field]};

View File

@ -117,7 +117,6 @@ if ($action == 'update') {
); );
if (in_array($accounting_product_mode, $accounting_product_modes)) { if (in_array($accounting_product_mode, $accounting_product_modes)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
$error ++; $error ++;
} }
@ -129,7 +128,6 @@ if ($action == 'update') {
if (! empty($btn_changeaccount)) { if (! empty($btn_changeaccount)) {
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>'; //$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
if (! empty($chk_prod)) { if (! empty($chk_prod)) {
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>'; //$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';

View File

@ -265,7 +265,7 @@ if ($action != 'export_csv')
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte); $root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($description)) { if (empty($description)) {
$link = '<a href="../admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; $link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -279,8 +279,8 @@ if ($action != 'export_csv')
print '</tr>'; print '</tr>';
} }
// Affiche le compte comptable en debut de ligne // Show first line of a break
print "<tr>"; print '<tr class="trforbreak">';
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>'; print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
print '</tr>'; print '</tr>';

View File

@ -105,7 +105,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>'; print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>';

View File

@ -83,7 +83,6 @@ $object = new BookKeeping($db);
*/ */
if ($action == "confirm_update") { if ($action == "confirm_update") {
$error = 0; $error = 0;
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) { if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
@ -439,7 +438,7 @@ if ($action == 'create')
print $langs->trans('Docdate'); print $langs->trans('Docdate');
print '</td>'; print '</td>';
if ($action != 'editdate') if ($action != 'editdate')
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;piece_num='. $object->piece_num .'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate&amp;piece_num='. $object->piece_num .'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="3">'; print '</td><td colspan="3">';
if ($action == 'editdate') { if ($action == 'editdate') {
@ -463,7 +462,7 @@ if ($action == 'create')
print $langs->trans('Codejournal'); print $langs->trans('Codejournal');
print '</td>'; print '</td>';
if ($action != 'editjournal') if ($action != 'editjournal')
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editjournal&amp;piece_num='.$object->piece_num.'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&amp;piece_num='.$object->piece_num.'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editjournal') { if ($action == 'editjournal') {
@ -487,7 +486,7 @@ if ($action == 'create')
print $langs->trans('Piece'); print $langs->trans('Piece');
print '</td>'; print '</td>';
if ($action != 'editdocref') if ($action != 'editdocref')
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdocref&amp;piece_num='.$object->piece_num.'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&amp;piece_num='.$object->piece_num.'&amp;mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editdocref') { if ($action == 'editdocref') {
@ -585,7 +584,6 @@ if ($action == 'create')
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
print load_fiche_titre($langs->trans("ListeMvts"), '', ''); print load_fiche_titre($langs->trans("ListeMvts"), '', '');
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
@ -601,7 +599,6 @@ if ($action == 'create')
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
if (count($object->linesmvt) > 0) { if (count($object->linesmvt) > 0) {
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;

View File

@ -155,6 +155,12 @@ $arrayfields=array(
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
$listofformat=AccountancyExport::getType();
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
if (empty($listofformat[$formatexportset])) $formatexportset = 1;
$error = 0;
/* /*
* Actions * Actions
@ -310,7 +316,6 @@ if (empty($reshook))
} }
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
$import_key = GETPOST('importkey', 'alpha'); $import_key = GETPOST('importkey', 'alpha');
if (! empty($import_key)) { if (! empty($import_key)) {
@ -325,7 +330,6 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
} }
} }
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
$delyear = GETPOST('delyear', 'int'); $delyear = GETPOST('delyear', 'int');
if ($delyear==-1) { if ($delyear==-1) {
$delyear=0; $delyear=0;
@ -356,7 +360,6 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
} }
} }
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
$mvt_num = GETPOST('mvt_num', 'int'); $mvt_num = GETPOST('mvt_num', 'int');
if (! empty($mvt_num)) { if (! empty($mvt_num)) {
@ -373,10 +376,96 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
exit; exit;
} }
} }
if ($action == 'setreexport') {
$setreexport = GETPOST('value', 'int');
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
if (! $error) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
}
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Build and execute select (used by page and export action)
// must de set after the action that set $filter
// --------------------------------------------------------------------
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.doc_date,";
$sql .= " t.doc_type,";
$sql .= " t.doc_ref,";
$sql .= " t.fk_doc,";
$sql .= " t.fk_docdet,";
$sql .= " t.thirdparty_code,";
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
$sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.montant,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
$sql .= " t.import_key,";
$sql .= " t.code_journal,";
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification,";
$sql .= " t.date_export";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $object->table_element . ' as t';
// Manage filter
$sqlwhere = array ();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
if ($key == 't.doc_date') {
$sqlwhere[] = $key . '=\'' . $db->idate($value) . '\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key . '\'' . $db->escape($value) . '\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key . '=' . $value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key . ' LIKE \'' . $db->escape($value) . '%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
} elseif ($key == 't.credit' || $key == 't.debit') {
$sqlwhere[] = natural_search($key, $value, 1, 1);
} else {
$sqlwhere[] = natural_search($key, $value, 0, 1);
}
}
}
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
if ($conf->global->ACCOUNTING_REEXPORT == 0) {
$sql .= " AND t.date_export IS NULL";
}
if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' AND ', $sqlwhere);
}
if (! empty($sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
//print $sql;
// Export into a file with format defined into setup (FEC, CSV, ...) // Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql
if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
// TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
if ($result < 0) if ($result < 0)
@ -387,55 +476,54 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
{ {
// Export files // Export files
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines); $accountancyexport->export($object->lines, $formatexportset);
if (! empty($accountancyexport->errors)) if (! empty($accountancyexport->errors))
{ {
setEventMessages('', $accountancyexport->errors, 'errors'); setEventMessages('', $accountancyexport->errors, 'errors');
} else { }
else
{
// Specify as export : update field date_export // Specify as export : update field date_export
// TODO Move in class bookKeeping
$error=0; $error=0;
$db->begin(); $db->begin();
if (is_array($object->lines)) { if (is_array($object->lines))
foreach ($object->lines as $movement) { {
foreach ($object->lines as $movement)
{
$now = dol_now(); $now = dol_now();
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " SET date_export = '" . $db->idate($now) . "'"; $sql .= " SET date_export = '" . $db->idate($now) . "'";
$sql .= " WHERE rowid = " . $movement->id; $sql .= " WHERE rowid = " . $movement->id;
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG); dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if (! $result)
$db->commit(); {
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); $error++;
} else { break;
$db->rollback();
// setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
} }
} }
} }
if (! $error)
{
$db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
}
else
{
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
}
} }
exit; exit;
} }
} }
if ($action == 'setreexport') {
$export = 0;
$setreexport = GETPOST('value', 'int');
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
if (! $error) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
}
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/* /*
* View * View
@ -443,31 +531,49 @@ if ($action == 'setreexport') {
$title_page = $langs->trans("Bookkeeping"); $title_page = $langs->trans("Bookkeeping");
llxHeader('', $title_page); // Count total nb of records
// List
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); {
if ($nbtotalofrecords < 0) { $resql = $db->query($sql);
setEventMessages($object->error, $object->errors, 'errors'); $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
{
$page = 0;
$offset = 0;
} }
} }
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
{
$num = $nbtotalofrecords;
}
else
{
$sql.= $db->plimit($limit+1, $offset);
// TODO Do not use this $resql=$db->query($sql);
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); if (! $resql)
if ($result < 0) { {
setEventMessages($object->error, $object->errors, 'errors'); dol_print_error($db);
exit;
}
$num = $db->num_rows($resql);
} }
$num=count($object->lines);
// Output page
// --------------------------------------------------------------------
llxHeader('', $title_page);
if ($action == 'delmouv') { if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
print $formconfirm; print $formconfirm;
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question = array (); $form_question = array ();
$delyear = GETPOST('delyear'); $delyear = GETPOST('delyear');
$deljournal = GETPOST('deljournal'); $deljournal = GETPOST('deljournal');
@ -502,35 +608,32 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; 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">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$button .= '<a class="butAction" title="" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
$listofformat=AccountancyExport::getType();
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
else $buttonLabel = $langs->trans("ExportList"); else $buttonLabel = $langs->trans("ExportList");
// Button re-export // Button re-export
if (! empty($conf->global->ACCOUNTING_REEXPORT)) { if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> '; $newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=0'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Activated"), 'switch_on').'</a> ';
} else { } else {
$newcardbutton ='<a href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> '; $newcardbutton ='<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&value=1'.($param?'&'.$param:'').'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a> ';
} }
$newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>'; $newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export); $newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -542,7 +645,7 @@ if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint;
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste" width="100%">'; print '<table class="tagtable liste centpercent">';
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
@ -650,7 +753,6 @@ if (! empty($arrayfields['t.code_journal']['checked']))
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>'; print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
} }
// Fields from hook // Fields from hook
$parameters=array('arrayfields'=>$arrayfields); $parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
@ -727,171 +829,200 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
print "</tr>\n"; print "</tr>\n";
if ($num > 0) $line = new BookKeepingLine();
// Loop on record
// --------------------------------------------------------------------
$i=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
if (empty($obj)) break; // Should not happen
$line->id = $obj->rowid;
$line->doc_date = $db->jdate($obj->doc_date);
$line->doc_type = $obj->doc_type;
$line->doc_ref = $obj->doc_ref;
$line->fk_doc = $obj->fk_doc;
$line->fk_docdet = $obj->fk_docdet;
$line->thirdparty_code = $obj->thirdparty_code;
$line->subledger_account = $obj->subledger_account;
$line->subledger_label = $obj->subledger_label;
$line->numero_compte = $obj->numero_compte;
$line->label_compte = $obj->label_compte;
$line->label_operation = $obj->label_operation;
$line->debit = $obj->debit;
$line->credit = $obj->credit;
$line->montant = $obj->montant;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $db->jdate($obj->date_creation);
$line->date_modification = $db->jdate($obj->date_modification);
$line->date_export = $db->jdate($obj->date_export);
$total_debit += $line->debit;
$total_credit += $line->credit;
print '<tr class="oddeven">';
// Piece number
if (! empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Document date
if (! empty($arrayfields['t.doc_date']['checked']))
{
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Document ref
if (! empty($arrayfields['t.doc_ref']['checked']))
{
print '<td class="nowrap">' . $line->doc_ref . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Account number
if (! empty($arrayfields['t.numero_compte']['checked']))
{
print '<td>' . length_accountg($line->numero_compte) . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Subledger account
if (! empty($arrayfields['t.subledger_account']['checked']))
{
print '<td>' . length_accounta($line->subledger_account) . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Label operation
if (! empty($arrayfields['t.label_operation']['checked']))
{
print '<td>' . $line->label_operation . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount debit
if (! empty($arrayfields['t.debit']['checked']))
{
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
$totalarray['totaldebit'] += $line->debit;
}
// Amount credit
if (! empty($arrayfields['t.credit']['checked']))
{
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
$totalarray['totalcredit'] += $line->credit;
}
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="center">' . $line->lettering_code . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Journal code
if (! empty($arrayfields['t.code_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Creation operation date
if (! empty($arrayfields['t.date_creation']['checked']))
{
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Modification operation date
if (! empty($arrayfields['t.tms']['checked']))
{
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Exported operation date
if (! empty($arrayfields['t.date_export']['checked']))
{
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td class="nowraponall center">';
if (empty($line->date_export)) {
if ($user->rights->accounting->mouvements->creer) {
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
}
if ($user->rights->accounting->mouvements->supprimer) {
print '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
// Show total line
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
{ {
$i=0; $i=0;
$totalarray=array(); print '<tr class="liste_total">';
while ($i < min($num, $limit)) while ($i < $totalarray['nbfield'])
{ {
$line = $object->lines[$i];
$total_debit += $line->debit;
$total_credit += $line->credit;
print '<tr class="oddeven">';
// Piece number
if (! empty($arrayfields['t.piece_num']['checked']))
{
print '<td>';
$object->id = $line->id;
$object->piece_num = $line->piece_num;
print $object->getNomUrl(1, '', 0, '', 1);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Document date
if (! empty($arrayfields['t.doc_date']['checked']))
{
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Document ref
if (! empty($arrayfields['t.doc_ref']['checked']))
{
print '<td class="nowrap">' . $line->doc_ref . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Account number
if (! empty($arrayfields['t.numero_compte']['checked']))
{
print '<td>' . length_accountg($line->numero_compte) . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Subledger account
if (! empty($arrayfields['t.subledger_account']['checked']))
{
print '<td>' . length_accounta($line->subledger_account) . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Label operation
if (! empty($arrayfields['t.label_operation']['checked']))
{
print '<td>' . $line->label_operation . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Amount debit
if (! empty($arrayfields['t.debit']['checked']))
{
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
$totalarray['totaldebit'] += $line->debit;
}
// Amount credit
if (! empty($arrayfields['t.credit']['checked']))
{
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
$totalarray['totalcredit'] += $line->credit;
}
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="center">' . $line->lettering_code . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Journal code
if (! empty($arrayfields['t.code_journal']['checked']))
{
$accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td class="center">' . $journaltoshow . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Creation operation date
if (! empty($arrayfields['t.date_creation']['checked']))
{
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Modification operation date
if (! empty($arrayfields['t.tms']['checked']))
{
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Exported operation date
if (! empty($arrayfields['t.date_export']['checked']))
{
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td class="nowraponall center">';
if (empty($line->date_export)) {
if ($user->rights->accounting->mouvements->creer) {
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
}
if ($user->rights->accounting->mouvements->supprimer) {
print '&nbsp;<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
}
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++; $i++;
} if ($i == 1)
// Show total line
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
{
$i=0;
print '<tr class="liste_total">';
while ($i < $totalarray['nbfield'])
{ {
$i++; if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
if ($i == 1) else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
{
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
else print '<td></td>';
} }
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
print $hookmanager->resPrint; else print '<td></td>';
print '</tr>';
} }
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>';
} }
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -37,9 +37,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("accountancy")); $langs->loadLangs(array("accountancy"));
$page = GETPOST("page");
$sortorder = GETPOST("sortorder");
$sortfield = GETPOST("sortfield");
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
@ -71,9 +68,9 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if ($sortorder == "") $sortorder = "ASC"; if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.rowid"; if ($sortfield == "") $sortfield = "t.doc_date,t.rowid";
if (empty($search_date_start) && empty($search_date_end)) { if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql.= $db->plimit(1); $sql.= $db->plimit(1);
@ -182,7 +179,6 @@ if (! empty($search_credit)) {
if ($action == 'delmouvconfirm') { if ($action == 'delmouvconfirm') {
$mvt_num = GETPOST('mvt_num', 'int'); $mvt_num = GETPOST('mvt_num', 'int');
if (! empty($mvt_num)) { if (! empty($mvt_num)) {
@ -232,7 +228,6 @@ if ($action == 'delmouv') {
print $formconfirm; print $formconfirm;
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question = array (); $form_question = array ();
$delyear = GETPOST('delyear'); $delyear = GETPOST('delyear');
@ -255,6 +250,14 @@ if ($action == 'delbookkeepingyear') {
print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton.= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); $newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create');
@ -265,12 +268,11 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($lim
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit);
// Reverse sort order // Reverse sort order
if ( preg_match('/^asc/i', $sortorder) ) if (preg_match('/^asc/i', $sortorder)) $sortorder = "asc";
$sortorder = "asc"; else $sortorder = "desc";
else
$sortorder = "desc";
print '<table class="noborder" width="100%">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -300,6 +302,7 @@ print '<td class="liste_titre right" colspan="2">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
@ -313,8 +316,6 @@ print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
print "</tr>\n"; print "</tr>\n";
print '</tr>';
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
@ -335,7 +336,6 @@ while ($i < min($num, $limit))
// Is it a break ? // Is it a break ?
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) { if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
// Affiche un Sous-Total par compte comptable // Affiche un Sous-Total par compte comptable
if (isset($displayed_account_number)) { if (isset($displayed_account_number)) {
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
@ -376,8 +376,8 @@ while ($i < min($num, $limit))
print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>'; print strlen(length_accounta($line->subledger_account)) == 0 ? '<td>' . $line->label_operation . '</td>' : '<td>' . $line->label_operation . '<br><span style="font-size:0.8em">(' . length_accounta($line->subledger_account) . ')</span></td>';
print '<td class="right">' . ($line->debit ? price($line->debit) :''). '</td>'; print '<td class="nowrap right">' . ($line->debit ? price($line->debit) :''). '</td>';
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>'; print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal); $result = $accountingjournal->fetch('', $line->code_journal);
@ -397,27 +397,32 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
// Affiche un Sous-Total du dernier compte comptable affiché // Show sub-total of last shown account
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>'; print '<td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
print "<td>&nbsp;</td>\n"; print '<td class="nowraponall center">';
print "<td>&nbsp;</td>\n"; print price($sous_total_debit - $sous_total_credit);
print '</td>';
print '<td></td>';
print '</tr>'; print '</tr>';
// Affiche le Total // Show total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="right" colspan="5">'.$langs->trans("Total").':</td>'; print '<td class="right" colspan="5">'.$langs->trans("Total").':</td>';
print '<td class="right">'; print '<td class="nowraponall right">';
print price($total_debit); print price($total_debit);
print '</td>'; print '</td>';
print '<td class="right">'; print '<td class="nowraponall right">';
print price($total_credit); print price($total_credit);
print '</td>'; print '</td>';
print '<td colspan="2"></td>'; print '<td></td>';
print '<td></td>';
print '</tr>'; print '</tr>';
print "</table>"; print "</table>";
print '</div>';
print '</form>'; print '</form>';
// End of page // End of page

View File

@ -100,7 +100,6 @@ if ($result < 0)
*/ */
if ($action == 'lettering') { if ($action == 'lettering') {
$result = $lettering->updateLettering($toselect); $result = $lettering->updateLettering($toselect);
if ($result < 0) { if ($result < 0) {
@ -251,7 +250,6 @@ if ($resql) {
$tmp = ''; $tmp = '';
while ( $obj = $db->fetch_object($resql) ) { while ( $obj = $db->fetch_object($resql) ) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);

View File

@ -99,7 +99,6 @@ if ($result<0)
* Action * Action
*/ */
if ($action == 'lettering') { if ($action == 'lettering') {
$result = $lettering->updateLettering($toselect); $result = $lettering->updateLettering($toselect);
if ($result < 0) { if ($result < 0) {
@ -248,7 +247,6 @@ if ($resql) {
$solde = 0; $solde = 0;
$tmp = ''; $tmp = '';
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code; if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit); /*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);

View File

@ -224,22 +224,23 @@ class AccountancyExport
/** /**
* Function who chose which export to use with the default config, and make the export into a file * Function who chose which export to use with the default config, and make the export into a file
* *
* @param array $TData data * @param array $TData Array with data
* @return void * @param int $formatexportset Id of export format
* @return void
*/ */
public function export(&$TData) public function export(&$TData, $formatexportset)
{ {
global $conf, $langs; global $conf, $langs;
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
// Define name of file to save // Define name of file to save
$filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV); $filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
$type_export = 'general_ledger'; $type_export = 'general_ledger';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) { switch ($formatexportset) {
case self::$EXPORT_TYPE_CONFIGURABLE : case self::$EXPORT_TYPE_CONFIGURABLE :
$this->exportConfigurable($TData); $this->exportConfigurable($TData);
break; break;
@ -548,7 +549,6 @@ class AccountancyExport
$end_line = "\n"; $end_line = "\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $separator; print $line->id . $separator;
@ -584,7 +584,6 @@ class AccountancyExport
$end_line = "\n"; $end_line = "\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->piece_num . $separator; print $line->piece_num . $separator;
@ -624,7 +623,6 @@ class AccountancyExport
$end_line = "\n"; $end_line = "\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $separator; print $date . $separator;
@ -926,91 +924,130 @@ class AccountancyExport
* *
* @return void * @return void
*/ */
public function exportLDCompta($objectLines) public function exportLDCompta($objectLines)
{ {
$separator = ';'; $separator = ';';
$end_line = "\n"; $end_line = "\r\n";
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_document = dol_print_date($line->doc_date, '%Y%m%d'); // TYPE
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $type_enregistrement = 'E'; // For write movement
print $type_enregistrement . $separator;
// JNAL
print substr($line->code_journal, 0, 2) . $separator;
// NECR
print $line->id . $separator;
// NPIE
print $line->piece_num . $separator;
// DATP
print $date_document . $separator;
// LIBE
print $line->label_operation . $separator;
// DATH
print $line->date_lim_reglement . $separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AC';
} else {
$nature_piece = 'FC';
}
} else {
$nature_piece = '';
}
print $nature_piece . $separator;
// RACI
/*
if (! empty($line->subledger_account)) {
if ($line->doc_type == 'supplier_invoice') {
$racine_subledger_account = '40';
} elseif ($line->doc_type == 'customer_invoice') {
$racine_subledger_account = '41';
} else {
$nature_piece = '';
}
print $racine_subledger_account . $separator;
} else {
print $separator;
}
*/
print $separator; // deprecated CPTG & CPTA use instead
// MONT
print price(abs($line->montant), 0, '', 1, 2) . $separator;
// CODC
print $line->sens . $separator;
// CPTG
print length_accountg($line->numero_compte) . $separator;
// DATE
print $date_creation . $separator;
// CLET
print $line->lettering_code . $separator;
// DATL
print $line->date_lettering . $separator;
// CPTA
if (! empty($line->subledger_account)) {
print length_accounta($line->subledger_account) . $separator;
} else {
print $separator;
}
// CNAT
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
print 'F' . $separator;
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
print 'C' . $separator;
} else {
print $separator;
}
// SECT
print $separator;
// CTRE
print $separator;
// NORL
print $separator;
// DATV
print $separator;
// REFD
print $line->doc_ref . $separator;
// CODH
print $separator;
// NSEQ
print $separator;
// MTDV
print '0' . $separator;
// CODV
print $separator;
// TXDV
print '0' . $separator;
// MOPM
print $separator;
// BONP
print $separator;
// BQAF
print $separator;
// ECES
print $separator;
// TXTL
print $separator;
// ECRM
print $separator;
// DATK
print $separator;
// HEUK
print $separator;
// TYPE print $end_line;
$type_enregistrement = 'E'; // For write movement }
print $type_enregistrement . $separator; }
// JNAL
print substr($line->code_journal, 0, 2) . $separator;
// NECR
print $line->id . $separator;
// NPIE
print $line->piece_num . $separator;
// DATP
print $date_document . $separator;
// LIBE
print $line->label_operation . $separator;
// DATH
print $line->date_lim_reglement . $separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AF';
} else {
$nature_piece = 'FF';
}
} elseif ($line->doc_type == 'customer_invoice') {
if ($line->montant < 0) {
$nature_piece = 'AC';
} else {
$nature_piece = 'FC';
}
} else {
$nature_piece = '';
}
print $nature_piece . $separator;
// RACI
/*
if (! empty($line->subledger_account)) {
if ($line->doc_type == 'supplier_invoice') {
$racine_subledger_account = '40';
} elseif ($line->doc_type == 'customer_invoice') {
$racine_subledger_account = '41';
} else {
$nature_piece = '';
}
print $racine_subledger_account . $separator;
} else {
print $separator;
}
*/
// MONT
print price(abs($line->montant)) . $separator;
// CODC
print $line->sens . $separator;
// CPTG
print length_accountg($line->numero_compte) . $separator;
// DATE
print $date_creation . $separator;
// CLET
print $line->lettering_code . $separator;
// DATL
print $line->date_lettering . $separator;
// CPTA
if (! empty($line->subledger_account)) {
print length_accounta($line->subledger_account) . $separator;
}
// CNAT
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
print 'F';
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
print 'C';
} else {
print '';
}
print $end_line;
}
}
/** /**
* Export format : Charlemagne * Export format : Charlemagne
@ -1046,7 +1083,6 @@ class AccountancyExport
print $end_line; print $end_line;
foreach($objectLines as $line) { foreach($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%Y%m%d'); $date = dol_print_date($line->doc_date, '%Y%m%d');
print $date . $separator; //Date print $date . $separator; //Date

View File

@ -407,7 +407,6 @@ class AccountingAccount extends CommonObject
$result = $this->checkUsage(); $result = $this->checkUsage();
if ($result > 0) { if ($result > 0) {
$this->db->begin(); $this->db->begin();
// if (! $error) { // if (! $error) {

View File

@ -235,7 +235,7 @@ class AccountingJournal extends CommonObject
{ {
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label=$langs->trans("ShowAccoutingJournal"); $label=$langs->trans("ShowAccountingJournal");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -406,7 +406,7 @@ class BookKeeping extends CommonObject
} }
/** /**
* Return a link to the object card (with optionaly the picto) * Return a link to the object card (with optionally the picto)
* *
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
* @param string $option On what the link point to ('nolink', ...) * @param string $option On what the link point to ('nolink', ...)
@ -1309,7 +1309,7 @@ class BookKeeping extends CommonObject
} }
/** /**
* Delete bookkepping by importkey * Delete bookkeeping by importkey
* *
* @param string $importkey Import key * @param string $importkey Import key
* @return int Result * @return int Result
@ -1337,7 +1337,7 @@ class BookKeeping extends CommonObject
} }
/** /**
* Delete bookkepping by year * Delete bookkeeping by year
* *
* @param string $delyear Year to delete * @param string $delyear Year to delete
* @param string $journal Journal to delete * @param string $journal Journal to delete
@ -1379,7 +1379,7 @@ class BookKeeping extends CommonObject
} }
/** /**
* Delete bookkepping by piece number * Delete bookkeeping by piece number
* *
* @param int $piecenum Piecenum to delete * @param int $piecenum Piecenum to delete
* @return int Result * @return int Result
@ -1584,9 +1584,7 @@ class BookKeeping extends CommonObject
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
while ($obj = $this->db->fetch_object($result)) { while ($obj = $this->db->fetch_object($result)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -1624,12 +1622,12 @@ class BookKeeping extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Export bookkeping * Export bookkeeping
* *
* @param string $model Model * @param string $model Model
* @return int Result * @return int Result
*/ */
public function export_bookkeping($model = 'ebp') public function export_bookkeeping($model = 'ebp')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1641,7 +1639,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE entity IN (" . getEntity('accountancy') . ")"; $sql .= " WHERE entity IN (" . getEntity('accountancy') . ")";
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); dol_syslog(get_class($this) . "::export_bookkeeping", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1679,7 +1677,7 @@ class BookKeeping extends CommonObject
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::export_bookkeping " . $this->error, LOG_ERR); dol_syslog(get_class($this) . "::export_bookkeeping " . $this->error, LOG_ERR);
return - 1; return - 1;
} }
} }
@ -1966,6 +1964,7 @@ class BookKeepingLine
public $credit; public $credit;
public $montant; public $montant;
public $sens; public $sens;
public $lettering_code;
/** /**
* @var int ID * @var int ID
@ -1977,4 +1976,6 @@ class BookKeepingLine
public $journal_label; public $journal_label;
public $piece_num; public $piece_num;
public $date_creation; public $date_creation;
public $date_modification;
public $date_export;
} }

View File

@ -149,7 +149,6 @@ class Lettering extends BookKeeping
} }
} }
} elseif ($obj->type == 'payment') { } elseif ($obj->type == 'payment') {
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id'; $sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";

View File

View File

@ -0,0 +1,132 @@
<?php
/* Copyright (C) 2019 Open-DSI <support@open-dsi.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/>.
*
*/
/**
* \file htdocs/accountancy/closure/index.php
* \ingroup Accountancy
* \brief Home closure page
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write)
accessforbidden();
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else
{
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
}
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
}
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$search_date_end = dol_get_last_day($year_end, $month_end);
$year_current = $year_start;
/*
* Actions
*/
/*
* View
*/
llxHeader('', $langs->trans("Closure"));
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
print load_fiche_titre($langs->trans("Closure") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print '<span class="opacitymedium">'.$langs->trans("DescClosure") . '</span><br>';
print '<br>';
$y = $year_current;
$buttonbind = '<a class="butAction" href="./validate.php">' . $langs->trans("ValidateMovements") . '</a>';
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
for($i = 1; $i <= 12; $i ++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
if ($j > 12) $j-=12;
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
}
print '<td width="60" class="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT COUNT(b.rowid) as detail,";
for($i = 1; $i <= 12; $i ++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
if ($j > 12) $j-=12;
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
}
$sql .= " COUNT(b.rowid) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven">';
for($i = 1; $i <= 12; $i ++) {
print '<td class="right">' . $row[$i] . '</td>';
}
print '<td class="right"><b>' . $row[13] . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -0,0 +1,157 @@
<?php
/* Copyright (C) 2019 Open-DSI <support@open-dsi.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/>.
*
*/
/**
* \file htdocs/accountancy/closure/validate.php
* \ingroup Accountancy
* \brief Validate entries page
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
// Load translation files required by the page
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
// Security check
if (empty($conf->accounting->enabled)) {
accessforbidden();
}
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear->write)
accessforbidden();
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else
{
$year_start = dol_print_date(dol_now(), '%Y');
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
}
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
}
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$search_date_end = dol_get_last_day($year_end, $month_end);
$year_current = $year_start;
/*
* Actions
*/
if ($action == 'validate')
{
$now = dol_now();
// Update database
$db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
$sql .= " SET b.date_validated = '" . $db->idate($now) . "'";
$sql .= ' WHERE b.date_validated IS NULL';
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql1) {
$error ++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
} else {
$db->commit();
}
// End clean database
}
/*
* View
*/
llxHeader('', $langs->trans("ValidateMovements"));
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
print $langs->trans("DescValidateMovements") . '<br>';
print '<br>';
$y = $year_current;
print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="oddeven">';
for($i = 1; $i <= 12; $i ++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
if ($j > 12) $j-=12;
print '<td class="center">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
}
print '<td><b>' . $langs->trans("Total") . '</b></td></tr>';
print '<tr class="oddeven">';
$sql = "SELECT COUNT(b.rowid) as detail,";
for($i = 1; $i <= 12; $i ++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
if ($j > 12) $j-=12;
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
}
$sql .= " COUNT(b.rowid) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
for($i = 1; $i <= 12; $i ++) {
print '<td class="nowrap center">' . $row[$i] . '<br><br>';
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected?' checked="checked"':'').'>';
print '</td>' ;
}
print '<td class="valigntop"><b>' . $row[13] . '</b></td>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print '</tr>';
print "</table>\n";
print '<br><div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?month=' . $year_current . '&action=validate"">' . $langs->trans("ValidateMovements") . '</a></div>';
print '</div>';
// End of page
llxFooter();
$db->close();

View File

@ -112,7 +112,6 @@ if (! empty($id)) {
$i = 0; $i = 0;
if ($num_lines) { if ($num_lines) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n"; print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";

View File

@ -29,6 +29,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
// Load translation files required by the page // Load translation files required by the page
@ -65,6 +66,8 @@ $year_current = $year_start;
// Validate History // Validate History
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
/* /*
* Actions * Actions
@ -97,12 +100,11 @@ if ($action == 'clean' || $action == 'validatehistory')
} }
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
if ($db->type == 'pgsql') { /*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
@ -115,16 +117,83 @@ if ($action == 'validatehistory') {
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0"; $sql1 .= " AND fd.fk_code_ventilation = 0";
} }*/
// Customer Invoice lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql.= " co.code as country_code, co.label as country_label,";
$sql.= " s.tva_intra";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
dol_syslog('htdocs/accountancy/customer/index.php'); dol_syslog('htdocs/accountancy/customer/index.php');
$result = $db->query($sql);
$resql1 = $db->query($sql1); if (! $result) {
if (! $resql1) { $error++;
$error ++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
$num_lines = $db->num_rows($result);
$isSellerInEEC = isInEEC($mysoc);
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
// Search suggested account for product/service
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
$objp->code_sell_p = $objp->code_sell_export;
$objp->aarowid_suggest = $objp->aarowid_export;
$suggestedaccountingaccountfor = 'export';
}
}
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$resqlupdate = $db->query($sqlupdate);
if (! $resqlupdate)
{
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
$i++;
}
}
if ($error)
{
$db->rollback();
}
else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
} }
@ -195,7 +264,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {
@ -271,7 +339,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {
@ -398,7 +465,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>'; print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td class="nowrap right">' . price(price2num($row[$i])) . '</td>'; print '<td class="nowrap right">' . price(price2num($row[$i])) . '</td>';

View File

@ -358,6 +358,7 @@ if ($result) {
// Ref Invoice // Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>'; print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product // Ref Product
@ -377,7 +378,13 @@ if ($result) {
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>'; print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>'; // Country
print '<td>';
if ($objp->country_code)
{
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
}
print '</td>';
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';

View File

@ -180,8 +180,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }
@ -221,9 +219,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture"; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2"; $sql.= " AND l.product_type <= 2";
// Add search filter like // Add search filter like
@ -249,7 +247,7 @@ if (strlen(trim($search_account))) {
$sql .= natural_search("aa.account_number", $search_account); $sql .= natural_search("aa.account_number", $search_account);
} }
if (strlen(trim($search_vat))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", $search_vat, 1); $sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
} }
$sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year); $sql.=dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
if (strlen(trim($search_country))) { if (strlen(trim($search_country))) {
@ -408,12 +406,11 @@ if ($result) {
$isSellerInEEC = isInEEC($mysoc); $isSellerInEEC = isInEEC($mysoc);
while ( $i < min($num_lines, $limit) ) { while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$objp->code_sell_l = ''; $objp->code_sell_l = '';
$objp->code_sell_p = ''; $objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -425,7 +422,7 @@ if ($result) {
$facture_static->type = $objp->ftype; $facture_static->type = $objp->ftype;
$code_sell_p_notset = ''; $code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = ''; // Will be set later
$isBuyerInEEC = isInEEC($objp); $isBuyerInEEC = isInEEC($objp);
@ -459,8 +456,9 @@ if ($result) {
} }
if ($objp->code_sell_l == -1) $objp->code_sell_l=''; if ($objp->code_sell_l == -1) $objp->code_sell_l='';
// Search suggested account for product/service
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell; $objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid; $objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';
@ -520,6 +518,7 @@ if ($result) {
print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')); print vatrate($objp->tva_tx_line.($objp->vat_src_code?' ('.$objp->vat_src_code.')':''));
print '</td>'; print '</td>';
// Country
print '<td>'; print '<td>';
$labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label; $labelcountry=($objp->country_code && ($langs->trans("Country".$objp->country_code)!="Country".$objp->country_code))?$langs->trans("Country".$objp->country_code):$objp->country_label;
print $labelcountry; print $labelcountry;
@ -549,12 +548,19 @@ if ($result) {
// Suggested accounting account // Suggested accounting account
print '<td>'; print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); $suggestedid = $objp->aarowid_suggest;
if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && ! empty($conf->global->ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC))
{
//$suggestedid = // id of $objp->code_sell_l
}
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; //var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -94,7 +94,6 @@ if ($action == 'clean' || $action == 'validatehistory')
} }
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
@ -187,7 +186,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {
@ -259,7 +257,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {

View File

@ -161,8 +161,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict")); $langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict"));
@ -41,8 +42,17 @@ $hookmanager->initHooks(array('accountancyindex'));
* Actions * Actions
*/ */
// None if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
$zone=GETPOST('areacode', 'aZ09');
$userid=GETPOST('userid', 'int');
$boxorder=GETPOST('boxorder', 'aZ09');
$boxorder.=GETPOST('boxcombo', 'aZ09');
$result=InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
}
/* /*
* View * View
@ -50,14 +60,39 @@ $hookmanager->initHooks(array('accountancyindex'));
llxHeader('', $langs->trans("AccountancyArea")); llxHeader('', $langs->trans("AccountancyArea"));
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
//dol_fiche_head();
$step = 0;
if ($conf->accounting->enabled) if ($conf->accounting->enabled)
{ {
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n"; $step = 0;
$resultboxes=FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$helpisexpanded = empty($resultboxes['boxactivated']); // If there is no widget, the tooltip help is expanded by default.
$showtutorial = '';
if (! $helpisexpanded)
{
$showtutorial = '<div align="right"><a href="#" id="show_hide">';
$showtutorial .= img_picto('', 'chevron-down');
$showtutorial .= ' ' . $langs->trans("ShowTutorial");
$showtutorial .= '</a></div>';
$showtutorial .= '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#show_hide").click(function () {
jQuery( "#idfaq" ).toggle({
duration: 400,
});
});
});
</script>';
}
print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
print "<br>\n";
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
print "<br>\n";print "<br>\n"; print "<br>\n";print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n"; print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
@ -172,12 +207,51 @@ if ($conf->accounting->enabled)
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n";
print "<br>\n"; print "<br>\n";
print '<br>';
print '</div>';
print '<div class="clearboth"></div>';
print '<div class="fichecenter fichecenterbis">';
/*
* Show boxes
*/
$boxlist.='<div class="twocolumns">';
$boxlist.='<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if(!empty($nbworkboardcount))
{
$boxlist.=$boxwork;
}
$boxlist.=$resultboxes['boxlista'];
$boxlist.= '</div>';
$boxlist.= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist.=$boxstat;
$boxlist.=$resultboxes['boxlistb'];
$boxlist.= '</div>';
$boxlist.= "\n";
$boxlist.='</div>';
print $boxlist;
print '</div>';
} }
else else
{ {
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print $langs->trans("Module10Desc")."<br>\n"; print $langs->trans("Module10Desc")."<br>\n";
} }
//dol_fiche_end();
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
@ -167,7 +167,6 @@ $journal_label = $accountingjournalstatic->label;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num = $db->num_rows($result); $num = $db->num_rows($result);
//print $sql; //print $sql;
@ -268,10 +267,8 @@ if ($result) {
// get_url may return -1 which is not traversable // get_url may return -1 which is not traversable
if (is_array($links) && count($links) > 0) { if (is_array($links) && count($links) > 0) {
// Now loop on each link of record in bank. // Now loop on each link of record in bank.
foreach ($links as $key => $val) { foreach ($links as $key => $val) {
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various')))
{ {
// So we excluded 'company' and 'user' here. We want only payment lines // So we excluded 'company' and 'user' here. We want only payment lines
@ -387,7 +384,9 @@ if ($result) {
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id; $tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id); $paymentvariousstatic->fetch($paymentvariousstatic->id);
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word $account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$tabtp[$obj->rowid][$account_various] += $obj->amount; $account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') { } elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id'];
@ -660,11 +659,11 @@ if (! $error && $action == 'writebookkeeping') {
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_various') { } elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'banktransfert') { } elseif ($tabtype[$key] == 'banktransfert') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
@ -997,7 +996,7 @@ if (empty($action) || $action == 'view') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
} }
else { else {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
@ -1123,6 +1122,7 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
$accounttoshow = length_accounta($account_ledger); $accounttoshow = length_accounta($account_ledger);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
@ -1156,7 +1156,7 @@ if (empty($action) || $action == 'view') {
// Subledger account // Subledger account
print "<td>"; print "<td>";
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary'))) // Type of payment with subledger if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger
{ {
$accounttoshowsubledger = length_accounta($k); $accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger) if ($accounttoshow != $accounttoshowsubledger)

View File

@ -115,7 +115,6 @@ $sql .= " ORDER BY er.date_debut";
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG); dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$taber = array (); $taber = array ();
$tabht = array (); $tabht = array ();
$tabtva = array (); $tabtva = array ();
@ -307,49 +306,49 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true); $accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit; $totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit; $totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
if ($result < 0) { if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{ {
$error++; $error++;
$errorforline++; $errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
} }
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
} }
} }
} }
@ -439,53 +438,52 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n"; print "\n";
foreach ($taber as $key => $val) { foreach ($taber as $key => $val) {
$date = dol_print_date($val["date"], 'day'); $date = dol_print_date($val["date"], 'day');
$userstatic->id = $tabuser[$key]['id']; $userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name']; $userstatic->name = $tabuser[$key]['name'];
// Fees // Fees
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n"; print "\n";
}
} }
} // VAT
// VAT foreach ($tabtva[$key] as $k => $mt) {
foreach ($tabtva[$key] as $k => $mt) { if ($mt) {
if ($mt) { print '"' . $date . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n";
print "\n"; }
} }
}
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($userstatic->name) . '"' . $sep; print '"' . dol_trunc($userstatic->name) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
} }
print "\n"; print "\n";
} }
} }
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("ExpenseReportsJournal")); llxHeader('', $langs->trans("ExpenseReportsJournal"));
$nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
@ -640,29 +638,29 @@ if (empty($action) || $action == 'view') {
if ($numtax == 2) $arrayofvat = $tablocaltax2; if ($numtax == 2) $arrayofvat = $tablocaltax2;
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- VAT -->"; print "<!-- VAT -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') if (($accountoshow == "") || $accountoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>'; print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
}
else print $accountoshow;
print "</td>";
// Subledger account
print "<td>";
print '</td>';
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
print "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
} }
else print $accountoshow;
print "</td>";
// Subledger account
print "<td>";
print '</td>';
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
print "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
} }
} }
} }

View File

@ -242,7 +242,6 @@ if ($action == 'writebookkeeping') {
$invoicestatic = new FactureFournisseur($db); $invoicestatic = new FactureFournisseur($db);
foreach ($tabfac as $key => $val) { // Loop on each invoice foreach ($tabfac as $key => $val) { // Loop on each invoice
$errorforline = 0; $errorforline = 0;
$totalcredit = 0; $totalcredit = 0;
@ -295,7 +294,61 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -303,20 +356,17 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
@ -342,62 +392,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//} }
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
//}
} }
} }
@ -716,7 +711,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} }
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("PurchasesJournal")); llxHeader('', $langs->trans("PurchasesJournal"));
$nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
@ -867,34 +861,32 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Thirdparty -->";
print "<!-- Thirdparty -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; // Subledger account
// Subledger account print "<td>";
print "<td>"; $accountoshow = length_accounta($k);
$accountoshow = length_accounta($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// Product / Service // Product / Service
@ -902,30 +894,28 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Product -->";
print "<!-- Product -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accountg($k);
$accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print "</td>";
print "</td>"; // Subledger account
// Subledger account print "<td>";
print "<td>"; print '</td>';
print '</td>'; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->name = $tabcompany[$key]['name']; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// VAT // VAT

View File

@ -124,7 +124,7 @@ if ($in_bookkeeping == 'already')
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
} }
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
//print $sql; //print $sql;
@ -255,7 +255,6 @@ if ($action == 'writebookkeeping') {
$invoicestatic = new Facture($db); $invoicestatic = new Facture($db);
foreach ($tabfac as $key => $val) { // Loop on each invoice foreach ($tabfac as $key => $val) { // Loop on each invoice
$errorforline = 0; $errorforline = 0;
$totalcredit = 0; $totalcredit = 0;
@ -306,7 +305,61 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -316,18 +369,15 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
@ -353,62 +403,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//} }
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
//}
} }
} }
@ -654,7 +649,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal")); llxHeader('', $langs->trans("SellsJournal"));
$nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1); $nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
@ -803,34 +797,32 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) foreach ($tabttc[$key] as $k => $mt)
{ {
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Thirdparty -->";
print "<!-- Thirdparty -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; // Subledger account
// Subledger account print "<td>";
print "<td>"; $accountoshow = length_accounta($k);
$accountoshow = length_accounta($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// Product / Service // Product / Service
@ -839,30 +831,28 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Product -->";
print "<!-- Product -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accountg($k);
$accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print "</td>";
print "</td>"; // Subledger account
// Subledger account print "<td>";
print "<td>"; print '</td>';
print '</td>'; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->name = $tabcompany[$key]['name']; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// VAT // VAT

View File

@ -27,6 +27,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
// Load translation files required by the page // Load translation files required by the page
@ -63,6 +64,7 @@ $year_current = $year_start;
// Validate History // Validate History
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
/* /*
@ -95,12 +97,11 @@ if ($action == 'clean' || $action == 'validatehistory')
} }
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
if ($db->type == 'pgsql') { /*if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
@ -113,16 +114,85 @@ if ($action == 'validatehistory') {
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0"; $sql1 .= " AND fd.fk_code_ventilation = 0";
} }*/
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
$sql.= " aa.rowid as aarowid,";
$sql.= " co.code as country_code, co.label as country_label,";
$sql.= " s.tva_intra";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
dol_syslog('htdocs/accountancy/supplier/index.php'); dol_syslog('htdocs/accountancy/supplier/index.php');
$resql1 = $db->query($sql1); $result = $db->query($sql);
if (! $resql1) { if (! $result) {
$error ++; $error++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else { } else {
$num_lines = $db->num_rows($result);
$isSellerInEEC = isInEEC($mysoc);
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
// Search suggested account for product/service
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
//$objp->code_buy_p = $objp->code_buy_intra;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_intra;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
//$objp->code_buy_p = $objp->code_buy_export;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_export;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = 'export';
}
}
if ($objp->aarowid_suggest > 0)
{
$sqlupdate = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sqlupdate.= " SET fk_code_ventilation = ".$objp->aarowid_suggest;
$sqlupdate.= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".$objp->rowid;
$resqlupdate = $db->query($sqlupdate);
if (! $resqlupdate)
{
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
$i++;
}
}
if ($error)
{
$db->rollback();
}
else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
} }
@ -187,7 +257,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {
@ -258,7 +327,6 @@ if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind') if ($row[0] == 'tobind')
{ {

View File

@ -192,12 +192,12 @@ if ($search_lineid) {
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
}
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
} }
if (strlen(trim($search_label))) {
$sql .= natural_search("p.label", $search_label);
}
if (strlen(trim($search_desc))) { if (strlen(trim($search_desc))) {
$sql .= natural_search("l.description", $search_desc); $sql .= natural_search("l.description", $search_desc);
} }
@ -300,14 +300,13 @@ if ($result) {
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); $formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
@ -368,6 +367,7 @@ if ($result) {
print $objp->invoice_label; print $objp->invoice_label;
print '</td>'; print '</td>';
// Date invoice
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product // Ref product
@ -388,7 +388,12 @@ if ($result) {
print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>'; print '<td class="right">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')</td>'; print '<td>';
if ($objp->country_code)
{
print $langs->trans("Country".$objp->country_code) .' ('.$objp->country_code.')';
}
print '</td>';
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';

View File

@ -184,8 +184,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }
@ -224,7 +222,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays "; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity; $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2"; $sql.= " AND l.product_type <= 2";
// Add search filter like // Add search filter like
@ -234,12 +232,12 @@ if ($search_lineid) {
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_label))) {
$sql .= natural_search("f.libelle", $search_label);
}
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
} }
if (strlen(trim($search_label))) {
$sql .= natural_search("p.label", $search_label);
}
if (strlen(trim($search_desc))) { if (strlen(trim($search_desc))) {
$sql .= natural_search("l.description", $search_desc); $sql .= natural_search("l.description", $search_desc);
} }
@ -309,14 +307,15 @@ if ($result) {
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid); if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
if ($search_day) $param.='&search_day='.urlencode($search_day); if ($search_day) $param.='&search_day='.urlencode($search_day);
if ($search_month) $param.='&search_month='.urlencode($search_month); if ($search_month) $param.='&search_month='.urlencode($search_month);
if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_year) $param.='&search_year='.urlencode($search_year);
if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice); if ($search_invoice) $param.='&search_invoice='.urlencode($search_invoice);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_label) $param.='&search_label='.urlencode($search_label);
if ($search_desc) $param.='&search_desc='.urlencode($search_desc); if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
if ($search_amount) $param.='&search_amount='.urlencode($search_amount); if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
if ($search_vat) $param.='&search_vat='.urlencode($search_vat); if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
@ -362,14 +361,13 @@ if ($result) {
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); $formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
@ -465,7 +463,7 @@ if ($result) {
print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product // Ref Product
print '<td>'; print '<td>';
if ($product_static->id > 0) if ($product_static->id > 0)
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
@ -473,7 +471,7 @@ if ($result) {
print '</td>'; print '</td>';
// Description // Description
print '<td>'; print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
@ -521,12 +519,14 @@ if ($result) {
// Suggested accounting account // Suggested accounting account
print '<td>'; print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); $suggestedid = $objp->aarowid_suggest;
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td class="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; $ischecked = $objp->aarowid_suggest;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($ischecked ? "checked" : "") . '/>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -225,7 +225,7 @@ if (! empty($conf->global->MEMBER_ENABLE_PUBLIC))
{ {
print '<br>'; print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>'; //print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':<br>'; print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>';
if ($conf->multicompany->enabled) { if ($conf->multicompany->enabled) {
$entity_qr='?entity='.$conf->entity; $entity_qr='?entity='.$conf->entity;
} else { } else {

View File

@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf))
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead'];
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
<?php echo $this->control->tpl['showhead']; ?>
<?php
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
?> if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth"> <table class="border allwidth">
@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
</table> </table>
<?php echo $this->control->tpl['showend']; ?> <?php echo $this->control->tpl['showend'];
<?php if (empty($user->societe_id)) { ?> if (empty($user->societe_id)) {
<div class="tabsAction"> echo '<div class="tabsAction">';
<?php if ($user->rights->adherent->creer) { ?> if ($user->rights->adherent->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
<?php } ?> }
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?> if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
<?php } ?> }
<?php if ($user->rights->adherent->supprimer) { ?> if ($user->rights->adherent->supprimer) {
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
<?php } ?> }
</div><br> echo '</div><br>';
<?php } }
echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionstodo'];
echo $this->control->tpl['actionsdone']; echo $this->control->tpl['actionsdone'];
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -68,7 +68,7 @@ $object = new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr) // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($id); $object->getCanvas($id);
@ -320,7 +320,7 @@ if (empty($reshook))
$object->public = GETPOST("public", 'alpha'); $object->public = GETPOST("public", 'alpha');
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
// Check if we need to also synchronize user information // Check if we need to also synchronize user information
@ -497,7 +497,7 @@ if (empty($reshook))
$object->public = $public; $object->public = $public;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
// Check parameters // Check parameters
@ -867,6 +867,18 @@ else
$object->country=$tmparray['label']; $object->country=$tmparray['label'];
} }
if (!empty($socid)) {
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
if (! ($object->id > 0))
{
$langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
}
}
$adht = new AdherentType($db); $adht = new AdherentType($db);
print load_fiche_titre($langs->trans("NewMember"), '', 'members'); print load_fiche_titre($langs->trans("NewMember"), '', 'members');
@ -905,6 +917,7 @@ else
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">'; print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">'; if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
dol_fiche_head(''); dol_fiche_head('');
@ -1362,15 +1375,8 @@ else
else print $langs->trans("NoDolibarrAccess"); else print $langs->trans("NoDolibarrAccess");
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
//Hooks here
$reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
print $object->showOptionals($extrafields, 'edit');
}
print '</table>'; print '</table>';
dol_fiche_end(); dol_fiche_end();
@ -1673,14 +1679,14 @@ else
else else
{ {
if ($object->need_subscription == 0) if ($object->need_subscription == 0)
{ {
print $langs->trans("SubscriptionNotNeeded"); print $langs->trans("SubscriptionNotNeeded");
} }
elseif (! $adht->subscription) elseif (! $adht->subscription)
{ {
print $langs->trans("SubscriptionNotRecorded"); print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
} }
else else
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");

View File

@ -48,7 +48,7 @@ $object=new Adherent($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
/* /*

View File

@ -581,6 +581,7 @@ class Adherent extends CommonObject
$sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid); $sql.= ", fk_adherent_type = ".$this->db->escape($this->typeid);
$sql.= ", morphy = '".$this->db->escape($this->morphy)."'"; $sql.= ", morphy = '".$this->db->escape($this->morphy)."'";
$sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null"); $sql.= ", birth = ".($this->birth?"'".$this->db->idate($this->birth)."'":"null");
if ($this->socid) $sql.= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription if ($this->datefin) $sql.= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member if ($this->datevalid) $sql.= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
@ -1281,7 +1282,7 @@ class Adherent extends CommonObject
$this->societe = $obj->company; $this->societe = $obj->company;
$this->company = $obj->company; $this->company = $obj->company;
$this->socid = $obj->fk_soc; $this->socid = $obj->fk_soc;
$this->fk_soc = $obj->fk_soc; // For backward comaptibility $this->fk_soc = $obj->fk_soc; // For backward compatibility
$this->address = $obj->address; $this->address = $obj->address;
$this->zip = $obj->zip; $this->zip = $obj->zip;
$this->town = $obj->town; $this->town = $obj->town;
@ -2369,7 +2370,6 @@ class Adherent extends CommonObject
$langs->load("orders"); $langs->load("orders");
if (! dol_strlen($modele)) { if (! dol_strlen($modele)) {
$modele = 'standard'; $modele = 'standard';
if ($this->modelpdf) { if ($this->modelpdf) {
@ -2471,7 +2471,7 @@ class Adherent extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Initialise tableau info (tableau des attributs LDAP) * Initialise tableau info (tableau des attributs LDAP)
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs

View File

@ -89,6 +89,8 @@ class AdherentType extends CommonObject
/** @var array Array of members */ /** @var array Array of members */
public $members=array(); public $members=array();
public $multilangs=array();
/** /**
* Constructor * Constructor
@ -101,6 +103,185 @@ class AdherentType extends CommonObject
$this->statut = 1; $this->statut = 1;
} }
/**
* Load array this->multilangs
*
* @return int <0 if KO, >0 if OK
*/
public function getMultiLangs()
{
global $langs;
$current_lang = $langs->getDefaultLang();
$sql = "SELECT lang, label, description, email";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql.= " WHERE fk_type=".$this->id;
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result))
{
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if ($obj->lang == $current_lang) // si on a les traduct. dans la langue courante on les charge en infos principales.
{
$this->label = $obj->label;
$this->description = $obj->description;
$this->email = $obj->email;
}
$this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["email"] = $obj->email;
}
return 1;
}
else
{
$this->error="Error: ".$this->db->lasterror()." - ".$sql;
return -1;
}
}
/**
* Update or add a translation for a product
*
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
public function setMultiLangs($user)
{
global $conf, $langs;
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2);
$current_lang = $langs->getDefaultLang();
foreach ($langs_available as $key => $value)
{
if ($key == $current_lang) {
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql.= " WHERE fk_type=".$this->id;
$sql.= " AND lang='".$key."'";
$result = $this->db->query($sql);
if ($this->db->num_rows($result)) // if there is already a description line for this language
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2.= " SET ";
$sql2.= " label='".$this->db->escape($this->label)."',";
$sql2.= " description='".$this->db->escape($this->description)."'";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->other)."'";
}
$sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email";
}
$sql2.= ")";
$sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->label)."',";
$sql2.= " '".$this->db->escape($this->description)."'";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->other)."'";
}
$sql2.= ")";
}
dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key);
if (! $this->db->query($sql2)) {
$this->error=$this->db->lasterror();
return -1;
}
}
elseif (isset($this->multilangs[$key])) {
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql.= " WHERE fk_type=".$this->id;
$sql.= " AND lang='".$key."'";
$result = $this->db->query($sql);
if ($this->db->num_rows($result)) // if there is already a description line for this language
{
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2.= " SET ";
$sql2.= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'";
}
$sql2.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
}
else
{
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.=", email";
}
$sql2.= ")";
$sql2.= " VALUES(".$this->id.",'".$this->db->escape($key)."','". $this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2.= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
if (! empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2.= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'";
}
$sql2.= ")";
}
// We do not save if main fields are empty
if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) {
if (! $this->db->query($sql2)) {
$this->error=$this->db->lasterror();
return -1;
}
}
}
else
{
// language is not current language and we didn't provide a multilang description for this language
}
}
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_SET_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
return -1;
}
// End call triggers
return 1;
}
/**
* Delete a language for this product
*
* @param string $langtodelete Language code to delete
* @param User $user Object user making delete
*
* @return int <0 if KO, >0 if OK
*/
public function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql.= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
// Call trigger
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
// End call triggers
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
}
/** /**
* Fonction qui permet de creer le status de l'adherent * Fonction qui permet de creer le status de l'adherent
@ -111,7 +292,7 @@ class AdherentType extends CommonObject
*/ */
public function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $langs, $conf;
$error=0; $error=0;
@ -180,7 +361,7 @@ class AdherentType extends CommonObject
*/ */
public function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $hookmanager; global $langs, $conf, $hookmanager;
$error=0; $error=0;
@ -202,6 +383,16 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$this->description = $this->db->escape($this->note);
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) {
if ($this->setMultiLangs($user) < 0) {
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -2;
}
}
$action='update'; $action='update';
// Actions on extra fields // Actions on extra fields
@ -283,6 +474,8 @@ class AdherentType extends CommonObject
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -299,12 +492,17 @@ class AdherentType extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->label = $obj->label; $this->label = $obj->label;
$this->morphy = $obj->morphy; $this->morphy = $obj->morphy;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note;
$this->vote = $obj->vote; $this->vote = $obj->vote;
// multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) {
$this->getMultiLangs();
}
} }
return 1; return 1;

View File

@ -90,7 +90,6 @@ if ($id > 0)
$result=$membert->fetch($object->typeid); $result=$membert->fetch($object->typeid);
if ($result > 0) if ($result > 0)
{ {
// Build file list // Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1); $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
$totalsize=0; $totalsize=0;

View File

@ -89,7 +89,7 @@ $hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -68,7 +68,7 @@ $extrafields = new ExtraFields($db);
$adht = new AdherentType($db); $adht = new AdherentType($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$errmsg=''; $errmsg='';
$errmsgs=array(); $errmsgs=array();
@ -571,7 +571,7 @@ if ($rowid > 0)
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty"); print $langs->trans("LinkedToDolibarrThirdParty");
print '</td>'; print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>'; if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'</a></td>';
print '</tr></table>'; print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editthirdparty') if ($action == 'editthirdparty')
@ -614,7 +614,7 @@ if ($rowid > 0)
print '<td class="right">'; print '<td class="right">';
if ($user->rights->user->user->creer) if ($user->rights->user->user->creer)
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>'; print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).'</a>';
} }
print '</td>'; print '</td>';
} }

View File

@ -68,7 +68,7 @@ $hookmanager->initHooks(array('subscriptionlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');

View File

@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
exit; exit;
} }
?> echo "<!-- BEGIN PHP TEMPLATE -->\n";
<!-- BEGIN PHP TEMPLATE -->
<?php
global $user; global $user;
@ -39,23 +35,20 @@ $langs->load("members");
$total=0; $total=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
echo '<tr class="oddeven">';
?> echo '<td>'.$langs->trans("Subscription").'</td>';
<tr class="oddeven" > echo '<td>'.$objectlink->getNomUrl(1).'</td>';
<td><?php echo $langs->trans("Subscription"); ?></td> echo '<td class="center"></td>';
<td><?php echo $objectlink->getNomUrl(1); ?></td> echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
<td class="center"></td> echo '<td class="right">';
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td>
<td class="right"><?php
if ($user->rights->adherent->lire) { if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
} ?></td> }
<td class="right"></td> echo '</td>';
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> echo '<td class="right"></td>';
</tr> echo '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
<?php echo '</tr>';
} }
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@ -73,7 +73,7 @@ $object = new AdherentType($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{ {
@ -94,7 +94,6 @@ $hookmanager->initHooks(array('membertypecard','globalcard'));
*/ */
if ($cancel) { if ($cancel) {
$action=''; $action='';
if (! empty($backtopage)) { if (! empty($backtopage)) {
@ -113,7 +112,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$object->vote = (int) $vote; $object->vote = (int) $vote;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
if (empty($object->label)) { if (empty($object->label)) {
@ -168,7 +167,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
$object->vote = (boolean) trim($vote); $object->vote = (boolean) trim($vote);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object); $ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
$ret=$object->update($user); $ret=$object->update($user);
@ -524,14 +523,14 @@ if ($rowid > 0)
{ {
$sql.= natural_search("d.email", $search_email); $sql.= natural_search("d.email", $search_email);
} }
if ($filter == 'uptodate') if ($filter == 'uptodate')
{ {
$sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
} }
if ($filter == 'outofdate') if ($filter == 'outofdate')
{ {
$sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
} }
$sql.= " ".$db->order($sortfield, $sortorder); $sql.= " ".$db->order($sortfield, $sortorder);
@ -713,7 +712,7 @@ if ($rowid > 0)
print '<td class="center">'; print '<td class="center">';
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
{ {
print '<a href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>'; print '<a class="editfielda" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
} }
print '&nbsp;'; print '&nbsp;';
if ($user->rights->adherent->supprimer) if ($user->rights->adherent->supprimer)

View File

@ -0,0 +1,323 @@
<?php
/* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/adherents/type_translation.php
* \ingroup product
* \brief Page de traduction des produits
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
// Load translation files required by the page
$langs->loadLangs(array('members', 'languages'));
$id = GETPOST('rowid', 'int');
$action=GETPOST('action', 'alpha');
$cancel=GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id;
// Security check
$result=restrictedArea($user, 'adherent', $id, 'adherent_type');
/*
* Actions
*/
// retour a l'affichage des traduction si annulation
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
if ($action == 'delete' && GETPOST('langtodelete', 'alpha'))
{
$object = new AdherentType($db);
$object->fetch($id);
$object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user);
}
// Add translation
if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer)
{
$object = new AdherentType($db);
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
// update de l'objet
if ( $_POST["forcelangprod"] == $current_lang )
{
$object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
}
else
{
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]);
}
// sauvegarde en base
if ( $object->setMultiLangs($user) > 0 )
{
$action = '';
}
else
{
$action = 'add';
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Edit translation
if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer)
{
$object = new AdherentType($db);
$object->fetch($id);
$current_lang = $langs->getDefaultLang();
foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet
{
if ( $key == $current_lang )
{
$object->label = $_POST["libelle-".$key];
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->other = dol_htmlcleanlastbr($_POST["other-".$key]);
}
else
{
$object->multilangs[$key]["label"] = $_POST["libelle-".$key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]);
}
}
if ( $object->setMultiLangs($user) > 0 )
{
$action = '';
}
else
{
$action = 'edit';
setEventMessages($object->error, $object->errors, 'errors');
}
}
// Delete translation
if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights->adherent->configurer)
{
$object = new AdherentType($db);
$object->fetch($id);
$langtodelete=GETPOST('langdel', 'alpha');
if ( $object->delMultiLangs($langtodelete, $user) > 0 )
{
$action = '';
}
else
{
$action = 'edit';
setEventMessages($object->error, $object->errors, 'errors');
}
}
$object = new AdherentType($db);
$result = $object->fetch($id);
/*
* View
*/
$title = $langs->trans('MemberTypeCard');
$helpurl = '';
$shortlabel = dol_trunc($object->label, 16);
$title = $langs->trans('MemberType')." ". $shortlabel ." - ".$langs->trans('Translation');
$helpurl='EN:Module_Services_En|FR:Module_Services|ES:M&oacute;dulo_Servicios';
llxHeader('', $title, $helpurl);
$form = new Form($db);
$formadmin=new FormAdmin($db);
$head = member_type_prepare_head($object);
$titre=$langs->trans("MemberType".$object->type);
// Calculate $cnt_trans
$cnt_trans = 0;
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)
{
$cnt_trans++;
}
}
dol_fiche_head($head, 'translation', $titre, 0, 'group');
$linkback = '<a href="'.dol_buildpath('/adherents/type.php', 1).'">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
dol_fiche_end();
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
if ($action == '')
{
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
if ($cnt_trans > 0) print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
}
}
print "\n</div>\n";
if ($action == 'edit')
{
//WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="vedit">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)
{
$s=picto_from_langcode($key);
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.dol_escape_htmltag($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, ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
print '</td></tr>';
print '</table>';
}
}
print '<br>';
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").'">';
print '</div>';
print '</form>';
}
elseif ($action != 'add')
{
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)
{
$s=picto_from_langcode($key);
print ($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefieldcreate">'.$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 '</table>';
print '</div>';
}
}
if (! $cnt_trans && $action != 'add') print '<div class="opacitymedium">'. $langs->trans('NoTranslation').'</div>';
}
/*
* Form to add a new translation
*/
if ($action == 'add' && $user->rights->adherent->configurer)
{
//WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
print '<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="vadd">';
print '<input type="hidden" name="rowid" value="'.GETPOST("rowid", 'int').'">';
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
print '</td></tr>';
print '<tr><td class="tdtop 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, ROWS_3, '90%');
$doleditor->Create();
print '</td></tr>';
print '</table>';
dol_fiche_end();
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").'">';
print '</div>';
print '</form>';
print '<br>';
}
// End of page
llxFooter();
$db->close();

View File

@ -93,158 +93,87 @@ $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst")
print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("AccountantDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";
if ($action == 'edit' || $action == 'updateedit') /**
{ * Edit parameters
/** */
* Edit parameters print "\n".'<script type="text/javascript" language="javascript">';
*/ print '$(document).ready(function () {
print "\n".'<script type="text/javascript" language="javascript">'; $("#selectcountry_id").change(function() {
print '$(document).ready(function () { document.form_index.action.value="updateedit";
$("#selectcountry_id").change(function() { document.form_index.submit();
document.form_index.action.value="updateedit"; });
document.form_index.submit(); });';
}); print '</script>'."\n";
});';
print '</script>'."\n";
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="oddeven liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="oddeven liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name // Name
print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_NAME?$conf->global->MAIN_INFO_ACCOUNTANT_NAME: GETPOST("nom", 'nohtml')) . '"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address // Address
print '<tr><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address", 'nohtml')) . '</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_3.'">'. ($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS?$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS: GETPOST("address", 'nohtml')) . '</textarea></td></tr>'."\n";
print '<tr><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>'; print '<tr><td><label for="zipcode">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode", 'alpha')) . '"></td></tr>'."\n"; print '<input class="minwidth100" name="zipcode" id="zipcode" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_ZIP?$conf->global->MAIN_INFO_ACCOUNTANT_ZIP: GETPOST("zipcode", 'alpha')) . '"></td></tr>'."\n";
print '<tr><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>'; print '<tr><td><label for="town">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town", 'nohtml')) . '"></td></tr>'."\n"; print '<input name="town" class="minwidth100" id="town" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_TOWN?$conf->global->MAIN_INFO_ACCOUNTANT_TOWN: GETPOST("town", 'nohtml')) . '"></td></tr>'."\n";
// Country // Country
print '<tr><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">'; print '<tr><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id'); print $form->select_country($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'country_id');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">'; print '<tr><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
$formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id'); $formcompany->select_departement($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 'state_id');
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>'; print '<tr><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>'; print '<input name="tel" id="phone" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_PHONE . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>'; print '<tr><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>'; print '<input name="fax" id="fax" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_FAX . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>'; print '<input name="mail" id="email" class="minwidth200" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_MAIL . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web
print '<tr><td><label for="web">'.$langs->trans("Web").'</label></td><td>'; print '<tr><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>'; print '<input name="web" id="web" class="minwidth300" value="'. $conf->global->MAIN_INFO_ACCOUNTANT_WEB . '"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Code // Code
print '<tr><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>'; print '<tr><td><label for="code">'.$langs->trans("AccountantFileNumber").'</label></td><td>';
print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '" autofocus="autofocus"></td></tr>'."\n"; print '<input name="code" id="code" class="minwidth100" value="'. ($conf->global->MAIN_INFO_ACCOUNTANT_CODE?$conf->global->MAIN_INFO_ACCOUNTANT_CODE: GETPOST("code", 'nohtml')) . '"></td></tr>'."\n";
// Note // Note
print '<tr><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>'; print '<tr><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note', 'none') ? GETPOST('note', 'none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>'; print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOST('note', 'none') ? GETPOST('note', 'none') : $conf->global->MAIN_INFO_ACCOUNTANT_NOTE).'</textarea></td></tr>';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; //print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; //print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '<br>'; //print '<br>';
print '</form>'; print '</form>';
}
else
{
/*
* Show parameters
*/
// Actions buttons
//print '<div class="tabsAction">';
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
//print '</div><br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="oddeven liste_titre"><td>'.$langs->trans("CompanyInfo").'</td><td>'.$langs->trans("Value").'</td></tr>';
print '<tr><td class="titlefield wordbreak">'.$langs->trans("CompanyName").'</td><td>';
print $conf->global->MAIN_INFO_ACCOUNTANT_NAME;
print '</td></tr>';
print '<tr><td>'.$langs->trans("CompanyAddress").'</td><td>' . nl2br(empty($conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ADDRESS) . '</td></tr>';
print '<tr><td>'.$langs->trans("CompanyZip").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_ZIP)?'':$conf->global->MAIN_INFO_ACCOUNTANT_ZIP) . '</td></tr>';
print '<tr><td>'.$langs->trans("CompanyTown").'</td><td>' . (empty($conf->global->MAIN_INFO_ACCOUNTANT_TOWN)?'':$conf->global->MAIN_INFO_ACCOUNTANT_TOWN) . '</td></tr>';
print '<tr><td>'.$langs->trans("CompanyCountry").'</td><td>';
if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY))
{
$code = getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 2);
$img=picto_from_langcode($code);
print $img?$img.' ':'';
print getCountry($conf->global->MAIN_INFO_ACCOUNTANT_COUNTRY, 1);
}
print '</td></tr>';
if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print '<tr><td>'.$langs->trans("Region-State").'</td><td>';
else print '<tr><td>'.$langs->trans("State").'</td><td>';
if (! empty($conf->global->MAIN_INFO_ACCOUNTANT_STATE)) print getState($conf->global->MAIN_INFO_ACCOUNTANT_STATE, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
else print '&nbsp;';
print '</td></tr>';
print '<tr><td>'.$langs->trans("Phone").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_PHONE, $mysoc->country_code) . '</td></tr>';
print '<tr><td>'.$langs->trans("Fax").'</td><td>' . dol_print_phone($conf->global->MAIN_INFO_ACCOUNTANT_FAX, $mysoc->country_code) . '</td></tr>';
print '<tr><td>'.$langs->trans("Mail").'</td><td>' . dol_print_email($conf->global->MAIN_INFO_ACCOUNTANT_MAIL, 0, 0, 0, 80) . '</td></tr>';
print '<tr><td>'.$langs->trans("Web").'</td><td>' . dol_print_url($conf->global->MAIN_INFO_ACCOUNTANT_WEB, '_blank', 80) . '</td></tr>';
print '<tr><td>'.$langs->trans("AccountantFileNumber").'</td><td>' . $conf->global->MAIN_INFO_ACCOUNTANT_CODE . '</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td><td>' . (! empty($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) ? nl2br($conf->global->MAIN_INFO_ACCOUNTANT_NOTE) : '') . '</td></tr>';
print '</table>';
print "</div>";
print '</form>';
// Actions buttons
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a></div>';
print '</div>';
}
llxFooter(); llxFooter();

View File

@ -268,18 +268,17 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print '<td class="center">'."\n";
print '<td class="center">'."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") {
{ print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'; print img_picto($langs->trans("Enabled"), 'switch_on');
print img_picto($langs->trans("Enabled"), 'switch_on'); print '</a>';
print '</a>'; }
} else
else {
{ print img_picto($langs->trans("Enabled"), 'switch_on');
print img_picto($langs->trans("Enabled"), 'switch_on'); }
}
print "</td>"; print "</td>";
} }
else else
@ -363,7 +362,6 @@ print '</td></tr>'."\n";
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->'; print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n"; print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";

View File

@ -161,13 +161,13 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
// Show message // Show message
$message=''; $message='';
$urlvcal='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>'; $urlvcal='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('', 'object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal); $message.=img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal);
$message.='<br>'; $message.='<br>';
$urlical='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>'; $urlical='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('', 'object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical); $message.=img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical);
$message.='<br>'; $message.='<br>';
$urlrss='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>'; $urlrss='<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY):'KEYNOTDEFINED').'</a>';
$message.=img_picto('', 'object_globe.png').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss); $message.=img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss);
$message.='<br>'; $message.='<br>';
$message.='<br>'; $message.='<br>';
print $message; print $message;

View File

@ -253,7 +253,6 @@ $i = 0;
$nbofbank = count($bankorder); $nbofbank = count($bankorder);
while ($i < $nbofbank) { while ($i < $nbofbank) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . $bankorder[$i][0] . "</td><td>\n"; print '<td>' . $bankorder[$i][0] . "</td><td>\n";
print $bankorder[$i][1]; print $bankorder[$i][1];
@ -341,7 +340,6 @@ foreach ($dirmodels as $reldir) {
foreach ($filelist as $file) { foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) { if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir . '/' . $file)) { if (file_exists($dir . '/' . $file)) {
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12); $classname = substr($file, 0, dol_strlen($file) - 12);

View File

@ -96,29 +96,29 @@ elseif ($action == 'updateengine')
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha')) if (GETPOST('coder'.$obj->rowid, 'alpha'))
{ {
$coder = GETPOST('coder'.$obj->rowid, 'alpha'); $coder = GETPOST('coder'.$obj->rowid, 'alpha');
$code_id = $obj->rowid; $code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'"; $sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id; $sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity; $sqlp.= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp); $upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db); if (! $upsql) dol_print_error($db);
} }
$i++; $i++;
} }
} }
} }
@ -319,7 +319,6 @@ print '</tr>';
// Chemin du binaire genbarcode sous linux // Chemin du binaire genbarcode sous linux
if (! isset($_SERVER['WINDIR'])) if (! isset($_SERVER['WINDIR']))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("GenbarcodeLocation").'</td>'; print '<td>'.$langs->trans("GenbarcodeLocation").'</td>';
print '<td width="60" class="center">'; print '<td width="60" class="center">';
@ -335,7 +334,6 @@ if (! isset($_SERVER['WINDIR']))
// Module products // Module products
if (! empty($conf->product->enabled)) if (! empty($conf->product->enabled))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>'; print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
print '<td width="60" class="right">'; print '<td width="60" class="right">';
@ -346,7 +344,6 @@ if (! empty($conf->product->enabled))
// Module thirdparty // Module thirdparty
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>'; print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
print '<td width="60" class="right">'; print '<td width="60" class="right">';

View File

@ -255,7 +255,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
@ -381,7 +380,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) -16);
@ -432,7 +430,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'boxes')); $langs->loadLangs(array('admin', 'boxes', 'accountancy'));
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
@ -222,7 +222,7 @@ llxHeader('', $langs->trans("Boxes"));
print load_fiche_titre($langs->trans("Boxes"), '', 'title_setup'); print load_fiche_titre($langs->trans("Boxes"), '', 'title_setup');
print $langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("BoxesDesc")." ".$langs->trans("OnlyActiveElementsAreShown")."</span><br>\n";
/* /*
* Search for the default active boxes for each possible position * Search for the default active boxes for each possible position
@ -474,7 +474,6 @@ print '</tr>';
// Activate FileCache - Developement // Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>'; print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1); print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
print '</td>'; print '</td>';

View File

@ -282,7 +282,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php') if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@ -299,7 +298,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n"; print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
@ -423,7 +421,6 @@ foreach ($dirmodels as $reldir)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) -16);
@ -473,7 +470,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

File diff suppressed because it is too large Load Diff

View File

@ -68,7 +68,6 @@ if ($action == 'update')
if (in_array($accounting_mode, $accounting_modes)) { if (in_array($accounting_mode, $accounting_modes)) {
if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) { if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
$error++; $error++;
} }

View File

@ -118,7 +118,6 @@ if (! empty($consts) && $action == 'update')
// Mass delete // Mass delete
if (! empty($consts) && $action == 'delete') if (! empty($consts) && $action == 'delete')
{ {
$nbdeleted=0; $nbdeleted=0;
foreach($consts as $const) foreach($consts as $const)
{ {
@ -164,7 +163,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
// Add logic to show/hide buttons // Add logic to show/hide buttons
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#updateconst").hide(); jQuery("#updateconst").hide();
@ -182,7 +181,7 @@ jQuery(document).ready(function() {
}); });
}); });
</script> </script>
<?php <?php
} }
print load_fiche_titre($langs->trans("OtherSetup"), '', 'title_setup'); print load_fiche_titre($langs->trans("OtherSetup"), '', 'title_setup');
@ -195,6 +194,8 @@ $param = '';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" id="action" name="action" value="">'; print '<input type="hidden" id="action" name="action" value="">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -219,7 +219,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php') if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php')
@ -236,7 +235,6 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n"; print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';
@ -359,7 +357,6 @@ foreach ($dirmodels as $reldir)
{ {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{ {
if (file_exists($dir.'/'.$file)) if (file_exists($dir.'/'.$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) -16);
@ -409,7 +406,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@ -123,7 +123,9 @@ else
{ {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
print $form->textwithpicto($langs->trans($key), $tooltiphelp); $label = $langs->trans($key);
if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP");
print $form->textwithpicto($label, $tooltiphelp);
print '</td><td>'; print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{ {
@ -172,13 +174,13 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
// Show message // Show message
$message=''; $message='';
$url='<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>'; $url='<a href="'.$urlwithroot.'/dav/fileserver.php" target="_blank">'.$urlwithroot.'/dav/fileserver.php</a>';
$message.=img_picto('', 'object_globe.png').' '.$langs->trans("WebDavServer", 'WebDAV', $url); $message.=img_picto('', 'globe').' '.$langs->trans("WebDavServer", 'WebDAV', $url);
$message.='<br>'; $message.='<br>';
if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR)) if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
{ {
$urlEntity = (! empty($conf->multicompany->enabled)?'?entity='.$conf->entity:''); $urlEntity = (! empty($conf->multicompany->enabled)?'?entity='.$conf->entity:'');
$url='<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>'; $url='<a href="'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'" target="_blank">'.$urlwithroot.'/dav/fileserver.php/public/'.$urlEntity.'</a>';
$message.=img_picto('', 'object_globe.png').' '.$langs->trans("WebDavServer", 'WebDAV public', $url); $message.=img_picto('', 'globe').' '.$langs->trans("WebDavServer", 'WebDAV public', $url);
$message.='<br>'; $message.='<br>';
} }
print $message; print $message;

View File

@ -174,8 +174,8 @@ llxHeader();
print load_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"), '', 'title_setup'); print load_fiche_titre($langs->trans("DelaysOfToleranceBeforeWarning"), '', 'title_setup');
print $langs->transnoentities("DelaysOfToleranceDesc", img_warning()); print '<span class="opacitymedium">'.$langs->transnoentities("DelaysOfToleranceDesc", img_warning());
print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."<br>\n"; print " ".$langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT.'/admin/modules.php')."</span><br>\n";
print "<br>\n"; print "<br>\n";
$countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>'; $countrynotdefined='<font class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</font>';
@ -265,7 +265,6 @@ print '<br>';
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> '; print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
if($action == 'edit') { if($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod')); $str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod')); $str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std; if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
@ -292,8 +291,6 @@ $text=''; $options='class="valignmiddle" height="60px"';
if ($action == 'edit') { if ($action == 'edit') {
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>'; print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
print '<div>'; print '<div>';
@ -364,9 +361,7 @@ if ($action == 'edit') {
<?php <?php
} else { } else {
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) { if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
print '<div>'; print '<div>';
print '<div class="inline-block" style="padding-right: 20px">'; print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options); print img_weather($text, 0, $options);
@ -386,7 +381,6 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '</div>'; print '</div>';
} else { } else {
print '<div>'; print '<div>';
print '<div class="inline-block" style="padding-right: 20px">'; print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options); print img_weather($text, 0, $options);
@ -411,11 +405,9 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
if($action == 'edit') { if($action == 'edit') {
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>'; print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '<br></form>'; print '<br></form>';
} else { } else {
print '<br><div class="tabsAction">'; print '<br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>'; print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
} }

View File

@ -551,27 +551,27 @@ $elementList = array();
$sourceList=array(); $sourceList=array();
if ($id == 11) if ($id == 11)
{ {
$elementList = array( $elementList = array(
'' => '', '' => '',
'societe' => $langs->trans('ThirdParty'), 'societe' => $langs->trans('ThirdParty'),
// 'proposal' => $langs->trans('Proposal'), // 'proposal' => $langs->trans('Proposal'),
// 'order' => $langs->trans('Order'), // 'order' => $langs->trans('Order'),
// 'invoice' => $langs->trans('Bill'), // 'invoice' => $langs->trans('Bill'),
'supplier_proposal' => $langs->trans('SupplierProposal'), 'supplier_proposal' => $langs->trans('SupplierProposal'),
'order_supplier' => $langs->trans('SupplierOrder'), 'order_supplier' => $langs->trans('SupplierOrder'),
'invoice_supplier' => $langs->trans('SupplierBill'), 'invoice_supplier' => $langs->trans('SupplierBill'),
// 'intervention' => $langs->trans('InterventionCard'), // 'intervention' => $langs->trans('InterventionCard'),
// 'contract' => $langs->trans('Contract'), // 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'agenda' => $langs->trans('Agenda'), 'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'), 'dolresource' => $langs->trans('Resource'),
// old deprecated // old deprecated
'propal' => $langs->trans('Proposal'), 'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'), 'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'), 'facture' => $langs->trans('Bill'),
'fichinter' => $langs->trans('InterventionCard'), 'fichinter' => $langs->trans('InterventionCard'),
'contrat' => $langs->trans('Contract') 'contrat' => $langs->trans('Contract'),
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
@ -589,13 +589,13 @@ $localtax_typeList = array();
if ($id == 10) if ($id == 10)
{ {
$localtax_typeList = array( $localtax_typeList = array(
"0" => $langs->trans("No"), "0" => $langs->trans("No"),
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
); );
} }
@ -636,8 +636,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
) )
) ) {
{
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
// We take translate key of field // We take translate key of field
@ -1510,6 +1509,10 @@ if ($id)
$key=$langs->trans("PaymentType".strtoupper($obj->code)); $key=$langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
} }
elseif ($fieldlist[$field]=='type' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') {
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
$valuetoshow = $payment_type_list[$valuetoshow];
}
elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') {
$key=$langs->trans("DemandReasonType".strtoupper($obj->code)); $key=$langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]});
@ -1558,18 +1561,18 @@ if ($id)
$class="center"; $class="center";
} }
elseif ($fieldlist[$field]=='localtax1_type') { elseif ($fieldlist[$field]=='localtax1_type') {
if ($obj->localtax1 != 0) if ($obj->localtax1 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
elseif ($fieldlist[$field]=='localtax2_type') { elseif ($fieldlist[$field]=='localtax2_type') {
if ($obj->localtax2 != 0) if ($obj->localtax2 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
elseif ($fieldlist[$field]=='taux') { elseif ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
@ -1724,7 +1727,6 @@ else
{ {
if ($showemptyline) if ($showemptyline)
{ {
print '<tr class="oddeven"><td width="50%">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>'; print '<tr class="oddeven"><td width="50%">&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$showemptyline=0; $showemptyline=0;
} }
@ -1876,6 +1878,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print $type.'<input type="hidden" name="type" value="'.$type.'">'; print $type.'<input type="hidden" name="type" value="'.$type.'">';
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement')
{
print '<td>';
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
print $form->selectarray($fieldlist[$field], $select_list, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'2'));
print '</td>';
}
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">'; if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
else print '<td>'; else print '<td>';

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